From 358c4fabc12b58f90726e53408057b5cd00eae0f Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Sat, 25 Sep 2021 20:58:48 +0200 Subject: [PATCH] Pass the 6502s test from Harte without breaking the 65c02 tests from Klaus --- core6502/addressing.go | 12 ++++-------- core6502/cmos65c02.go | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/core6502/addressing.go b/core6502/addressing.go index d0e0440..90b4405 100644 --- a/core6502/addressing.go +++ b/core6502/addressing.go @@ -19,6 +19,7 @@ const ( modeIndexedIndirectX modeIndirectIndexedY // Added on the 65c02 + modeIndirect65c02Fix modeIndirectZeroPage modeAbsoluteIndexedIndirectX modeZeroPageAndRelative @@ -90,16 +91,11 @@ func resolveAddress(s *State, line []uint8, opcode opcode) uint16 { addressAddress := line[1] + s.reg.getX() address = getZeroPageWord(s.mem, addressAddress) case modeIndirect: + addressAddress := getWordInLine(line) + address = getWordNoCrossPage(s.mem, addressAddress) + case modeIndirect65c02Fix: addressAddress := getWordInLine(line) address = getWord(s.mem, addressAddress) - //address = getWordNoCrossPage(s.mem, addressAddress) - - /* - The tests from https://github.com/Klaus2m5/6502_65C02_functional_tests - pass with getWord(), but the tests in https://github.com/TomHarte/ProcessorTests/tree/main/6502/v1 - need getWordNoCrossPage(). - */ - case modeIndirectIndexedY: base := getZeroPageWord(s.mem, line[1]) address, extraCycle = addOffset(base, s.reg.getY()) diff --git a/core6502/cmos65c02.go b/core6502/cmos65c02.go index 28aa976..9a07801 100644 --- a/core6502/cmos65c02.go +++ b/core6502/cmos65c02.go @@ -67,6 +67,7 @@ var opcodes65c02Delta = [256]opcode{ 0x00: {"BRK", 1, 7, modeImplicit, opBRKAlt}, 0x24: {"BIT", 2, 3, modeZeroPage, opBIT}, 0x2C: {"BIT", 3, 3, modeAbsolute, opBIT}, + 0x6C: {"JMP", 3, 3, modeIndirect65c02Fix, opJMP}, // Fixed BCD arithmetic flags 0x69: {"ADC", 2, 2, modeImmediate, opADCAlt},