Skip to content

Commit cb24d55

Browse files
authored
Merge pull request #25 from Timendus/version-4.2
Version 4.2
2 parents 8d67cd6 + e59dad0 commit cb24d55

32 files changed

+197
-77
lines changed

bin/1-chip8-logo.8o

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
: splash-3-1
6262
0xce 0xfc 0xf8 0xc0 0xd4 0xdc 0xc4 0xc5 0x00 0x00 0x30 0x44 0x24 0x14 0x63
6363
: splash-4-1
64-
0xf1 0x03 0x07 0x07 0x27 0x67 0x23 0x71 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6
64+
0xf1 0x03 0x07 0x07 0x77 0x17 0x63 0x71 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6
6565
: splash-5-1
6666
0xce 0x87 0x03 0x03 0x03 0x87 0xfe 0xfc 0x00 0x00 0x60 0x90 0xf0 0x80 0x70
6767

bin/1-chip8-logo.ch8

0 Bytes
Binary file not shown.

bin/2-ibm-logo.8o

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@
5858
: ibm-4-0
5959
0x03 0x00 0x07 0x00 0x0f 0x00 0xbf 0x00 0xfb 0x00 0xf3 0x00 0xe3 0x00 0x43
6060
: ibm-5-0
61-
0xe5 0x05 0xe2 0x00 0x85 0x07 0x81 0x01 0x80 0x02 0x80 0x02 0xe6 0x02 0xe7
61+
0xe5 0x05 0xe2 0x00 0x85 0x07 0x81 0x01 0x80 0x02 0x80 0x07 0xe1 0x06 0xe7
6262

bin/2-ibm-logo.ch8

0 Bytes
Binary file not shown.

bin/3-corax+.8o

Lines changed: 128 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# MIT License
66
#
7-
# Copyright (c) 2019 corax89, 2023 Timendus
7+
# Copyright (c) 2019 corax89, 2023,2024 Timendus
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -27,22 +27,27 @@
2727
:alias x0 v8
2828
:alias x1 v9
2929
:alias x2 vA
30-
:alias y vB
30+
:alias y vB
3131

3232
:macro drawop A B {
3333
i := A
3434
sprite x0 y 4
35+
3536
i := B
3637
sprite x1 y 4
3738
}
3839

39-
: test2X
40-
i := image-ok
41-
sprite x2 y 4
40+
: test-2X-0E
41+
v0 := 1
4242
return
43+
# These opcodes will run if the interpreter doesn't have return (00EE) implemented:
44+
v0 := 2
45+
jump test-2X-0E-hard-return
4346

4447
: main
4548
clear
49+
50+
# Display current version
4651
x0 := 50
4752
y := 26
4853
i := version-0-0
@@ -51,75 +56,99 @@
5156
i := version-1-0
5257
sprite x0 y 4
5358

59+
# Show output in the first column
5460
x0 := 2
5561
x1 := 6
5662
x2 := 11
5763
y := 1
64+
65+
#################
66+
# Test 3xNN
67+
5868
v5 := 42
5969
v6 := 43
60-
61-
#test 3x
6270
drawop im3 imX
6371
i := image-ok
6472
if v6 != 43 then i := image-no
6573
sprite x2 y 4
6674

67-
#test 4x
75+
#################
76+
# Test 4xNN
77+
6878
y := 6
6979
drawop im4 imX
7080
i := image-no
7181
if v5 == 42 then i := image-ok
7282
sprite x2 y 4
7383

74-
#test 5x
84+
#################
85+
# Test 5xy0
86+
7587
y := 11
7688
drawop im5 imX
7789
i := image-no
7890
if v5 != v6 then i := image-ok
7991
sprite x2 y 4
8092

81-
#test 7x
93+
#################
94+
# Test 7xNN
95+
8296
y := 16
8397
drawop im7 imX
8498
i := image-no
8599
v6 += 255
86100
if v6 == 42 then i := image-ok
87101
sprite x2 y 4
88102

89-
#test 9x
103+
#################
104+
# Test 9xy0
105+
90106
y += 5
91107
drawop im9 imX
92108
i := image-no
93109
if v5 == v6 then i := image-ok
94110
sprite x2 y 4
95111

96-
#test 1x
112+
#################
113+
# Test 1NNN (displayed as 1X)
114+
97115
y += 5
98116
drawop im1 imX
99117
i := image-ok
100-
jump test1x
118+
jump test-1X-pass
101119
i := image-no
102-
: test1x
120+
: test-1X-pass
103121
sprite x2 y 4
104122

105-
#test "AX"
106-
# Note by Timendus: I think this really tests 2NNN, not ANNN, so I changed the
107-
# displayed label on this to not confuse users.
108-
# See PR: https://github.com/corax89/chip8-test-rom/pull/9
123+
# Show output in the second column
109124
x0 := 18
110125
x1 := 22
111126
x2 := 27
112127
y := 1
128+
129+
#################
130+
# Test calling subroutines (2NNN, displayed as 2X)
131+
113132
drawop im2 imX
114-
test2X
133+
v0 := 0
134+
test-2X-0E # Attempt to run a subroutine
135+
: test-2X-0E-hard-return
136+
i := image-ok
137+
if v0 == 0 then i := image-no # Subroutine was never called
138+
sprite x2 y 4
139+
140+
#################
141+
# Test returning from subroutines (00EE, displayed as 0E)
115142

116-
#test 0E
117143
y += 5
118144
drawop im0 imE
119145
i := image-ok
120-
sprite x2 y 4
146+
if v0 == 2 then i := image-no # Return didn't work
147+
if v0 != 0 then sprite x2 y 4 # If subroutine wasn't called, return wasn't tested
148+
149+
#################
150+
# Test 8xy0
121151

122-
#test 8xy0
123152
y += 5
124153
drawop im8 im0
125154
i := image-no
@@ -129,7 +158,9 @@
129158
if v7 == 42 then i := image-ok
130159
sprite x2 y 4
131160

132-
#test 8xy1
161+
#################
162+
# Test 8xy1
163+
133164
y += 5
134165
drawop im8 im1
135166
i := image-no
@@ -139,7 +170,9 @@
139170
if v7 == 43 then i := image-ok
140171
sprite x2 y 4
141172

142-
#test 8xy2
173+
#################
174+
# Test 8xy2
175+
143176
y += 5
144177
drawop im8 im2
145178
i := image-no
@@ -149,7 +182,9 @@
149182
if v7 == 24 then i := image-ok
150183
sprite x2 y 4
151184

152-
#test 8xy3
185+
#################
186+
# Test 8xy3
187+
153188
y += 5
154189
drawop im8 im3
155190
i := image-no
@@ -159,11 +194,15 @@
159194
if v7 == 103 then i := image-ok
160195
sprite x2 y 4
161196

162-
#test 8xy4
197+
# Show output in the third column
163198
x0 := 34
164199
x1 := 38
165200
x2 := 43
166201
y := 1
202+
203+
#################
204+
# Test 8xy4
205+
167206
drawop im8 im4
168207
i := image-no
169208
v6 := 140
@@ -172,7 +211,9 @@
172211
if v7 == 24 then i := image-ok
173212
sprite x2 y 4
174213

175-
#test 8xy5
214+
#################
215+
# Test 8xy5
216+
176217
y += 5
177218
drawop im8 im5
178219
i := image-no
@@ -182,7 +223,9 @@
182223
if v7 == 236 then i := image-ok
183224
sprite x2 y 4
184225

185-
#test 8xy7
226+
#################
227+
# Test 8xy7
228+
186229
y += 5
187230
drawop im8 im7
188231
i := image-no
@@ -192,9 +235,9 @@
192235
if v7 == 236 then i := image-ok
193236
sprite x2 y 4
194237

195-
#test "8xyE"
196-
# Note by Timendus: This should be 8XY6, changed the label here too.
197-
# See PR: https://github.com/corax89/chip8-test-rom/pull/7
238+
#################
239+
# Test 8xy6
240+
198241
y += 5
199242
drawop im8 im6
200243
i := image-no
@@ -203,9 +246,9 @@
203246
if v6 == 7 then i := image-ok
204247
sprite x2 y 4
205248

206-
#test "8xy6"
207-
# Note by Timendus: This should be 8XYE, changed the label here too.
208-
# See PR: https://github.com/corax89/chip8-test-rom/pull/7
249+
#################
250+
# Test 8xyE
251+
209252
y += 5
210253
drawop im8 imE
211254
i := image-no
@@ -214,7 +257,9 @@
214257
if v6 == 192 then i := image-ok
215258
sprite x2 y 4
216259

217-
#test Fx65
260+
#################
261+
# Test Fx65
262+
218263
y += 5
219264
drawop imF im6
220265
i := scratchpad
@@ -224,7 +269,9 @@
224269
if v1 != 0x55 then i := image-no
225270
sprite x2 y 4
226271

227-
#test Fx55
272+
#################
273+
# Test Fx55
274+
228275
x0 := 50
229276
x1 := 54
230277
x2 := 59
@@ -244,31 +291,63 @@
244291
if v1 != 0 then i := image-no
245292
sprite x2 y 4
246293

247-
#test Fx33
294+
#################
295+
# Test Fx33
296+
248297
y += 5
249298
drawop imF im3
299+
300+
# N >= 100
250301
i := scratchpad
251302
v6 := 137
252303
bcd v6
253304
load v2
305+
i := image-no
306+
if v0 != 1 then jump fx33-fail
307+
if v1 != 3 then jump fx33-fail
308+
if v2 != 7 then jump fx33-fail
309+
310+
# N < 100
311+
i := scratchpad
312+
v6 := 65
313+
bcd v6
314+
load v2
315+
i := image-no
316+
if v0 != 0 then jump fx33-fail
317+
if v1 != 6 then jump fx33-fail
318+
if v2 != 5 then jump fx33-fail
319+
320+
# N < 10
321+
i := scratchpad
322+
v6 := 4
323+
bcd v6
324+
load v2
325+
i := image-no
326+
if v0 != 0 then jump fx33-fail
327+
if v1 != 0 then jump fx33-fail
328+
if v2 != 4 then jump fx33-fail
329+
254330
i := image-ok
255-
if v0 != 1 then i := image-no
256-
if v1 != 3 then i := image-no
257-
if v2 != 7 then i := image-no
331+
: fx33-fail
258332
sprite x2 y 4
259333

260-
#test Fx1E
334+
#################
335+
# Test Fx1E
336+
261337
y += 5
262338
drawop imF imE
263339
i := image-no
264340
v6 := 4
265341
i += v6
266342
sprite x2 y 4
267343

268-
# Test to see if registers are 8 bit, as much as we can
344+
#################
345+
# Test to see if registers are 8 bit, as thoroughly as possible.
346+
269347
y += 5
270348
drawop imV imX
271349
i := image-ok
350+
272351
# Addition opcodes should not allow us to overflow
273352
v6 := 255
274353
v6 += 10
@@ -281,6 +360,7 @@
281360
if v6 != 9 then i := image-no
282361
v6 >>= v6
283362
if v6 != 4 then i := image-no
363+
284364
# Shift opcodes should not retain bits
285365
v6 := 255
286366
v6 <<= v6
@@ -289,6 +369,7 @@
289369
v6 >>= v6
290370
v6 <<= v6
291371
if v6 != 126 then i := image-no
372+
292373
# Subtraction should wrap back to positive
293374
v6 := 5
294375
v6 -= 10
@@ -299,8 +380,12 @@
299380
v6 := 5
300381
v0 =- v6
301382
if v0 != 251 then i := image-no
383+
302384
sprite x2 y 4
303385

386+
#################
387+
# Test is done!
388+
304389
loop again
305390

306391
: scratchpad
@@ -416,5 +501,5 @@
416501
: version-0-0
417502
0x0a 0xae 0xa2 0x42
418503
: version-1-0
419-
0x10 0x30 0x10 0xb8
504+
0x38 0x08 0x30 0xb8
420505

bin/3-corax+.ch8

64 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)