mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-24 12:30:17 +00:00
Implements proper test for ADC/SBC 65C02 NZ, though not yet the proper timing.
This gets Klaus Dorman's test to pass.
This commit is contained in:
parent
b63e0cff72
commit
261fb3d4f8
@ -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"
|
||||
|
@ -285,6 +285,10 @@ if(number_of_cycles <= Cycles(0)) break;
|
||||
|
||||
carry_flag_ = (temp16 > 0xff) ? 0 : Flag::Carry;
|
||||
a_ = static_cast<uint8_t>(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<uint8_t>(result);
|
||||
zero_result_ = static_cast<uint8_t>(decimalResult);
|
||||
|
||||
if(personality_ != P6502) {
|
||||
negative_result_ = zero_result_ = a_;
|
||||
}
|
||||
} else {
|
||||
const uint16_t result = static_cast<uint16_t>(a_) + static_cast<uint16_t>(operand_) + static_cast<uint16_t>(carry_flag_);
|
||||
overflow_flag_ = (( (result^a_)&(result^operand_) )&0x80) >> 1;
|
||||
|
Loading…
Reference in New Issue
Block a user