Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #12

Merged
merged 12 commits into from
Jun 9, 2023
1 change: 0 additions & 1 deletion CPCCoreEmu/BreakpointHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class BreakpointHandler : public IBreakpoint
virtual void ToggleBreakpoint ( unsigned short addr );
virtual int GetBreakpointNumber() { return breakpoint_number_; };
void AddBreakpoint(IBreakpointItem* breakpoint);
// Impl�mentation

void ClearBreakpoints();
void CreateBreakpoint(int indice, std::vector<std::string> param);
Expand Down
2 changes: 1 addition & 1 deletion CPCCoreEmu/Machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class CPCCOREEMU_API EmulatorEngine : public ILoadingProgree
void MultifaceStop (){multiface_stop_ = true;}
void MultifaceToggleVisible (){multiface2_.Visible(multiface2_.IsVisible()?false:true);};
bool IsMultifaceIIVisible () { return multiface2_.IsVisible();};
// Donn�es
// Data
IPrinterPort* GetPrinter () { return motherboard_.GetPrinter();};
Memory* GetMem () { return motherboard_.GetMem();};
Asic* GetAsic() { return motherboard_.GetAsic(); }
Expand Down
5 changes: 3 additions & 2 deletions CPCCoreEmu/Motherboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ int Motherboard::DebugOpcodes( unsigned int& nb_opcodes )
signals_.Propagate();
++next_cycle;

if ((z80_.t_ == 1 &&
/*if ((z80_.t_ == 1 &&
(z80_.machine_cycle_ == Z80::M_M1_NMI
|| z80_.machine_cycle_ == Z80::M_M1_INT)
)
Expand All @@ -423,7 +423,8 @@ int Motherboard::DebugOpcodes( unsigned int& nb_opcodes )
&& ((z80_.current_opcode_ & 0xFF00) == 0)
&& elapsed_time_z80 == next_cycle
)
)
)*/
if (z80_.new_instruction_)
{
counter_ += (component_elapsed_time_[z80_index_] - old_counter + 1);
old_counter = component_elapsed_time_[z80_index_];
Expand Down
2 changes: 1 addition & 1 deletion CPCCoreEmu/Sig.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CPCCOREEMU_API CSig
// Bus d'adresse
Bus* address_bus_;

// Bus de donn�es
// Data bus
Bus* data_bus_;

// ASIC
Expand Down
27 changes: 14 additions & 13 deletions CPCCoreEmu/SoundMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,28 +492,29 @@ bool SoundMixer::GetNewSoundFile(char * buffer, unsigned int size)
#ifndef RASPPI
bool name_is_ok = false;

char exe_path[MAX_PATH];
strcpy(exe_path, ".\\REC\\");
const fs::path exe_path = "./REC/";

// Create record directory if necessary
if (!fs::exists(exe_path))
{
fs::create_directories(exe_path);
}
// Create new sound file
unsigned int inc = 0;

while (!name_is_ok && inc <= 9999)
{
sprintf(buffer, "%sSND%4.4i.WAV", exe_path, inc);
const std::regex my_filter(buffer);
char sound_name[16];
sprintf(sound_name, "SND%4.4i.WAV", inc++);

for (auto& p : fs::directory_iterator(exe_path))
fs::path sound_file = exe_path / fs::path(sound_name);

if ( !fs::exists(sound_file))
{
if (fs::is_regular_file(p.status()))
{
if (regex_match(p.path().filename().generic_string().c_str(), my_filter))
{
name_is_ok = true;
break;
}
}
name_is_ok = true;
strncpy(buffer, sound_file.string().c_str(), size);
}

}
return name_is_ok;
#else
Expand Down
29 changes: 16 additions & 13 deletions CPCCoreEmu/Tape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2870,23 +2870,26 @@ double CTape::GetSoundVolume ()

void CTape::SetTapePosition ( unsigned int nb_sec_from_begining)
{
unsigned long long nbu_sec = 0;
unsigned int nb_sec = 0;
unsigned int i;
for (i = 0; i < nb_inversions_ && ( nb_sec < nb_sec_from_begining ); i++)
if (nb_inversions_ > 0)
{
// Size of this inversion / sample rate = nb of samples
nbu_sec += tape_array_[i].length ;
while ( nbu_sec > 4000000)
unsigned long long nbu_sec = 0;
int nb_sec = 0;
unsigned int i;
for (i = 0; i < nb_inversions_ && (nb_sec < nb_sec_from_begining); i++)
{
nb_sec ++;
nbu_sec -= 4000000;
// Size of this inversion / sample rate = nb of samples
nbu_sec += tape_array_[i].length;
while (nbu_sec > 4000000)
{
nb_sec++;
nbu_sec -= 4000000;
}
}
tape_position_ = i;
remaining_reversal_flux_ = tape_array_[tape_position_].length - nbu_sec;
counter_sec_ = nb_sec;
counter_us_ = nbu_sec;
}
tape_position_ = i;
remaining_reversal_flux_ = tape_array_[tape_position_].length - nbu_sec;
counter_sec_ = nb_sec;
counter_us_ = nbu_sec;

}

Expand Down
2 changes: 1 addition & 1 deletion CPCCoreEmu/Tape.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CTape : public IComponent, public IExternalSource, public ILoadingProgress
{
public:
CTape(void);
~CTape(void);
virtual ~CTape(void);

void SetLog ( ILog* log ) {log_ = log;};
void SetNotifier ( IFdcNotify* notify_tape){tape_notifier_ = notify_tape;}
Expand Down
2 changes: 1 addition & 1 deletion CPCCoreEmu/VGA.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CPCCOREEMU_API GateArray : public IComponent
// Bus d'adresse
Bus* address_bus_;

// Bus de donn�es
// Data bus
Bus* data_bus_;

// Signaux;
Expand Down
2 changes: 2 additions & 0 deletions CPCCoreEmu/Z80_Full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Z80::Z80(void) :
stop_on_fetch_(false),
rw_opcode_(false),
log_(nullptr),
new_instruction_(true),
count_(0)
{

Expand Down Expand Up @@ -145,6 +146,7 @@ void Z80::PreciseTick()

unsigned int Z80::Tick_Fetch_1()
{
new_instruction_ = false;
INC_R
// Set PC to address bus
address_ = pc_++;
Expand Down
6 changes: 4 additions & 2 deletions CPCCoreEmu/Z80_Full.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
else {machine_cycle_=M_FETCH;t_ = 1;rw_opcode_=false;\
current_opcode_ = 0;return 1;}

#define NEXT_INSTR current_function_ = &fetch_func;if (!sig_->nmi_){if ((!sig_->int_) || !iff1_) {SET_NOINT;}else{SET_INT;}}else {SET_NMI;}
#define NEXT_INSTR new_instruction_=true;current_function_ = &fetch_func;if (!sig_->nmi_){if ((!sig_->int_) || !iff1_) {SET_NOINT;}else{SET_INT;}}else {SET_NMI;}

#define NEXT_INSTR_RES(reset_ptr)\
/*if(reset_ptr)*/current_function_ = &fetch_func;\
/*if(reset_ptr)*/current_function_ = &fetch_func;new_instruction_=true;\
if (!sig_->nmi_ && ((!sig_->int_) || !iff1_)){\
SET_NOINT;}\
if ((sig_->int_) && iff1_) {\
Expand Down Expand Up @@ -260,6 +260,8 @@ class Z80 : public IComponent
} MachineCycle;
MachineCycle machine_cycle_;

bool new_instruction_;

// Inner helper attributes
unsigned int counter_;
unsigned int read_count_;
Expand Down
49 changes: 0 additions & 49 deletions UnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,52 +86,3 @@ install ( DIRECTORY "./ROM" DESTINATION ${PROJECT_BINARY_DIR}/..)
install ( DIRECTORY "./CART" DESTINATION ${PROJECT_BINARY_DIR}/..)
install ( DIRECTORY "./CONF" DESTINATION ${PROJECT_BINARY_DIR}/..)
install ( DIRECTORY "./res" DESTINATION ${PROJECT_BINARY_DIR}/..)

# ini file
#install ( FILES "./TestConf.ini" CONFIGURATIONS Debug DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/ )
#install ( FILES "./TestConf.ini" CONFIGURATIONS Release DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/ )
#install ( FILES "./TestConf.ini" CONFIGURATIONS RelWithDebInfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/ )
#
## ROM & CONF
#install ( DIRECTORY "./ROM" CONFIGURATIONS Debug DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/ )
#install ( DIRECTORY "./ROM" CONFIGURATIONS Release DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/ )
#install ( DIRECTORY "./ROM" CONFIGURATIONS RelWithDebInfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/ )
#
## CARTs
#install ( DIRECTORY "./CART" CONFIGURATIONS Debug DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/)
#install ( DIRECTORY "./CART" CONFIGURATIONS Release DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/)
#install ( DIRECTORY "./CART" CONFIGURATIONS RelWithDebInfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/)
#
#install ( DIRECTORY "./CONF" CONFIGURATIONS Debug DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/ )
#install ( DIRECTORY "./CONF" CONFIGURATIONS Release DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/ )
#install ( DIRECTORY "./CONF" CONFIGURATIONS RelWithDebInfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/ )
## Res
#install ( DIRECTORY "./res" CONFIGURATIONS Debug DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/ )
#install ( DIRECTORY "./res" CONFIGURATIONS Release DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/ )
#install ( DIRECTORY "./res" CONFIGURATIONS RelWithDebInfo DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/ )

#zlib1.dll


#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/After Burner" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/res" )
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/CONF" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/ROM" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/z80" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/res" )
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/Dsk" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/res" )
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/res/Record" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/res" )
#
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/DEATHSWORD128K.DSK" "${CMAKE_CURRENT_BINARY_DIR}/res/DEATHSWORD128K.DSK" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/Discology60PlusA1 [MAXIT][SAMdisk36B19][Original].dsk" "${CMAKE_CURRENT_BINARY_DIR}/res/Discology60PlusA1 [MAXIT][SAMdisk36B19][Original].dsk" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/30YMD double sides 1 and 2.hfe" "${CMAKE_CURRENT_BINARY_DIR}/res/30YMD double sides 1 and 2.hfe" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/1942.raw" "${CMAKE_CURRENT_BINARY_DIR}/res/1942.raw" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/After Burner (UK) (1988) [Activision SEGA] (Pre-release).ipf" "${CMAKE_CURRENT_BINARY_DIR}/res/After Burner (UK) (1988) [Activision SEGA] (Pre-release).ipf" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/The Demo [A].scp" "${CMAKE_CURRENT_BINARY_DIR}/res/The Demo [A].scp" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/necro.sfw" "${CMAKE_CURRENT_BINARY_DIR}/res/necro.sfw" COPYONLY)
#
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/Basil The Great Mouse Detective (UK) (1987) [Original] [TAPE].cdt" "${CMAKE_CURRENT_BINARY_DIR}/res/Basil The Great Mouse Detective (UK) (1987) [Original] [TAPE].cdt" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/Mask_1_1.csw" "${CMAKE_CURRENT_BINARY_DIR}/res/Mask_1_1.csw" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/Ultima Ratio (Firebird)(UK)(1987)[Original][TAPE].csw" "${CMAKE_CURRENT_BINARY_DIR}/res/Ultima Ratio (Firebird)(UK)(1987)[Original][TAPE].csw" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/FootBallerOfTheYear2.wav" "${CMAKE_CURRENT_BINARY_DIR}/res/FootBallerOfTheYear2.wav" COPYONLY)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/K7_MICK.VOC" "${CMAKE_CURRENT_BINARY_DIR}/res/K7_MICK.VOC" COPYONLY)
#
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/TestConf.ini" "${CMAKE_CURRENT_BINARY_DIR}/TestConf.ini" COPYONLY)
2 changes: 1 addition & 1 deletion UnitTests/Test_Dumps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ TEST(Dumps_Disk, DarkSceptre)
}

//lappend testlist[SingleTest dsk89{ 6128 } {disk} {Despotik Design[MAXIT][SAMdisk388][Original][ALLGAPS].dsk} {run"ere"} {1500} {defaut}]
TEST(Dumps_Disk, DespotikDesign)
TEST(Dumps_Disk, DISABLED_DespotikDesign)
{
TestDump test_dump;
CommandList cmd_list;
Expand Down