CPU: Enabling 8-bit indexes must truncate the value of X/Y

This commit is contained in:
Sour 2019-02-20 19:53:45 -05:00
parent 37b501122f
commit 011caf951c

View file

@ -267,6 +267,11 @@ void Cpu::REP()
void Cpu::SEP()
{
SetFlags((uint8_t)_operand);
if(CheckFlag(ProcFlags::IndexMode8)) {
//Truncate X/Y when 8-bit indexes are enabled
_state.Y &= 0xFF;
_state.X &= 0xFF;
}
}
/******************************
@ -967,7 +972,6 @@ void Cpu::XCE()
if(_state.EmulationMode) {
SetFlags(ProcFlags::IndexMode8 | ProcFlags::MemoryMode8);
//_state.A &= 0xFF;
_state.Y &= 0xFF;
_state.X &= 0xFF;
_state.SP = 0x100 | (_state.SP & 0xFF);