diff --git a/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift b/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift index 5e37d84d2..d04e74e1e 100644 --- a/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift +++ b/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift @@ -70,6 +70,8 @@ class KlausDormannTests: XCTestCase { func test65C02() { func errorForTrapAddress(_ address: UInt16) -> String? { switch address { + case 0x24f1: return nil // success! + case 0x0423: return "PHX: value of X not on stack page" case 0x0428: return "PHX: stack pointer not decremented" case 0x042d: return "PLY: didn't acquire value 0xaa from stack" diff --git a/Processors/6502/Implementation/6502Implementation.hpp b/Processors/6502/Implementation/6502Implementation.hpp index 771b4b5d2..0010da63c 100644 --- a/Processors/6502/Implementation/6502Implementation.hpp +++ b/Processors/6502/Implementation/6502Implementation.hpp @@ -285,6 +285,10 @@ if(number_of_cycles <= Cycles(0)) break; carry_flag_ = (temp16 > 0xff) ? 0 : Flag::Carry; a_ = static_cast(temp16); + + if(personality_ != P6502) { + negative_result_ = zero_result_ = a_; + } continue; } else { operand_ = ~operand_; @@ -305,6 +309,10 @@ if(number_of_cycles <= Cycles(0)) break; carry_flag_ = (result >> 8) ? 1 : 0; a_ = static_cast(result); zero_result_ = static_cast(decimalResult); + + if(personality_ != P6502) { + negative_result_ = zero_result_ = a_; + } } else { const uint16_t result = static_cast(a_) + static_cast(operand_) + static_cast(carry_flag_); overflow_flag_ = (( (result^a_)&(result^operand_) )&0x80) >> 1;