2019-02-16 19:15:41 +00:00
|
|
|
package core6502
|
2019-02-12 21:30:35 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFunctional(t *testing.T) {
|
2019-02-16 16:32:06 +00:00
|
|
|
|
2019-02-16 19:15:41 +00:00
|
|
|
//t.SkipNow()
|
2019-02-16 16:32:06 +00:00
|
|
|
|
2019-02-16 19:15:41 +00:00
|
|
|
var s State
|
2019-02-12 23:03:43 +00:00
|
|
|
// Test suite from https://github.com/Klaus2m5/6502_65C02_functional_tests
|
2019-02-16 19:15:41 +00:00
|
|
|
s.Mem.loadBinary("testdata/6502_functional_test.bin")
|
2019-02-12 21:30:35 +00:00
|
|
|
|
2019-02-16 19:15:41 +00:00
|
|
|
s.Reg.setPC(0x0400)
|
2019-02-12 21:30:35 +00:00
|
|
|
for true {
|
2019-02-16 19:15:41 +00:00
|
|
|
testCase := s.Mem.Peek(0x0200)
|
2019-02-12 21:30:35 +00:00
|
|
|
if testCase >= 240 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
log := testCase > 43
|
|
|
|
if log {
|
|
|
|
fmt.Printf("[ %d ] ", testCase)
|
|
|
|
}
|
2019-02-16 19:15:41 +00:00
|
|
|
pc := s.Reg.getPC()
|
|
|
|
ExecuteInstruction(&s, log)
|
|
|
|
if pc == s.Reg.getPC() {
|
2019-02-12 21:30:35 +00:00
|
|
|
//s.memory.printPage(0x00)
|
|
|
|
//s.memory.printPage(0x01)
|
|
|
|
t.Errorf("Failuse in test %v.", testCase)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|