Minor innacuracy updates
This commit is contained in:
20
src/cpu.cpp
20
src/cpu.cpp
@@ -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;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user