Files
atari2600/source/atari2600.cpp
T
raimon@prometeo e245410c0a - [NEW] 6502dis i 6502debugger implementats
- [FIX] font.bmp afegit
- [NEW] Afegides regles de comprobació de memòria en la versió debug de compilació en el lagueirtofile
- [FIX] la rom ha de carregar abans de atari2600::init()
- [NEW] Implementació bàsica del PIA completada.
- [FIX] El framebuffer intern en el mòdul TIA era incorrecte.
- [NEW] Afegits accesors als registres del 6502
- [NEW] m6502::reset()
- [FIX] [6502m] Corregits opcodes amb direccionament implicit: CLC, SEC, PHA, CLI, PLA, SEI, DEY, TXA, TYA, TXS, TAY, TAX, CLV, TSX, INY, DEX, CLD, INX, NOP i SED). Augmentaven el PC una posició de més.
2026-09-17 17:43:33 +02:00

93 lines
1.9 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 "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;
}
}