Tom Harte tests for wdc6502

This commit is contained in:
Ivan Izaguirre 2021-09-25 21:11:15 +02:00
parent 358c4fabc1
commit 1a150d0f96
1 changed files with 29 additions and 4 deletions

View File

@ -42,21 +42,46 @@ func TestHarteNMOS6502(t *testing.T) {
opcode := fmt.Sprintf("%02x", i)
t.Run(opcode+s.opcodes[i].name, func(t *testing.T) {
t.Parallel()
testOpcode(t, path, opcode)
m := new(FlatMemory)
s := NewNMOS6502(m)
testOpcode(t, s, path, opcode)
})
}
}
}
func testOpcode(t *testing.T, path string, opcode string) {
m := new(FlatMemory)
s := NewNMOS6502(m)
func TestHarteCMOS65c02(t *testing.T) {
t.Skip("Not ready to be used in CI")
s := NewCMOS65c02(nil) // Use to get the opcodes names
path := "/home/casa/code/ProcessorTests/wdc65c02/v1/"
for i := 0x00; i <= 0xff; /*0xff*/ i++ {
if s.opcodes[i].name != "ADC" && // Issue with ADC crossing page boundaries
s.opcodes[i].name != "SBC" && // Issue with SBC crossing page boundaries
s.opcodes[i].name != "" {
opcode := fmt.Sprintf("%02x", i)
t.Run(opcode+s.opcodes[i].name, func(t *testing.T) {
t.Parallel()
m := new(FlatMemory)
s := NewCMOS65c02(m)
testOpcode(t, s, path, opcode)
})
}
}
}
func testOpcode(t *testing.T, s *State, path string, opcode string) {
data, err := os.ReadFile(path + opcode + ".json")
if err != nil {
t.Fatal(err)
}
if len(data) == 0 {
return
}
var scenarios []scenario
err = json.Unmarshal(data, &scenarios)
if err != nil {