Files
atari2600/atari2600.cpp
T
Raimon @ quifisraimon 61d8b0a808 - [NEW] [tia] AUDC0, AUDC1, AUDF0, AUDF1, AUDV0, AUDV1, GRP0, GRP1, ENAM0, ENAM1, ENABL
- [NEW] [tia] áudio en el seu propi mòdul, pa no tornar-se loco
- [NEW] Afegides frequències de rellotge per a NTSC, PAL, SECAM i PAL-M
- [NEW] Mòdul Speaker conectat a tia-audio
2026-09-16 10:26:42 +02:00

92 lines
1.8 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"
#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);
//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) {
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;
}
}