From 82010a792f8bda378f4260a3a2b1c581691ae6da Mon Sep 17 00:00:00 2001 From: Sour Date: Wed, 13 Feb 2019 13:33:10 -0500 Subject: [PATCH] Fixed PHB and XCE instructions --- Core/Cpu.Instructions.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Core/Cpu.Instructions.cpp b/Core/Cpu.Instructions.cpp index 0b29d7c..d54cfd2 100644 --- a/Core/Cpu.Instructions.cpp +++ b/Core/Cpu.Instructions.cpp @@ -627,7 +627,7 @@ void Cpu::PER() void Cpu::PHB() { - PushWord(_state.DBR); + PushByte(_state.DBR); } void Cpu::PHD() @@ -891,7 +891,13 @@ void Cpu::XBA() void Cpu::XCE() { - _state.EmulationMode = (_state.PS & ProcFlags::Carry) ? true : false; + bool carry = (_state.PS & ProcFlags::Carry) != 0; + if(_state.EmulationMode) { + SetFlags(ProcFlags::Carry); + } else { + ClearFlags(ProcFlags::Carry); + } + _state.EmulationMode = carry; } /*****************