add compiler option (#define) for using 6502 emulator or simulator

This commit is contained in:
Christopher Mosher 2013-12-19 22:00:31 -05:00
parent eb2cc561d6
commit 90d9fbd9c5
3 changed files with 15 additions and 2 deletions

View File

@ -47,9 +47,12 @@ Apple2::Apple2(KeypressQueue& keypresses, PaddleButtonStates& paddleButtonStates
addressBus(ram,rom,kbd,videoMode,paddles,paddleButtonStates,speaker,cassette,slts), addressBus(ram,rom,kbd,videoMode,paddles,paddleButtonStates,speaker,cassette,slts),
picgen(tv,videoMode,this->revision), picgen(tv,videoMode,this->revision),
video(videoMode,addressBus,picgen,textRows), video(videoMode,addressBus,picgen,textRows),
#ifdef USE_EMU
transistors("transistors"), transistors("transistors"),
cpu(transistors,addressBus), cpu(transistors,addressBus),
// cpu(addressBus), #else
cpu(addressBus),
#endif
powerUpReset(*this), powerUpReset(*this),
revision(1) revision(1)
{ {

View File

@ -39,6 +39,9 @@
class Emulator; class Emulator;
class ScreenImage; class ScreenImage;
//#define USE_EMU 1
#undef USE_EMU
class Apple2 : public Timable class Apple2 : public Timable
{ {
Slots slts; Slots slts;
@ -53,9 +56,12 @@ class Apple2 : public Timable
PictureGenerator picgen; PictureGenerator picgen;
TextCharacters textRows; TextCharacters textRows;
Video video; Video video;
// CPU cpu; #ifdef USE_EMU
std::ifstream transistors; std::ifstream transistors;
Emu6502 cpu; Emu6502 cpu;
#else
CPU cpu;
#endif
PowerUpReset powerUpReset; PowerUpReset powerUpReset;
int revision; int revision;

View File

@ -44,5 +44,9 @@ void PowerUpReset::tick()
void PowerUpReset::powerOn() void PowerUpReset::powerOn()
{ {
#ifdef USE_EMU
this->pendingTicks = 99; // TODO REMOVE THIS
#else
this->pendingTicks = (int)(E2Const::AVG_CPU_HZ*.3); // U.A.II, p. 7-15 this->pendingTicks = (int)(E2Const::AVG_CPU_HZ*.3); // U.A.II, p. 7-15
#endif
} }