-
Notifications
You must be signed in to change notification settings - Fork 27
/
tms9918cputests.asm
166 lines (123 loc) · 2.05 KB
/
tms9918cputests.asm
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
; Troy's HBC-56 - CPU tests (degugging emulator issues)
;
; Copyright (c) 2021 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
!src "hbc56kernel.inc"
hbc56Meta:
+setHbcMetaTitle "CPU UNIT TESTS"
rts
hbc56Main:
sei
jsr kbInit
+tmsSetColorFgBg TMS_LT_GREEN, TMS_BLACK
jsr tmsInitEntireColorTable
+tmsEnableOutput
cli
+tmsEnableInterrupts
jsr overflowTests
jsr decimalTests
jmp success
decimalTests:
sed
clc
lda #$08
adc #$08
cld
cmp #$16
bne FAIL
sed
sec
sbc #$08
cld
cmp #$08
bne FAIL
sed
clc
sbc #$16
;bcc FAIL
cld
cmp #$91
bne FAIL
rts
FAIL:
+tmsPrint "FAILED",2,0
-
jmp -
overflowTests:
clc
lda #$30
adc #$10
bvs FAIL
clc
lda #$50
adc #$50
bvc FAIL
clc
lda #$50
adc #$90
bvs FAIL
clc
lda #$50
adc #$D0
bvs FAIL
clc
lda #$D0
adc #$10
bvs FAIL
clc
lda #$D0
adc #$50
bvs FAIL
clc
lda #$D0
adc #$90
bvc FAIL
clc
lda #$D0
adc #$D0
bvs FAIL
sec
lda #$50
sbc #$F0
bvs FAIL
sec
lda #$50
sbc #$B0
bvc FAIL
sec
lda #$50
sbc #$70
bvs FAIL
sec
lda #$50
sbc #$30
bvs FAIL
sec
lda #$D0
sbc #$F0
bvs FAIL2
sec
lda #$D0
sbc #$B0
bvs FAIL2
sec
lda #$D0
sbc #$70
bvc FAIL2
sec
lda #$D0
sbc #$30
bvs FAIL2
rts
FAIL2:
+tmsPrint "FAILED",2,0
-
jmp -
success:
+tmsPrint "PASSED",2,0
-
jmp -