-
Notifications
You must be signed in to change notification settings - Fork 1
/
opc_test.go
53 lines (46 loc) · 1.11 KB
/
opc_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package m68k_test
import (
"testing"
"github.com/cavaliercoder/go-m68k"
. "github.com/cavaliercoder/go-m68k/m68ktest"
)
func TestAbcd(t *testing.T) {
t.Run("Simple", func(t *testing.T) {
p := LoadBytes(t, []byte{
0xC1, 0x01, // abcd D1,D0
})
p.D[0], p.D[1] = 0x09, 0x09
AssertRun(t, p)
AssertDataRegister(t, p, 0, 0x18)
AssertStatusRegister(t, p, 0)
})
t.Run("WithExtend", func(t *testing.T) {
p := LoadBytes(t, []byte{
0xC1, 0x01, // abcd D1,D0
})
p.SR |= m68k.StatusExtend
p.D[0], p.D[1] = 0x09, 0x09
AssertRun(t, p)
AssertDataRegister(t, p, 0, 0x19)
AssertStatusRegister(t, p, 0)
})
t.Run("WithInvalidInput", func(t *testing.T) {
p := LoadBytes(t, []byte{
0xC1, 0x01, // abcd D1,D0
})
p.D[0], p.D[1] = 0xFF, 0xFF
AssertRun(t, p)
AssertDataRegister(t, p, 0, 0x64)
AssertStatusRegister(t, p, 0x11)
})
t.Run("WithInvalidInputAndExtend", func(t *testing.T) {
p := LoadBytes(t, []byte{
0xC1, 0x01, // abcd D1,D0
})
p.SR |= m68k.StatusExtend
p.D[0], p.D[1] = 0xFF, 0xFF
AssertRun(t, p)
AssertDataRegister(t, p, 0, 0x65)
AssertStatusRegister(t, p, 0x11)
})
}