1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 07:29:45 +00:00

Corrects absolute, x and absolute, y addressing modes.

This commit is contained in:
Thomas Harte 2020-10-13 20:30:39 -04:00
parent 8f5537aaaa
commit 3e6a2adaaf
2 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,8 @@ class Jeek816Tests: XCTestCase {
NSException(name: NSExceptionName(rawValue: "Failed Test"), reason: "Couldn't load file \(name)", userInfo: nil).raise() NSException(name: NSExceptionName(rawValue: "Failed Test"), reason: "Couldn't load file \(name)", userInfo: nil).raise()
} }
while machine.value(for: .lastOperationAddress) != 0x0874 { // $874 is the failure stopping point and $85d is success.
while machine.value(for: .lastOperationAddress) != 0x0874 && machine.value(for: .lastOperationAddress) != 0x085d {
machine.runForNumber(ofCycles: 1000) machine.runForNumber(ofCycles: 1000)
} }

View File

@ -249,7 +249,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
case OperationConstructAbsoluteXRead: case OperationConstructAbsoluteXRead:
case OperationConstructAbsoluteX: case OperationConstructAbsoluteX:
data_address_ = ((instruction_buffer_.value + x()) & 0xffff) + data_bank_; data_address_ = instruction_buffer_.value + x() + data_bank_;
incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) + data_bank_; incorrect_data_address_ = (data_address_ & 0xff) | (instruction_buffer_.value & 0xff00) + data_bank_;
// If the incorrect address isn't actually incorrect, skip its usage. // If the incorrect address isn't actually incorrect, skip its usage.
@ -261,7 +261,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
case OperationConstructAbsoluteYRead: case OperationConstructAbsoluteYRead:
case OperationConstructAbsoluteY: case OperationConstructAbsoluteY:
data_address_ = ((instruction_buffer_.value + y()) & 0xffff) + data_bank_; data_address_ = instruction_buffer_.value + y() + data_bank_;
incorrect_data_address_ = (data_address_ & 0xff) + (instruction_buffer_.value & 0xff00) + data_bank_; incorrect_data_address_ = (data_address_ & 0xff) + (instruction_buffer_.value & 0xff00) + data_bank_;
// If the incorrect address isn't actually incorrect, skip its usage. // If the incorrect address isn't actually incorrect, skip its usage.