From 401c2c91cb808145001f95109f940b604577dd58 Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 24 Mar 2019 20:20:43 -0400 Subject: [PATCH] CPU: Fixed move behavior with 8-bit index mode --- Core/Cpu.Instructions.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Core/Cpu.Instructions.cpp b/Core/Cpu.Instructions.cpp index 1943aee..82e0ae5 100644 --- a/Core/Cpu.Instructions.cpp +++ b/Core/Cpu.Instructions.cpp @@ -670,8 +670,12 @@ void Cpu::MVN() _state.X++; _state.Y++; - _state.A--; + if(CheckFlag(ProcFlags::IndexMode8)) { + _state.X &= 0xFF; + _state.Y &= 0xFF; + } + _state.A--; if(_state.A != 0xFFFF) { //Operation isn't done, set the PC back to the start of the instruction @@ -693,6 +697,11 @@ void Cpu::MVP() _state.X--; _state.Y--; + if(CheckFlag(ProcFlags::IndexMode8)) { + _state.X &= 0xFF; + _state.Y &= 0xFF; + } + _state.A--; if(_state.A != 0xFFFF) {