Pass the 6502s test from Harte without breaking the 65c02 tests from Klaus

This commit is contained in:
Ivan Izaguirre 2021-09-25 20:58:48 +02:00
parent 3f916a60fa
commit 358c4fabc1
2 changed files with 5 additions and 8 deletions

View File

@ -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())

View File

@ -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},