#include "atari2600.h" #include "6502m.h" #include "mem.h" #include "tia.h" #include "pia.h" #include "display.h" #include "speaker.h" //#include "keyboard.h" #include "6502debugger.h" #define NTSC_CLOCK 1193182.0f #define PAL_CLOCK 1182298.0f #define SECAM_CLOCK 1187500.0f #define PAL_M_CLOCK 1191870.0f namespace atari2600 { static bool should_exit = false; static bool paused = false; void init() { paused = false; m6502::reset(); mem::reset(); tia::reset(); pia::reset(); display::init(); speaker::init(NTSC_CLOCK); speaker::register_source(tia::audio::get_sample0); speaker::register_source(tia::audio::get_sample1); } void quit() { should_exit = true; } int ppc = 0; void step() { //uint8_t t_states; uint16_t pc = m6502::getPC(); ppc += pc; m6502debugger::onInstructionExecute(pc); // if (z80debugger::isbreak(pc, 9)) { // msx::pause(); // z80debugger::show(); // return; // } else { bool instruction_done = false; while (!instruction_done) { if (!tia::is_rdy_low()) { instruction_done = m6502::tick(); } else { instruction_done = true; } tia::tick(); tia::tick(); tia::tick(); pia::tick(); //t_states++; } //speaker::update(t_states); // } } void pause() { display::setTitle(" (paused)"); paused = true; display::redraw(); } void resume() { display::setTitle(""); paused = false; } bool is_paused() { return paused; } bool is_quitting() { return should_exit; } }