@@ -7,19 +7,19 @@ CHIP-8, SUPER-CHIP or XO-CHIP interpreter (or "emulator")_
7
7
8
8
## Table of contents
9
9
10
- * [ Introduction] ( #introduction )
11
- * [ Baseline] ( #baseline )
12
- * [ Available tests] ( #available-tests )
13
- * [ CHIP-8 splash screen] ( #chip-8-splash-screen )
14
- * [ IBM logo] ( #ibm-logo )
15
- * [ Corax+ opcode test] ( #corax-opcode-test )
16
- * [ Flags test] ( #flags-test )
17
- * [ Quirks test] ( #quirks-test )
18
- * [ Keypad test] ( #keypad-test )
19
- * [ Beep test] ( #beep-test )
20
- * [ Scrolling test] ( #scrolling-test )
21
- * [ Contributing] ( #contributing )
22
- * [ Community response 😄] ( #community-response- )
10
+ - [ Introduction] ( #introduction )
11
+ - [ Baseline] ( #baseline )
12
+ - [ Available tests] ( #available-tests )
13
+ - [ CHIP-8 splash screen] ( #chip-8-splash-screen )
14
+ - [ IBM logo] ( #ibm-logo )
15
+ - [ Corax+ opcode test] ( #corax-opcode-test )
16
+ - [ Flags test] ( #flags-test )
17
+ - [ Quirks test] ( #quirks-test )
18
+ - [ Keypad test] ( #keypad-test )
19
+ - [ Beep test] ( #beep-test )
20
+ - [ Scrolling test] ( #scrolling-test )
21
+ - [ Contributing] ( #contributing )
22
+ - [ Community response 😄] ( #community-response- )
23
23
24
24
# Introduction
25
25
@@ -74,9 +74,9 @@ gold standard for how an XO-CHIP system should behave, and test against that.
74
74
75
75
## CHIP-8 splash screen
76
76
77
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/1-chip8-logo.ch8 )
77
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/1-chip8-logo.ch8 )
78
78
(source code available [ here] ( ./src/tests/1-chip8-logo.8o ) )
79
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/1-chip8-logo.html )
79
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/1-chip8-logo.html )
80
80
to see what's supposed to happen
81
81
82
82
The first test is a very simple splash screen. It is very similar to the often
@@ -91,21 +91,21 @@ to shift the bits of the sprite to align with the buffer.
91
91
Run the ROM for 39 cycles to see this splash screen on the display. This first
92
92
test can tell you if you're interpreting these opcodes properly:
93
93
94
- * ` 00E0 ` - Clear the screen
95
- * ` 6xnn ` - Load normal register with immediate value
96
- * ` Annn ` - Load index register with immediate value
97
- * ` Dxyn ` - Draw sprite to screen (only aligned)
94
+ - ` 00E0 ` - Clear the screen
95
+ - ` 6xnn ` - Load normal register with immediate value
96
+ - ` Annn ` - Load index register with immediate value
97
+ - ` Dxyn ` - Draw sprite to screen (only aligned)
98
98
99
99
If you run the ROM for more than 39 cycles, it will enter an endless loop. If
100
100
that also works as expected, you've also correctly interpreted the jump opcode:
101
101
102
- * ` 1nnn ` - Jump
102
+ - ` 1nnn ` - Jump
103
103
104
104
## IBM logo
105
105
106
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/2-ibm-logo.ch8 )
106
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/2-ibm-logo.ch8 )
107
107
(source code available [ here] ( ./src/tests/2-ibm-logo.8o ) )
108
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/2-ibm-logo.html )
108
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/2-ibm-logo.html )
109
109
to see what's supposed to happen
110
110
111
111
The second test is the classic IBM ROM. If the splash screen works as expected,
@@ -122,23 +122,22 @@ original (except for the version number).
122
122
Run the ROM for 20 cycles to see the IBM logo on the display. If you can see the
123
123
IBM logo, you are properly interpreting these opcodes:
124
124
125
-
126
- * ` 00E0 ` - Clear the screen
127
- * ` 6xnn ` - Load normal register with immediate value
128
- * ` Annn ` - Load index register with immediate value
129
- * ` 7xnn ` - Add immediate value to normal register
130
- * ` Dxyn ` - Draw sprite to screen (un-aligned)
125
+ - ` 00E0 ` - Clear the screen
126
+ - ` 6xnn ` - Load normal register with immediate value
127
+ - ` Annn ` - Load index register with immediate value
128
+ - ` 7xnn ` - Add immediate value to normal register
129
+ - ` Dxyn ` - Draw sprite to screen (un-aligned)
131
130
132
131
If you run the ROM for more than 20 cycles, it will enter an endless loop. If
133
132
that also works as expected, you've also correctly interpreted the jump opcode:
134
133
135
- * ` 1nnn ` - Jump
134
+ - ` 1nnn ` - Jump
136
135
137
136
## Corax+ opcode test
138
137
139
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/3-corax+.ch8 )
138
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/3-corax+.ch8 )
140
139
(source code available [ here] ( ./src/tests/3-corax+.8o ) )
141
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/3-corax+.html )
140
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/3-corax+.html )
142
141
to see what's supposed to happen
143
142
144
143
This ROM is an adaptation of another famous one, the [ CHIP-8 test rom written by
@@ -173,29 +172,29 @@ If you see a cross you can be sure that you have an issue with that opcode.
173
172
174
173
Here's a rough description of what these opcodes should do to pass the tests:
175
174
176
- * ` 3xnn ` - if ` vX == nn ` , skip next opcode
177
- * ` 4xnn ` - if ` vX != nn ` , skip next opcode
178
- * ` 5xy0 ` - if ` vX == vY ` , skip next opcode
179
- * ` 7xnn ` - ` vX += nn `
180
- * ` 9xy0 ` - if ` vX != vY ` , skip next opcode
181
- * ` 1nnn ` - ` jump nnn ` (goto)
182
- * ` 2nnn ` - ` call nnn ` (subroutine)
183
- * ` 00EE ` - ` return ` from subroutine
184
- * ` 8xy0 ` - ` vX = vY `
185
- * ` 8xy1 ` - ` vX |= vY `
186
- * ` 8xy2 ` - ` vX &= vY `
187
- * ` 8xy3 ` - ` vX ^= vY `
188
- * ` 8xy4 ` - ` vX += vY `
189
- * ` 8xy5 ` - ` vX -= vY `
190
- * ` 8xy7 ` - ` vX = vY - vX `
191
- * ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
192
- * ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
193
- * ` Fx65 ` - load registers ` v0 ` - ` vX ` from memory starting at ` i `
194
- * ` Fx55 ` - save registers ` v0 ` - ` vX ` to memory starting at ` i `
195
- * ` Fx33 ` - store binary-coded decimal representation of ` vX ` to memory at ` i ` ,
175
+ - ` 3xnn ` - if ` vX == nn ` , skip next opcode
176
+ - ` 4xnn ` - if ` vX != nn ` , skip next opcode
177
+ - ` 5xy0 ` - if ` vX == vY ` , skip next opcode
178
+ - ` 7xnn ` - ` vX += nn `
179
+ - ` 9xy0 ` - if ` vX != vY ` , skip next opcode
180
+ - ` 1nnn ` - ` jump nnn ` (goto)
181
+ - ` 2nnn ` - ` call nnn ` (subroutine)
182
+ - ` 00EE ` - ` return ` from subroutine
183
+ - ` 8xy0 ` - ` vX = vY `
184
+ - ` 8xy1 ` - ` vX |= vY `
185
+ - ` 8xy2 ` - ` vX &= vY `
186
+ - ` 8xy3 ` - ` vX ^= vY `
187
+ - ` 8xy4 ` - ` vX += vY `
188
+ - ` 8xy5 ` - ` vX -= vY `
189
+ - ` 8xy7 ` - ` vX = vY - vX `
190
+ - ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
191
+ - ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
192
+ - ` Fx65 ` - load registers ` v0 ` - ` vX ` from memory starting at ` i `
193
+ - ` Fx55 ` - save registers ` v0 ` - ` vX ` to memory starting at ` i `
194
+ - ` Fx33 ` - store binary-coded decimal representation of ` vX ` to memory at ` i ` ,
196
195
` i + 1 ` and ` i + 2 `
197
- * ` Fx1E ` - ` i += vX `
198
- * ` Registers ` - The ` v0 ` - ` vF ` registers should be 8 bits wide. This tests to
196
+ - ` Fx1E ` - ` i += vX `
197
+ - ` Registers ` - The ` v0 ` - ` vF ` registers should be 8 bits wide. This tests to
199
198
see if it can overflow your registers.
200
199
201
200
If you are having trouble figuring out how each opcode is supposed to behave,
@@ -205,9 +204,9 @@ guide](https://tobiasvl.github.io/blog/write-a-chip-8-emulator/#instructions) or
205
204
206
205
## Flags test
207
206
208
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/4-flags.ch8 )
207
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/4-flags.ch8 )
209
208
(source code available [ here] ( ./src/tests/4-flags.8o ) )
210
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/4-flags.html )
209
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/4-flags.html )
211
210
to see what's supposed to happen
212
211
213
212
This test checks to see if your math operations function properly on some given
@@ -242,14 +241,14 @@ HAPPY 8xy1 8xy2
242
241
8xy6 8xy7 8xyE
243
242
```
244
243
245
- * ` 8xy1 ` - ` vX |= vY `
246
- * ` 8xy2 ` - ` vX &= vY `
247
- * ` 8xy3 ` - ` vX ^= vY `
248
- * ` 8xy4 ` - ` vX += vY `
249
- * ` 8xy5 ` - ` vX -= vY `
250
- * ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
251
- * ` 8xy7 ` - ` vX = vY - vX `
252
- * ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
244
+ - ` 8xy1 ` - ` vX |= vY `
245
+ - ` 8xy2 ` - ` vX &= vY `
246
+ - ` 8xy3 ` - ` vX ^= vY `
247
+ - ` 8xy4 ` - ` vX += vY `
248
+ - ` 8xy5 ` - ` vX -= vY `
249
+ - ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
250
+ - ` 8xy7 ` - ` vX = vY - vX `
251
+ - ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
253
252
254
253
The bottom part (that starts with "CARRY") checks behaviour of the following
255
254
opcodes, in the case that there ** is** an overflow, carry or shifted out bit:
@@ -259,11 +258,11 @@ CARRY 8xy4 8xy5
259
258
8xy6 8xy7 8xyE
260
259
```
261
260
262
- * ` 8xy4 ` - ` vX += vY `
263
- * ` 8xy5 ` - ` vX -= vY `
264
- * ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
265
- * ` 8xy7 ` - ` vX = vY - vX `
266
- * ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
261
+ - ` 8xy4 ` - ` vX += vY `
262
+ - ` 8xy5 ` - ` vX -= vY `
263
+ - ` 8xy6 ` - ` vX = vY >> 1 ` or ` vX = vX >> 1 ` depending on quirks
264
+ - ` 8xy7 ` - ` vX = vY - vX `
265
+ - ` 8xyE ` - ` vX = vY << 1 ` or ` vX = vX << 1 ` depending on quirks
267
266
268
267
The last row (that starts with "OTHER") checks that the opcode ` Fx1E ` (`i +=
269
268
vX` ) properly adds the value of register ` vX` to the index register, first for a
@@ -278,9 +277,9 @@ for more information on the arithmetic operations and the flags.
278
277
279
278
## Quirks test
280
279
281
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/5-quirks.ch8 )
280
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/5-quirks.ch8 )
282
281
(source code available [ here] ( ./src/tests/5-quirks.8o ) )
283
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/5-quirks.html )
282
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/5-quirks.html )
284
283
to see what's supposed to happen
285
284
286
285
CHIP-8, SUPER-CHIP and XO-CHIP have subtle differences in the way they interpret
@@ -310,10 +309,10 @@ graphical menu just gets in the way. In that case, you can force this ROM to
310
309
select a specific platform by loading a value between ` 1 ` and ` 4 ` into memory at
311
310
the address ` 0x1FF ` (` 512 ` ).
312
311
313
- * ` 1 ` - CHIP-8
314
- * ` 2 ` - SUPER-CHIP with modern behaviour
315
- * ` 3 ` - XO-CHIP
316
- * ` 4 ` - SUPER-CHIP with legacy behaviour
312
+ - ` 1 ` - CHIP-8
313
+ - ` 2 ` - SUPER-CHIP with modern behaviour
314
+ - ` 3 ` - XO-CHIP
315
+ - ` 4 ` - SUPER-CHIP with legacy behaviour
317
316
318
317
### The test
319
318
@@ -327,19 +326,19 @@ The screen shows you if the following quirks are detected as active ("on", "off"
327
326
or an error) and if that matches your chosen target platform (a checkmark or a
328
327
cross).
329
328
330
- * ` vF reset ` - The AND, OR and XOR opcodes (` 8xy1 ` , ` 8xy2 ` and ` 8xy3 ` ) reset the
329
+ - ` vF reset ` - The AND, OR and XOR opcodes (` 8xy1 ` , ` 8xy2 ` and ` 8xy3 ` ) reset the
331
330
flags register to zero. Test will show ` ERR1 ` if the AND and OR tests don't
332
331
behave the same and ` ERR2 ` if the AND and XOR tests don't behave the same.
333
- * ` Memory ` - The save and load opcodes (` Fx55 ` and ` Fx65 ` ) increment the index
332
+ - ` Memory ` - The save and load opcodes (` Fx55 ` and ` Fx65 ` ) increment the index
334
333
register. More information [ here] ( https://laurencescotford.net/chip-8-on-the-cosmac-vip-loading-and-saving-variables/ )
335
334
and [ here] ( https://tobiasvl.github.io/blog/write-a-chip-8-emulator/#fx55-and-fx65-store-and-load-memory ) .
336
- * ` Display wait ` - Drawing sprites to the display waits for the vertical blank
335
+ - ` Display wait ` - Drawing sprites to the display waits for the vertical blank
337
336
interrupt, limiting their speed to max 60 sprites per second. More information
338
337
[ here] ( https://laurencescotford.net/chip-8-on-the-cosmac-vip-drawing-sprites/ ) .
339
338
Test will show ` SLOW ` if the number of cycles per frame is too low for the test
340
339
to be deterministic (this is not necessarily an error, but a suggestion to
341
340
rerun the test with a higher number of cycles per frame).
342
- * ` Clipping ` - Sprites drawn at the bottom edge of the screen get clipped
341
+ - ` Clipping ` - Sprites drawn at the bottom edge of the screen get clipped
343
342
instead of wrapping around to the top of the screen. When clipping is off, the
344
343
test checks if sprites get rendered at the right coordinates on the other side
345
344
of the screen. This also tests that sprites drawn at coordinates of ` x > 63 `
@@ -348,11 +347,11 @@ cross).
348
347
Test will show ` ERR1 ` if the clipping is inconsistent in different dimensions
349
348
or wrapping to the wrong coordinates and ` ERR2 ` if sprites don't wrap around
350
349
as expected.
351
- * ` Shifting ` - The shift opcodes (` 8xy6 ` and ` 8xyE ` ) only operate on ` vX `
350
+ - ` Shifting ` - The shift opcodes (` 8xy6 ` and ` 8xyE ` ) only operate on ` vX `
352
351
instead of storing the shifted version of ` vY ` in ` vX ` (more information
353
352
[ here] ( https://tobiasvl.github.io/blog/write-a-chip-8-emulator/#8xy6-and-8xye-shift ) ).
354
353
Test will show ` ERR1 ` if the shift opcodes behave differently.
355
- * ` Jumping ` - The "jump to some address plus ` v0 ` " instruction (` Bnnn ` ) doesn't
354
+ - ` Jumping ` - The "jump to some address plus ` v0 ` " instruction (` Bnnn ` ) doesn't
356
355
use ` v0 ` , but ` vX ` instead where ` X ` is the highest nibble of ` nnn ` (more
357
356
information [ here] ( https://tobiasvl.github.io/blog/write-a-chip-8-emulator/#bnnn-jump-with-offset ) )
358
357
@@ -365,10 +364,10 @@ executed in `hires` mode, and the behaviour of `Display wait` and `Clipping`
365
364
will be tested in both ` lores ` and ` hires ` modes. This means you will not just
366
365
see "on" or "off" for these quirks, but instead one of these values:
367
366
368
- * ` NONE ` - The quirk is disabled in both modes
369
- * ` HRES ` - The quirk is only enabled in ` hires ` mode
370
- * ` LRES ` - The quirk is only enabled in ` lores ` mode
371
- * ` BOTH ` - The quirk is enabled in both modes
367
+ - ` NONE ` - The quirk is disabled in both modes
368
+ - ` HRES ` - The quirk is only enabled in ` hires ` mode
369
+ - ` LRES ` - The quirk is only enabled in ` lores ` mode
370
+ - ` BOTH ` - The quirk is enabled in both modes
372
371
373
372
If the test finds different errors for the ` Clipping ` test in ` hires ` mode
374
373
compared to ` lores ` mode, it will show ` ERR3 ` . In that case, first make sure
@@ -391,9 +390,9 @@ quirks among them.
391
390
392
391
## Keypad test
393
392
394
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/6-keypad.ch8 )
393
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/6-keypad.ch8 )
395
394
(source code available [ here] ( ./src/tests/6-keypad.8o ) )
396
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/6-keypad.html )
395
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/6-keypad.html )
397
396
to see what's supposed to happen
398
397
399
398
This test allows you to test all three CHIP-8 key input opcodes. It shows you a
@@ -447,11 +446,11 @@ screen:
447
446
448
447
Otherwise, you can get either of these errors:
449
448
450
- * ` NOT HALTING ` - Your implementation immediately returns the value of any
449
+ - ` NOT HALTING ` - Your implementation immediately returns the value of any
451
450
currently pressed keys in ` vX ` , instead of halting the interpreter until a key
452
451
is pressed (note that this needs timer support to be accurate - in other words,
453
452
the DELAY TIMER should continue to count down while awaiting a keypress)
454
- * ` NOT RELEASED ` - Your implementation doesn't wait for the pressed key to be
453
+ - ` NOT RELEASED ` - Your implementation doesn't wait for the pressed key to be
455
454
released before resuming
456
455
457
456
See [ this
@@ -460,9 +459,9 @@ for more information.
460
459
461
460
## Beep test
462
461
463
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/7-beep.ch8 )
462
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/7-beep.ch8 )
464
463
(source code available [ here] ( ./src/tests/7-beep.8o ) )
465
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/7-beep.html )
464
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/7-beep.html )
466
465
to see what's supposed to happen (sound may not actually play due to browser
467
466
restrictions)
468
467
@@ -475,9 +474,9 @@ Press `B` to beep.
475
474
476
475
## Scrolling test
477
476
478
- * [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/8-scrolling.ch8 )
477
+ - [ Download ROM] ( https://github.com/Timendus/chip8-test-suite/raw/main/bin/8-scrolling.ch8 )
479
478
(source code available [ here] ( ./src/tests/8-scrolling.8o ) )
480
- * [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/8-scrolling.html )
479
+ - [ Run this ROM in Octo] ( https://timendus.github.io/chip8-test-suite/8-scrolling.html )
481
480
to see what's supposed to happen
482
481
483
482
This test is only applicable to SUPER-CHIP and XO-CHIP interpreters, since
@@ -507,11 +506,11 @@ graphical menu just gets in the way. In that case, you can force this ROM to
507
506
select a specific platform by loading a value between ` 1 ` and ` 5 ` into memory at
508
507
the address ` 0x1FF ` (` 512 ` ).
509
508
510
- * ` 1 ` - SUPER-CHIP ` lores ` with modern behaviour
511
- * ` 2 ` - SUPER-CHIP ` lores ` with legacy behaviour
512
- * ` 3 ` - SUPER-CHIP ` hires `
513
- * ` 4 ` - XO-CHIP ` lores `
514
- * ` 5 ` - XO-CHIP ` hires `
509
+ - ` 1 ` - SUPER-CHIP ` lores ` with modern behaviour
510
+ - ` 2 ` - SUPER-CHIP ` lores ` with legacy behaviour
511
+ - ` 3 ` - SUPER-CHIP ` hires `
512
+ - ` 4 ` - XO-CHIP ` lores `
513
+ - ` 5 ` - XO-CHIP ` hires `
515
514
516
515
### The test
517
516
546
545
cd chip8-test-suite
547
546
npm install
548
547
```
548
+
549
549
``` bash
550
550
# Build all the tests in `src/tests/` to `bin/`:
551
551
npm start
0 commit comments