CPU: Enabling 8-bit indexes must truncate the value of X/Y
This commit is contained in:
parent
37b501122f
commit
011caf951c
1 changed files with 5 additions and 1 deletions
|
@ -267,6 +267,11 @@ void Cpu::REP()
|
||||||
void Cpu::SEP()
|
void Cpu::SEP()
|
||||||
{
|
{
|
||||||
SetFlags((uint8_t)_operand);
|
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) {
|
if(_state.EmulationMode) {
|
||||||
SetFlags(ProcFlags::IndexMode8 | ProcFlags::MemoryMode8);
|
SetFlags(ProcFlags::IndexMode8 | ProcFlags::MemoryMode8);
|
||||||
//_state.A &= 0xFF;
|
|
||||||
_state.Y &= 0xFF;
|
_state.Y &= 0xFF;
|
||||||
_state.X &= 0xFF;
|
_state.X &= 0xFF;
|
||||||
_state.SP = 0x100 | (_state.SP & 0xFF);
|
_state.SP = 0x100 | (_state.SP & 0xFF);
|
||||||
|
|
Loading…
Add table
Reference in a new issue