Minor innacuracy updates

This commit is contained in:
2025-07-28 12:16:50 -04:00
parent 176a408408
commit ecca099d81
2 changed files with 11 additions and 11 deletions

View File

@@ -8,12 +8,11 @@
// CPU Implementation // CPU Implementation
void CPU::Reset() { void CPU::Reset() {
A = X = Y = 0; A = D = X = Y = 0;
SP = 0x01FF; SP = 0x01FF; // Start of page 1
PC = 0x8000; // Will be loaded from reset vector PC = ReadWord(0x00FFFC);
P = 0x34; // Start in emulation mode P = 0x34; // Start in emulation mode
DB = PB = 0; DB = PB = 0;
D = 0;
cycles = 0; cycles = 0;
} }
@@ -5112,15 +5111,16 @@ void CPU::XBA() {
} }
void CPU::XCE() { void CPU::XCE() {
const bool old_carry = (P & FLAG_C) != 0; const bool old_carry = (P & FLAG_C) != 0;
const bool old_emulation = emulation_mode;
if (emulation_mode) P |= FLAG_C;
else P &= ~FLAG_C;
emulation_mode = old_carry; emulation_mode = old_carry;
if (old_emulation) { if (emulation_mode) {
P |= FLAG_C; // Force 8-bit modes, constrain stack to page 1
P |= (FLAG_M | FLAG_X);
SP = (SP & 0x00FF) | 0x0100;
} }
cycles += 2;
} }

View File

@@ -20,7 +20,7 @@ class CPU {
Bus* bus; Bus* bus;
uint64_t cycles; uint64_t cycles;
bool emulation_mode = false; bool emulation_mode = true;
bool stopped = false; bool stopped = false;
bool waiting_for_interrupt = false; bool waiting_for_interrupt = false;