- [NEW] Afegit el mòdul "acabat" del 6502 - [NEW] Afegit el módul "atari2600" director - [NEW] Afeggits stubs de display, speaker, mem, tia i pia
82 lines
1.5 KiB
C++
82 lines
1.5 KiB
C++
#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 "z80debugger.h"
|
|
|
|
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();
|
|
//speaker::register_source(psg::get_sample);
|
|
//speaker::register_source(keyboard::get_sample);
|
|
}
|
|
|
|
void quit()
|
|
{
|
|
should_exit = true;
|
|
}
|
|
|
|
void step()
|
|
{
|
|
uint8_t t_states;
|
|
uint16_t pc = m6502::getPC();
|
|
|
|
// if (z80debugger::isbreak(pc, 9)) {
|
|
// msx::pause();
|
|
// z80debugger::show();
|
|
// return;
|
|
// } else {
|
|
bool instruction_done = false;
|
|
while (!instruction_done) {
|
|
instruction_done = m6502::tick();
|
|
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;
|
|
}
|
|
|
|
}
|