diff --git a/bin/chip8-test-suite.8o b/bin/chip8-test-suite.8o index 8515cf8..963fadd 100644 --- a/bin/chip8-test-suite.8o +++ b/bin/chip8-test-suite.8o @@ -1,3 +1,6 @@ +# CHIP-8 Test Suite -- Timendus, 2022 +# https://github.com/Timendus/chip8-test-suite + # The program begins from 0x200 with the CHIP-8 logo image, # which contains the `main` label: @@ -49,136 +52,188 @@ # After that, if the user auto-started a test, run it: : select-test - i := 0x1FF - load v0 - if v0 == 1 then jump ibm-logo - if v0 == 2 then jump corax89 - if v0 == 3 then jump flags-test - if v0 == 4 then jump quirks-test - if v0 == 5 then jump keypad-test - if v0 == 9 then jump menu - jump menu-after-keypress + i := 0x1FF + load v0 + if v0 == 1 then jump ibm-logo + if v0 == 2 then jump corax89 + if v0 == 3 then jump flags-test + if v0 == 4 then jump quirks-test + if v0 == 5 then jump keypad-test + if v0 == 9 then jump menu + jump menu-after-keypress # Include all support code: :stringmode str "$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -." { - :byte { 4 * VALUE } + :byte { 4 * VALUE } } :macro text X Y STR { - vD := X - vE := Y - i := STR - drawText + vD := X + vE := Y + i := STR + drawText } :alias x vA :alias y vB : waitKeyRelease - v0 := 0 + v0 := 0 : - - if v0 key then jump - - v0 += 1 - if v0 == 16 then return - jump - + if v0 key then jump - + v0 += 1 + if v0 == 16 then return + jump - # A cute little menu to select a test : menu-after-keypress - v0 := key - waitKeyRelease + v0 := key + waitKeyRelease : menu - clear - text 10 1 menu-header - text 14 7 menu-ibm - text 14 12 menu-corax - text 14 17 menu-flags - text 14 22 menu-quirks - text 14 27 menu-keypad - - v1 := 10 - v2 := 8 - v3 := 0 - i := menu-cursor - delay := v3 - loop - # Blink cursor - v0 := delay - if v0 == 0 begin - sprite v1 v2 2 - v0 := 10 - delay := v0 - v0 := 1 - v3 ^= v0 - end - - # Use numbers to start test - v0 := 1 if v0 key then jump ibm-logo-after-keyrelease - v0 := 2 if v0 key then jump corax89-after-keyrelease - v0 := 3 if v0 key then jump flags-test-after-keyrelease - v0 := 4 if v0 key then jump quirks-test-after-keyrelease - v0 := 0xC if v0 key then jump quirks-test-after-keyrelease - - # Select test under cursor - v0 := 6 - if v0 key begin - waitKeyRelease - if v2 == 8 then jump ibm-logo - if v2 == 13 then jump corax89 - if v2 == 18 then jump flags-test - if v2 == 23 then jump quirks-test - if v2 == 28 then jump keypad-test - end - - # Move cursor - # Up - v0 := 5 - if v0 key begin - if v3 == 1 then sprite v1 v2 2 - if v2 > 8 then v2 -= 5 - if v3 == 1 then sprite v1 v2 2 - waitKeyRelease - end - # Down - v0 := 8 - if v0 key begin - if v3 == 1 then sprite v1 v2 2 - if v2 < 28 then v2 += 5 - if v3 == 1 then sprite v1 v2 2 - waitKeyRelease - end - again + clear + text 10 1 menu-header + text 14 7 menu-ibm + text 14 12 menu-corax + text 14 17 menu-flags + text 14 22 menu-quirks + text 14 27 menu-keypad + + :unpack 0xA menu-main + v2 := 4 + #jump menu-start + +# Input: +# * v0 v1 point to 0xA + menu struct +# * v2 holds the length (zero-indexed) +: menu-start + :alias cursorX v0 + :alias cursorY v1 + :alias numItems v2 + :alias showing v3 + :alias temp v4 + :alias currentItem v5 + :alias selectedItem v6 + + currentItem := 0 + i := menu-draw-cursor + save v1 + i := menu-choose-load + save v1 + jump menu-draw-cursor +: menu-move-cursor + if showing == 1 then sprite cursorX cursorY 2 # i should still be correct + waitKeyRelease +: menu-draw-cursor + 0 0 # i := + i += currentItem + i += currentItem + i += currentItem + i += currentItem + load cursorY # and cursorX + showing := 0 + delay := showing + + loop + # Blink cursor + temp := delay + if temp == 0 begin + i := menu-cursor + sprite cursorX cursorY 2 + temp := 10 + delay := temp + temp := 1 + showing ^= temp + end + + # Move cursor up + temp := 0xE + if temp key begin + if currentItem != 0 begin + currentItem -= 1 + jump menu-move-cursor + end + end + # Move cursor down + temp := 0xF + if temp key begin + if currentItem != numItems begin + currentItem += 1 + jump menu-move-cursor + end + end + # Start test under cursor + selectedItem := currentItem + temp := 0xA + if temp key then jump menu-choose + + # Use numbers to jump to tests directly + temp := 0 + numItems += 1 + loop + temp += 1 + if temp key begin + selectedItem := temp + selectedItem -= 1 + jump menu-choose + end + if temp != numItems then again + numItems -= 1 + again + +: menu-choose + waitKeyRelease +: menu-choose-load + 0 0 # i := + i += selectedItem + i += selectedItem + i += selectedItem + i += selectedItem + temp := 2 + i += temp + load v1 + temp := 0x10 + v0 |= temp + i := menu-choose-jump + save v1 +: menu-choose-jump + 0 0 # jump # Font rendering code and character data # Kept this very simplistic and fast :macro drawCharacter REG { - if REG == 0 then return - i := characters - i += REG - sprite vD vE 4 - vD += 4 + if REG == 0 then return + v0 := REG + drawChar } : drawText - load vC - drawCharacter v0 - drawCharacter v1 - drawCharacter v2 - drawCharacter v3 - drawCharacter v4 - drawCharacter v5 - drawCharacter v6 - drawCharacter v7 - drawCharacter v8 - drawCharacter v9 - drawCharacter vA - drawCharacter vB - drawCharacter vC - return + load vC + drawChar + drawCharacter v1 + drawCharacter v2 + drawCharacter v3 + drawCharacter v4 + drawCharacter v5 + drawCharacter v6 + drawCharacter v7 + drawCharacter v8 + drawCharacter v9 + drawCharacter vA + drawCharacter vB + drawCharacter vC + return + +: drawChar + i := characters + i += v0 + sprite vD vE 4 + vD += 4 + return @@ -193,8 +248,6 @@ # Original "IBM logo" MD5 hash: 2dbace8066709ac9a264d23281820d32 # MD5 hash of binary from this code: 2dbace8066709ac9a264d23281820d32 -: ibm-logo-after-keyrelease - waitKeyRelease : ibm-logo clear # Address 512 / 0x200 @@ -257,198 +310,196 @@ :alias y vB :macro drawop A B { - i := A - sprite x0 y 4 - i := B - sprite x1 y 4 + i := A + sprite x0 y 4 + i := B + sprite x1 y 4 } : test2X - #test 2x - i := imageok - sprite x2 y 4 - return + #test 2x + i := imageok + sprite x2 y 4 + return : test1x - i := imageok - sprite x2 y 4 - jump menu-after-keypress + i := imageok + sprite x2 y 4 + jump menu-after-keypress -: corax89-after-keyrelease - waitKeyRelease : corax89 - clear - x0 := 1 - x1 := 5 - x2 := 10 - y := 1 - v5 := 42 - v6 := 43 - - #test 3x - drawop im3 imX - i := imageok - if v6 != 43 then i := imagefalse - sprite x2 y 4 - - #test 4x - y := 6 - drawop im4 imX - i := imagefalse - if v5 == 42 then i := imageok - sprite x2 y 4 - - #test 5x - y := 11 - drawop im5 imX - i := imagefalse - if v5 != v6 then i := imageok - sprite x2 y 4 - - #test 7x - y := 16 - drawop im7 imX - i := imagefalse - v6 += 255 - if v6 == 42 then i := imageok - sprite x2 y 4 - - #test 9x - y := 21 - drawop im9 imX - i := imagefalse - if v5 == v6 then i := imageok - sprite x2 y 4 - - #test "AX" - # Note by Timendus: I think this really tests 2NNN, not ANNN, so I changed the - # displayed label on this to not confuse users. - # See PR: https://github.com/corax89/chip8-test-rom/pull/9 - y := 26 - drawop im2 imX - test2X - - #test 0E - x0 := 24 - x1 := 28 - x2 := 33 - y := 1 - drawop im0 imE - i := imageok - sprite x2 y 4 - - #test 8xy0 - y := 6 - drawop im8 im0 - i := imagefalse - v7 := v5 - if v7 == 42 then i := imageok - sprite x2 y 4 - - #test 8xy1 - y := 11 - drawop im8 im1 - i := imagefalse - v7 := 42 - v7 |= y - if v7 == 43 then i := imageok - sprite x2 y 4 - - #test 8xy2 - y := 16 - drawop im8 im2 - i := imagefalse - v6 := 120 - v7 := 31 - v7 &= v6 - if v7 == 24 then i := imageok - sprite x2 y 4 - - #test 8xy3 - y := 21 - drawop im8 im3 - i := imagefalse - v6 := 120 - v7 := 31 - v7 ^= v6 - if v7 == 103 then i := imageok - sprite x2 y 4 - - #test 8xy4 - y := 26 - drawop im8 im4 - i := imagefalse - v6 := 140 - v7 := 140 - v7 += v6 - if v7 == 24 then i := imageok - sprite x2 y 4 - - #test 8xy5 - x0 := 47 - x1 := 51 - x2 := 56 - y := 1 - drawop im8 im5 - i := imagefalse - v6 := 140 - v7 := 120 - v7 -= v6 - if v7 == 236 then i := imageok - sprite x2 y 4 - - #test "8xy6" - # Note by Timendus: This should be 8XYE, changed the label here too. - # See PR: https://github.com/corax89/chip8-test-rom/pull/7 - y := 6 - drawop im8 imE - i := imagefalse - v6 := 224 - v6 <<= v6 - if v6 == 192 then i := imageok - sprite x2 y 4 - - #test "8xyE" - # Note by Timendus: This should be 8XY6, changed the label here too. - # See PR: https://github.com/corax89/chip8-test-rom/pull/7 - y := 11 - drawop im8 im6 - i := imagefalse - v6 := 15 - v6 >>= v6 - if v6 == 7 then i := imageok - sprite x2 y 4 - - #test Fx55,Fx65 - y := 16 - drawop imF im5 - i := scratchpad - v0 := 0 - v1 := 48 - save v1 - i := scratchpad-plus-1 - load v0 - i := imagefalse - if v0 == 48 then i := imageok - sprite x2 y 4 - - #test Fx33 - y := 21 - drawop imF im3 - i := scratchpad - v6 := 137 - bcd v6 - load v2 - i := imageok - if v0 != 1 then i := imagefalse - if v1 != 3 then i := imagefalse - if v2 != 7 then i := imagefalse - sprite x2 y 4 - - #test 1x - y := 26 - drawop im1 imX - jump test1x + clear + x0 := 1 + x1 := 5 + x2 := 10 + y := 1 + v5 := 42 + v6 := 43 + + #test 3x + drawop im3 imX + i := imageok + if v6 != 43 then i := imagefalse + sprite x2 y 4 + + #test 4x + y := 6 + drawop im4 imX + i := imagefalse + if v5 == 42 then i := imageok + sprite x2 y 4 + + #test 5x + y := 11 + drawop im5 imX + i := imagefalse + if v5 != v6 then i := imageok + sprite x2 y 4 + + #test 7x + y := 16 + drawop im7 imX + i := imagefalse + v6 += 255 + if v6 == 42 then i := imageok + sprite x2 y 4 + + #test 9x + y := 21 + drawop im9 imX + i := imagefalse + if v5 == v6 then i := imageok + sprite x2 y 4 + + #test "AX" + # Note by Timendus: I think this really tests 2NNN, not ANNN, so I changed the + # displayed label on this to not confuse users. + # See PR: https://github.com/corax89/chip8-test-rom/pull/9 + y := 26 + drawop im2 imX + test2X + + #test 0E + x0 := 24 + x1 := 28 + x2 := 33 + y := 1 + drawop im0 imE + i := imageok + sprite x2 y 4 + + #test 8xy0 + y := 6 + drawop im8 im0 + i := imagefalse + v7 := v5 + if v7 == 42 then i := imageok + sprite x2 y 4 + + #test 8xy1 + y := 11 + drawop im8 im1 + i := imagefalse + v7 := 42 + v7 |= y + if v7 == 43 then i := imageok + sprite x2 y 4 + + #test 8xy2 + y := 16 + drawop im8 im2 + i := imagefalse + v6 := 120 + v7 := 31 + v7 &= v6 + if v7 == 24 then i := imageok + sprite x2 y 4 + + #test 8xy3 + y := 21 + drawop im8 im3 + i := imagefalse + v6 := 120 + v7 := 31 + v7 ^= v6 + if v7 == 103 then i := imageok + sprite x2 y 4 + + #test 8xy4 + y := 26 + drawop im8 im4 + i := imagefalse + v6 := 140 + v7 := 140 + v7 += v6 + if v7 == 24 then i := imageok + sprite x2 y 4 + + #test 8xy5 + x0 := 47 + x1 := 51 + x2 := 56 + y := 1 + drawop im8 im5 + i := imagefalse + v6 := 140 + v7 := 120 + v7 -= v6 + if v7 == 236 then i := imageok + sprite x2 y 4 + + #test "8xy6" + # Note by Timendus: This should be 8XYE, changed the label here too. + # See PR: https://github.com/corax89/chip8-test-rom/pull/7 + y := 6 + drawop im8 imE + i := imagefalse + v6 := 224 + v6 <<= v6 + if v6 == 192 then i := imageok + sprite x2 y 4 + + #test "8xyE" + # Note by Timendus: This should be 8XY6, changed the label here too. + # See PR: https://github.com/corax89/chip8-test-rom/pull/7 + y := 11 + drawop im8 im6 + i := imagefalse + v6 := 15 + v6 >>= v6 + if v6 == 7 then i := imageok + sprite x2 y 4 + + #test Fx55,Fx65 + y := 16 + drawop imF im5 + i := scratchpad + v0 := 0 + v1 := 48 + save v1 + i := scratchpad-plus-1 + load v0 + i := imagefalse + if v0 == 48 then i := imageok + sprite x2 y 4 + + #test Fx33 + y := 21 + drawop imF im3 + i := scratchpad + v6 := 137 + bcd v6 + load v2 + i := imageok + if v0 != 1 then i := imagefalse + if v1 != 3 then i := imagefalse + if v2 != 7 then i := imagefalse + sprite x2 y 4 + + #test 1x + y := 26 + drawop im1 imX + jump test1x # Image data is in text-rendering.8o, as part of the font @@ -462,177 +513,225 @@ flags-draw-opcode } -:macro expect REG VAL { - i := flag-err - if REG == VAL then i := flag-ok - y += 1 - sprite x y 3 +: flags-draw-opcode + i := im0 + vE := vD + vF := 0xF0 + vE &= vF + vE >>= vE + vE >>= vE + i += vE + sprite x y 4 + x += 4 + i := im0 + vE := vD + vF := 0x0F + vE &= vF + vE <<= vE + vE <<= vE + i += vE + sprite x y 4 + x += 5 + return + +:macro expect-v0 V0VAL { + x += 4 + v2 := v0 + vC := V0VAL + flags-draw-result + x += 9 } -:macro expect-val-flag VAL FLAG { +:macro expect-v2-vf-v3 V2VAL VFVAL V3VAL { vE := vF - vD := FLAG - vC := VAL - flags-draw-results + vC := V2VAL + flags-draw-result + v2 := vE + vC := VFVAL + flags-draw-result + v2 := v3 + vC := V3VAL + flags-draw-result + x += 1 } -: flags-test-after-keyrelease - waitKeyRelease +: flags-draw-result + i := flag-err + if v2 == vC then i := flag-ok + y += 1 + sprite x y 3 + x += 4 + y -= 1 + return + : flags-test - clear - - ## Without complications - - text 1 1 flags-no-carry - x := 23 - y := 1 - - v0 := 50 - v1 := 15 - - # OR - opcode 0x81 - v2 := v0 - v2 |= v1 # 63 (0x3F) - expect-val-flag 63 0 - - # AND - opcode 0x82 - v2 := v0 - v2 &= v1 # 2 (0x02) - expect-val-flag 2 0 - - # XOR - opcode 0x83 - v2 := v0 - v2 ^= v1 # 61 (0x3D) - expect-val-flag 61 0 - - # Addition (no overflow) - opcode 0x84 - v2 := v0 - v2 += v1 # 65 (0x41) - expect-val-flag 65 0 - - # Subtraction in one direction (no carry) - opcode 0x85 - v2 := v0 - v2 -= v1 # 35 (0x23) - expect-val-flag 35 1 - - # Shift right (no LSB) - opcode 0x86 - v2 := v0 - v2 >>= v2 # 25 (0x19) - expect-val-flag 25 0 - - # Subtraction in the other direction (no carry) - opcode 0x87 - v2 := v1 - v2 =- v0 # 35 (0x23) - expect-val-flag 35 1 - - # Shift left (no MSB) - opcode 0x8E - v2 := v0 - v2 <<= v2 # 100 (0x64) - expect-val-flag 100 0 - - - # With complications - - text 1 17 flags-carry - x := 23 - y := 17 - - v0 := 200 - v1 := 100 - - # Addition (with overflow) - opcode 0x84 - v2 := v0 - v2 += v1 # 300 (0x2C) - expect-val-flag 0x2C 1 - - # Subtraction in one direction (with carry) - opcode 0x85 - v2 := v1 - v2 -= v0 # 100 - 200 = -100 = 156 (0x9C) - expect-val-flag 0x9C 0 - - # Shift right (with LSB) - opcode 0x86 - v2 := 3 - v2 >>= v2 # 1 (0x1) - expect-val-flag 1 1 - - # Subtraction in the other direction (with carry) - opcode 0x87 - v2 := v0 - v2 =- v1 # 100 - 200 = -100 = 156 (0x9C) - expect-val-flag 0x9C 0 - - # Shift left (with MSB) - opcode 0x8E - v2 := v0 - v2 <<= v2 # 400 (0x90) - expect-val-flag 0x90 1 - - # Addition to i - - text 1 28 flags-other - x := 23 - y := 28 - - opcode 0xFE - i := scratchpad - v1 := 0x10 - i += v1 - v0 := 0xAA - save v0 - i := scratchpad-plus-16 - load v0 - expect v0 0xAA - - jump menu-after-keypress + clear -: flags-draw-opcode - i := im0 - vE := vD - vF := 0xF0 - vE &= vF - vE >>= vE - vE >>= vE - i += vE - sprite x y 4 - x += 4 - i := im0 - vE := vD - vF := 0x0F - vE &= vF - vE <<= vE - vE <<= vE - i += vE - sprite x y 4 - x += 6 - return - -: flags-draw-results - i := flag-err - if v2 == vC then i := flag-ok - y += 1 - sprite x y 3 - x += 5 - i := flag-err - if vE == vD then i := flag-ok - sprite x y 3 - x += 7 - y -= 1 - if x == 67 begin - y += 5 - x := 1 - end - return + ## Without complications + + text 0 0 flags-no-carry + x := 22 + y := 0 + + v0 := 50 + v1 := 15 + + # OR + opcode 0x81 + v3 := 15 + vF := 20 + v3 |= vF # 31 (0x1F) + vF := 0 + v2 := v0 + v2 |= v1 # 63 (0x3F) + expect-v2-vf-v3 63 0 31 + + # AND + opcode 0x82 + v3 := 15 + vF := 20 + v3 &= vF # 4 (0x04) + vF := 0 + v2 := v0 + v2 &= v1 # 2 (0x02) + expect-v2-vf-v3 2 0 4 + + y += 5 + x := 0 + + # XOR + opcode 0x83 + v3 := 15 + vF := 20 + v3 ^= vF # 27 (0x1B) + vF := 0 + v2 := v0 + v2 ^= v1 # 61 (0x3D) + expect-v2-vf-v3 61 0 27 + + # Addition (no overflow) + opcode 0x84 + v3 := 15 + vF := 20 + v3 += vF # 35 (0x23) + v2 := v0 + v2 += v1 # 65 (0x41) + expect-v2-vf-v3 65 0 35 + + # Subtraction in one direction (no carry) + opcode 0x85 + v3 := 20 + vF := 15 + v3 -= vF # 5 (0x05) + v2 := v0 + v2 -= v1 # 35 (0x23) + expect-v2-vf-v3 35 1 5 + + y += 5 + x := 0 + + # Shift right (no LSB) + opcode 0x86 + vF := v0 + vF >>= vF # 25 (0x19), but should be overwritten by flag, so 0 + v3 := vF + v2 := v0 + v2 >>= v2 # 25 (0x19) + expect-v2-vf-v3 25 0 0 + + # Subtraction in the other direction (no carry) + opcode 0x87 + v3 := 15 + vF := 20 + v3 =- vF # 5 (0x05) + v2 := v1 + v2 =- v0 # 35 (0x23) + expect-v2-vf-v3 35 1 5 + + # Shift left (no MSB) + opcode 0x8E + vF := v0 + vF <<= vF # 100 (0x64), but should be overwritten by flag, so 0 + v3 := vF + v2 := v0 + v2 <<= v2 # 100 (0x64) + expect-v2-vf-v3 100 0 0 + + + # With complications + + text 0 16 flags-carry + x := 22 + y := 16 + + v0 := 200 + v1 := 100 + + # Addition (with overflow) + opcode 0x84 + v3 := 200 + vF := 100 + v3 += vF # 300 (0x2C) + v2 := v0 + v2 += v1 # 300 (0x2C) + expect-v2-vf-v3 0x2C 1 0x2C + + # Subtraction in one direction (with carry) + opcode 0x85 + v3 := 15 + vF := 20 + v3 -= vF # -5 = 251 (0xFB) + v2 := v1 + v2 -= v0 # 100 - 200 = -100 = 156 (0x9C) + expect-v2-vf-v3 0x9C 0 0xFB + + y += 5 + x := 0 + + # Shift right (with LSB) + opcode 0x86 + vF := 7 + vF >>= vF # 3 (0x3), but should be overwritten by flag, so 1 + v3 := vF + v2 := 3 + v2 >>= v2 # 1 (0x1) + expect-v2-vf-v3 1 1 1 + + # Subtraction in the other direction (with carry) + opcode 0x87 + v3 := 20 + vF := 15 + v3 =- vF # -5 = 251 (0xFB) + v2 := v0 + v2 =- v1 # 100 - 200 = -100 = 156 (0x9C) + expect-v2-vf-v3 0x9C 0 0xFB + + # Shift left (with MSB) + opcode 0x8E + vF := v0 + vF <<= vF # 400 (0x90), but should be overwritten by flag, so 1 + v3 := vF + v2 := v0 + v2 <<= v2 # 400 (0x90) + expect-v2-vf-v3 0x90 1 1 + + # Addition to i + + text 0 27 flags-other + x := 22 + y := 27 + + opcode 0xFE + i := scratchpad + v1 := 0x10 + i += v1 + v0 := 0xAA + save v0 + i := scratchpad-plus-16 + load v0 + expect-v0 0xAA + + jump menu-after-keypress # Quirks test @@ -641,376 +740,403 @@ # (https://github.com/Timendus/silicon8/tree/main/tests) and some newly written # tests for specific quirks. -: quirks-test-after-keyrelease - waitKeyRelease : quirks-test - clear - i := 0x1FE - load v0 - if v0 == 1 then jump quirks-chip8 - if v0 == 2 then jump quirks-schip - if v0 == 3 then jump quirks-xochip - - text 6 3 quirks-choose - text 16 12 quirks-str-chip8 - text 16 17 quirks-str-schip - text 16 22 quirks-str-xochip - - v1 := 12 - v2 := 13 - v3 := 0 - i := menu-cursor - delay := v3 - loop - # Blink cursor - v0 := delay - if v0 == 0 begin - sprite v1 v2 2 - v0 := 10 - delay := v0 - v0 := 1 - v3 ^= v0 - end - - # Use numbers to start test - v0 := 1 if v0 key then jump quirks-chip8 - v0 := 2 if v0 key then jump quirks-schip - v0 := 3 if v0 key then jump quirks-xochip - - # Select test under cursor - v0 := 6 - if v0 key begin - if v2 == 13 then jump quirks-chip8 - if v2 == 18 then jump quirks-schip - if v2 == 23 then jump quirks-xochip - end - - # Move cursor - # Up - v0 := 5 - if v0 key begin - if v3 == 1 then sprite v1 v2 2 - if v2 > 13 then v2 -= 5 - if v3 == 1 then sprite v1 v2 2 - waitKeyRelease - end - # Down - v0 := 8 - if v0 key begin - if v3 == 1 then sprite v1 v2 2 - if v2 < 23 then v2 += 5 - if v3 == 1 then sprite v1 v2 2 - waitKeyRelease - end - again + clear + i := 0x1FE + load v0 + if v0 == 1 then jump quirks-chip8 + if v0 == 2 then jump quirks-schip + if v0 == 3 then jump quirks-xochip + + text 6 3 quirks-choose + text 16 12 quirks-str-chip8 + text 16 17 quirks-str-schip + text 16 22 quirks-str-xochip + + :unpack 0xA quirks-menu + v2 := 2 + jump menu-start : quirks-chip8 - i := scratchpad - v0 := 1 - save v0 - jump quirks-run-tests + i := scratchpad + v0 := 1 + save v0 + jump quirks-run-tests : quirks-schip - i := scratchpad - v0 := 2 - save v0 - jump quirks-run-tests + i := scratchpad + v0 := 2 + save v0 + jump quirks-run-tests : quirks-xochip - i := scratchpad - v0 := 3 - save v0 + i := scratchpad + v0 := 3 + save v0 : quirks-run-tests - waitKeyRelease - - # Determine frames per second - v0 := 120 - delay := v0 - i := quirks-values - load vA - i := quirks-image - loop - clear - sprite v0 v0 8 - sprite v1 v0 8 - sprite v2 v0 8 - sprite v3 v0 8 - sprite v4 v0 8 - sprite v5 v0 8 - sprite v6 v0 8 - sprite v7 v0 8 - sprite v0 v1 8 - sprite v1 v1 8 - sprite v2 v1 8 - sprite v3 v1 8 - sprite v4 v1 8 - sprite v5 v1 8 - sprite v6 v1 8 - sprite v7 v1 8 - sprite v0 v2 8 - sprite v1 v2 8 - sprite v2 v2 8 - sprite v3 v2 8 - sprite v4 v2 8 - sprite v5 v2 8 - sprite v6 v2 8 - sprite v7 v2 8 - sprite v0 v3 8 - sprite v1 v3 8 - sprite v2 v3 8 - sprite v3 v3 8 - sprite v4 v3 8 - sprite v5 v3 8 - sprite v6 v3 8 - sprite v7 v3 8 - v8 += vA - v9 += vF - vE := delay - if vE != 0 then again - - vE := 128 - v8 >>= v8 - v9 >>= v9 - if vF == 1 then v8 |= vE - - v0 := 1 - if v9 != 0 then v0 := 0 - if v8 != 2 then v0 := 0 - i := scratchpad-plus-1 - save v0 - - # Determine if sprites get clipped - clear - i := keypad-cursor - v0 := 28 - v1 := 29 - sprite v0 v1 6 - v0 := 22 - v1 := 2 - sprite v0 v1 1 - v5 := vF - v0 := 34 - sprite v0 v1 1 - v6 := vF - v0 := 0 - if v5 == 0 then v0 := 1 - if v5 != v6 then v0 := 2 - i := scratchpad-plus-2 - save v0 - - # Present results - - clear - - # vfQuirk - # When using &, | or ^, the flags register always gets reset to 0 - text 1 1 quirks-vf - v5 := 0 - vF := 15 - v0 &= v0 - if vF == 0 then v5 := 1 - v6 := 0 - vF := 15 - v0 |= v0 - if vF == 0 then v6 := 1 - v7 := 0 - vF := 15 - v0 ^= v0 - if vF == 0 then v7 := 1 - i := scratchpad - load v0 - i := flag-err - if v0 == 1 begin - # Selected CHIP-8 - if v5 == 1 then i := flag-ok - else - # Selected SCHIP or XO-CHIP - if v5 == 0 then i := flag-ok - end - x := 59 - y := 2 - sprite x y 3 - i := quirks-off - if v5 == 1 then i := quirks-on - if v5 != v6 then i := quirks-inconsistent - if v5 != v7 then i := quirks-inconsistent - vD := 44 - vE := 1 - drawText - - # memQuirk - # When reading or writing memory, i gets incremented - text 1 6 quirks-mem - v0 := 5 - i := scratchpad-plus-16 - save v0 - load v0 - v5 := v0 - i := scratchpad - load v0 - i := flag-err - if v0 == 2 begin - # Selected SCHIP - if v5 == 5 then i := flag-ok - else - # Selected CHIP-8 or XO-CHIP - if v5 != 5 then i := flag-ok - end - x := 59 - y := 7 - sprite x y 3 - i := quirks-on - if v5 == 5 then i := quirks-off - vD := 44 - vE := 6 - drawText - - # dispQuirk - # When drawing a sprite to the screen, the interpreter waits for v-blank - text 1 11 quirks-disp - i := scratchpad - load v1 - i := flag-err - if v0 == 1 begin - # Selected CHIP-8 - if v1 == 1 then i := flag-ok - else - # Selected SCHIP or XO-CHIP - if v1 == 0 then i := flag-ok - end - x := 59 - y := 12 - sprite x y 3 - i := quirks-off - if v1 == 1 then i := quirks-on - vD := 44 - vE := 11 - drawText - - # clipQuirk - # Sprites wrap to the top of the screen - text 1 16 quirks-clip - i := scratchpad - load v2 - i := flag-err - if v0 == 3 begin - # Selected XO-CHIP - if v2 == 0 then i := flag-ok - else - # Selected CHIP-8 or SCHIP - if v2 == 1 then i := flag-ok - end - x := 59 - y := 17 - sprite x y 3 - i := quirks-off - if v2 == 1 then i := quirks-on - if v2 == 2 then i := quirks-inconsistent - vD := 44 - vE := 16 - drawText - - # shiftQuirk - # When shifting a register, the interpreter always shifts register X into - # register X (instead of shifting register Y into register X) - text 1 21 quirks-shift - v5 := 0 - v6 := 8 - v7 := 0 - v8 := 32 - v5 <<= v6 - v7 >>= v8 - i := scratchpad - load v0 - i := flag-err - if v0 == 2 begin - # Selected SCHIP - if v5 == 0 then i := flag-ok - else - # Selected CHIP-8 or XO-CHIP - if v5 != 0 then i := flag-ok - end - x := 59 - y := 22 - sprite x y 3 - i := quirks-off - if v5 == 0 then i := quirks-on - if v5 != v7 then i := quirks-inconsistent - vD := 44 - vE := 21 - drawText - - # jumpQuirk - # When using `jump0` (BNNN) the interpreter doesn't jump to NNN + v0 but to - # NNN + vX where X is the highest nibble of NNN - text 1 26 quirks-jump - v0 := 0x10 - vE := 0x20 - jump0 0xE00 # This jumps to one of two routines defined in index.8o (for + waitKeyRelease + + # Determine frames per second + clear + v0 := 120 + delay := v0 + i := quirks-values + load v4 + i := quirks-image + loop + v5 := 32 + loop + sprite v0 v1 8 + v5 -= 1 + if v5 != 0 then again + v2 += v4 + v3 += vF + vE := delay + if vE != 0 then again + + vE := 128 + v2 >>= v2 + v3 >>= v3 + if vF == 1 then v2 |= vE + + v0 := 1 + if v3 != 0 then v0 := 0 + if v2 != 2 then v0 := 0 + i := scratchpad-plus-1 + save v0 + + # Determine if sprites get clipped vertically + clear + i := keypad-cursor + v0 := 28 + v1 := 29 + sprite v0 v1 6 + v0 := 22 + v1 := 2 + sprite v0 v1 2 + v5 := vF + v0 := 34 + sprite v0 v1 2 + v6 := vF + + # Determine if sprites get clipped horizontally + clear + i := keypad-cursor + v0 := 61 + v1 := 5 + sprite v0 v1 6 + v0 := 3 + v1 := 4 + sprite v0 v1 2 + v7 := vF + v1 := 10 + sprite v0 v1 2 + v8 := vF + + # Determine if sprites get wrapped (both directions) + clear + v0 := 110 + v1 := 50 + sprite v0 v1 6 # Should draw at 46,18 + v0 := 40 + v1 := 17 + sprite v0 v1 2 + v9 := vF + v0 := 52 + sprite v0 v1 2 + v9 += vF + v1 := 23 + sprite v0 v1 2 + v9 += vF + v0 := 40 + sprite v0 v1 2 + v9 += vF + + # Save result + v0 := 0 + # Clipping + if v5 == 0 then v0 := 1 + if v5 != v6 then v0 := 2 + if v5 != v7 then v0 := 2 + if v5 != v8 then v0 := 2 + # Wrapping + if v9 != 4 then v0 := 2 + i := scratchpad-plus-2 + save v0 + + # Present results + + clear + + # vfQuirk + # When using &, | or ^, the flags register always gets reset to 0 + text 1 1 quirks-vf + v5 := 0 + vF := 15 + v0 &= v0 + if vF == 0 then v5 := 1 + v6 := 0 + vF := 15 + v0 |= v0 + if vF == 0 then v6 := 1 + v7 := 0 + vF := 15 + v0 ^= v0 + if vF == 0 then v7 := 1 + i := scratchpad + load v0 + i := flag-err + if v0 == 1 begin + # Selected CHIP-8 + if v5 == 1 then i := flag-ok + else + # Selected SCHIP or XO-CHIP + if v5 == 0 then i := flag-ok + end + x := 59 + y := 2 + sprite x y 3 + i := quirks-off + if v5 == 1 then i := quirks-on + if v5 != v6 then i := quirks-inconsistent + if v5 != v7 then i := quirks-inconsistent + vD := 44 + vE := 1 + drawText + + # memQuirk + # When reading or writing memory, i gets incremented + text 1 6 quirks-mem + v0 := 5 + i := scratchpad-plus-16 + save v0 + load v0 + v5 := v0 + i := scratchpad + load v0 + i := flag-err + if v0 == 2 begin + # Selected SCHIP + if v5 == 5 then i := flag-ok + else + # Selected CHIP-8 or XO-CHIP + if v5 != 5 then i := flag-ok + end + x := 59 + y := 7 + sprite x y 3 + i := quirks-on + if v5 == 5 then i := quirks-off + vD := 44 + vE := 6 + drawText + + # dispQuirk + # When drawing a sprite to the screen, the interpreter waits for v-blank + text 1 11 quirks-disp + i := scratchpad + load v1 + i := flag-err + if v0 == 1 begin + # Selected CHIP-8 + if v1 == 1 then i := flag-ok + else + # Selected SCHIP or XO-CHIP + if v1 == 0 then i := flag-ok + end + x := 59 + y := 12 + sprite x y 3 + i := quirks-off + if v1 == 1 then i := quirks-on + vD := 44 + vE := 11 + drawText + + # clipQuirk + # Sprites wrap to the top of the screen + text 1 16 quirks-clip + i := scratchpad + load v2 + i := flag-err + if v0 == 3 begin + # Selected XO-CHIP + if v2 == 0 then i := flag-ok + else + # Selected CHIP-8 or SCHIP + if v2 == 1 then i := flag-ok + end + x := 59 + y := 17 + sprite x y 3 + i := quirks-off + if v2 == 1 then i := quirks-on + if v2 == 2 then i := quirks-inconsistent + vD := 44 + vE := 16 + drawText + + # shiftQuirk + # When shifting a register, the interpreter always shifts register X into + # register X (instead of shifting register Y into register X) + text 1 21 quirks-shift + v5 := 0 + v6 := 8 + v7 := 0 + v8 := 32 + v5 <<= v6 + v7 >>= v8 + i := scratchpad + load v0 + i := flag-err + if v0 == 2 begin + # Selected SCHIP + if v5 == 0 then i := flag-ok + else + # Selected CHIP-8 or XO-CHIP + if v5 != 0 then i := flag-ok + end + x := 59 + y := 22 + sprite x y 3 + i := quirks-off + if v5 == 0 then i := quirks-on + if v5 != v7 then i := quirks-inconsistent + vD := 44 + vE := 21 + drawText + + # jumpQuirk + # When using `jump0` (BNNN) the interpreter doesn't jump to NNN + v0 but to + # NNN + vX where X is the highest nibble of NNN + text 1 26 quirks-jump + v0 := 0x87 + vE := 0x8B + jump0 0xE00 # This jumps to one of two routines defined in index.8o (for : quirks-resume # reasons of having to put them in precisely the right spot) - i := scratchpad - load v0 - i := flag-err - if v0 == 2 begin - # Selected SCHIP - if v5 != 0 then i := flag-ok - else - # Selected CHIP-8 or XO-CHIP - if v5 == 0 then i := flag-ok - end - x := 59 - y := 27 - sprite x y 3 - i := quirks-off - if v5 == 1 then i := quirks-on - vD := 44 - vE := 26 - drawText - - jump menu-after-keypress + i := scratchpad + load v0 + i := flag-err + if v0 == 2 begin + # Selected SCHIP + if v5 != 0 then i := flag-ok + else + # Selected CHIP-8 or XO-CHIP + if v5 == 0 then i := flag-ok + end + x := 59 + y := 27 + sprite x y 3 + i := quirks-off + if v5 == 1 then i := quirks-on + vD := 44 + vE := 26 + drawText + + jump menu-after-keypress # Keypad test # A fresh new implementation for this test suite : keypad-test - clear - i := keypad-initial-values - load vF - i := scratchpad - save vF - text 18 3 keypad-row1 - text 18 10 keypad-row2 - text 18 17 keypad-row3 - text 18 24 keypad-row4 - vE := 0 - loop - keypad-pressed - vE += 1 - if vE == 16 then vE := 0 - again + clear + i := 0x1FE + load v0 + if v0 == 1 then jump keypad-down + if v0 == 2 then jump keypad-up + if v0 == 3 then jump keypad-getkey + + text 10 3 keypad-choose + text 8 12 keypad-str-key-down + text 8 17 keypad-str-key-up + text 8 22 keypad-str-getkey + + :unpack 0xA keypad-menu + v2 := 2 + jump menu-start + +: keypad-down + v1 := 0x9E + jump keypad-skip-if-key-test +: keypad-up + v1 := 0xA1 +: keypad-skip-if-key-test + v0 := 0xEE + i := keypad-opcode + save v1 + clear + i := keypad-initial-values + load vF + i := scratchpad + save vF + text 18 3 keypad-row1 + text 18 10 keypad-row2 + text 18 17 keypad-row3 + text 18 24 keypad-row4 + vE := 0 + loop + keypad-pressed + vE += 1 + if vE == 16 then vE := 0 + again : keypad-pressed - i := scratchpad - i += vE - load v0 - v2 := 0 - if vE key then v2 := 1 - if v0 != v2 begin - v0 := vE - v0 <<= v0 - i := keypad-coordinates - i += v0 - load v1 - i := keypad-cursor - sprite v0 v1 6 - i := scratchpad - i += vE - v0 := v2 - save v0 - end - return + i := scratchpad + i += vE + load v0 + v2 := 1 +: keypad-opcode + if vE key then v2 := 0 + if v0 != v2 begin + v0 := vE + v0 <<= v0 + i := keypad-coordinates + i += v0 + load v1 + i := keypad-cursor + sprite v0 v1 6 + i := scratchpad + i += vE + v0 := v2 + save v0 + end + return + +: keypad-getkey + clear + text 6 13 keypad-str-press-key + v0 := 3 + delay := v0 + v0 := key + v1 := delay + if v1 != 0 then jump keypad-getkey-no-halt + if v0 key then jump keypad-getkey-no-release-wait + clear + i := flag-ok + v0 := 30 + v1 := 9 + sprite v0 v1 3 + text 16 17 keypad-str-good + jump menu-after-keypress + +: keypad-getkey-no-halt + vD := 10 + i := keypad-str-no-halt + jump keypad-getkey-error +: keypad-getkey-no-release-wait + vD := 8 + i := keypad-str-no-release-wait +: keypad-getkey-error + clear + vE := 17 + drawText + i := flag-err + v0 := 30 + v1 := 9 + sprite v0 v1 3 + jump menu-after-keypress @@ -1036,209 +1162,215 @@ : logo-part10 0xce 0xfc 0xf8 0xc0 0xc0 0xca 0xca 0xc4 0x00 0x00 0x30 0x44 0x24 0x14 0x63 : logo-part11 - 0xf1 0x03 0x07 0x47 0xc7 0x47 0x43 0xe1 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6 + 0xf1 0x03 0x07 0xc7 0x27 0x47 0x83 0xe1 0x00 0x00 0x28 0x8e 0xa8 0xa8 0xa6 : logo-part12 0xce 0x87 0x03 0x03 0x03 0x87 0xfe 0xfc 0x00 0x00 0x60 0x90 0xf0 0x80 0x70 : scratchpad - 0 + 0 : scratchpad-plus-1 - 0 + 0 : scratchpad-plus-2 - 0 0 0 0 0 - 0 0 0 0 0 - 0 0 0 0 + 0 0 0 0 0 + 0 0 0 0 0 + 0 0 0 0 : scratchpad-plus-16 0 +: menu-main + 10 8 :pointer ibm-logo + 10 13 :pointer corax89 + 10 18 :pointer flags-test + 10 23 :pointer quirks-test + 10 28 :pointer keypad-test + : menu-header - str "PICK A TEST" 0 + str "PICK A TEST" 0 : menu-ibm - str "1 IBM LOGO" 0 + str "1 IBM LOGO" 0 : menu-corax - str "2 CORAX89" 0 + str "2 CORAX89" 0 : menu-flags - str "3 FLAGS" 0 + str "3 FLAGS" 0 : menu-quirks - str "4 QUIRKS" 0 + str "4 QUIRKS" 0 : menu-keypad - str "5 KEYPAD" 0 + str "5 KEYPAD" 0 : menu-cursor - 0b11000000 - 0b11000000 + 0b11000000 + 0b11000000 # Positive and negative images : imageok - 0xEA 0xAC 0xAA 0xEA + 0xEA 0xAC 0xAA 0xEA : imagefalse - 0xCE 0xAA 0xAA 0xAE + 0xCE 0xAA 0xAA 0xAE : flag-ok - 0b10100000 - 0b11000000 - 0b10000000 + 0b10100000 + 0b11000000 +: characters + 0b10000000 : flag-err - 0b10100000 - 0b01000000 - 0b10100000 + 0b10100000 + 0b01000000 + 0b10100000 # Individual characters, some taken from Corax89' test. -: characters - 0 0 0 0 : im0 - 0xE0 0xA0 0xA0 0xE0 + 0xE0 0xA0 0xA0 0xE0 : im1 - 0xC0 0x40 0x40 0xE0 + 0xC0 0x40 0x40 0xE0 : im2 - 0xE0 0x20 0xC0 0xE0 + 0xE0 0x20 0xC0 0xE0 : im3 - 0xE0 0x60 0x20 0xE0 + 0xE0 0x60 0x20 0xE0 : im4 - 0xA0 0xE0 0x20 0x20 + 0xA0 0xE0 0x20 0x20 : im5 - 0b11100000 - 0b11000000 - 0b00100000 - 0b11000000 + 0b11100000 + 0b11000000 + 0b00100000 + 0b11000000 : im6 - 0xE0 0x80 0xE0 0xE0 + 0xE0 0x80 0xE0 0xE0 : im7 - 0xE0 0x20 0x20 0x20 + 0xE0 0x20 0x20 0x20 : im8 - 0xE0 0xE0 0xA0 0xE0 + 0xE0 0xE0 0xA0 0xE0 : im9 - 0xE0 0xE0 0x20 0xE0 + 0xE0 0xE0 0x20 0xE0 : imA - 0x40 0xA0 0xE0 0xA0 + 0x40 0xA0 0xE0 0xA0 : imB - 0b11000000 - 0b11100000 - 0b10100000 - 0b11100000 + 0b11000000 + 0b11100000 + 0b10100000 + 0b11100000 : imC - 0b11100000 - 0b10000000 - 0b10000000 - 0b11100000 + 0b11100000 + 0b10000000 + 0b10000000 + 0b11100000 : imD - 0b11000000 - 0b10100000 - 0b10100000 - 0b11000000 + 0b11000000 + 0b10100000 + 0b10100000 + 0b11000000 : imE - 0xE0 0xC0 0x80 0xE0 + 0xE0 0xC0 0x80 0xE0 : imF - 0xE0 0x80 0xC0 0x80 + 0xE0 0x80 0xC0 0x80 : imG - 0b01100000 - 0b10000000 - 0b10100000 - 0b01100000 + 0b01100000 + 0b10000000 + 0b10100000 + 0b01100000 : imH - 0b10100000 - 0b11100000 - 0b10100000 - 0b10100000 + 0b10100000 + 0b11100000 + 0b10100000 + 0b10100000 : imI - 0b11100000 - 0b01000000 - 0b01000000 - 0b11100000 + 0b11100000 + 0b01000000 + 0b01000000 + 0b11100000 : imJ - 0b01100000 - 0b00100000 - 0b00100000 - 0b11000000 + 0b01100000 + 0b00100000 + 0b00100000 + 0b11000000 : imK - 0b10100000 - 0b11000000 - 0b10100000 - 0b10100000 + 0b10100000 + 0b11000000 + 0b10100000 + 0b10100000 : imL - 0b10000000 - 0b10000000 - 0b10000000 - 0b11100000 + 0b10000000 + 0b10000000 + 0b10000000 + 0b11100000 : imM - 0b11100000 - 0b11100000 - 0b10100000 - 0b10100000 + 0b11100000 + 0b11100000 + 0b10100000 + 0b10100000 : imN - 0b11000000 - 0b10100000 - 0b10100000 - 0b10100000 + 0b11000000 + 0b10100000 + 0b10100000 + 0b10100000 : imO - 0b11100000 - 0b10100000 - 0b10100000 - 0b11100000 + 0b11100000 + 0b10100000 + 0b10100000 + 0b11100000 : imP - 0b11000000 - 0b10100000 - 0b11000000 - 0b10000000 + 0b11000000 + 0b10100000 + 0b11000000 + 0b10000000 : imQ - 0b01000000 - 0b10100000 - 0b11100000 - 0b01100000 + 0b01000000 + 0b10100000 + 0b11100000 + 0b01100000 : imR - 0b11000000 - 0b10100000 - 0b11000000 - 0b10100000 + 0b11000000 + 0b10100000 + 0b11000000 + 0b10100000 : imS - 0b01100000 - 0b11000000 - 0b00100000 - 0b11000000 + 0b01100000 + 0b11000000 + 0b00100000 + 0b11000000 : imT - 0b11100000 - 0b01000000 - 0b01000000 - 0b01000000 + 0b11100000 + 0b01000000 + 0b01000000 + 0b01000000 : imU - 0b10100000 - 0b10100000 - 0b10100000 - 0b01100000 + 0b10100000 + 0b10100000 + 0b10100000 + 0b01100000 : imV - 0b10100000 - 0b10100000 - 0b10100000 - 0b01000000 + 0b10100000 + 0b10100000 + 0b10100000 + 0b01000000 : imW - 0b10100000 - 0b10100000 - 0b11100000 - 0b11100000 + 0b10100000 + 0b10100000 + 0b11100000 + 0b11100000 : imX - 0xA0 0x40 0xA0 0xA0 + 0xA0 0x40 0xA0 0xA0 : imY - 0b10100000 - 0b10100000 - 0b01000000 - 0b01000000 + 0b10100000 + 0b10100000 + 0b01000000 + 0b01000000 : imZ - 0b11100000 - 0b01100000 - 0b10000000 - 0b11100000 + 0b11100000 + 0b01100000 + 0b10000000 + 0b11100000 : imSpace - 0 0 0 0 + 0 0 0 0 : imDash - 0b00000000 - 0b11100000 - 0b00000000 - 0b00000000 + 0b00000000 + 0b11100000 + 0b00000000 + 0b00000000 : imPeriod - 0b00000000 - 0b00000000 - 0b00000000 - 0b01000000 + 0b00000000 + 0b00000000 + 0b00000000 + 0b01000000 : ibm-logo-part1 0xFF 0x00 0xFF 0x00 0x3C 0x00 0x3C 0x00 0x3C 0x00 0x3C 0x00 0xFF 0x00 0xFF @@ -1254,91 +1386,119 @@ 0xE0 0x00 0xE0 0x00 0x80 0x00 0x80 0x00 0x80 0x00 0x80 0x00 0xE0 0x00 0xE0 : flags-no-carry - str "NO C." 0 + str "HAPPY" 0 : flags-carry - str "CARRY" 0 + str "CARRY" 0 : flags-other - str "OTHER" 0 + str "OTHER" 0 + +: quirks-menu + 12 13 :pointer quirks-chip8 + 12 18 :pointer quirks-schip + 12 23 :pointer quirks-xochip : quirks-choose - str "PICK PLATFORM" 0 + str "PICK PLATFORM" 0 : quirks-str-chip8 - str "1 CHIP-8" 0 + str "1 CHIP-8" 0 : quirks-str-schip - str "2 SCHIP" 0 + str "2 SCHIP" 0 : quirks-str-xochip - str "3 XO-CHIP" 0 + str "3 XO-CHIP" 0 : quirks-vf - str "VF RESET" 0 + str "VF RESET" 0 : quirks-mem - str "MEMORY" 0 + str "MEMORY" 0 : quirks-disp - str "DISP.WAIT" 0 + str "DISP.WAIT" 0 : quirks-clip - str "CLIPPING" 0 + str "CLIPPING" 0 : quirks-shift - str "SHIFTING" 0 + str "SHIFTING" 0 : quirks-jump - str "JUMPING" 0 + str "JUMPING" 0 : quirks-on - str "ON" 0 + str "ON" 0 : quirks-off - str "OFF" 0 + str "OFF" 0 : quirks-inconsistent - str "ERR" 0 + str "ERR" 0 : quirks-values - 0 8 16 24 32 40 48 56 0 0 1 + 28 12 0 0 1 : quirks-image - 0x3C 0x7E 0xFF 0xDB 0xFF 0xDB 0x66 0x3C + 0x3C 0x7E 0xFF 0xDB 0xFF 0xDB 0x66 0x3C + +: keypad-menu + 4 13 :pointer keypad-down + 4 18 :pointer keypad-up + 4 23 :pointer keypad-getkey + +: keypad-choose + str "PICK OPCODE" 0 +: keypad-str-key-down + str "1 EX9E DOWN" 0 +: keypad-str-key-up + str "2 EXA1 UP" 0 +: keypad-str-getkey + str "3 FX0A GETKEY" 0 + +: keypad-str-press-key + str "PRESS ANY KEY" 0 +: keypad-str-good + str "ALL GOOD" 0 +: keypad-str-no-halt + str "NOT HALTING" 0 +: keypad-str-no-release-wait + str "NOT RELEASED" 0 : keypad-initial-values - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 : keypad-row1 - str "1 2 3 C" 0 + str "1 2 3 C" 0 : keypad-row2 - str "4 5 6 D" 0 + str "4 5 6 D" 0 : keypad-row3 - str "7 8 9 E" 0 + str "7 8 9 E" 0 : keypad-row4 - str "A 0 B F" 0 + str "A 0 B F" 0 : keypad-coordinates - 24 23 # 0 - 16 2 # 1 - 24 2 # 2 - 32 2 # 3 - 16 9 # 4 - 24 9 # 5 - 32 9 # 6 - 16 16 # 7 - 24 16 # 8 - 32 16 # 9 - 16 23 # A - 32 23 # B - 40 2 # C - 40 9 # D - 40 16 # E - 40 23 # F + 24 23 # 0 + 16 2 # 1 + 24 2 # 2 + 32 2 # 3 + 16 9 # 4 + 24 9 # 5 + 32 9 # 6 + 16 16 # 7 + 24 16 # 8 + 32 16 # 9 + 16 23 # A + 32 23 # B + 40 2 # C + 40 9 # D + 40 16 # E + 40 23 # F : keypad-cursor - 0b11111110 - 0b11111110 - 0b11111110 - 0b11111110 - 0b11111110 - 0b11111110 + 0b11111110 + 0b11111110 + 0b11111110 + 0b11111110 + 0b11111110 + 0b11111110 # Jump quirk targets: -:org 0xE10 - # We jump here when using v0 in the `jump0` quirks test - v5 := 0 - jump quirks-resume -:org 0xE20 - # We jump here when using vE in the `jump0` quirks test - v5 := 1 - jump quirks-resume \ No newline at end of file +:org 0xE87 + # We jump here when using v0 in the `jump0` quirks test + v5 := 0 + jump quirks-resume +:org 0xE8B + # We jump here when using vE in the `jump0` quirks test + v5 := 1 + jump quirks-resume \ No newline at end of file diff --git a/bin/chip8-test-suite.ch8 b/bin/chip8-test-suite.ch8 index 5c918a2..67cff63 100644 Binary files a/bin/chip8-test-suite.ch8 and b/bin/chip8-test-suite.ch8 differ diff --git a/docs/index.html b/docs/index.html index 76c8e74..f0e1a5d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ - +