Tom Harte tests for wdc6502
This commit is contained in:
parent
358c4fabc1
commit
1a150d0f96
|
@ -42,21 +42,46 @@ func TestHarteNMOS6502(t *testing.T) {
|
||||||
opcode := fmt.Sprintf("%02x", i)
|
opcode := fmt.Sprintf("%02x", i)
|
||||||
t.Run(opcode+s.opcodes[i].name, func(t *testing.T) {
|
t.Run(opcode+s.opcodes[i].name, func(t *testing.T) {
|
||||||
t.Parallel()
|
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) {
|
func TestHarteCMOS65c02(t *testing.T) {
|
||||||
m := new(FlatMemory)
|
t.Skip("Not ready to be used in CI")
|
||||||
s := NewNMOS6502(m)
|
|
||||||
|
|
||||||
|
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")
|
data, err := os.ReadFile(path + opcode + ".json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(data) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var scenarios []scenario
|
var scenarios []scenario
|
||||||
err = json.Unmarshal(data, &scenarios)
|
err = json.Unmarshal(data, &scenarios)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue