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
void CPU::Reset() {
A = X = Y = 0;
SP = 0x01FF;
PC = 0x8000; // Will be loaded from reset vector
A = D = X = Y = 0;
SP = 0x01FF; // Start of page 1
PC = ReadWord(0x00FFFC);
P = 0x34; // Start in emulation mode
DB = PB = 0;
D = 0;
cycles = 0;
}
@@ -5112,15 +5111,16 @@ void CPU::XBA() {
}
void CPU::XCE() {
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;
if (old_emulation) {
P |= FLAG_C;
if (emulation_mode) {
// 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;
uint64_t cycles;
bool emulation_mode = false;
bool emulation_mode = true;
bool stopped = false;
bool waiting_for_interrupt = false;