30
30
clear
31
31
32
32
v1 := 1
33
- show 8 logo-part1
34
- show 16 logo-part2
35
- show 24 logo-part3
36
- show 32 logo-part4
37
- show 40 logo-part5
38
- show 48 logo-part6
33
+ show 8 splash-0-0
34
+ show 16 splash-1-0
35
+ show 24 splash-2-0
36
+ show 32 splash-3-0
37
+ show 40 splash-4-0
38
+ show 48 splash-5-0
39
39
40
40
v1 := 16
41
- show 8 logo-part7
42
- show 16 logo-part8
43
- show 24 logo-part9
44
- show 32 logo-part10
45
- show 40 logo-part11
46
- show 48 logo-part12
41
+ show 8 splash-0-1
42
+ show 16 splash-1-1
43
+ show 24 splash-2-1
44
+ show 32 splash-3-1
45
+ show 40 splash-4-1
46
+ show 48 splash-5-1
47
47
48
48
jump select-test
49
49
50
50
51
-
52
51
# After that, if the user auto-started a test, run it:
53
52
54
53
: select-test
86
85
if v0 == 16 then return
87
86
jump -
88
87
89
-
90
88
# A cute little menu to select a test
91
89
92
90
: menu-after-keypress
201
199
: menu-choose-jump
202
200
0 0 # jump <item>
203
201
204
-
205
202
# Font rendering code and character data
206
203
# Kept this very simplistic and fast
207
204
236
233
return
237
234
238
235
239
-
240
236
# Include all available tests:
241
237
242
238
# Disassembly of the famous "IBM logo" program, published here before:
278
274
279
275
jump menu-after-keypress # Address 552 / 0x228
280
276
281
-
282
277
# Corax89's chip8-test-rom, published here before:
283
278
# https://github.com/corax89/chip8-test-rom
284
279
690
685
691
686
# Shift right (with LSB)
692
687
opcode 0x86
693
- vF := 7
694
- vF >>= vF # 3 (0x3 ), but should be overwritten by flag, so 1
688
+ vF := 27
689
+ vF >>= vF # 13 (0xD ), but should be overwritten by flag, so 1
695
690
v3 := vF
696
- v2 := 3
697
- v2 >>= v2 # 1 (0x1 )
698
- expect-v2-vf-v3 1 1 1
691
+ v2 := 27
692
+ v2 >>= v2 # 13 (0xD )
693
+ expect-v2-vf-v3 13 1 1
699
694
700
695
# Subtraction in the other direction (with carry)
701
696
opcode 0x87
733
728
734
729
jump menu-after-keypress
735
730
736
-
737
731
# Quirks test
738
732
739
733
# This is a visual adaptation of some of the tests I wrote for Silicon8
777
771
: quirks-run-tests
778
772
waitKeyRelease
779
773
780
- # Determine frames per second
774
+ # Determine frames per second for dispQuirk
781
775
clear
782
- v0 := 120
783
- delay := v0
784
776
i := quirks-values
785
777
load v4
786
778
i := quirks-image
779
+ vF := 120
780
+ delay := vF
787
781
loop
788
- v5 := 32
782
+ v5 := 30
789
783
loop
790
- sprite v0 v1 8
784
+ sprite v0 v1 1
791
785
v5 -= 1
792
- if v5 != 0 then again
786
+ if v5 != 0 then
787
+ again
793
788
v2 += v4
794
789
v3 += vF
795
790
vE := delay
796
791
if vE != 0 then again
797
792
798
- vE := 128
799
- v2 >>= v2
800
- v3 >>= v3
801
- if vF == 1 then v2 |= vE
802
-
793
+ # We expect the inner loop with 30 `sprite`s to have been able to run four
794
+ # times in the timespan of 120 interrupts
803
795
v0 := 1
804
796
if v3 != 0 then v0 := 0
805
- if v2 != 2 then v0 := 0
797
+ if v2 != 4 then v0 := 0
806
798
i := scratchpad-plus-1
807
799
save v0
808
800
1036
1028
1037
1029
jump menu-after-keypress
1038
1030
1039
-
1040
1031
# Keypad test
1041
1032
# A fresh new implementation for this test suite
1042
1033
1138
1129
sprite v0 v1 3
1139
1130
jump menu-after-keypress
1140
1131
1141
-
1142
-
1143
-
1144
- : logo-part1
1132
+ : splash-0-0
1145
1133
0x0f 0x02 0x02 0x02 0x02 0x02 0x00 0x00 0x1f 0x3f 0x71 0xe0 0xe5 0xe0 0xe8
1146
- : logo-part2
1134
+ : splash-1-0
1147
1135
0xa0 0x0d 0x2a 0x28 0x28 0x28 0x00 0x00 0x18 0xb8 0xb8 0x38 0x38 0x3f 0xbf
1148
- : logo-part3
1136
+ : splash-2-0
1149
1137
0x00 0x19 0xa5 0xbd 0xa1 0x9d 0x00 0x00 0x0c 0x1d 0x1d 0x01 0x0d 0x1d 0x9d
1150
- : logo-part4
1138
+ : splash-3-0
1151
1139
0x01 0xc7 0x29 0x29 0x29 0x27 0x00 0x00 0xf8 0xfc 0xce 0xc6 0xc6 0xc6 0xc6
1152
- : logo-part5
1140
+ : splash-4-0
1153
1141
0x00 0x49 0x4a 0x49 0x48 0x3b 0x00 0x00 0x00 0x01 0x03 0x03 0x03 0x01 0xf0
1154
- : logo-part6
1142
+ : splash-5-0
1155
1143
0x30 0x90 0x00 0x00 0x80 0x00 0x00 0x00 0xfe 0xc7 0x83 0x83 0x83 0xc6 0xfc
1156
- : logo-part7
1144
+ : splash-0-1
1157
1145
0xe7 0xe0 0xe0 0xe0 0xe0 0x71 0x3f 0x1f 0x00 0x00 0x07 0x02 0x02 0x02 0x02
1158
- : logo-part8
1146
+ : splash-1-1
1159
1147
0x39 0x38 0x38 0x38 0x38 0xb8 0xb8 0x38 0x00 0x00 0x31 0x4a 0x79 0x40 0x3b
1160
- : logo-part9
1148
+ : splash-2-1
1161
1149
0xdd 0xdd 0xdd 0xdd 0xdd 0xdd 0xdd 0xdd 0x00 0x00 0xa0 0x38 0x20 0xa0 0x18
1162
- : logo-part10
1150
+ : splash-3-1
1163
1151
0xce 0xfc 0xf8 0xc0 0xc0 0xca 0xca 0xc4 0x00 0x00 0x30 0x44 0x24 0x14 0x63
1164
- : logo-part11
1165
- 0xf1 0x03 0x07 0xc7 0x27 0x47 0x83 0xe1 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6
1166
- : logo-part12
1152
+ : splash-4-1
1153
+ 0xf1 0x03 0x07 0xc7 0x27 0x47 0x23 0xc1 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6
1154
+ : splash-5-1
1167
1155
0xce 0x87 0x03 0x03 0x03 0x87 0xfe 0xfc 0x00 0x00 0x60 0x90 0xf0 0x80 0x70
1168
1156
1157
+
1158
+
1169
1159
: scratchpad
1170
1160
0
1171
1161
: scratchpad-plus-1
1177
1167
: scratchpad-plus-16
1178
1168
0
1179
1169
1170
+
1180
1171
: menu-main
1181
1172
10 8 :pointer ibm-logo
1182
1173
10 13 :pointer corax89
1201
1192
0b11000000
1202
1193
0b11000000
1203
1194
1195
+
1204
1196
# Positive and negative images
1205
1197
: imageok
1206
1198
0xEA 0xAC 0xAA 0xEA
1372
1364
0b00000000
1373
1365
0b01000000
1374
1366
1367
+
1375
1368
: ibm-logo-part1
1376
1369
0xFF 0x00 0xFF 0x00 0x3C 0x00 0x3C 0x00 0x3C 0x00 0x3C 0x00 0xFF 0x00 0xFF
1377
1370
: ibm-logo-part2
1385
1378
: ibm-logo-part6
1386
1379
0xE0 0x00 0xE0 0x00 0x80 0x00 0x80 0x00 0x80 0x00 0x80 0x00 0xE0 0x00 0xE0
1387
1380
1381
+
1388
1382
: flags-no-carry
1389
1383
str "HAPPY" 0
1390
1384
: flags-carry
1391
1385
str "CARRY" 0
1392
1386
: flags-other
1393
1387
str "OTHER" 0
1394
1388
1389
+
1395
1390
: quirks-menu
1396
1391
12 13 :pointer quirks-chip8
1397
1392
12 18 :pointer quirks-schip
1427
1422
str "ERR" 0
1428
1423
1429
1424
: quirks-values
1430
- 28 12 0 0 1
1425
+ 32 12 0 0 1
1431
1426
: quirks-image
1432
- 0x3C 0x7E 0xFF 0xDB 0xFF 0xDB 0x66 0x3C
1427
+ 0b10000000
1428
+
1433
1429
1434
1430
: keypad-menu
1435
1431
4 13 :pointer keypad-down
1493
1489
0b11111110
1494
1490
0b11111110
1495
1491
1492
+
1496
1493
# Jump quirk targets:
1497
1494
:org 0xE87
1498
1495
# We jump here when using v0 in the `jump0` quirks test
1501
1498
:org 0xE8B
1502
1499
# We jump here when using vE in the `jump0` quirks test
1503
1500
v5 := 1
1504
- jump quirks-resume
1501
+ jump quirks-resume
0 commit comments