================================================================================
                 'JUMPING JACK' (ZX SPECTRUM) - DISASSEMBLY
                  Chris Ward, 2012 (cjw116@googlemail.com)
                  Original game (c) 1983 Imagine Software
================================================================================

This is file 3 of 4:

     1) JJLoader.txt       Commented RAM disassembly of loader program with all
                           addresses & object code

     2) JJLoader.asm       Address-independent assembler source file of above -
                           can be reassembled at any address

    *3) JJGame.txt         Commented RAM disassembly of game with all addresses
                           & object code. Also a list of useful POKES.

     4) JJGame.asm         Address-independent assembler source file of above -
                           can be reassembled at any address


NB: All mistakes are mine. Please forgive the amount of comments and the way
the files are formatted. I've never disassembled anything before and this
worked for me! Hope it is of interest to someone.

The .asm files have been tested with Pasmo (http://pasmo.speccy.org/) and
they produce exact binary matches of the original.

Enjoy!

================================================================================

POKES

Infinite Lives                     30094,182
Immune to Hazards                  30633,201
Jump through lines                 29901,38
Never fall through gaps            30146,167
Complete current level             28205,1

Change Left/Right to O/P           30370,223
Change Jump to SPACE               30356,127

================================================================================

The game (data and code) consists of 8818 bytes which is loaded at 5d8eh. This
fills the memory right up to 7fffh (the upper limit on a 16K Spectrum).

The code entry point is at 6f42h.

Definitions for comments:

Jline     One of the 8 red lines that Jack has to jump through. Each Jline
          is two pixels thick and spans the width of the screen.
          The Jlines are numbered 0-7 where 0 is the top and 7 the bottom.

InfoLine  The 32 cells in screen line 22 - which include the 'lives
          remaining' symbols and the High Score.

Disassembly follows:

================================================================================


; GFX DATA
;
; The following 4232 bytes define all the GFX bitmap data for the game. There
; are 13 different animation sequences for Jack, 10 animations for the different
; Hazards and 1 Lives Remaining Symbol.

GFXJStil:      ; Jack standing still GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
5d8e 01        db      00000001b
5d8f 03        db      00000011b
5d90 04        db      00000100b
5d91 07        db      00000111b
5d92 05        db      00000101b
5d93 04        db      00000100b
5d94 03        db      00000011b
5d95 01        db      00000001b

; Frame 1/4 - Cell (0,1)
5d96 c0        db      11000000b
5d97 e0        db      11100000b
5d98 90        db      10010000b
5d99 70        db      01110000b
5d9a d0        db      11010000b
5d9b 10        db      00010000b
5d9c e0        db      11100000b
5d9d c0        db      11000000b

; Frame 1/4 - Cell (1,0)
5d9e 03        db      00000011b
5d9f 04        db      00000100b
5da0 09        db      00001001b
5da1 11        db      00010001b
5da2 02        db      00000010b
5da3 02        db      00000010b
5da4 04        db      00000100b
5da5 0c        db      00001100b

; Frame 1/4 - Cell (1,1)
5da6 e0        db      11100000b
5da7 90        db      10010000b
5da8 48        db      01001000b
5da9 44        db      01000100b
5daa 20        db      00100000b
5dab 20        db      00100000b
5dac 10        db      00010000b
5dad 18        db      00011000b

; Frame 2/4 - Cell (0,0)
5dae 01        db      00000001b
5daf 03        db      00000011b
5db0 04        db      00000100b
5db1 0f        db      00001111b
5db2 1f        db      00011111b
5db3 04        db      00000100b
5db4 03        db      00000011b
5db5 01        db      00000001b

; Frame 2/4 - Cell (0,1)
5db6 c0        db      11000000b
5db7 e0        db      11100000b
5db8 f0        db      11110000b
5db9 f0        db      11110000b
5dba 30        db      00110000b
5dbb 70        db      01110000b
5dbc e0        db      11100000b
5dbd c0        db      11000000b

; Frame 2/4 - Cell (1,0)
5dbe 03        db      00000011b
5dbf 04        db      00000100b
5dc0 09        db      00001001b
5dc1 11        db      00010001b
5dc2 02        db      00000010b
5dc3 02        db      00000010b
5dc4 04        db      00000100b
5dc5 0c        db      00001100b

; Frame 2/4 - Cell (1,1)
5dc6 e0        db      11100000b
5dc7 90        db      10010000b
5dc8 50        db      01010000b
5dc9 48        db      01001000b
5dca 20        db      00100000b
5dcb 20        db      00100000b
5dcc 10        db      00010000b
5dcd 30        db      00110000b

; Frame 3/4 - Cell (0,0)
5dce 01        db      00000001b
5dcf 03        db      00000011b
5dd0 04        db      00000100b
5dd1 07        db      00000111b
5dd2 05        db      00000101b
5dd3 04        db      00000100b
5dd4 03        db      00000011b
5dd5 01        db      00000001b

; Frame 3/4 - Cell (0,1)
5dd6 c0        db      11000000b
5dd7 e0        db      11100000b
5dd8 90        db      10010000b
5dd9 70        db      01110000b
5dda d0        db      11010000b
5ddb 10        db      00010000b
5ddc e0        db      11100000b
5ddd c0        db      11000000b

; Frame 3/4 - Cell (1,0)
5dde 03        db      00000011b
5ddf 04        db      00000100b
5de0 09        db      00001001b
5de1 11        db      00010001b
5de2 02        db      00000010b
5de3 02        db      00000010b
5de4 04        db      00000100b
5de5 0c        db      00001100b

; Frame 3/4 - Cell (1,1)
5de6 e0        db      11100000b
5de7 90        db      10010000b
5de8 48        db      01001000b
5de9 44        db      01000100b
5dea 20        db      00100000b
5deb 20        db      00100000b
5dec 10        db      00010000b
5ded 18        db      00011000b

; Frame 4/4 - Cell (0,0)
5dee 01        db      00000001b
5def 03        db      00000011b
5df0 07        db      00000111b
5df1 07        db      00000111b
5df2 06        db      00000110b
5df3 07        db      00000111b
5df4 03        db      00000011b
5df5 01        db      00000001b

; Frame 4/4 - Cell (0,1)
5df6 c0        db      11000000b
5df7 e0        db      11100000b
5df8 90        db      10010000b
5df9 f8        db      11111000b
5dfa 7c        db      01111100b
5dfb 10        db      00010000b
5dfc e0        db      11100000b
5dfd c0        db      11000000b

; Frame 4/4 - Cell (1,0)
5dfe 03        db      00000011b
5dff 04        db      00000100b
5e00 05        db      00000101b
5e01 09        db      00001001b
5e02 02        db      00000010b
5e03 02        db      00000010b
5e04 04        db      00000100b
5e05 06        db      00000110b

; Frame 4/4 - Cell (1,1)
5e06 e0        db      11100000b
5e07 90        db      10010000b
5e08 48        db      01001000b
5e09 44        db      01000100b
5e0a 20        db      00100000b
5e0b 20        db      00100000b
5e0c 10        db      00010000b
5e0d 18        db      00011000b


GFXJLeft:      ; Jack running left GFX data
               ; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
5e0e 00        db      00000000b
5e0f 00        db      00000000b
5e10 00        db      00000000b
5e11 00        db      00000000b
5e12 00        db      00000000b
5e13 00        db      00000000b
5e14 00        db      00000000b
5e15 00        db      00000000b

; Frame 1/4 - Cell (0,1)
5e16 01        db      00000001b
5e17 03        db      00000011b
5e18 04        db      00000100b
5e19 0f        db      00001111b
5e1a 1f        db      00011111b
5e1b 04        db      00000100b
5e1c 03        db      00000011b
5e1d 01        db      00000001b

; Frame 1/4 - Cell (0,2)
5e1e c0        db      11000000b
5e1f e0        db      11100000b
5e20 f0        db      11110000b
5e21 f0        db      11110000b
5e22 30        db      00110000b
5e23 70        db      01110000b
5e24 e0        db      11100000b
5e25 c0        db      11000000b

; Frame 1/4 - Cell (1,0)
5e26 00        db      00000000b
5e27 00        db      00000000b
5e28 00        db      00000000b
5e29 00        db      00000000b
5e2a 00        db      00000000b
5e2b 00        db      00000000b
5e2c 00        db      00000000b
5e2d 00        db      00000000b

; Frame 1/4 - Cell (1,1)
5e2e 23        db      00100011b
5e2f 14        db      00010100b
5e30 09        db      00001001b
5e31 02        db      00000010b
5e32 04        db      00000100b
5e33 08        db      00001000b
5e34 10        db      00010000b
5e35 30        db      00110000b

; Frame 1/4 - Cell (1,2)
5e36 f8        db      11111000b
5e37 84        db      10000100b
5e38 44        db      01000100b
5e39 40        db      01000000b
5e3a 20        db      00100000b
5e3b 3c        db      00111100b
5e3c 04        db      00000100b
5e3d 00        db      00000000b

; Frame 2/4 - Cell (0,0)
5e3e 00        db      00000000b
5e3f 00        db      00000000b
5e40 00        db      00000000b
5e41 00        db      00000000b
5e42 00        db      00000000b
5e43 00        db      00000000b
5e44 00        db      00000000b
5e45 00        db      00000000b

; Frame 2/4 - Cell (0,1)
5e46 07        db      00000111b
5e47 0f        db      00001111b
5e48 13        db      00010011b
5e49 3f        db      00111111b
5e4a 7c        db      01111100b
5e4b 11        db      00010001b
5e4c 0f        db      00001111b
5e4d 27        db      00100111b

; Frame 2/4 - Cell (0,2)
5e4e 00        db      00000000b
5e4f 80        db      10000000b
5e50 c0        db      11000000b
5e51 c0        db      11000000b
5e52 c0        db      11000000b
5e53 c0        db      11000000b
5e54 80        db      10000000b
5e55 00        db      00000000b

; Frame 2/4 - Cell (1,0)
5e56 00        db      00000000b
5e57 00        db      00000000b
5e58 00        db      00000000b
5e59 00        db      00000000b
5e5a 00        db      00000000b
5e5b 00        db      00000000b
5e5c 00        db      00000000b
5e5d 00        db      00000000b

; Frame 2/4 - Cell (1,1)
5e5e 17        db      00010111b
5e5f 0e        db      00001110b
5e60 04        db      00000100b
5e61 05        db      00000101b
5e62 08        db      00001000b
5e63 0f        db      00001111b
5e64 10        db      00010000b
5e65 30        db      00110000b

; Frame 2/4 - Cell (1,2)
5e66 00        db      00000000b
5e67 80        db      10000000b
5e68 40        db      01000000b
5e69 80        db      10000000b
5e6a 00        db      00000000b
5e6b 80        db      10000000b
5e6c 80        db      10000000b
5e6d 00        db      00000000b

; Frame 3/4 - Cell (0,0)
5e6e 00        db      00000000b
5e6f 00        db      00000000b
5e70 00        db      00000000b
5e71 00        db      00000000b
5e72 01        db      00000001b
5e73 00        db      00000000b
5e74 00        db      00000000b
5e75 00        db      00000000b

; Frame 3/4 - Cell (0,1)
5e76 1c        db      00011100b
5e77 3e        db      00111110b
5e78 4f        db      01001111b
5e79 ff        db      11111111b
5e7a f3        db      11110011b
5e7b 47        db      01000111b
5e7c 3e        db      00111110b
5e7d 9c        db      10011100b

; Frame 3/4 - Cell (0,2)
5e7e 00        db      00000000b
5e7f 00        db      00000000b
5e80 00        db      00000000b
5e81 00        db      00000000b
5e82 00        db      00000000b
5e83 00        db      00000000b
5e84 00        db      00000000b
5e85 00        db      00000000b

; Frame 3/4 - Cell (1,0)
5e86 00        db      00000000b
5e87 00        db      00000000b
5e88 00        db      00000000b
5e89 00        db      00000000b
5e8a 00        db      00000000b
5e8b 00        db      00000000b
5e8c 00        db      00000000b
5e8d 00        db      00000000b

; Frame 3/4 - Cell (1,1)
5e8e 5e        db      01011110b
5e8f 3f        db      00111111b
5e90 18        db      00011000b
5e91 28        db      00101000b
5e92 48        db      01001000b
5e93 7e        db      01111110b
5e94 0a        db      00001010b
5e95 18        db      00011000b

; Frame 3/4 - Cell (1,2)
5e96 00        db      00000000b
5e97 00        db      00000000b
5e98 00        db      00000000b
5e99 00        db      00000000b
5e9a 00        db      00000000b
5e9b 00        db      00000000b
5e9c 00        db      00000000b
5e9d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
5e9e 00        db      00000000b
5e9f 00        db      00000000b
5ea0 01        db      00000001b
5ea1 03        db      00000011b
5ea2 07        db      00000111b
5ea3 01        db      00000001b
5ea4 00        db      00000000b
5ea5 02        db      00000010b

; Frame 4/4 - Cell (0,1)
5ea6 70        db      01110000b
5ea7 f8        db      11111000b
5ea8 3c        db      00111100b
5ea9 fc        db      11111100b
5eaa cc        db      11001100b
5eab 1c        db      00011100b
5eac f8        db      11111000b
5ead 70        db      01110000b

; Frame 4/4 - Cell (0,2)
5eae 00        db      00000000b
5eaf 00        db      00000000b
5eb0 00        db      00000000b
5eb1 00        db      00000000b
5eb2 00        db      00000000b
5eb3 00        db      00000000b
5eb4 00        db      00000000b
5eb5 00        db      00000000b

; Frame 4/4 - Cell (1,0)
5eb6 01        db      00000001b
5eb7 01        db      00000001b
5eb8 02        db      00000010b
5eb9 02        db      00000010b
5eba 06        db      00000110b
5ebb 00        db      00000000b
5ebc 00        db      00000000b
5ebd 00        db      00000000b

; Frame 4/4 - Cell (1,1)
5ebe 70        db      01110000b
5ebf f8        db      11111000b
5ec0 1c        db      00011100b
5ec1 10        db      00010000b
5ec2 08        db      00001000b
5ec3 08        db      00001000b
5ec4 04        db      00000100b
5ec5 0c        db      00001100b

; Frame 4/4 - Cell (1,2)
5ec6 00        db      00000000b
5ec7 00        db      00000000b
5ec8 00        db      00000000b
5ec9 00        db      00000000b
5eca 00        db      00000000b
5ecb 00        db      00000000b
5ecc 00        db      00000000b
5ecd 00        db      00000000b


GFXJRgt:       ; Jack running right GFX data
               ; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
5ece 01        db      00000001b
5ecf 03        db      00000011b
5ed0 07        db      00000111b
5ed1 07        db      00000111b
5ed2 06        db      00000110b
5ed3 07        db      00000111b
5ed4 03        db      00000011b
5ed5 01        db      00000001b

; Frame 1/4 - Cell (0,1)
5ed6 c0        db      11000000b
5ed7 e0        db      11100000b
5ed8 90        db      10010000b
5ed9 f8        db      11111000b
5eda 7c        db      01111100b
5edb 10        db      00010000b
5edc e0        db      11100000b
5edd c0        db      11000000b

; Frame 1/4 - Cell (0,2)
5ede 00        db      00000000b
5edf 00        db      00000000b
5ee0 00        db      00000000b
5ee1 00        db      00000000b
5ee2 00        db      00000000b
5ee3 00        db      00000000b
5ee4 00        db      00000000b
5ee5 00        db      00000000b

; Frame 1/4 - Cell (1,0)
5ee6 0f        db      00001111b
5ee7 10        db      00010000b
5ee8 11        db      00010001b
5ee9 01        db      00000001b
5eea 02        db      00000010b
5eeb 1e        db      00011110b
5eec 10        db      00010000b
5eed 00        db      00000000b

; Frame 1/4 - Cell (1,1)
5eee e2        db      11100010b
5eef 94        db      10010100b
5ef0 48        db      01001000b
5ef1 20        db      00100000b
fef2 10        db      00010000b
5ef3 08        db      00001000b
5ef4 04        db      00000100b
5ef5 06        db      00000110b

; Frame 1/4 - Cell (1,2)
5ef6 00        db      00000000b
5ef7 00        db      00000000b
5ef8 00        db      00000000b
5ef9 00        db      00000000b
5efa 00        db      00000000b
5efb 00        db      00000000b
5efc 00        db      00000000b
5efd 00        db      00000000b

; Frame 2/4 - Cell (0,0)
5efe 00        db      00000000b
5eff 00        db      00000000b
5f00 01        db      00000001b
5f01 01        db      00000001b
5f02 01        db      00000001b
5f03 01        db      00000001b
5f04 00        db      00000000b
5f05 00        db      00000000b

; Frame 2/4 - Cell (0,1)
5f06 70        db      01110000b
5f07 f8        db      11111000b
5f08 e4        db      11100100b
5f09 fe        db      11111110b
5f0a 9f        db      10011111b
5f0b c4        db      11000100b
5f0c f8        db      11111000b
5f0d 72        db      01110010b

; Frame 2/4 - Cell (0,2)
5f0e 00        db      00000000b
5f0f 00        db      00000000b
5f10 00        db      00000000b
5f11 00        db      00000000b
5f12 00        db      00000000b
5f13 00        db      00000000b
5f14 00        db      00000000b
5f15 00        db      00000000b

; Frame 2/4 - Cell (1,0)
5f16 00        db      00000000b
5f17 00        db      00000000b
5f18 01        db      00000001b
5f19 00        db      00000000b
5f1a 00        db      00000000b
5f1b 00        db      00000000b
5f1c 00        db      00000000b
5f1d 00        db      00000000b

; Frame 2/4 - Cell (1,1)
5f1e 74        db      01110100b
5f1f b8        db      10111000b
5f20 10        db      00010000b
5f21 d0        db      11010000b
5f22 08        db      00001000b
5f23 f8        db      11111000b
5f24 84        db      10000100b
5f25 06        db      00000110b

; Frame 2/4 - Cell (1,2)
5f26 00        db      00000000b
5f27 00        db      00000000b
5f28 00        db      00000000b
5f29 00        db      00000000b
5f2a 00        db      00000000b
5f2b 00        db      00000000b
5f2c 00        db      00000000b
5f2d 00        db      00000000b

; Frame 3/4 - Cell (0,0)
5f2e 00        db      00000000b
5f2f 00        db      00000000b
5f30 00        db      00000000b
5f31 00        db      00000000b
5f32 00        db      00000000b
5f33 00        db      00000000b
5f34 00        db      00000000b
5f35 00        db      00000000b

; Frame 3/4 - Cell (0,1)
5f36 1c        db      00011100b
5f37 3e        db      00111110b
5f38 79        db      01111001b
5f39 7f        db      01111111b
5f3a 67        db      01100111b
5f3b 71        db      01110001b
5f3c 3e        db      00111110b
5f3d 1c        db      00011100b

; Frame 3/4 - Cell (0,2)
5f3e 00        db      00000000b
5f3f 00        db      00000000b
5f40 00        db      00000000b
5f41 80        db      10000000b
5f42 c0        db      11000000b
5f43 00        db      00000000b
5f44 00        db      00000000b
5f45 80        db      10000000b

; Frame 3/4 - Cell (1,0)
5f46 00        db      00000000b
5f47 00        db      00000000b
5f48 00        db      00000000b
5f49 00        db      00000000b
5f4a 00        db      00000000b
5f4b 00        db      00000000b
5f4c 00        db      00000000b
5f4d 00        db      00000000b

; Frame 3/4 - Cell (1,1)
5f4e 3d        db      00111101b
5f4f 7e        db      01111110b
5f50 0c        db      00001100b
5f51 0a        db      00001010b
5f52 09        db      00001001b
5f53 3f        db      00111111b
5f54 28        db      00101000b
5f55 0c        db      00001100b

; Frame 3/4 - Cell (1,2)
5f56 00        db      00000000b
5f57 00        db      00000000b
5f58 00        db      00000000b
5f59 00        db      00000000b
5f5a 00        db      00000000b
5f5b 00        db      00000000b
5f5c 00        db      00000000b
5f5d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
5f5e 00        db      00000000b
5f5f 00        db      00000000b
5f60 00        db      00000000b
5f61 00        db      00000000b
5f62 00        db      00000000b
5f63 00        db      00000000b
5f64 00        db      00000000b
5f65 00        db      00000000b

; Frame 4/4 - Cell (0,1)
5f66 07        db      00000111b
5f67 0f        db      00001111b
5f68 1e        db      00011110b
5f69 1f        db      00011111b
5f6a 19        db      00011001b
5f6b 1c        db      00011100b
5f6c 0f        db      00001111b
5f6d 07        db      00000111b

; Frame 4/4 - Cell (0,2)
5f6e 00        db      00000000b
5f6f 80        db      10000000b
5f70 40        db      01000000b
5f71 e0        db      11100000b
5f72 f0        db      11110000b
5f73 40        db      01000000b
5f74 80        db      10000000b
5f75 20        db      00100000b

; Frame 4/4 - Cell (1,0)
5f76 00        db      00000000b
5f77 00        db      00000000b
5f78 00        db      00000000b
5f79 00        db      00000000b
5f7a 00        db      00000000b
5f7b 00        db      00000000b
5f7c 00        db      00000000b
5f7d 00        db      00000000b

; Frame 4/4 - Cell (1,1)
5f7e 07        db      00000111b
5f7f 0f        db      00001111b
5f80 1c        db      00011100b
5f81 04        db      00000100b
5f82 08        db      00001000b
5f83 08        db      00001000b
5f84 10        db      00010000b
5f85 18        db      00011000b

; Frame 4/4 - Cell (1,2)
5f86 40        db      01000000b
5f87 c0        db      11000000b
5f88 20        db      00100000b
5f89 20        db      00100000b
5f8a 30        db      00110000b
5f8b 00        db      00000000b
5f8c 00        db      00000000b
5f8d 00        db      00000000b


GFXJLEOf:      ; Jack running off left edge GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
5f8e 01        db      00000001b
5f8f 03        db      00000011b
5f90 04        db      00000100b
5f91 0f        db      00001111b
5f92 1f        db      00011111b
5f93 04        db      00000100b
5f94 03        db      00000011b
5f95 01        db      00000001b

; Frame 1/4 - Cell (0,1)
5f96 c0        db      11000000b
5f97 e0        db      11100000b
5f98 f0        db      11110000b
5f99 f0        db      11110000b
5f9a 30        db      00110000b
5f9b 70        db      01110000b
5f9c e0        db      11100000b
5f9d c0        db      11000000b

; Frame 1/4 - Cell (1,0)
5f9e 23        db      00100011b
5f9f 14        db      00010100b
5fa0 09        db      00001001b
5fa1 02        db      00000010b
5fa2 04        db      00000100b
5fa3 08        db      00001000b
5fa4 10        db      00010000b
5fa5 30        db      00110000b

; Frame 1/4 - Cell (1,1)
5fa6 f8        db      11111000b
5fa7 84        db      10000100b
5fa8 44        db      01000100b
5fa9 40        db      01000000b
5faa 20        db      00100000b
5fab 3c        db      00111100b
5fac 04        db      00000100b
5fad 00        db      00000000b

; Frame 2/4 - Cell (0,0)
5fae 1c        db      00011100b
5faf 3e        db      00111110b
5fb0 4f        db      01001111b
5fb1 ff        db      11111111b
5fb2 f3        db      11110011b
5fb3 47        db      01000111b
5fb4 3e        db      00111110b
5fb5 1c        db      00011100b

; Frame 2/4 - Cell (0,1)
5fb6 00        db      00000000b
5fb7 00        db      00000000b
5fb8 00        db      00000000b
5fb9 00        db      00000000b
5fba 00        db      00000000b
5fbb 00        db      00000000b
5fbc 00        db      00000000b
5fbd 00        db      00000000b

; Frame 2/4 - Cell (1,0)
5fbe 1e        db      00011110b
5fbf 1f        db      00011111b
5fc0 18        db      00011000b
5fc1 28        db      00101000b
5fc2 48        db      01001000b
5fc3 7e        db      01111110b
5fc4 0a        db      00001010b
5fc5 18        db      00011000b

; Frame 2/4 - Cell (1,1)
5fc6 00        db      00000000b
5fc7 00        db      00000000b
5fc8 00        db      00000000b
5fc9 00        db      00000000b
5fca 00        db      00000000b
5fcb 00        db      00000000b
5fcc 00        db      00000000b
5fcd 00        db      00000000b

; Frame 3/4 - Cell (0,0)
5fce c0        db      11000000b
5fcf e0        db      11100000b
5fd0 f0        db      11110000b
5fd1 f0        db      11110000b
5fd2 30        db      00110000b
5fd3 70        db      01110000b
5fd4 e0        db      11100000b
5fd5 c0        db      11000000b

; Frame 3/4 - Cell (0,1)
5fd6 00        db      00000000b
5fd7 00        db      00000000b
5fd8 00        db      00000000b
5fd9 00        db      00000000b
5fda 00        db      00000000b
5fdb 00        db      00000000b
5fdc 00        db      00000000b
5fdd 00        db      00000000b

; Frame 3/4 - Cell (1,0)
5fde f8        db      11111000b
5fdf 84        db      10000100b
5fe0 44        db      01000100b
5fe1 40        db      01000000b
5fe2 20        db      00100000b
5fe3 3c        db      00111100b
5fe4 04        db      00000100b
5fe5 00        db      00000000b

; Frame 3/4 - Cell (1,1)
5fe6 00        db      00000000b
5fe7 00        db      00000000b
5fe8 00        db      00000000b
5fe9 00        db      00000000b
5fea 00        db      00000000b
5feb 00        db      00000000b
5fec 00        db      00000000b
5fed 00        db      00000000b

; Frame 4/4 - Cell (0,0)
5fee 00        db      00000000b
5fef 00        db      00000000b
5ff0 00        db      00000000b
5ff1 00        db      00000000b
5ff2 00        db      00000000b
5ff3 00        db      00000000b
5ff4 00        db      00000000b
5ff5 00        db      00000000b

; Frame 4/4 - Cell (0,1)
5ff6 00        db      00000000b
5ff7 00        db      00000000b
5ff8 00        db      00000000b
5ff9 00        db      00000000b
5ffa 00        db      00000000b
5ffb 00        db      00000000b
5ffc 00        db      00000000b
5ffd 00        db      00000000b

; Frame 4/4 - Cell (1,0)
5ffe 00        db      00000000b
5fff 00        db      00000000b
6000 00        db      00000000b
6001 00        db      00000000b
6002 00        db      00000000b
6003 00        db      00000000b
6004 00        db      00000000b
6005 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6006 00        db      00000000b
6007 00        db      00000000b
6008 00        db      00000000b
6009 00        db      00000000b
600a 00        db      00000000b
600b 00        db      00000000b
600c 00        db      00000000b
600d 00        db      00000000b


GFXJREOn:      ; Jack running in from right edge GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
600e 00        db      00000000b
600f 00        db      00000000b
6010 00        db      00000000b
6011 00        db      00000000b
6012 00        db      00000000b
6013 00        db      00000000b
6014 00        db      00000000b
6015 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6016 00        db      00000000b
6017 00        db      00000000b
6018 00        db      00000000b
6019 00        db      00000000b
601a 00        db      00000000b
601b 00        db      00000000b
601c 00        db      00000000b
601d 00        db      00000000b

; Frame 1/4 - Cell (1,0)
601e 00        db      00000000b
601f 00        db      00000000b
6020 00        db      00000000b
6021 00        db      00000000b
6022 00        db      00000000b
6023 00        db      00000000b
6024 00        db      00000000b
6025 00        db      00000000b

; Frame 1/4 - Cell (1,1)
6026 00        db      00000000b
6027 00        db      00000000b
6028 00        db      00000000b
6029 00        db      00000000b
602a 00        db      00000000b
602b 00        db      00000000b
602c 00        db      00000000b
602d 00        db      00000000b

; Frame 2/4 - Cell (0,0)
602e 00        db      00000000b
602f 00        db      00000000b
6030 00        db      00000000b
6031 00        db      00000000b
6032 00        db      00000000b
6033 00        db      00000000b
6034 00        db      00000000b
6035 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6036 00        db      00000000b
6037 00        db      00000000b
6038 00        db      00000000b
6039 00        db      00000000b
603a 01        db      00000001b
603b 00        db      00000000b
603c 00        db      00000000b
603d 00        db      00000000b

; Frame 2/4 - Cell (1,0)
603e 00        db      00000000b
603f 00        db      00000000b
6040 00        db      00000000b
6041 00        db      00000000b
6042 00        db      00000000b
6043 00        db      00000000b
6044 00        db      00000000b
6045 00        db      00000000b

; Frame 2/4 - Cell (1,1)
6046 00        db      00000000b
6047 00        db      00000000b
6048 00        db      00000000b
6049 00        db      00000000b
604a 00        db      00000000b
604b 00        db      00000000b
604c 00        db      00000000b
604d 00        db      00000000b

; Frame 3/4 - Cell (0,0)
604e 00        db      00000000b
604f 00        db      00000000b
6050 00        db      00000000b
6051 00        db      00000000b
6052 00        db      00000000b
6053 00        db      00000000b
6054 00        db      00000000b
6055 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6056 01        db      00000001b
6057 03        db      00000011b
6058 04        db      00000100b
6059 0f        db      00001111b
605a 1f        db      00011111b
605b 04        db      00000100b
605c 03        db      00000011b
605d 01        db      00000001b

; Frame 3/4 - Cell (1,0)
605e 00        db      00000000b
605f 00        db      00000000b
6060 00        db      00000000b
6061 00        db      00000000b
6062 00        db      00000000b
6063 00        db      00000000b
6064 00        db      00000000b
6065 00        db      00000000b

; Frame 3/4 - Cell (1,1)
6066 23        db      00100011b
6067 14        db      00010100b
6068 09        db      00001001b
6069 02        db      00000010b
606a 04        db      00000100b
606b 08        db      00001000b
606c 10        db      00010000b
606d 30        db      00110000b

; Frame 4/4 - Cell (0,0)
606e 00        db      00000000b
606f 00        db      00000000b
6070 00        db      00000000b
6071 00        db      00000000b
6072 01        db      00000001b
6073 00        db      00000000b
6074 00        db      00000000b
6075 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6076 1c        db      00011100b
6077 3e        db      00111110b
6078 4f        db      01001111b
6079 ff        db      11111111b
607a f3        db      11110011b
607b 47        db      01000111b
607c 3e        db      00111110b
607d 1c        db      00011100b

; Frame 4/4 - Cell (1,0)
607e 00        db      00000000b
607f 00        db      00000000b
6080 00        db      00000000b
6081 00        db      00000000b
6082 00        db      00000000b
6083 00        db      00000000b
6084 00        db      00000000b
6085 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6086 1e        db      00011110b
6087 1f        db      00011111b
6088 18        db      00011000b
6089 28        db      00101000b
608a 48        db      01001000b
608b 7e        db      01111110b
608c 0a        db      00001010b
608d 18        db      00011000b


GFXJLEOn:      ; Jack running in from left edge GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
608e 00        db      00000000b
608f 00        db      00000000b
6090 00        db      00000000b
6091 00        db      00000000b
6092 00        db      00000000b
6093 00        db      00000000b
6094 00        db      00000000b
6095 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6096 00        db      00000000b
6097 00        db      00000000b
6098 00        db      00000000b
6099 00        db      00000000b
609a 00        db      00000000b
609b 00        db      00000000b
609c 00        db      00000000b
609d 00        db      00000000b

; Frame 1/4 - Cell (1,0)
609e 00        db      00000000b
609f 00        db      00000000b
60a0 00        db      00000000b
60a1 00        db      00000000b
60a2 00        db      00000000b
60a3 00        db      00000000b
60a4 00        db      00000000b
60a5 00        db      00000000b

; Frame 1/4 - Cell (1,1)
60a6 00        db      00000000b
60a7 00        db      00000000b
60a8 00        db      00000000b
60a9 00        db      00000000b
60aa 00        db      00000000b
60ab 00        db      00000000b
60ac 00        db      00000000b
60ad 00        db      00000000b

; Frame 2/4 - Cell (0,0)
60ae 00        db      00000000b
60af 00        db      00000000b
60b0 00        db      00000000b
60b1 80        db      10000000b
60b2 c0        db      11000000b
60b3 00        db      00000000b
60b4 00        db      00000000b
60b5 80        db      10000000b

; Frame 2/4 - Cell (0,1)
60b6 00        db      00000000b
60b7 00        db      00000000b
60b8 00        db      00000000b
60b9 00        db      00000000b
60ba 00        db      00000000b
60bb 00        db      00000000b
60bc 00        db      00000000b
60bd 00        db      00000000b

; Frame 2/4 - Cell (1,0)
60be 00        db      00000000b
60bf 00        db      00000000b
60c0 00        db      00000000b
60c1 00        db      00000000b
60c2 00        db      00000000b
60c3 00        db      00000000b
60c4 00        db      00000000b
60c5 00        db      00000000b

; Frame 2/4 - Cell (1,1)
60c6 00        db      00000000b
60c7 00        db      00000000b
60c8 00        db      00000000b
60c9 00        db      00000000b
60ca 00        db      00000000b
60cb 00        db      00000000b
60cc 00        db      00000000b
60cd 00        db      00000000b

; Frame 3/4 - Cell (0,0)
60ce c0        db      11000000b
60cf e0        db      11100000b
60d0 90        db      10010000b
60d1 f8        db      11111000b
60d2 7c        db      01111100b
60d3 10        db      00010000b
60d4 e0        db      11100000b
60d5 c0        db      11000000b

; Frame 3/4 - Cell (0,1)
60d6 00        db      00000000b
60d7 00        db      00000000b
60d8 00        db      00000000b
60d9 00        db      00000000b
60da 00        db      00000000b
60db 00        db      00000000b
60dc 00        db      00000000b
60dd 00        db      00000000b

; Frame 3/4 - Cell (1,0)
60de e2        db      11100010b
60df 94        db      10010100b
60e0 48        db      01001000b
60e1 20        db      00100000b
60e2 10        db      00010000b
60e3 08        db      00001000b
60e4 04        db      00000100b
60e5 06        db      00000110b

; Frame 3/4 - Cell (1,1)
60e6 00        db      00000000b
60e7 00        db      00000000b
60e8 00        db      00000000b
60e9 00        db      00000000b
60ea 00        db      00000000b
60eb 00        db      00000000b
60ec 00        db      00000000b
60ed 00        db      00000000b

; Frame 4/4 - Cell (0,0)
60ee 0e        db      00001110b
60ef 1f        db      00011111b
60f0 3c        db      00111100b
60f1 3f        db      00111111b
60f2 33        db      00110011b
60f3 38        db      00111000b
60f4 1f        db      00011111b
60f5 0e        db      00001110b

; Frame 4/4 - Cell (0,1)
60f6 00        db      00000000b
60f7 00        db      00000000b
60f8 80        db      10000000b
60f9 c0        db      11000000b
60fa e0        db      11100000b
60fb 80        db      10000000b
60fc 00        db      00000000b
60fd 40        db      01000000b

; Frame 4/4 - Cell (1,0)
60fe 1e        db      00011110b
60ff 3f        db      00111111b
6100 06        db      00000110b
6101 05        db      00000101b
6102 04        db      00000100b
6103 1f        db      00011111b
6104 14        db      00010100b
6105 06        db      00000110b

; Frame 4/4 - Cell (1,1)
6106 80        db      10000000b
6107 00        db      00000000b
6108 00        db      00000000b
6109 00        db      00000000b
610a 80        db      10000000b
610b 80        db      10000000b
610c 00        db      00000000b
610d 00        db      00000000b


GFXJREOf:      ; Jack running off right edge GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
610e 01        db      00000001b
610f 03        db      00000011b
6110 07        db      00000111b
6111 07        db      00000111b
6112 06        db      00000110b
6113 07        db      00000111b
6114 03        db      00000011b
6115 01        db      00000001b

; Frame 1/4 - Cell (0,1)
6116 c0        db      11000000b
6117 e0        db      11100000b
6118 90        db      10010000b
6119 f8        db      11111000b
611a 7c        db      01111100b
611b 10        db      00010000b
611c e0        db      11100000b
611d c0        db      11000000b

; Frame 1/4 - Cell (1,0)
611e 0f        db      00001111b
611f 10        db      00010000b
6120 11        db      00010001b
6121 01        db      00000001b
6122 02        db      00000010b
6123 1e        db      00011110b
6124 10        db      00010000b
6125 00        db      00000000b

; Frame 1/4 - Cell (1,1)
6126 e2        db      11100010b
6127 94        db      10010100b
6128 48        db      01001000b
6129 20        db      00100000b
612a 10        db      00010000b
612b 08        db      00001000b
612c 04        db      00000100b
612d 06        db      00000110b

; Frame 2/4 - Cell (0,0)
612e 00        db      00000000b
612f 00        db      00000000b
6130 00        db      00000000b
6131 00        db      00000000b
6132 00        db      00000000b
6133 00        db      00000000b
6134 00        db      00000000b
6135 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6136 1c        db      00011100b
6137 3e        db      00111110b
6138 79        db      01111001b
6139 7f        db      01111111b
613a 67        db      01100111b
613b 71        db      01110001b
613c 3e        db      00111110b
613d 1c        db      00011100b

; Frame 2/4 - Cell (1,0)
613e 00        db      00000000b
613f 00        db      00000000b
6140 00        db      00000000b
6141 00        db      00000000b
6142 00        db      00000000b
6143 00        db      00000000b
6144 00        db      00000000b
6145 00        db      00000000b

; Frame 2/4 - Cell (1,1)
6146 3d        db      00111101b
6147 7e        db      01111110b
6148 0c        db      00001100b
6149 0a        db      00001010b
614a 09        db      00001001b
614b 3f        db      00111111b
614c 28        db      00101000b
614d 0c        db      00001100b

; Frame 3/4 - Cell (0,0)
614e 00        db      00000000b
614f 00        db      00000000b
6150 00        db      00000000b
6151 00        db      00000000b
6152 00        db      00000000b
6153 00        db      00000000b
6154 00        db      00000000b
6155 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6156 01        db      00000001b
6157 03        db      00000011b
6158 07        db      00000111b
6159 07        db      00000111b
615a 06        db      00000110b
615b 07        db      00000111b
615c 03        db      00000011b
615d 01        db      00000001b

; Frame 3/4 - Cell (1,0)
615e 00        db      00000000b
615f 00        db      00000000b
6160 00        db      00000000b
6161 00        db      00000000b
6162 00        db      00000000b
6163 00        db      00000000b
6164 00        db      00000000b
6165 00        db      00000000b

; Frame 3/4 - Cell (1,1)
6166 0f        db      00001111b
6167 10        db      00010000b
6168 11        db      00010001b
6169 01        db      00000001b
616a 02        db      00000010b
616b 1e        db      00011110b
616c 10        db      00010000b
616d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
616e 00        db      00000000b
616f 00        db      00000000b
6170 00        db      00000000b
6171 00        db      00000000b
6172 00        db      00000000b
6173 00        db      00000000b
6174 00        db      00000000b
6175 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6176 00        db      00000000b
6177 00        db      00000000b
6178 00        db      00000000b
6179 00        db      00000000b
617a 00        db      00000000b
617b 00        db      00000000b
617c 00        db      00000000b
617d 00        db      00000000b

; Frame 4/4 - Cell (1,0)
617e 00        db      00000000b
617f 00        db      00000000b
6180 00        db      00000000b
6181 00        db      00000000b
6182 00        db      00000000b
6183 00        db      00000000b
6184 00        db      00000000b
6185 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6186 00        db      00000000b
6187 00        db      00000000b
6188 00        db      00000000b
6189 00        db      00000000b
618a 00        db      00000000b
618b 00        db      00000000b
618c 00        db      00000000b
618d 00        db      00000000b


GFXJGJp1:      ; Jack Good Jump Part 1 GFX data
               ; 3x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
618e 00        db      00000000b
618f 00        db      00000000b
6190 00        db      00000000b
6191 00        db      00000000b
6192 00        db      00000000b
6193 00        db      00000000b
6194 00        db      00000000b
6195 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6196 00        db      00000000b
6197 00        db      00000000b
6198 00        db      00000000b
6199 00        db      00000000b
619a 00        db      00000000b
619b 00        db      00000000b
619c 00        db      00000000b
619d 00        db      00000000b

; Frame 1/4 - Cell (1,0)
619e 00        db      00000000b
619f 00        db      00000000b
61a0 00        db      00000000b
61a1 01        db      00000001b
61a2 03        db      00000011b
61a3 04        db      00000100b
61a4 07        db      00000111b
61a5 05        db      00000101b

; Frame 1/4 - Cell (1,1)
61a6 00        db      00000000b
61a7 00        db      00000000b
61a8 00        db      00000000b
61a9 c0        db      11000000b
61aa e0        db      11100000b
61ab 90        db      10010000b
61ac 70        db      01110000b
61ad d0        db      11010000b

; Frame 1/4 - Cell (2,0)
61ae 04        db      00000100b
61af 03        db      00000011b
61b0 09        db      00001001b
61b1 05        db      00000101b
61b2 03        db      00000011b
61b3 04        db      00000100b
61b4 08        db      00001000b
61b5 18        db      00011000b

; Frame 1/4 - Cell (2,1)
61b6 10        db      00010000b
61b7 e0        db      11100000b
61b8 c8        db      11001000b
61b9 d0        db      11010000b
61ba e0        db      11100000b
61bb 10        db      00010000b
61bc 08        db      00001000b
61bd 0c        db      00001100b

; Frame 2/4 - Cell (0,0)
61be 00        db      00000000b
61bf 00        db      00000000b
61c0 00        db      00000000b
61c1 00        db      00000000b
61c2 00        db      00000000b
61c3 00        db      00000000b
61c4 00        db      00000000b
61c5 00        db      00000000b

; Frame 2/4 - Cell (0,1)
61c6 00        db      00000000b
61c7 00        db      00000000b
61c8 00        db      00000000b
61c9 00        db      00000000b
61ca 00        db      00000000b
61cb 00        db      00000000b
61cc 00        db      00000000b
61cd 00        db      00000000b

; Frame 2/4 - Cell (1,0)
61ce 01        db      00000001b
61cf 03        db      00000011b
61d0 04        db      00000100b
61d1 07        db      00000111b
61d2 05        db      00000101b
61d3 04        db      00000100b
61d4 03        db      00000011b
61d5 01        db      00000001b

; Frame 2/4 - Cell (1,1)
61d6 c0        db      11000000b
61d7 e0        db      11100000b
61d8 90        db      10010000b
61d9 70        db      01110000b
61da d0        db      11010000b
61db 10        db      00010000b
61de e0        db      11100000b
61dd c0        db      11000000b

; Frame 2/4 - Cell (2,0)
61de 03        db      00000011b
61df 04        db      00000100b
61e0 09        db      00001001b
61e1 11        db      00010001b
61e2 02        db      00000010b
61e3 02        db      00000010b
61e4 04        db      00000100b
61e5 0c        db      00001100b

; Frame 2/4 - Cell (2,1)
61e6 e0        db      11100000b
61e7 90        db      10010000b
61e8 48        db      01001000b
61e9 44        db      01000100b
61ea 20        db      00100000b
61eb 20        db      00100000b
61ec 10        db      00010000b
61ed 18        db      00011000b

; Frame 3/4 - Cell (0,0)
61ee 00        db      00000000b
61ef 00        db      00000000b
61f0 00        db      00000000b
61f1 00        db      00000000b
61f2 01        db      00000001b
61f3 03        db      00000011b
61f4 04        db      00000100b
61f5 07        db      00000111b

; Frame 3/4 - Cell (0,1)
61f6 00        db      00000000b
61f7 00        db      00000000b
61f8 00        db      00000000b
61f9 00        db      00000000b
61fa c0        db      11000000b
61fb e0        db      11100000b
61fc 90        db      10010000b
61fd 70        db      01110000b

; Frame 3/4 - Cell (1,0)
61fe 05        db      00000101b
61ff 04        db      00000100b
6200 03        db      00000011b
6201 01        db      00000001b
6202 03        db      00000011b
6203 04        db      00000100b
6204 09        db      00001001b
6205 11        db      00010001b

; Frame 3/4 - Cell (1,1)
6206 d0        db      11010000b
6207 10        db      00010000b
6208 e0        db      11100000b
6209 c0        db      11000000b
620a e0        db      11100000b
620b 90        db      10010000b
620c 48        db      01001000b
620d 44        db      01000100b

; Frame 3/4 - Cell (2,0)
620e 01        db      00000001b
620f 02        db      00000010b
6210 02        db      00000010b
6211 06        db      00000110b
6212 00        db      00000000b
6213 00        db      00000000b
6214 00        db      00000000b
6215 00        db      00000000b

; Frame 3/4 - Cell (2,1)
6216 40        db      01000000b
6217 20        db      00100000b
6218 20        db      00100000b
6219 30        db      00110000b
621a 00        db      00000000b
621b 00        db      00000000b
621c 00        db      00000000b
621d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
621e 01        db      00000001b
621f 03        db      00000011b
6220 04        db      00000100b
6221 07        db      00000111b
6222 05        db      00000101b
6223 04        db      00000100b
6224 03        db      00000011b
6225 01        db      00000001b

; Frame 4/4 - Cell (0,1)
6226 c0        db      11000000b
6227 e0        db      11100000b
6228 90        db      10010000b
6229 70        db      01110000b
622a d0        db      11010000b
622b 10        db      00010000b
622c e0        db      11100000b
622d c0        db      11000000b

; Frame 4/4 - Cell (1,0)
622e 03        db      00000011b
622f 04        db      00000100b
6230 09        db      00001001b
6231 11        db      00010001b
6232 02        db      00000010b
6233 02        db      00000010b
6234 04        db      00000100b
6235 0c        db      00001100b

; Frame 4/4 - Cell (1,1)
6236 e0        db      11100000b
6237 90        db      10010000b
6238 48        db      01001000b
6239 44        db      01000100b
623a 20        db      00100000b
623b 20        db      00100000b
623c 10        db      00010000b
623d 18        db      00011000b

; Frame 4/4 - Cell (2,0)
623e 00        db      00000000b
623f 00        db      00000000b
6240 00        db      00000000b
6241 00        db      00000000b
6242 00        db      00000000b
6243 00        db      00000000b
6244 00        db      00000000b
6245 00        db      00000000b

; Frame 4/4 - Cell (2,1)
6246 00        db      00000000b
6247 00        db      00000000b
6248 00        db      00000000b
6249 00        db      00000000b
624a 00        db      00000000b
624b 00        db      00000000b
624c 00        db      00000000b
624d 00        db      00000000b


GFXJGJp2:      ; Jack Good Jump Part 2 GFX data
               ; 4x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
624e 00        db      00000000b
624f 00        db      00000000b
6250 00        db      00000000b
6251 00        db      00000000b
6252 00        db      00000000b
6253 00        db      00000000b
6254 00        db      00000000b
6255 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6256 00        db      00000000b
6257 00        db      00000000b
6258 00        db      00000000b
6259 00        db      00000000b
625a 00        db      00000000b
625b 00        db      00000000b
625c 00        db      00000000b
625d 00        db      00000000b

; Frame 1/4 - Cell (1,0)
625e 00        db      00000000b
625f 00        db      00000000b
6260 00        db      00000000b
6261 00        db      00000000b
6262 01        db      00000001b
6263 03        db      00000011b
6264 04        db      00000100b
6265 07        db      00000111b

; Frame 1/4 - Cell (1,1)
6266 00        db      00000000b
6267 00        db      00000000b
6268 00        db      00000000b
6269 00        db      00000000b
626a c0        db      11000000b
626b e0        db      11100000b
626c 90        db      10010000b
626d 70        db      01110000b

; Frame 1/4 - Cell (2,0)
626e 05        db      00000101b
626f 04        db      00000100b
6270 03        db      00000011b
6271 01        db      00000001b
6272 03        db      00000011b
6273 04        db      00000100b
6274 05        db      00000101b
6275 05        db      00000101b

; Frame 1/4 - Cell (2,1)
6276 d0        db      11010000b
6277 10        db      00010000b
6278 e0        db      11100000b
6279 c0        db      11000000b
627a e0        db      11100000b
627b 90        db      10010000b
627c 50        db      01010000b
627d 50        db      01010000b

; Frame 1/4 - Cell (3,0)
627e 05        db      00000101b
627f 01        db      00000001b
6280 01        db      00000001b
6281 01        db      00000001b
6282 02        db      00000010b
6283 00        db      00000000b
6284 00        db      00000000b
6285 00        db      00000000b

; Frame 1/4 - Cell (3,1)
6286 50        db      01010000b
6287 40        db      01000000b
6288 40        db      01000000b
6289 40        db      01000000b
628a 20        db      00100000b
628b 00        db      00000000b
628c 00        db      00000000b
628d 00        db      00000000b

; Frame 2/4 - Cell (0,0)
628e 00        db      00000000b
628f 00        db      00000000b
6290 00        db      00000000b
6291 00        db      00000000b
6292 00        db      00000000b
6293 00        db      00000000b
6294 00        db      00000000b
6295 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6296 00        db      00000000b
6297 00        db      00000000b
6298 00        db      00000000b
6299 00        db      00000000b
629a 00        db      00000000b
629b 00        db      00000000b
629c 00        db      00000000b
629d 00        db      00000000b

; Frame 2/4 - Cell (1,0)
629e 01        db      00000001b
629f 03        db      00000011b
62a0 04        db      00000100b
62a1 07        db      00000111b
62a2 05        db      00000101b
62a3 04        db      00000100b
62a4 03        db      00000011b
62a5 01        db      00000001b

; Frame 2/4 - Cell (1,1)
62a6 c0        db      11000000b
62a7 e0        db      11100000b
62a8 90        db      10010000b
62a9 70        db      01110000b
62aa d0        db      11010000b
62ab 10        db      00010000b
62ac e0        db      11100000b
62ad c0        db      11000000b

; Frame 2/4 - Cell (2,0)
62ae 03        db      00000011b
62af 04        db      00000100b
62b0 05        db      00000101b
62b1 05        db      00000101b
62b2 05        db      00000101b
62b3 01        db      00000001b
62b4 01        db      00000001b
62b5 01        db      00000001b

; Frame 2/4 - Cell (2,1)
62b6 e0        db      11100000b
62b7 90        db      10010000b
62b8 50        db      01010000b
62b9 50        db      01010000b
62ba 50        db      01010000b
62bb 40        db      01000000b
62bc 40        db      01000000b
62bd 40        db      01000000b

; Frame 2/4 - Cell (3,0)
62be 02        db      00000010b
62bf 00        db      00000000b
62c0 00        db      00000000b
62c1 00        db      00000000b
62c2 00        db      00000000b
62c3 00        db      00000000b
62c4 00        db      00000000b
62c5 00        db      00000000b

; Frame 2/4 - Cell (3,1)
62c6 20        db      00100000b
62c7 00        db      00000000b
62c8 00        db      00000000b
62c9 00        db      00000000b
62ca 00        db      00000000b
62cb 00        db      00000000b
62cc 00        db      00000000b
62cd 00        db      00000000b

; Frame 3/4 - Cell (0,0)
62ce 00        db      00000000b
62cf 00        db      00000000b
62d0 00        db      00000000b
62d1 00        db      00000000b
62d2 01        db      00000001b
62d3 03        db      00000011b
62d4 04        db      00000100b
62d5 07        db      00000111b

; Frame 3/4 - Cell (0,1)
62d6 00        db      00000000b
62d7 00        db      00000000b
62d8 00        db      00000000b
62d9 00        db      00000000b
62da c0        db      11000000b
62db e0        db      11100000b
62dc 90        db      10010000b
62dd 70        db      01110000b

; Frame 3/4 - Cell (1,0)
62de 05        db      00000101b
62df 04        db      00000100b
62e0 03        db      00000011b
62e1 01        db      00000001b
62e2 03        db      00000011b
62e3 04        db      00000100b
62e4 05        db      00000101b
62e5 05        db      00000101b

; Frame 3/4 - Cell (1,1)
62e6 d0        db      11010000b
62e7 10        db      00010000b
62e8 e0        db      11100000b
62e9 c0        db      11000000b
62ea e0        db      11100000b
62eb 90        db      10010000b
62ec 50        db      01010000b
62ed 50        db      01010000b

; Frame 3/4 - Cell (2,0)
62ee 05        db      00000101b
62ef 01        db      00000001b
62f0 01        db      00000001b
62f1 01        db      00000001b
62f2 02        db      00000010b
62f3 00        db      00000000b
62f4 00        db      00000000b
62f5 00        db      00000000b

; Frame 3/4 - Cell (2,1)
62f6 50        db      01010000b
62f7 40        db      01000000b
62f8 40        db      01000000b
62f9 40        db      01000000b
62fa 20        db      00100000b
62fb 00        db      00000000b
62fc 00        db      00000000b
62fd 00        db      00000000b

; Frame 3/4 - Cell (3,0)
62fe 00        db      00000000b
62ff 00        db      00000000b
6300 00        db      00000000b
6301 00        db      00000000b
6302 00        db      00000000b
6303 00        db      00000000b
6304 00        db      00000000b
6305 00        db      00000000b

; Frame 3/4 - Cell (3,1)
6306 00        db      00000000b
6307 00        db      00000000b
6308 00        db      00000000b
6309 00        db      00000000b
630a 00        db      00000000b
630b 00        db      00000000b
630c 00        db      00000000b
630d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
630e 01        db      00000001b
630f 03        db      00000011b
6310 04        db      00000100b
6311 07        db      00000111b
6312 05        db      00000101b
6313 04        db      00000100b
6314 03        db      00000011b
6315 01        db      00000001b

; Frame 4/4 - Cell (0,1)
6316 c0        db      11000000b
6317 e0        db      11100000b
6318 90        db      10010000b
6319 70        db      01110000b
631a d0        db      11010000b
631b 10        db      00010000b
631c e0        db      11100000b
631d c0        db      11000000b

; Frame 4/4 - Cell (1,0)
631e 03        db      00000011b
631f 04        db      00000100b
6320 09        db      00001001b
6321 11        db      00010001b
6322 02        db      00000010b
6323 02        db      00000010b
6324 04        db      00000100b
6325 0c        db      00001100b

; Frame 4/4 - Cell (1,1)
6326 e0        db      11100000b
6327 90        db      10010000b
6328 48        db      01001000b
6329 44        db      01000100b
632a 20        db      00100000b
632b 20        db      00100000b
632c 10        db      00010000b
632d 18        db      00011000b

; Frame 4/4 - Cell (2,0)
632e 00        db      00000000b
632f 00        db      00000000b
6330 00        db      00000000b
6331 00        db      00000000b
6332 00        db      00000000b
6333 00        db      00000000b
6334 00        db      00000000b
6335 00        db      00000000b

; Frame 4/4 - Cell (2,1)
6336 00        db      00000000b
6337 00        db      00000000b
6338 00        db      00000000b
6339 00        db      00000000b
633a 00        db      00000000b
633b 00        db      00000000b
633c 00        db      00000000b
633d 00        db      00000000b

; Frame 4/4 - Cell (3,0)
633e 00        db      00000000b
633f 00        db      00000000b
6340 00        db      00000000b
6341 00        db      00000000b
6342 00        db      00000000b
6343 00        db      00000000b
6344 00        db      00000000b
6345 00        db      00000000b

; Frame 4/4 - Cell (3,1)
6346 00        db      00000000b
6347 00        db      00000000b
6348 00        db      00000000b
6349 00        db      00000000b
634a 00        db      00000000b
634b 00        db      00000000b
634c 00        db      00000000b
634d 00        db      00000000b


GFXJFal1:      ; Jack Falling Through Gap Part 1 GFX data
               ; 4x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
634e 00        db      00000000b
634f 00        db      00000000b
6350 00        db      00000000b
6351 00        db      00000000b
6352 01        db      00000001b
6353 03        db      00000011b
6354 04        db      00000100b
6355 07        db      00000111b

; Frame 1/4 - Cell (0,1)
6356 00        db      00000000b
6357 00        db      00000000b
6358 00        db      00000000b
6359 00        db      00000000b
635a c0        db      11000000b
635b e0        db      11100000b
635c 90        db      10010000b
635d 70        db      01110000b

; Frame 1/4 - Cell (1,0)
635e 07        db      00000111b
635f 16        db      00010110b
6360 0b        db      00001011b
6361 05        db      00000101b
6362 03        db      00000011b
6363 00        db      00000000b
6364 01        db      00000001b
6365 01        db      00000001b

; Frame 1/4 - Cell (1,1)
6366 f0        db      11110000b
6367 34        db      00110100b
6368 e8        db      11101000b
6369 d0        db      11010000b
636a e0        db      11100000b
636b 80        db      10000000b
636c 40        db      01000000b
636d 40        db      01000000b

; Frame 1/4 - Cell (2,0)
636e 02        db      00000010b
636f 02        db      00000010b
6370 04        db      00000100b
6371 0c        db      00001100b
6372 00        db      00000000b
6373 00        db      00000000b
6374 00        db      00000000b
6375 00        db      00000000b

; Frame 1/4 - Cell (2,1)
6376 20        db      00100000b
6377 20        db      00100000b
6378 10        db      00010000b
6379 18        db      00011000b
637a 00        db      00000000b
637b 00        db      00000000b
637c 00        db      00000000b
637d 00        db      00000000b

; Frame 1/4 - Cell (3,0)
637e 00        db      00000000b
637f 00        db      00000000b
6380 00        db      00000000b
6381 00        db      00000000b
6382 00        db      00000000b
6383 00        db      00000000b
6384 00        db      00000000b
6385 00        db      00000000b

; Frame 1/4 - Cell (3,1)
6386 00        db      00000000b
6387 00        db      00000000b
6388 00        db      00000000b
6389 00        db      00000000b
638a 00        db      00000000b
638b 00        db      00000000b
638c 00        db      00000000b
638d 00        db      00000000b

; Frame 2/4 - Cell (0,0)
638e 00        db      00000000b
638f 00        db      00000000b
6390 00        db      00000000b
6391 00        db      00000000b
6392 00        db      00000000b
6393 00        db      00000000b
6394 00        db      00000000b
6395 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6396 00        db      00000000b
6397 00        db      00000000b
6398 00        db      00000000b
6399 00        db      00000000b
639a 00        db      00000000b
639b 00        db      00000000b
639c 00        db      00000000b
639d 00        db      00000000b

; Frame 2/4 - Cell (1,0)
639e 01        db      00000001b
639f 03        db      00000011b
63a0 04        db      00000100b
63a1 07        db      00000111b
63a2 07        db      00000111b
63a3 16        db      00010110b
63a4 0b        db      00001011b
63a5 05        db      00000101b

; Frame 2/4 - Cell (1,1)
63a6 c0        db      11000000b
63a7 e0        db      11100000b
63a8 90        db      10010000b
63a9 70        db      01110000b
63aa f0        db      11110000b
63ab 34        db      00110100b
63ac e8        db      11101000b
63ad d0        db      11010000b

; Frame 2/4 - Cell (2,0)
63ae 03        db      00000011b
63af 00        db      00000000b
63b0 01        db      00000001b
63b1 01        db      00000001b
63b2 02        db      00000010b
63b3 02        db      00000010b
63b4 04        db      00000100b
63b5 0c        db      00001100b

; Frame 2/4 - Cell (2,1)
63b6 e0        db      11100000b
63b7 80        db      10000000b
63b8 40        db      01000000b
63b9 40        db      01000000b
63ba 20        db      00100000b
63bb 20        db      00100000b
63bc 10        db      00010000b
63bd 18        db      00011000b

; Frame 2/4 - Cell (3,0)
63be 00        db      00000000b
63bf 00        db      00000000b
63c0 00        db      00000000b
63c1 00        db      00000000b
63c2 00        db      00000000b
63c3 00        db      00000000b
63c4 00        db      00000000b
63c5 00        db      00000000b

; Frame 2/4 - Cell (3,1)
63c6 00        db      00000000b
63c7 00        db      00000000b
63c8 00        db      00000000b
63c9 00        db      00000000b
63ca 00        db      00000000b
63cb 00        db      00000000b
63cc 00        db      00000000b
63cd 00        db      00000000b

; Frame 3/4 - Cell (0,0)
63ce 00        db      00000000b
63cf 00        db      00000000b
63d0 00        db      00000000b
63d1 00        db      00000000b
63d2 00        db      00000000b
63d3 00        db      00000000b
63d4 00        db      00000000b
63d5 00        db      00000000b

; Frame 3/4 - Cell (0,1)
63d6 00        db      00000000b
63d7 00        db      00000000b
63d8 00        db      00000000b
63d9 00        db      00000000b
63da 00        db      00000000b
63db 00        db      00000000b
63dc 00        db      00000000b
63dd 00        db      00000000b

; Frame 3/4 - Cell (1,0)
63de 00        db      00000000b
63df 00        db      00000000b
63e0 00        db      00000000b
63e1 00        db      00000000b
63e2 01        db      00000001b
63e3 03        db      00000011b
63e4 04        db      00000100b
63e5 07        db      00000111b

; Frame 3/4 - Cell (1,1)
63e6 00        db      00000000b
63e7 00        db      00000000b
63e8 00        db      00000000b
63e9 00        db      00000000b
63ea c0        db      11000000b
63eb e0        db      11100000b
63ec 90        db      10010000b
63ed 70        db      01110000b

; Frame 3/4 - Cell (2,0)
63ee 07        db      00000111b
63ef 06        db      00000110b
63f0 03        db      00000011b
63f1 01        db      00000001b
63f2 03        db      00000011b
63f3 04        db      00000100b
63f4 09        db      00001001b
63f5 11        db      00010001b

; Frame 3/4 - Cell (2,1)
63f6 f0        db      11110000b
63f7 30        db      00110000b
63f8 e0        db      11100000b
63f9 c0        db      11000000b
63fa e0        db      11100000b
63fb 90        db      10010000b
63fc 48        db      01001000b
63fd 44        db      01000100b

; Frame 3/4 - Cell (3,0)
63fe 02        db      00000010b
63ff 02        db      00000010b
6400 04        db      00000100b
6401 0c        db      00001100b
6402 00        db      00000000b
6403 00        db      00000000b
6404 00        db      00000000b
6405 00        db      00000000b

; Frame 3/4 - Cell (3,1)
6406 20        db      00100000b
6407 20        db      00100000b
6408 10        db      00010000b
6409 18        db      00011000b
640a 00        db      00000000b
640b 00        db      00000000b
640c 00        db      00000000b
640d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
640e 00        db      00000000b
640f 00        db      00000000b
6410 00        db      00000000b
6411 00        db      00000000b
6412 00        db      00000000b
6413 00        db      00000000b
6414 00        db      00000000b
6415 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6416 00        db      00000000b
6417 00        db      00000000b
6418 00        db      00000000b
6419 00        db      00000000b
641a 00        db      00000000b
641b 00        db      00000000b
641c 00        db      00000000b
641d 00        db      00000000b

; Frame 4/4 - Cell (1,0)
641e 00        db      00000000b
641f 00        db      00000000b
6420 00        db      00000000b
6421 00        db      00000000b
6422 00        db      00000000b
6423 00        db      00000000b
6424 00        db      00000000b
6425 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6426 00        db      00000000b
6427 00        db      00000000b
6428 00        db      00000000b
6429 00        db      00000000b
642a 00        db      00000000b
642b 00        db      00000000b
642c 00        db      00000000b
642d 00        db      00000000b

; Frame 4/4 - Cell (2,0)
642e 01        db      00000001b
642f 03        db      00000011b
6430 04        db      00000100b
6431 07        db      00000111b
6432 07        db      00000111b
6433 06        db      00000110b
6434 03        db      00000011b
6435 01        db      00000001b

; Frame 4/4 - Cell (2,1)
6436 c0        db      11000000b
6437 e0        db      11100000b
6438 90        db      10010000b
6439 70        db      01110000b
643a f0        db      11110000b
643b 30        db      00110000b
643c e0        db      11100000b
643d c0        db      11000000b

; Frame 4/4 - Cell (3,0)
643e 03        db      00000011b
643f 04        db      00000100b
6440 09        db      00001001b
6441 11        db      00010001b
6442 02        db      00000010b
6443 02        db      00000010b
6444 04        db      00000100b
6445 0c        db      00001100b

; Frame 4/4 - Cell (3,1)
6446 e0        db      11100000b
6447 90        db      10010000b
6448 48        db      01001000b
6449 44        db      01000100b
644a 20        db      00100000b
644b 20        db      00100000b
644c 10        db      00010000b
644d 18        db      00011000b


GFXJBdJp:      ; Jack Bad Jump GFX data
               ; 3x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
644e 00        db      00000000b
644f 00        db      00000000b
6450 00        db      00000000b
6451 00        db      00000000b
6452 01        db      00000001b
6453 03        db      00000011b
6454 04        db      00000100b
6455 07        db      00000111b

; Frame 1/4 - Cell (0,1)
6456 00        db      00000000b
6457 00        db      00000000b
6458 00        db      00000000b
6459 00        db      00000000b
645a c0        db      11000000b
645b e0        db      11100000b
645c 90        db      10010000b
645d 70        db      01110000b

; Frame 1/4 - Cell (1,0)
645e 05        db      00000101b
645f 04        db      00000100b
6460 03        db      00000011b
6461 01        db      00000001b
6462 03        db      00000011b
6463 04        db      00000100b
6464 09        db      00001001b
6465 11        db      00010001b

; Frame 1/4 - Cell (1,1)
6466 d0        db      11010000b
6467 10        db      00010000b
6468 e0        db      11100000b
6469 c0        db      11000000b
646a e0        db      11100000b
646b 90        db      10010000b
646c 48        db      01001000b
646d 44        db      01000100b

; Frame 1/4 - Cell (2,0)
646e 01        db      00000001b
646f 02        db      00000010b
6470 02        db      00000010b
6471 06        db      00000110b
6472 00        db      00000000b
6473 00        db      00000000b
6474 00        db      00000000b
6475 00        db      00000000b

; Frame 1/4 - Cell (2,1)
6476 40        db      01000000b
6477 20        db      00100000b
6478 20        db      00100000b
6479 30        db      00110000b
647a 00        db      00000000b
647b 00        db      00000000b
647c 00        db      00000000b
647d 00        db      00000000b

; Frame 2/4 - Cell (0,0)
647e 01        db      00000001b
647f 03        db      00000011b
6480 04        db      00000100b
6481 07        db      00000111b
6482 07        db      00000111b
6483 16        db      00010110b
6484 0b        db      00001011b
6485 05        db      00000101b

; Frame 2/4 - Cell (0,1)
6486 c0        db      11000000b
6487 e0        db      11100000b
6488 90        db      10010000b
6489 70        db      01110000b
648a f0        db      11110000b
648b 34        db      00110100b
648c e8        db      11101000b
648d d0        db      11010000b

; Frame 2/4 - Cell (1,0)
648e 13        db      00010011b
648f 18        db      00011000b
6490 06        db      00000110b
6491 01        db      00000001b
6492 00        db      00000000b
6493 00        db      00000000b
6494 00        db      00000000b
6495 00        db      00000000b

; Frame 2/4 - Cell (1,1)
6496 e4        db      11100100b
6497 8c        db      10001100b
6498 b0        db      10110000b
6499 c0        db      11000000b
649a 00        db      00000000b
649b 00        db      00000000b
649c 00        db      00000000b
649d 00        db      00000000b

; Frame 2/4 - Cell (2,0)
649e 00        db      00000000b
649f 00        db      00000000b
64a0 00        db      00000000b
64a1 00        db      00000000b
64a2 00        db      00000000b
64a3 00        db      00000000b
64a4 00        db      00000000b
64a5 00        db      00000000b

; Frame 2/4 - Cell (2,1)
64a6 00        db      00000000b
64a7 00        db      00000000b
64a8 00        db      00000000b
64a9 00        db      00000000b
64aa 00        db      00000000b
64ab 00        db      00000000b
64ac 00        db      00000000b
64ad 00        db      00000000b

; Frame 3/4 - Cell (0,0)
64ae 00        db      00000000b
64af 48        db      01001000b
64b0 84        db      10000100b
64b1 42        db      01000010b
64b2 21        db      00100001b
64b3 16        db      00010110b
64b4 08        db      00001000b
64b5 00        db      00000000b

; Frame 3/4 - Cell (0,1)
64b6 18        db      00011000b
64b7 3c        db      00111100b
64b8 5a        db      01011010b
64b9 db        db      11011011b
64ba df        db      11011111b
64bb df        db      11011111b
64bc 7e        db      01111110b
64bd 3c        db      00111100b

; Frame 3/4 - Cell (1,0)
64be 00        db      00000000b
64bf 00        db      00000000b
64c0 00        db      00000000b
64c1 00        db      00000000b
64c2 00        db      00000000b
64c3 00        db      00000000b
64c4 00        db      00000000b
64c5 00        db      00000000b

; Frame 3/4 - Cell (1,1)
64c6 00        db      00000000b
64c7 00        db      00000000b
64c8 00        db      00000000b
64c9 00        db      00000000b
64ca 00        db      00000000b
64cb 00        db      00000000b
64cc 00        db      00000000b
64cd 00        db      00000000b

; Frame 3/4 - Cell (2,0)
64ce 00        db      00000000b
64cf 00        db      00000000b
64d0 00        db      00000000b
64d1 00        db      00000000b
64d2 00        db      00000000b
64d3 00        db      00000000b
64d4 00        db      00000000b
64d5 00        db      00000000b

; Frame 3/4 - Cell (2,1)
64d6 00        db      00000000b
64d7 00        db      00000000b
64d8 00        db      00000000b
64d9 00        db      00000000b
64da 00        db      00000000b
64db 00        db      00000000b
64dc 00        db      00000000b
64dd 00        db      00000000b

; Frame 4/4 - Cell (0,0)
64de 00        db      00000000b
64df 00        db      00000000b
64e0 00        db      00000000b
64e1 00        db      00000000b
64e2 00        db      00000000b
64e3 00        db      00000000b
64e4 00        db      00000000b
64e5 00        db      00000000b

; Frame 4/4 - Cell (0,1)
64e6 00        db      00000000b
64e7 00        db      00000000b
64e8 00        db      00000000b
64e9 00        db      00000000b
64ea 00        db      00000000b
64eb 00        db      00000000b
64ec 00        db      00000000b
64ed 00        db      00000000b

; Frame 4/4 - Cell (1,0)
64ee 01        db      00000001b
64ef 03        db      00000011b
64f0 04        db      00000100b
64f1 07        db      00000111b
64f2 05        db      00000101b
64f3 04        db      00000100b
64f4 03        db      00000011b
64f5 01        db      00000001b

; Frame 4/4 - Cell (1,1)
64f6 c0        db      11000000b
64f7 e0        db      11100000b
64f8 90        db      10010000b
64f9 70        db      01110000b
64fa d0        db      11010000b
64fb 10        db      00010000b
64fc e0        db      11100000b
64fd c0        db      11000000b

; Frame 4/4 - Cell (2,0)
64fe 03        db      00000011b
64ff 04        db      00000100b
6500 09        db      00001001b
6501 11        db      00010001b
6502 02        db      00000010b
6503 02        db      00000010b
6504 04        db      00000100b
6505 0c        db      00001100b

; Frame 4/4 - Cell (2,1)
6506 e0        db      11100000b
6507 90        db      10010000b
6508 48        db      01001000b
6509 44        db      01000100b
650a 20        db      00100000b
650b 20        db      00100000b
650c 10        db      00010000b
650d 18        db      00011000b


GFXJStun:      ; Jack stunned GFX data
               ; 2x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
650e 00        db      00000000b
650f 00        db      00000000b
6510 00        db      00000000b
6511 00        db      00000000b
6512 02        db      00000010b
6513 00        db      00000000b
6514 00        db      00000000b
6515 18        db      00011000b

; Frame 1/4 - Cell (0,1)
6516 00        db      00000000b
6517 04        db      00000100b
6518 40        db      01000000b
6519 00        db      00000000b
651a 02        db      00000010b
651b 20        db      00100000b
651c 00        db      00000000b
651d 10        db      00010000b

; Frame 1/4 - Cell (1,0)
651e 11        db      00010001b
651f 11        db      00010001b
6520 11        db      00010001b
6521 11        db      00010001b
6522 11        db      00010001b
6523 1f        db      00011111b
6524 00        db      00000000b
6525 00        db      00000000b

; Frame 1/4 - Cell (1,1)
6526 18        db      00011000b
6527 3c        db      00111100b
6528 5e        db      01011110b
6529 5b        db      01011011b
652a df        db      11011111b
652b df        db      11011111b
652c fe        db      11111110b
652d 3c        db      00111100b

; Frame 2/4 - Cell (0,0)
652e 00        db      00000000b
652f 00        db      00000000b
6530 00        db      00000000b
6531 01        db      00000001b
6532 00        db      00000000b
6533 00        db      00000000b
6534 00        db      00000000b
6535 18        db      00011000b

; Frame 2/4 - Cell (0,1)
6536 00        db      00000000b
6537 22        db      00100010b
6538 00        db      00000000b
6539 00        db      00000000b
653a 00        db      00000000b
653b 04        db      00000100b
653c 40        db      01000000b
653d 10        db      00010000b

; Frame 2/4 - Cell (1,0)
653e 11        db      00010001b
653f 11        db      00010001b
6540 11        db      00010001b
6541 11        db      00010001b
6542 11        db      00010001b
6543 1f        db      00011111b
6544 00        db      00000000b
6545 00        db      00000000b

; Frame 2/4 - Cell (1,1)
6546 18        db      00011000b
6547 3c        db      00111100b
6548 5e        db      01011110b
6549 5b        db      01011011b
654a df        db      11011111b
654b df        db      11011111b
654c fe        db      11111110b
654d 3c        db      00111100b

; Frame 3/4 - Cell (0,0)
654e 00        db      00000000b
654f 00        db      00000000b
6550 01        db      00000001b
6551 00        db      00000000b
6552 00        db      00000000b
6553 00        db      00000000b
6554 00        db      00000000b
6555 c0        db      11000000b

; Frame 3/4 - Cell (0,1)
6556 00        db      00000000b
6557 10        db      00010000b
6558 02        db      00000010b
6559 00        db      00000000b
655a 00        db      00000000b
655b 08        db      00001000b
655c 80        db      10000000b
655d 10        db      00010000b

; Frame 3/4 - Cell (1,0)
655e 84        db      10000100b
655f 44        db      01000100b
6560 42        db      01000010b
6561 22        db      00100010b
6562 21        db      00100001b
6563 1f        db      00011111b
6564 00        db      00000000b
6565 00        db      00000000b

; Frame 3/4 - Cell (1,1)
6566 18        db      00011000b
6567 3c        db      00111100b
6568 5e        db      01011110b
6569 5b        db      01011011b
656a df        db      11011111b
656b df        db      11011111b
656c fe        db      11111110b
656d 3c        db      00111100b

; Frame 4/4 - Cell (0,0)
656e 00        db      00000000b
656f 00        db      00000000b
6570 00        db      00000000b
6571 00        db      00000000b
6572 00        db      00000000b
6573 02        db      00000010b
6574 00        db      00000000b
6575 c0        db      11000000b

; Frame 4/4 - Cell (0,1)
6576 00        db      00000000b
6577 08        db      00001000b
6578 80        db      10000000b
6579 02        db      00000010b
657a 00        db      00000000b
657b 10        db      00010000b
657c 00        db      00000000b
657d 10        db      00010000b

; Frame 4/4 - Cell (1,0)
657e 84        db      10000100b
657f 44        db      01000100b
6580 42        db      01000010b
6581 22        db      00100010b
6582 21        db      00100001b
6583 1f        db      00011111b
6584 00        db      00000000b
6585 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6586 18        db      00011000b
6587 3c        db      00111100b
6588 5e        db      01011110b
6589 5b        db      01011011b
658a df        db      11011111b
658b df        db      11011111b
658c fe        db      11111110b
658d 3c        db      00111100b


GFXJFal2:      ; Jack Falling Through Gap Part 2 GFX data
               ; 4x2 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
658e 00        db      00000000b
658f 00        db      00000000b
6590 00        db      00000000b
6591 00        db      00000000b
6592 00        db      00000000b
6593 00        db      00000000b
6594 00        db      00000000b
6595 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6596 00        db      00000000b
6597 00        db      00000000b
6598 00        db      00000000b
6599 00        db      00000000b
659a 00        db      00000000b
659b 00        db      00000000b
659c 00        db      00000000b
659d 00        db      00000000b

; Frame 1/4 - Cell (1,0)
659e 00        db      00000000b
659f 00        db      00000000b
65a0 00        db      00000000b
65a1 00        db      00000000b
65a2 01        db      00000001b
65a3 03        db      00000011b
65a4 04        db      00000100b
65a5 07        db      00000111b

; Frame 1/4 - Cell (1,1)
65a6 00        db      00000000b
65a7 00        db      00000000b
65a8 00        db      00000000b
65a9 00        db      00000000b
65aa c0        db      11000000b
65ab e0        db      11100000b
65ac 90        db      10010000b
65ad 70        db      01110000b

; Frame 1/4 - Cell (2,0)
65ae 07        db      00000111b
65af 06        db      00000110b
65b0 03        db      00000011b
65b1 01        db      00000001b
65b2 03        db      00000011b
65b3 04        db      00000100b
65b4 09        db      00001001b
65b5 11        db      00010001b

; Frame 1/4 - Cell (2,1)
65b6 f0        db      11110000b
65b7 30        db      00110000b
65b8 e0        db      11100000b
65b9 c0        db      11000000b
65ba e0        db      11100000b
65bb 90        db      10010000b
65bc 48        db      01001000b
65bd 44        db      01000100b

; Frame 1/4 - Cell (3,0)
65be 02        db      00000010b
65bf 02        db      00000010b
65c0 04        db      00000100b
65c1 0c        db      00001100b
65c2 00        db      00000000b
65c3 00        db      00000000b
65c4 00        db      00000000b
65c5 00        db      00000000b

; Frame 1/4 - Cell (3,1)
65c6 20        db      00100000b
65c7 20        db      00100000b
65c8 10        db      00010000b
65c9 18        db      00011000b
65ca 00        db      00000000b
65cb 00        db      00000000b
65cc 00        db      00000000b
65cd 00        db      00000000b

; Frame 2/4 - Cell (0,0)
65ce 00        db      00000000b
65cf 00        db      00000000b
65d0 00        db      00000000b
65d1 00        db      00000000b
65d2 00        db      00000000b
65d3 00        db      00000000b
65d4 00        db      00000000b
65d5 00        db      00000000b

; Frame 2/4 - Cell (0,1)
65d6 00        db      00000000b
65d7 00        db      00000000b
65d8 00        db      00000000b
65d9 00        db      00000000b
65da 00        db      00000000b
65db 00        db      00000000b
65dc 00        db      00000000b
65dd 00        db      00000000b

; Frame 2/4 - Cell (1,0)
65de 00        db      00000000b
65df 00        db      00000000b
65e0 00        db      00000000b
65e1 00        db      00000000b
65e2 00        db      00000000b
65e3 00        db      00000000b
65e4 00        db      00000000b
65e5 00        db      00000000b

; Frame 2/4 - Cell (1,1)
65e6 00        db      00000000b
65e7 00        db      00000000b
65e8 00        db      00000000b
65e9 00        db      00000000b
65ea 00        db      00000000b
65eb 00        db      00000000b
65ec 00        db      00000000b
65ed 00        db      00000000b

; Frame 2/4 - Cell (2,0)
65ee 01        db      00000001b
65ef 03        db      00000011b
65f0 04        db      00000100b
65f1 07        db      00000111b
65f2 07        db      00000111b
65f3 06        db      00000110b
65f4 03        db      00000011b
65f5 01        db      00000001b

; Frame 2/4 - Cell (2,1)
65f6 c0        db      11000000b
65f7 e0        db      11100000b
65f8 90        db      10010000b
65f9 70        db      01110000b
65fa f0        db      11110000b
65fb 30        db      00110000b
65fc e0        db      11100000b
65fd c0        db      11000000b

; Frame 2/4 - Cell (3,0)
65fe 03        db      00000011b
65ff 04        db      00000100b
6600 09        db      00001001b
6601 11        db      00010001b
6602 02        db      00000010b
6603 02        db      00000010b
6604 04        db      00000100b
6605 0c        db      00001100b

; Frame 2/4 - Cell (3,1)
6606 e0        db      11100000b
6607 90        db      10010000b
6608 48        db      01001000b
6609 44        db      01000100b
660a 20        db      00100000b
660b 20        db      00100000b
660c 10        db      00010000b
660d 18        db      00011000b

; Frame 3/4 - Cell (0,0)
660e 00        db      00000000b
660f 00        db      00000000b
6610 00        db      00000000b
6611 00        db      00000000b
6612 00        db      00000000b
6613 00        db      00000000b
6614 00        db      00000000b
6615 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6616 00        db      00000000b
6617 00        db      00000000b
6618 00        db      00000000b
6619 00        db      00000000b
661a 00        db      00000000b
661b 00        db      00000000b
661c 00        db      00000000b
661d 00        db      00000000b

; Frame 3/4 - Cell (1,0)
661e 00        db      00000000b
661f 00        db      00000000b
6620 00        db      00000000b
6621 00        db      00000000b
6622 00        db      00000000b
6623 00        db      00000000b
6624 00        db      00000000b
6625 00        db      00000000b

; Frame 3/4 - Cell (1,1)
6626 00        db      00000000b
6627 00        db      00000000b
6628 00        db      00000000b
6629 00        db      00000000b
662a 00        db      00000000b
662b 00        db      00000000b
662c 00        db      00000000b
662d 00        db      00000000b

; Frame 3/4 - Cell (2,0)
662e 00        db      00000000b
662f 00        db      00000000b
6630 00        db      00000000b
6631 01        db      00000001b
6632 03        db      00000011b
6633 04        db      00000100b
6634 07        db      00000111b
6635 05        db      00000101b

; Frame 3/4 - Cell (2,1)
6636 00        db      00000000b
6637 00        db      00000000b
6638 00        db      00000000b
6639 c0        db      11000000b
663a e0        db      11100000b
663b 90        db      10010000b
663c 70        db      01110000b
663d d0        db      11010000b

; Frame 3/4 - Cell (3,0)
663e 04        db      00000100b
663f 03        db      00000011b
6640 09        db      00001001b
6641 05        db      00000101b
6642 03        db      00000011b
6643 04        db      00000100b
6644 08        db      00001000b
6645 18        db      00011000b

; Frame 3/4 - Cell (3,1)
6646 10        db      00010000b
6647 e0        db      11100000b
6648 c8        db      11001000b
6649 d0        db      11010000b
664a e0        db      11100000b
664b 10        db      00010000b
664c 08        db      00001000b
664d 0c        db      00001100b

; Frame 4/4 - Cell (0,0)
664e 00        db      00000000b
664f 00        db      00000000b
6650 00        db      00000000b
6651 00        db      00000000b
6652 00        db      00000000b
6653 00        db      00000000b
6654 00        db      00000000b
6655 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6656 00        db      00000000b
6657 00        db      00000000b
6658 00        db      00000000b
6659 00        db      00000000b
665a 00        db      00000000b
665b 00        db      00000000b
665c 00        db      00000000b
665d 00        db      00000000b

; Frame 4/4 - Cell (1,0)
665e 00        db      00000000b
665f 00        db      00000000b
6660 00        db      00000000b
6661 00        db      00000000b
6662 00        db      00000000b
6663 00        db      00000000b
6664 00        db      00000000b
6665 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6666 00        db      00000000b
6667 00        db      00000000b
6668 00        db      00000000b
6669 00        db      00000000b
666a 00        db      00000000b
666b 00        db      00000000b
666c 00        db      00000000b
666d 00        db      00000000b

; Frame 4/4 - Cell (2,0)
666e 00        db      00000000b
666f 00        db      00000000b
6670 00        db      00000000b
6671 00        db      00000000b
6672 02        db      00000010b
6673 00        db      00000000b
6674 00        db      00000000b
6675 18        db      00011000b

; Frame 4/4 - Cell (2,1)
6676 00        db      00000000b
6677 04        db      00000100b
6678 40        db      01000000b
6679 00        db      00000000b
667a 02        db      00000010b
667b 20        db      00100000b
667c 00        db      00000000b
667d 10        db      00010000b

; Frame 4/4 - Cell (3,0)
667e 11        db      00010001b
667f 11        db      00010001b
6680 11        db      00010001b
6681 11        db      00010001b
6682 11        db      00010001b
6683 1f        db      00011111b
6684 00        db      00000000b
6685 00        db      00000000b

; Frame 4/4 - Cell (3,1)
6686 18        db      00011000b
6687 3c        db      00111100b
6688 5e        db      01011110b
6689 5b        db      01011011b
668a df        db      11011111b
668b df        db      11011111b
668c fe        db      11111110b
668d 3c        db      00111100b




GFXHzrds:

; Hazard 1 - Octopus
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
668e 00        db      00000000b
668f 00        db      00000000b
6690 00        db      00000000b
6691 00        db      00000000b
6692 00        db      00000000b
6693 00        db      00000000b
6694 00        db      00000000b
6695 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6696 00        db      00000000b
6697 00        db      00000000b
6698 00        db      00000000b
6699 00        db      00000000b
669a 00        db      00000000b
669b 00        db      00000000b
669c 00        db      00000000b
669d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
669e 01        db      00000001b
669f 07        db      00000111b
66a0 0f        db      00001111b
66a1 19        db      00011001b
66a2 1f        db      00011111b
66a3 0f        db      00001111b
66a4 03        db      00000011b
66a5 07        db      00000111b

; Frame 1/4 - Cell (1,1)
66a6 0b        db      00001011b
66a7 13        db      00010011b
66a8 15        db      00010101b
66a9 25        db      00100101b
66aa 24        db      00100100b
66ab 44        db      01000100b
66ac 49        db      01001001b
66ad 49        db      01001001b

; Frame 1/4 - Cell (0,2)
66ae c0        db      11000000b
66af f0        db      11110000b
66b0 f8        db      11111000b
66b1 cc        db      11001100b
66b2 fc        db      11111100b
66b3 f8        db      11111000b
66b4 e0        db      11100000b
66b5 f0        db      11110000b

; Frame 1/4 - Cell (1,2)
66b6 e8        db      11101000b
66b7 c4        db      11000100b
66b8 d4        db      11010100b
66b9 d2        db      11010010b
66ba 92        db      10010010b
66bb 91        db      10010001b
66bc 49        db      01001001b
66bd 49        db      01001001b

; Frame 2/4 - Cell (0,0)
66be 00        db      00000000b
66bf 00        db      00000000b
66c0 00        db      00000000b
66c1 00        db      00000000b
66c2 00        db      00000000b
66c3 01        db      00000001b
66c4 01        db      00000001b
66c5 00        db      00000000b

; Frame 2/4 - Cell (1,0)
66c6 00        db      00000000b
66c7 00        db      00000000b
66c8 00        db      00000000b
66c9 01        db      00000001b
66ca 02        db      00000010b
66cb 02        db      00000010b
66cc 04        db      00000100b
66cd 04        db      00000100b

; Frame 2/4 - Cell (0,1)
66ce 00        db      00000000b
66cf 00        db      00000000b
66d0 1c        db      00011100b
66d1 7f        db      01111111b
66d2 ff        db      11111111b
66d3 9c        db      10011100b
66d4 ff        db      11111111b
66d5 ff        db      11111111b

; Frame 2/4 - Cell (1,1)
66d6 3e        db      00111110b
66d7 7f        db      01111111b
66d8 be        db      10111110b
66d9 3e        db      00111110b
66da 5d        db      01011101b
66db 5d        db      01011101b
66dc 88        db      10001000b
66dd 94        db      10010100b

; Frame 2/4 - Cell (0,2)
66de 00        db      00000000b
66df 00        db      00000000b
66e0 00        db      00000000b
66e1 00        db      00000000b
66e2 80        db      10000000b
66e3 c0        db      11000000b
66e4 c0        db      11000000b
66e5 80        db      10000000b

; Frame 2/4 - Cell (1,2)
66e6 00        db      00000000b
66e7 00        db      00000000b
66e8 80        db      10000000b
66e9 40        db      01000000b
66ea 20        db      00100000b
66eb 20        db      00100000b
66ec 90        db      10010000b
66ed 90        db      10010000b

; Frame 3/4 - Cell (0,0)
66ee 00        db      00000000b
66ef 00        db      00000000b
66f0 00        db      00000000b
66f1 00        db      00000000b
66f2 00        db      00000000b
66f3 00        db      00000000b
66f4 00        db      00000000b
66f5 00        db      00000000b

; Frame 3/4 - Cell (1,0)
66f6 00        db      00000000b
66f7 00        db      00000000b
66f8 00        db      00000000b
66f9 00        db      00000000b
66fa 00        db      00000000b
66fb 00        db      00000000b
66fc 00        db      00000000b
66fd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
66fe 00        db      00000000b
66ff 00        db      00000000b
6700 00        db      00000000b
6701 00        db      00000000b
6702 01        db      00000001b
6703 07        db      00000111b
6704 0f        db      00001111b
6705 19        db      00011001b

; Frame 3/4 - Cell (1,1)
6706 1f        db      00011111b
6707 0f        db      00001111b
6708 03        db      00000011b
6709 07        db      00000111b
670a 0b        db      00001011b
670b 13        db      00010011b
670c 24        db      00100100b
670d 49        db      01001001b

; Frame 3/4 - Cell (0,2)
670e 00        db      00000000b
670f 00        db      00000000b
6710 00        db      00000000b
6711 00        db      00000000b
6712 c0        db      11000000b
6713 f0        db      11110000b
6714 f8        db      11111000b
6715 cc        db      11001100b

; Frame 3/4 - Cell (1,2)
6716 fc        db      11111100b
6717 f8        db      11111000b
6718 e0        db      11100000b
6719 f0        db      11110000b
671a e8        db      11101000b
671b e4        db      11100100b
671c 92        db      10010010b
671d 49        db      01001001b

; Frame 4/4 - Cell (0,0)
671e 00        db      00000000b
671f 00        db      00000000b
6720 00        db      00000000b
6721 00        db      00000000b
6722 00        db      00000000b
6723 01        db      00000001b
6724 01        db      00000001b
6725 00        db      00000000b

; Frame 4/4 - Cell (1,0)
6726 00        db      00000000b
6727 00        db      00000000b
6728 00        db      00000000b
6729 01        db      00000001b
672a 02        db      00000010b
672b 02        db      00000010b
672c 04        db      00000100b
672d 04        db      00000100b

; Frame 4/4 - Cell (0,1)
672e 00        db      00000000b
672f 00        db      00000000b
6730 1c        db      00011100b
6731 7f        db      01111111b
6732 ff        db      11111111b
6733 9c        db      10011100b
6734 ff        db      11111111b
6735 ff        db      11111111b

; Frame 4/4 - Cell (1,1)
6736 3e        db      00111110b
6737 7f        db      01111111b
6738 be        db      10111110b
6739 3e        db      00111110b
673a 5d        db      01011101b
673b 5d        db      01011101b
673c 88        db      10001000b
673d 94        db      10010100b

; Frame 4/4 - Cell (0,2)
673e 00        db      00000000b
673f 00        db      00000000b
6740 00        db      00000000b
6741 00        db      00000000b
6742 80        db      10000000b
6743 c0        db      11000000b
6744 c0        db      11000000b
6745 80        db      10000000b

; Frame 4/4 - Cell (1,2)
6746 00        db      00000000b
6747 00        db      00000000b
6748 80        db      10000000b
6749 40        db      01000000b
674a 20        db      00100000b
674b 20        db      00100000b
674c 90        db      10010000b
674d 90        db      10010000b


; Hazard 2 - Train
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
674e 00        db      00000000b
674f 00        db      00000000b
6750 00        db      00000000b
6751 00        db      00000000b
6752 00        db      00000000b
6753 00        db      00000000b
6754 00        db      00000000b
6755 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6756 00        db      00000000b
6757 00        db      00000000b
6758 00        db      00000000b
6759 02        db      00000010b
675a 03        db      00000011b
675b 02        db      00000010b
675c 00        db      00000000b
675d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
675e 3c        db      00111100b
675f 18        db      00011000b
6760 18        db      00011000b
6761 18        db      00011000b
6762 18        db      00011000b
6763 18        db      00011000b
6762 18        db      00011000b
6765 ff        db      11111111b

; Frame 1/4 - Cell (1,1)
6766 ff        db      11111111b
6767 ff        db      11111111b
6768 ff        db      11111111b
6769 ff        db      11111111b
676a ff        db      11111111b
676b 2c        db      00101100b
676c 34        db      00110100b
676d 18        db      00011000b

; Frame 1/4 - Cell (0,2)
676e 00        db      00000000b
676f 07        db      00000111b
6770 04        db      00000100b
6771 04        db      00000100b
6772 44        db      01000100b
6773 e4        db      11100100b
6774 e4        db      11100100b
6775 ff        db      11111111b

; Frame 1/4 - Cell (1,2)
6776 ff        db      11111111b
6777 ff        db      11111111b
6778 ff        db      11111111b
6779 ff        db      11111111b
677a ff        db      11111111b
677b 2c        db      00101100b
677c 34        db      00110100b
677d 18        db      00011000b

; Frame 2/4 - Cell (0,0)
677e 01        db      00000001b
677f 08        db      00001000b
6780 03        db      00000011b
6781 01        db      00000001b
6782 01        db      00000001b
6783 01        db      00000001b
6784 01        db      00000001b
6785 0f        db      00001111b

; Frame 2/4 - Cell (1,0)
6786 0f        db      00001111b
6787 0f        db      00001111b
6788 0f        db      00001111b
6789 4f        db      01001111b
678a 7f        db      01111111b
678b 43        db      01000011b
678c 02        db      00000010b
678d 01        db      00000001b

; Frame 2/4 - Cell (0,1)
678e 40        db      01000000b
678f 10        db      00010000b
6790 c0        db      11000000b
6791 80        db      10000000b
6792 84        db      10000100b
6793 8e        db      10001110b
6794 8e        db      10001110b
6795 ff        db      11111111b

; Frame 2/4 - Cell (1,1)
6796 ff        db      11111111b
6797 ff        db      11111111b
6798 ff        db      11111111b
6799 ff        db      11111111b
679a ff        db      11111111b
679b 43        db      01000011b
679c c2        db      11000010b
679d 81        db      10000001b

; Frame 2/4 - Cell (0,2)
679e 00        db      00000000b
679f 70        db      01110000b
67a0 40        db      01000000b
67a1 40        db      01000000b
67a2 40        db      01000000b
67a3 40        db      01000000b
67a4 40        db      01000000b
67a5 f0        db      11110000b

; Frame 2/4 - Cell (1,2)
67a6 f0        db      11110000b
67a7 f0        db      11110000b
67a8 f0        db      11110000b
67a9 f0        db      11110000b
67aa f0        db      11110000b
67ab 40        db      01000000b
67ac c0        db      11000000b
67ad 80        db      10000000b

; Frame 3/4 - Cell (0,0)
67ae 00        db      00000000b
67af 00        db      00000000b
67b0 00        db      00000000b
67b1 00        db      00000000b
67b2 00        db      00000000b
67b3 00        db      00000000b
67b4 00        db      00000000b
67b5 00        db      00000000b

; Frame 3/4 - Cell (1,0)
67b6 00        db      00000000b
67b7 00        db      00000000b
67b8 00        db      00000000b
67b9 08        db      00001000b
67ba 0f        db      00001111b
67bb 08        db      00001000b
67bc 00        db      00000000b
67bd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
67be 28        db      00101000b
67bf 84        db      10000100b
67c0 51        db      01010001b
67c1 82        db      10000010b
67c2 3c        db      00111100b
67c3 18        db      00011000b
67c4 18        db      00011000b
67c5 ff        db      11111111b

; Frame 3/4 - Cell (1,1)
67c6 ff        db      11111111b
67c7 ff        db      11111111b
67c8 ff        db      11111111b
67c9 ff        db      11111111b
67ca ff        db      11111111b
67cb 2c        db      00101100b
67cc 34        db      00110100b
67cd 18        db      00011000b

; Frame 3/4 - Cell (0,2)
67ce 00        db      00000000b
67cf 07        db      00000111b
67d0 04        db      00000100b
67d1 04        db      00000100b
67d2 44        db      01000100b
67d3 e4        db      11100100b
67d4 e4        db      11100100b
67d5 ff        db      11111111b

; Frame 3/4 - Cell (1,2)
67d6 ff        db      11111111b
67d7 ff        db      11111111b
67d8 ff        db      11111111b
67d9 ff        db      11111111b
67da ff        db      11111111b
67db 2c        db      00101100b
67dc 34        db      00110100b
67dd 18        db      00011000b

; Frame 4/4 - Cell (0,0)
67de 01        db      00000001b
67df 08        db      00001000b
67e0 03        db      00000011b
67e1 01        db      00000001b
67e2 01        db      00000001b
67e3 01        db      00000001b
67e4 01        db      00000001b
67e5 0f        db      00001111b

; Frame 4/4 - Cell (1,0)
67e6 0f        db      00001111b
67e7 0f        db      00001111b
67e8 0f        db      00001111b
67e9 4f        db      01001111b
67ea 7f        db      01111111b
67eb 43        db      01000011b
67ec 02        db      00000010b
67ed 01        db      00000001b

; Frame 4/4 - Cell (0,1)
67ee 40        db      01000000b
67ef 10        db      00010000b
67f0 c0        db      11000000b
67f1 80        db      10000000b
67f2 84        db      10000100b
67f3 8e        db      10001110b
67f4 8e        db      10001110b
67f5 ff        db      11111111b

; Frame 4/4 - Cell (1,1)
67f6 ff        db      11111111b
67f7 ff        db      11111111b
67f8 ff        db      11111111b
67f9 ff        db      11111111b
67fa ff        db      11111111b
67fb 43        db      01000011b
67fc c2        db      11000010b
67fd 81        db      10000001b

; Frame 4/4 - Cell (0,2)
67fe 00        db      00000000b
67ff 70        db      01110000b
6800 40        db      01000000b
6801 40        db      01000000b
6802 40        db      01000000b
6803 40        db      01000000b
6804 40        db      01000000b
6805 f0        db      11110000b

; Frame 4/4 - Cell (1,2)
6806 f0        db      11110000b
6807 f0        db      11110000b
6808 f0        db      11110000b
6809 f0        db      11110000b
680a f0        db      11110000b
680b 40        db      01000000b
680c c0        db      11000000b
680d 80        db      10000000b


; Hazard 3 - Ray
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
680e 00        db      00000000b
680f 00        db      00000000b
6810 00        db      00000000b
6811 00        db      00000000b
6812 00        db      00000000b
6813 00        db      00000000b
6814 00        db      00000000b
6815 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6816 00        db      00000000b
6817 00        db      00000000b
6818 00        db      00000000b
6819 00        db      00000000b
681a 00        db      00000000b
681b 00        db      00000000b
681c 00        db      00000000b
681d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
681e 01        db      00000001b
681f 03        db      00000011b
6820 27        db      00100111b
6821 7f        db      01111111b
6822 f9        db      11111001b
6823 f9        db      11111001b
6824 7f        db      01111111b
6825 7f        db      01111111b

; Frame 1/4 - Cell (1,1)
6826 7f        db      01111111b
6827 3f        db      00111111b
6828 3f        db      00111111b
6829 3f        db      00111111b
682a 3f        db      00111111b
682b 1f        db      00011111b
682c 0f        db      00001111b
682d 01        db      00000001b

; Frame 1/4 - Cell (0,2)
682e 80        db      10000000b
682f c0        db      11000000b
6830 e4        db      11100100b
6831 fe        db      11111110b
6832 9f        db      10011111b
6833 9f        db      10011111b
6834 fe        db      11111110b
6835 fe        db      11111110b

; Frame 1/4 - Cell (1,2)
6836 fe        db      11111110b
6837 fc        db      11111100b
6838 fc        db      11111100b
6839 fc        db      11111100b
683a fc        db      11111100b
683b f8        db      11111000b
683c f0        db      11110000b
683d 80        db      10000000b

; Frame 2/4 - Cell (0,0)
683e 00        db      00000000b
683f 00        db      00000000b
6840 00        db      00000000b
6841 00        db      00000000b
6842 01        db      00000001b
6843 01        db      00000001b
6844 00        db      00000000b
6845 00        db      00000000b

; Frame 2/4 - Cell (1,0)
6846 00        db      00000000b
6847 00        db      00000000b
6848 00        db      00000000b
6849 00        db      00000000b
684a 00        db      00000000b
684b 00        db      00000000b
684c 00        db      00000000b
684d 00        db      00000000b

; Frame 2/4 - Cell (0,1)
684e 06        db      00000110b
684f 0f        db      00001111b
6850 3f        db      00111111b
6851 7f        db      01111111b
6852 e6        db      11100110b
6853 e6        db      11100110b
6854 ff        db      11111111b
6855 ff        db      11111111b

; Frame 2/4 - Cell (1,1)
6856 ff        db      11111111b
6857 7f        db      01111111b
6858 7f        db      01111111b
6859 7f        db      01111111b
685a 7f        db      01111111b
685b 3f        db      00111111b
685c 3f        db      00111111b
685d 1e        db      00011110b

; Frame 2/4 - Cell (0,2)
685e 00        db      00000000b
685f 00        db      00000000b
6860 c0        db      11000000b
6861 e0        db      11100000b
6862 70        db      01110000b
6863 70        db      01110000b
6864 f0        db      11110000b
6865 f0        db      11110000b

; Frame 2/4 - Cell (1,2)
6866 e0        db      11100000b
6867 e0        db      11100000b
6868 e0        db      11100000b
6869 e0        db      11100000b
686a c0        db      11000000b
686b c0        db      11000000b
686c 80        db      10000000b
686d 00        db      00000000b

; Frame 3/4 - Cell (0,0)
686e 00        db      00000000b
686f 00        db      00000000b
6870 00        db      00000000b
6871 00        db      00000000b
6872 00        db      00000000b
6873 00        db      00000000b
6874 00        db      00000000b
6875 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6876 00        db      00000000b
6877 00        db      00000000b
6878 00        db      00000000b
6879 00        db      00000000b
687a 00        db      00000000b
687b 00        db      00000000b
687c 00        db      00000000b
687d 00        db      00000000b

; Frame 3/4 - Cell (0,1)
687e 00        db      00000000b
687f 03        db      00000011b
6880 07        db      00000111b
6881 0e        db      00001110b
6882 0e        db      00001110b
6883 0f        db      00001111b
6884 07        db      00000111b
6885 07        db      00000111b

; Frame 3/4 - Cell (1,1)
6886 03        db      00000011b
6887 03        db      00000011b
6888 01        db      00000001b
6889 01        db      00000001b
688a 00        db      00000000b
688b 00        db      00000000b
688c 00        db      00000000b
688d 00        db      00000000b

; Frame 3/4 - Cell (0,2)
688e c0        db      11000000b
688f f8        db      11111000b
6890 fe        db      11111110b
6891 df        db      11011111b
6892 de        db      11011110b
6893 fc        db      11111100b
6894 fc        db      11111100b
6895 f8        db      11111000b

; Frame 3/4 - Cell (1,2)
6896 f8        db      11111000b
6897 f8        db      11111000b
6898 f8        db      11111000b
6899 f0        db      11110000b
689a f0        db      11110000b
689b f0        db      11110000b
689c 78        db      01111000b
689d 1c        db      00011100b

; Frame 4/4 - Cell (0,0)
689e 00        db      00000000b
689f 00        db      00000000b
68a0 00        db      00000000b
68a1 00        db      00000000b
68a2 01        db      00000001b
68a3 01        db      00000001b
68a4 00        db      00000000b
68a5 00        db      00000000b

; Frame 4/4 - Cell (1,0)
68a6 00        db      00000000b
68a7 00        db      00000000b
68a8 00        db      00000000b
68a9 00        db      00000000b
68aa 00        db      00000000b
68ab 00        db      00000000b
68ac 00        db      00000000b
68ad 00        db      00000000b

; Frame 4/4 - Cell (0,1)
68ae 06        db      00000110b
68af 0f        db      00001111b
68b0 3f        db      00111111b
68b1 7f        db      01111111b
68b2 e6        db      11100110b
68b3 e6        db      11100110b
68b4 ff        db      11111111b
68b5 ff        db      11111111b

; Frame 4/4 - Cell (1,1)
68b6 ff        db      11111111b
68b7 7f        db      01111111b
68b8 7f        db      01111111b
68b9 7f        db      01111111b
68ba 7f        db      01111111b
68bb 3f        db      00111111b
68bc 3f        db      00111111b
68bd 1e        db      00011110b

; Frame 4/4 - Cell (0,2)
68bc 00        db      00000000b
68bf 00        db      00000000b
68c0 c0        db      11000000b
68c1 e0        db      11100000b
68c2 70        db      01110000b
68c3 70        db      01110000b
68c4 f0        db      11110000b
68c5 f0        db      11110000b

; Frame 4/4 - Cell (1,2)
68c6 e0        db      11100000b
68c7 e0        db      11100000b
68c8 e0        db      11100000b
68c9 e0        db      11100000b
68ca c0        db      11000000b
68cb c0        db      11000000b
68cc 80        db      10000000b
68cd 00        db      00000000b


; Hazard 4 - Farmer
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
68ce 00        db      00000000b
68cf 00        db      00000000b
68d0 00        db      00000000b
68d1 00        db      00000000b
68d2 00        db      00000000b
68d3 00        db      00000000b
68d4 04        db      00000100b
68d5 01        db      00000001b

; Frame 1/4 - Cell (1,0)
68d6 04        db      00000100b
68d7 01        db      00000001b
68d8 04        db      00000100b
68d9 01        db      00000001b
68da 04        db      00000100b
68db 00        db      00000000b
68dc 00        db      00000000b
68dd 00        db      00000000b

; Frame 1/4 - Cell (0,1)
68de 00        db      00000000b
68df 00        db      00000000b
68e0 00        db      00000000b
68e1 03        db      00000011b
68e2 00        db      00000000b
68e3 01        db      00000001b
68e4 00        db      00000000b
68e5 00        db      00000000b

; Frame 1/4 - Cell (1,1)
68e6 40        db      01000000b
68e7 0f        db      00001111b
68e8 40        db      01000000b
68e9 00        db      00000000b
68ea 00        db      00000000b
68eb 00        db      00000000b
68ec 00        db      00000000b
68ed 03        db      00000011b

; Frame 1/4 - Cell (0,2)
68ee 38        db      00111000b
68ef 38        db      00111000b
68f0 7c        db      01111100b
68f1 ff        db      11111111b
68f2 bc        db      10111100b
68f3 fc        db      11111100b
68f4 48        db      01001000b
68f5 78        db      01111000b

; Frame 1/4 - Cell (1,2)
68f6 30        db      00110000b
68f7 ff        db      11111111b
68f8 7f        db      01111111b
68f9 71        db      01110001b
68fa 50        db      01010000b
68fb 88        db      10001000b
68fc 88        db      10001000b
68fd 18        db      00011000b

; Frame 2/4 - Cell (0,0)
68fe 00        db      00000000b
68ff 00        db      00000000b
6900 00        db      00000000b
6901 00        db      00000000b
6902 00        db      00000000b
6903 00        db      00000000b
6904 40        db      01000000b
6905 10        db      00010000b

; Frame 2/4 - Cell (1,0)
6906 44        db      01000100b
6907 10        db      00010000b
6908 44        db      01000100b
6909 10        db      00010000b
690a 40        db      01000000b
690b 00        db      00000000b
690c 00        db      00000000b
690d 00        db      00000000b

; Frame 2/4 - Cell (0,1)
690e 03        db      00000011b
690f 03        db      00000011b
6910 07        db      00000111b
6911 3f        db      00111111b
6912 0b        db      00001011b
6913 1f        db      00011111b
6914 08        db      00001000b
6915 07        db      00000111b

; Frame 2/4 - Cell (1,1)
6916 03        db      00000011b
6917 ff        db      11111111b
6918 07        db      00000111b
6919 07        db      00000111b
691a 05        db      00000101b
691b 04        db      00000100b
691c 04        db      00000100b
691d 0c        db      00001100b

; Frame 2/4 - Cell (0,2)
691e 80        db      10000000b
691f 80        db      10000000b
6920 c0        db      11000000b
6921 f0        db      11110000b
6922 c0        db      11000000b
6923 c0        db      11000000b
6924 80        db      10000000b
6925 80        db      10000000b

; Frame 2/4 - Cell (1,2)
6926 00        db      00000000b
6927 f0        db      11110000b
6928 f0        db      11110000b
6929 10        db      00010000b
692a 80        db      10000000b
692b 40        db      01000000b
692c 20        db      00100000b
692d 40        db      01000000b

; Frame 3/4 - Cell (0,0)
692e 00        db      00000000b
692f 00        db      00000000b
6930 00        db      00000000b
6931 00        db      00000000b
6932 00        db      00000000b
6933 00        db      00000000b
6934 00        db      00000000b
6935 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6936 00        db      00000000b
6937 00        db      00000000b
6938 00        db      00000000b
6939 00        db      00000000b
693a 00        db      00000000b
693b 00        db      00000000b
693c 00        db      00000000b
693d 00        db      00000000b

; Frame 3/4 - Cell (0,1)
693e 00        db      00000000b
693f 00        db      00000000b
6940 00        db      00000000b
6941 03        db      00000011b
6942 00        db      00000000b
6943 01        db      00000001b
6944 00        db      00000000b
6945 00        db      00000000b

; Frame 3/4 - Cell (1,1)
6946 00        db      00000000b
6947 0f        db      00001111b
6948 00        db      00000000b
6949 00        db      00000000b
694a 00        db      00000000b
694b 00        db      00000000b
694c 00        db      00000000b
694d 00        db      00000000b

; Frame 3/4 - Cell (0,2)
694e 38        db      00111000b
694f 38        db      00111000b
6950 7c        db      01111100b
6951 ff        db      11111111b
6952 bc        db      10111100b
6953 fc        db      11111100b
6954 88        db      10001000b
6955 78        db      01111000b

; Frame 3/4 - Cell (1,2)
6956 30        db      00110000b
6957 ff        db      11111111b
6958 7f        db      01111111b
6959 71        db      01110001b
695a 30        db      00110000b
695b 18        db      00011000b
695c 10        db      00010000b
695d 30        db      00110000b

; Frame 4/4 - Cell (0,0)
695e 00        db      00000000b
695f 00        db      00000000b
6960 00        db      00000000b
6961 00        db      00000000b
6962 00        db      00000000b
6963 00        db      00000000b
6964 00        db      00000000b
6965 00        db      00000000b

; Frame 4/4 - Cell (1,0)
6966 00        db      00000000b
6967 00        db      00000000b
6968 00        db      00000000b
6969 00        db      00000000b
696a 00        db      00000000b
696b 00        db      00000000b
696c 00        db      00000000b
696d 00        db      00000000b

; Frame 4/4 - Cell (0,1)
696e 03        db      00000011b
696f 03        db      00000011b
6970 07        db      00000111b
6971 3f        db      00111111b
6972 0b        db      00001011b
6973 1f        db      00011111b
6974 08        db      00001000b
6975 07        db      00000111b

; Frame 4/4 - Cell (1,1)
6976 03        db      00000011b
6977 ff        db      11111111b
6978 07        db      00000111b
6979 07        db      00000111b
697a 04        db      00000100b
697b 04        db      00000100b
697c 18        db      00011000b
697d 00        db      00000000b

; Frame 4/4 - Cell (0,2)
697e 80        db      10000000b
697f 80        db      10000000b
6980 c0        db      11000000b
6981 f0        db      11110000b
6982 c0        db      11000000b
6983 c0        db      11000000b
6984 80        db      10000000b
6985 80        db      10000000b

; Frame 4/4 - Cell (1,2)
6986 00        db      00000000b
6987 f0        db      11110000b
6988 f0        db      11110000b
6989 10        db      00010000b
698a 80        db      10000000b
698b 80        db      10000000b
698c 40        db      01000000b
698d c0        db      11000000b


; Hazard 5 - Aeroplane
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
698e 00        db      00000000b
698f 00        db      00000000b
6990 00        db      00000000b
6991 00        db      00000000b
6992 00        db      00000000b
6993 00        db      00000000b
6994 00        db      00000000b
6995 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6996 01        db      00000001b
6997 03        db      00000011b
6998 07        db      00000111b
6999 03        db      00000011b
699a 00        db      00000000b
699b 00        db      00000000b
699c 00        db      00000000b
699d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
699e 00        db      00000000b
699f 00        db      00000000b
69a0 00        db      00000000b
69a1 00        db      00000000b
69a2 00        db      00000000b
69a3 00        db      00000000b
69a4 00        db      00000000b
69a5 00        db      00000000b

; Frame 1/4 - Cell (1,1)
69a6 ff        db      11111111b
69a7 49        db      01001001b
69a8 ff        db      11111111b
69a9 ff        db      11111111b
69aa 03        db      00000011b
69ab 01        db      00000001b
69ac 00        db      00000000b
69ad 00        db      00000000b

; Frame 1/4 - Cell (0,2)
69ae 00        db      00000000b
69af 00        db      00000000b
69b0 00        db      00000000b
69b1 00        db      00000000b
69b2 00        db      00000000b
69b3 02        db      00000010b
69b4 06        db      00000110b
69b5 0e        db      00001110b

; Frame 1/4 - Cell (1,2)
69b6 fe        db      11111110b
69b7 27        db      00100111b
69b8 ff        db      11111111b
69b9 fe        db      11111110b
69ba c0        db      11000000b
69bb e0        db      11100000b
69bc f0        db      11110000b
69bd 30        db      00110000b

; Frame 2/4 - Cell (0,0)
69bc 00        db      00000000b
69bf 00        db      00000000b
69c0 00        db      00000000b
69c1 00        db      00000000b
69c2 00        db      00000000b
69c3 00        db      00000000b
69c4 1f        db      00011111b
69c5 34        db      00110100b

; Frame 2/4 - Cell (1,0)
69c6 7f        db      01111111b
69c7 3f        db      00111111b
69c8 00        db      00000000b
69c9 00        db      00000000b
69ca 00        db      00000000b
69cb 00        db      00000000b
69cc 00        db      00000000b
69cd 00        db      00000000b

; Frame 2/4 - Cell (0,1)
69ce 00        db      00000000b
69cf 00        db      00000000b
69d0 00        db      00000000b
69d1 00        db      00000000b
69d2 00        db      00000000b
69d3 00        db      00000000b
69d4 ff        db      11111111b
69d5 92        db      10010010b

; Frame 2/4 - Cell (1,1)
69d6 ff        db      11111111b
69d7 ff        db      11111111b
69d8 3c        db      00111100b
69d9 1e        db      00011110b
69da 0f        db      00001111b
69db 03        db      00000011b
69dc 00        db      00000000b
69dd 00        db      00000000b

; Frame 2/4 - Cell (0,2)
69de 00        db      00000000b
69df 00        db      00000000b
69e0 00        db      00000000b
69e1 20        db      00100000b
69e2 60        db      01100000b
69e3 e0        db      11100000b
69e4 e0        db      11100000b
69e5 70        db      01110000b

; Frame 2/4 - Cell (1,2)
69e6 f0        db      11110000b
69e7 e0        db      11100000b
69e8 00        db      00000000b
69e9 00        db      00000000b
69ea 00        db      00000000b
69eb 00        db      00000000b
69ec 00        db      00000000b
69ed 00        db      00000000b

; Frame 3/4 - Cell (0,0)
69ee 00        db      00000000b
69ef 00        db      00000000b
69f0 00        db      00000000b
69f1 00        db      00000000b
69f2 01        db      00000001b
69f3 03        db      00000011b
69f4 07        db      00000111b
69f5 03        db      00000011b

; Frame 3/4 - Cell (1,0)
69f6 00        db      00000000b
69f7 00        db      00000000b
69f8 00        db      00000000b
69f9 00        db      00000000b
69fa 00        db      00000000b
69fb 00        db      00000000b
69fc 00        db      00000000b
69fd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
69fe 00        db      00000000b
69ff 00        db      00000000b
6a00 00        db      00000000b
6a01 00        db      00000000b
6a02 ff        db      11111111b
6a03 49        db      01001001b
6a04 ff        db      11111111b
6a05 ff        db      11111111b

; Frame 3/4 - Cell (1,1)
6a06 03        db      00000011b
6a07 01        db      00000001b
6a08 00        db      00000000b
6a09 00        db      00000000b
6a0a 00        db      00000000b
6a0b 00        db      00000000b
6a0c 00        db      00000000b
6a0d 00        db      00000000b

; Frame 3/4 - Cell (0,2)
6a0e 00        db      00000000b
6a0f 02        db      00000010b
6a10 06        db      00000110b
6a11 0e        db      00001110b
6a12 fe        db      11111110b
6a13 27        db      00100111b
6a14 ff        db      11111111b
6a15 fe        db      11111110b

; Frame 3/4 - Cell (1,2)
6a16 c0        db      11000000b
6a17 e0        db      11100000b
6a18 f0        db      11110000b
6a19 30        db      00110000b
6a1a 00        db      00000000b
6a1b 00        db      00000000b
6a1c 00        db      00000000b
6a1d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
6a1e 00        db      00000000b
6a1f 00        db      00000000b
6a20 00        db      00000000b
6a21 00        db      00000000b
6a22 00        db      00000000b
6a23 00        db      00000000b
6a24 1f        db      00011111b
6a25 34        db      00110100b

; Frame 4/4 - Cell (1,0)
6a26 7f        db      01111111b
6a27 3f        db      00111111b
6a28 00        db      00000000b
6a29 00        db      00000000b
6a2a 00        db      00000000b
6a2b 00        db      00000000b
6a2c 00        db      00000000b
6a2d 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6a2e 00        db      00000000b
6a2f 00        db      00000000b
6a30 00        db      00000000b
6a31 00        db      00000000b
6a32 00        db      00000000b
6a33 00        db      00000000b
6a34 ff        db      11111111b
6a35 92        db      10010010b

; Frame 4/4 - Cell (1,1)
6a36 ff        db      11111111b
6a37 ff        db      11111111b
6a38 3c        db      00111100b
6a39 1e        db      00011110b
6a3a 0f        db      00001111b
6a3b 03        db      00000011b
6a3c 00        db      00000000b
6a3d 00        db      00000000b

; Frame 4/4 - Cell (0,2)
6a3e 00        db      00000000b
6a3f 00        db      00000000b
6a40 00        db      00000000b
6a41 20        db      00100000b
6a42 60        db      01100000b
6a43 e0        db      11100000b
6a44 e0        db      11100000b
6a45 70        db      01110000b

; Frame 4/4 - Cell (1,2)
6a46 f0        db      11110000b
6a47 e0        db      11100000b
6a48 00        db      00000000b
6a49 00        db      00000000b
6a4a 00        db      00000000b
6a4b 00        db      00000000b
6a4c 00        db      00000000b
6a4d 00        db      00000000b


; Hazard 6 - Bus
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
6a4e 00        db      00000000b
6a4f 00        db      00000000b
6a50 00        db      00000000b
6a51 00        db      00000000b
6a52 00        db      00000000b
6a53 00        db      00000000b
6a54 01        db      00000001b
6a55 03        db      00000011b

; Frame 1/4 - Cell (1,0)
6a56 03        db      00000011b
6a57 03        db      00000011b
6a58 03        db      00000011b
6a59 03        db      00000011b
6a5a 00        db      00000000b
6a5b 00        db      00000000b
6a5c 00        db      00000000b
6a5d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6a5e 00        db      00000000b
6a5f 00        db      00000000b
6a60 7f        db      01111111b
6a61 49        db      01001001b
6a62 49        db      01001001b
6a63 49        db      01001001b
6a64 7f        db      01111111b
6a65 ff        db      11111111b

; Frame 1/4 - Cell (1,1)
6a66 ff        db      11111111b
6a67 ff        db      11111111b
6a68 ff        db      11111111b
6a69 ff        db      11111111b
6a6a 47        db      01000111b
6a6b 93        db      10010011b
6a6c bb        db      10111011b
6a6d 10        db      00010000b

; Frame 1/4 - Cell (0,2)
6a6e 00        db      00000000b
6a6f 00        db      00000000b
6a70 fe        db      11111110b
6a71 22        db      00100010b
6a72 22        db      00100010b
6a73 22        db      00100010b
6a74 e2        db      11100010b
6a75 e2        db      11100010b

; Frame 1/4 - Cell (1,2)
6a76 e2        db      11100010b
6a77 e2        db      11100010b
6a78 e2        db      11100010b
6a79 fe        db      11111110b
6a7a e2        db      11100010b
6a7b c9        db      11001001b
6a7c dd        db      11011101b
6a7d 08        db      00001000b

; Frame 2/4 - Cell (0,0)
6a7e 00        db      00000000b
6a7f 00        db      00000000b
6a80 00        db      00000000b
6a81 07        db      00000111b
6a82 04        db      00000100b
6a83 04        db      00000100b
6a84 04        db      00000100b
6a85 17        db      00010111b

; Frame 2/4 - Cell (1,0)
6a86 3f        db      00111111b
6a87 3f        db      00111111b
6a88 3f        db      00111111b
6a89 3f        db      00111111b
6a8a 04        db      00000100b
6a8b 0a        db      00001010b
6a8c 09        db      00001001b
6a8d 02        db      00000010b

; Frame 2/4 - Cell (0,1)
6a8e 00        db      00000000b
6a8f 00        db      00000000b
6a90 00        db      00000000b
6a91 ff        db      11111111b
6a92 92        db      10010010b
6a93 92        db      10010010b
6a94 92        db      10010010b
6a95 fe        db      11111110b

; Frame 2/4 - Cell (1,1)
6a96 fe        db      11111110b
6a97 fe        db      11111110b
6a98 fe        db      11111110b
6a99 ff        db      11111111b
6a9a 7e        db      01111110b
6a9b bd        db      10111101b
6a9c 3c        db      00111100b
6a9d 81        db      10000001b

; Frame 2/4 - Cell (0,2)
6a9e 00        db      00000000b
6a9f 00        db      00000000b
6aa0 00        db      00000000b
6aa1 e0        db      11100000b
6aa2 20        db      00100000b
6aa3 20        db      00100000b
6aa4 20        db      00100000b
6aa5 20        db      00100000b

; Frame 2/4 - Cell (1,2)
6aa6 20        db      00100000b
6aa7 20        db      00100000b
6aa8 20        db      00100000b
6aa9 e0        db      11100000b
6aaa 20        db      00100000b
6aab 50        db      01010000b
6aac 90        db      10010000b
6aad 40        db      01000000b

; Frame 3/4 - Cell (0,0)
6aae 00        db      00000000b
6aaf 00        db      00000000b
6ab0 00        db      00000000b
6ab1 00        db      00000000b
6ab2 00        db      00000000b
6ab3 00        db      00000000b
6ab4 00        db      00000000b
6ab5 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6ab6 01        db      00000001b
6ab7 03        db      00000011b
6ab8 03        db      00000011b
6ab9 03        db      00000011b
6aba 00        db      00000000b
6abb 00        db      00000000b
6abc 00        db      00000000b
6abd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6abe 00        db      00000000b
6abf 00        db      00000000b
6ac0 00        db      00000000b
6ac1 00        db      00000000b
6ac2 7f        db      01111111b
6ac3 49        db      01001001b
6ac4 49        db      01001001b
6ac5 49        db      01001001b

; Frame 3/4 - Cell (1,1)
6ac6 7f        db      01111111b
6ac7 ff        db      11111111b
6ac8 ff        db      11111111b
6ac9 ff        db      11111111b
6aca 47        db      01000111b
6acb 93        db      10010011b
6acc bb        db      10111011b
6acd 10        db      00010000b

; Frame 3/4 - Cell (0,2)
6ace 00        db      00000000b
6acf 00        db      00000000b
6ad0 00        db      00000000b
6ad1 00        db      00000000b
6ad2 fe        db      11111110b
6ad3 22        db      00100010b
6ad4 22        db      00100010b
6ad5 22        db      00100010b

; Frame 3/4 - Cell (1,2)
6ad6 e2        db      11100010b
6ad7 e2        db      11100010b
6ad8 e2        db      11100010b
6ad9 fe        db      11111110b
6ada e2        db      11100010b
6adb c9        db      11001001b
6adc dd        db      11011101b
6add 08        db      00001000b

; Frame 4/4 - Cell (0,0)
6ade 00        db      00000000b
6adf 00        db      00000000b
6ae0 00        db      00000000b
6ae1 07        db      00000111b
6ae2 04        db      00000100b
6ae3 04        db      00000100b
6ae4 04        db      00000100b
6ae5 17        db      00010111b

; Frame 4/4 - Cell (1,0)
6ae6 3f        db      00111111b
6ae7 3f        db      00111111b
6ae8 3f        db      00111111b
6ae9 3f        db      00111111b
6aea 04        db      00000100b
6aeb 0a        db      00001010b
6aec 09        db      00001001b
6aed 02        db      00000010b

; Frame 4/4 - Cell (0,1)
6aee 00        db      00000000b
6aef 00        db      00000000b
6af0 00        db      00000000b
6af1 ff        db      11111111b
6af2 92        db      10010010b
6af3 92        db      10010010b
6af4 92        db      10010010b
6af5 fe        db      11111110b

; Frame 4/4 - Cell (1,1)
6af6 fe        db      11111110b
6af7 fe        db      11111110b
6af8 fe        db      11111110b
6af9 ff        db      11111111b
6afa 7e        db      01111110b
6afb bd        db      10111101b
6afc 3c        db      00111100b
6afd 81        db      10000001b

; Frame 4/4 - Cell (0,2)
6afe 00        db      00000000b
6aff 00        db      00000000b
6b00 00        db      00000000b
6b01 e0        db      11100000b
6b02 20        db      00100000b
6b03 20        db      00100000b
6b04 20        db      00100000b
6b05 20        db      00100000b

; Frame 4/4 - Cell (1,2)
6b06 20        db      00100000b
6b07 20        db      00100000b
6b08 20        db      00100000b
6b09 e0        db      11100000b
6b0a 20        db      00100000b
6b0b 50        db      01010000b
6b0c 90        db      10010000b
6b0d 40        db      01000000b


; Hazard 7 - Dinosaur
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
6b0e 00        db      00000000b
6b0f 00        db      00000000b
6b10 00        db      00000000b
6b11 00        db      00000000b
6b12 00        db      00000000b
6b13 00        db      00000000b
6b14 00        db      00000000b
6b15 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6b16 00        db      00000000b
6b17 00        db      00000000b
6b18 00        db      00000000b
6b19 00        db      00000000b
6b1a 00        db      00000000b
6b1b 00        db      00000000b
6b1c 00        db      00000000b
6b1d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6b1e 00        db      00000000b
6b1f 00        db      00000000b
6b20 00        db      00000000b
6b21 30        db      00110000b
6b22 58        db      01011000b
6b23 7c        db      01111100b
6b24 6c        db      01101100b
6b25 0e        db      00001110b

; Frame 1/4 - Cell (1,1)
6b26 0f        db      00001111b
6b27 1f        db      00011111b
6b28 7f        db      01111111b
6b29 87        db      10000111b
6b2a 07        db      00000111b
6b2b 0f        db      00001111b
6b2c 3c        db      00111100b
6b2d 78        db      01111000b

; Frame 1/4 - Cell (0,2)
6b2e 00        db      00000000b
6b2f 00        db      00000000b
6b30 00        db      00000000b
6b31 00        db      00000000b
6b32 00        db      00000000b
6b33 00        db      00000000b
6b34 00        db      00000000b
6b35 00        db      00000000b

; Frame 1/4 - Cell (1,2)
6b36 00        db      00000000b
6b37 80        db      10000000b
6b38 83        db      10000011b
6b39 c4        db      11000100b
6b3a c4        db      11000100b
6b3b e8        db      11101000b
6b3c f8        db      11111000b
6b3d f0        db      11110000b

; Frame 2/4 - Cell (0,0)
6b3e 00        db      00000000b
6b3f 00        db      00000000b
6b40 00        db      00000000b
6b41 03        db      00000011b
6b42 05        db      00000101b
6b43 07        db      00000111b
6b44 06        db      00000110b
6b45 00        db      00000000b

; Frame 2/4 - Cell (1,0)
6b46 00        db      00000000b
6b47 01        db      00000001b
6b48 07        db      00000111b
6b49 08        db      00001000b
6b4a 00        db      00000000b
6b4b 00        db      00000000b
6b4c 03        db      00000011b
6b4d 07        db      00000111b

; Frame 2/4 - Cell (0,1)
6b4e 00        db      00000000b
6b4f 00        db      00000000b
6b50 00        db      00000000b
6b51 00        db      00000000b
6b52 80        db      10000000b
6b53 c0        db      11000000b
6b54 c0        db      11000000b
6b55 e0        db      11100000b

; Frame 2/4 - Cell (1,1)
6b56 f0        db      11110000b
6b57 f8        db      11111000b
6b58 f8        db      11111000b
6b59 7c        db      01111100b
6b5a 7c        db      01111100b
6b5b fe        db      11111110b
6b5c cf        db      11001111b
6b5d 8f        db      10001111b

; Frame 2/4 - Cell (0,2)
6b5e 00        db      00000000b
6b5f 00        db      00000000b
6b60 00        db      00000000b
6b61 00        db      00000000b
6b62 00        db      00000000b
6b63 00        db      00000000b
6b64 00        db      00000000b
6b65 00        db      00000000b

; Frame 2/4 - Cell (1,2)
6b66 00        db      00000000b
6b67 00        db      00000000b
6b68 30        db      00110000b
6b69 40        db      01000000b
6b6a 40        db      01000000b
6b6b 80        db      10000000b
6b6c 80        db      10000000b
6b6d 00        db      00000000b

; Frame 3/4 - Cell (0,0)
6b6e 00        db      00000000b
6b6f 00        db      00000000b
6b70 00        db      00000000b
6b71 00        db      00000000b
6b72 00        db      00000000b
6b73 00        db      00000000b
6b74 00        db      00000000b
6b75 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6b76 01        db      00000001b
6b77 00        db      00000000b
6b78 00        db      00000000b
6b79 00        db      00000000b
6b7a 00        db      00000000b
6b7b 00        db      00000000b
6b7c 00        db      00000000b
6b7d 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6b7e 00        db      00000000b
6b7f 00        db      00000000b
6b80 00        db      00000000b
6b81 e0        db      11100000b
6b82 d0        db      11010000b
6b83 78        db      01111000b
6b84 18        db      00011000b
6b85 1c        db      00011100b

; Frame 3/4 - Cell (1,1)
6b86 1e        db      00011110b
6b87 ff        db      11111111b
6b88 3f        db      00111111b
6b89 0f        db      00001111b
6b8a 0f        db      00001111b
6b8b 1f        db      00011111b
6b8c 79        db      01111001b
6b8d f2        db      11110010b

; Frame 3/4 - Cell (0,2)
6b8e 00        db      00000000b
6b8f 00        db      00000000b
6b90 00        db      00000000b
6b91 00        db      00000000b
6b92 00        db      00000000b
6b93 00        db      00000000b
6b94 00        db      00000000b
6b95 00        db      00000000b

; Frame 3/4 - Cell (1,2)
6b96 00        db      00000000b
6b97 00        db      00000000b
6b98 00        db      00000000b
6b99 80        db      10000000b
6b9a 83        db      10000011b
6b9b dc        db      11011100b
6b9c f0        db      11110000b
6b9d e0        db      11100000b

; Frame 4/4 - Cell (0,0)
6b9e 00        db      00000000b
6b9f 00        db      00000000b
6ba0 00        db      00000000b
6ba1 0e        db      00001110b
6ba2 0d        db      00001101b
6ba3 07        db      00000111b
6ba4 01        db      00000001b
6ba5 01        db      00000001b

; Frame 4/4 - Cell (1,0)
6ba6 11        db      00010001b
6ba7 0f        db      00001111b
6ba8 03        db      00000011b
6ba9 00        db      00000000b
6baa 00        db      00000000b
6bab 01        db      00000001b
6bac 07        db      00000111b
6bad 0f        db      00001111b

; Frame 4/4 - Cell (0,1)
6bae 00        db      00000000b
6baf 00        db      00000000b
6bb0 00        db      00000000b
6bb1 00        db      00000000b
6bb2 00        db      00000000b
6bb3 80        db      10000000b
6bb4 80        db      10000000b
6bb5 c0        db      11000000b

; Frame 4/4 - Cell (1,1)
6bb6 e0        db      11100000b
6bb7 f0        db      11110000b
6bb8 f0        db      11110000b
6bb9 f8        db      11111000b
6bba f8        db      11111000b
6bbb fd        db      11111101b
6bbc 9f        db      10011111b
6bbd 2e        db      00101110b

; Frame 4/4 - Cell (0,2)
6bbe 00        db      00000000b
6bbf 00        db      00000000b
6bc0 00        db      00000000b
6bc1 00        db      00000000b
6bc2 00        db      00000000b
6bc3 00        db      00000000b
6bc4 00        db      00000000b
6bc5 00        db      00000000b

; Frame 4/4 - Cell (1,2)
6bc6 00        db      00000000b
6bc7 00        db      00000000b
6bc8 00        db      00000000b
6bc9 00        db      00000000b
6bca 30        db      00110000b
6bcb c0        db      11000000b
6bcc 00        db      00000000b
6bcd 00        db      00000000b


; Hazard 8 - Witch
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
6bce 00        db      00000000b
6bcf 00        db      00000000b
6bd0 00        db      00000000b
6bd1 00        db      00000000b
6bd2 00        db      00000000b
6bd3 00        db      00000000b
6bd4 00        db      00000000b
6bd5 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6bd6 00        db      00000000b
6bd7 00        db      00000000b
6bd8 00        db      00000000b
6bd9 00        db      00000000b
6bda 07        db      00000111b
6bdb 00        db      00000000b
6bdc 00        db      00000000b
6bdd 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6bde 04        db      00000100b
6bdf 0e        db      00001110b
6be0 0e        db      00001110b
6be1 1f        db      00011111b
6be2 ff        db      11111111b
6be3 1f        db      00011111b
6be4 2f        db      00101111b
6be5 7e        db      01111110b

; Frame 1/4 - Cell (1,1)
6be6 1e        db      00011110b
6be7 44        db      01000100b
6be8 3e        db      00111110b
6b89 0e        db      00001110b
6bea ff        db      11111111b
6beb 0e        db      00001110b
6bec 04        db      00000100b
6bed 0c        db      00001100b

; Frame 1/4 - Cell (0,2)
6bee 00        db      00000000b
6bef 00        db      00000000b
6bf0 00        db      00000000b
6bf1 00        db      00000000b
6bf2 e0        db      11100000b
6bf3 00        db      00000000b
6bf4 00        db      00000000b
6bf5 00        db      00000000b

; Frame 1/4 - Cell (1,2)
6bf6 00        db      00000000b
6bf7 0f        db      00001111b
6bf8 10        db      00010000b
6bf9 27        db      00100111b
6bfa fc        db      11111100b
6bfb 13        db      00010011b
6bfc 0c        db      00001100b
6bfd 03        db      00000011b

; Frame 2/4 - Cell (0,0)
6bfe 00        db      00000000b
6bff 00        db      00000000b
6c00 00        db      00000000b
6c01 01        db      00000001b
6c02 0f        db      00001111b
6c03 01        db      00000001b
6c04 02        db      00000010b
6c05 07        db      00000111b

; Frame 2/4 - Cell (1,0)
6c06 01        db      00000001b
6c07 04        db      00000100b
6c08 03        db      00000011b
6c09 00        db      00000000b
6c0a 7f        db      01111111b
6c0b 00        db      00000000b
6c0c 00        db      00000000b
6c0d 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6c0e 40        db      01000000b
6c0f e0        db      11100000b
6c10 e0        db      11100000b
6c11 f0        db      11110000b
6c12 fe        db      11111110b
6c13 f0        db      11110000b
6c14 f0        db      11110000b
6c15 e0        db      11100000b

; Frame 2/4 - Cell (1,1)
6c16 e0        db      11100000b
6c17 40        db      01000000b
6c18 e1        db      11100001b
6c19 e2        db      11100010b
6c1a ff        db      11111111b
6c1b e1        db      11100001b
6c1c 40        db      01000000b
6c1d c0        db      11000000b

; Frame 2/4 - Cell (0,2)
6c1e 00        db      00000000b
6c1f 00        db      00000000b
6c20 00        db      00000000b
6c21 00        db      00000000b
6c22 00        db      00000000b
6c23 00        db      00000000b
6c24 00        db      00000000b
6c25 00        db      00000000b

; Frame 2/4 - Cell (1,2)
6c26 00        db      00000000b
6c27 f0        db      11110000b
6c28 00        db      00000000b
6c29 70        db      01110000b
6c2a c0        db      11000000b
6c2b 30        db      00110000b
6c2c c0        db      11000000b
6c2d 30        db      00110000b

; Frame 3/4 - Cell (0,0)
6c2e 00        db      00000000b
6c2f 00        db      00000000b
6c30 00        db      00000000b
6c31 00        db      00000000b
6c32 00        db      00000000b
6c33 00        db      00000000b
6c34 00        db      00000000b
6c35 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6c36 00        db      00000000b
6c37 00        db      00000000b
6c38 00        db      00000000b
6c39 00        db      00000000b
6c3a 07        db      00000111b
6c3b 00        db      00000000b
6c3c 00        db      00000000b
6c3d 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6c3e 04        db      00000100b
6c3f 0e        db      00001110b
6c40 0e        db      00001110b
6c41 1f        db      00011111b
6c42 ff        db      11111111b
6c43 1f        db      00011111b
6c44 2f        db      00101111b
6c45 7e        db      01111110b

; Frame 3/4 - Cell (1,1)
6c46 1e        db      00011110b
6c47 04        db      00000100b
6c48 3e        db      00111110b
6c49 4e        db      01001110b
6c4a ff        db      11111111b
6c4b 0e        db      00001110b
6c4c 04        db      00000100b
6c4d 0c        db      00001100b

; Frame 3/4 - Cell (0,2)
6c4e 00        db      00000000b
6c4f 00        db      00000000b
6c50 00        db      00000000b
6c51 00        db      00000000b
6c52 e0        db      11100000b
6c53 00        db      00000000b
6c54 00        db      00000000b
6c55 00        db      00000000b

; Frame 3/4 - Cell (1,2)
6c56 00        db      00000000b
6c57 0f        db      00001111b
6c58 10        db      00010000b
6c59 27        db      00100111b
6c5a fc        db      11111100b
6c5b 13        db      00010011b
6c5c 0c        db      00001100b
6c5d 03        db      00000011b

; Frame 4/4 - Cell (0,0)
6c5e 00        db      00000000b
6c5f 00        db      00000000b
6c60 00        db      00000000b
6c61 01        db      00000001b
6c62 0f        db      00001111b
6c63 01        db      00000001b
6c64 02        db      00000010b
6c65 07        db      00000111b

; Frame 4/4 - Cell (1,0)
6c66 01        db      00000001b
6c67 00        db      00000000b
6c68 03        db      00000011b
6c69 04        db      00000100b
6c6a 7f        db      01111111b
6c6b 00        db      00000000b
6c6c 00        db      00000000b
6c6d 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6c6e 40        db      01000000b
6c6f e0        db      11100000b
6c70 e0        db      11100000b
6c71 f0        db      11110000b
6c72 fe        db      11111110b
6c73 f0        db      11110000b
6c74 f0        db      11110000b
6c75 e0        db      11100000b

; Frame 4/4 - Cell (1,1)
6c76 e0        db      11100000b
6c77 40        db      01000000b
6c78 e1        db      11100001b
6c79 e2        db      11100010b
6c7a ff        db      11111111b
6c7b e1        db      11100001b
6c7c 40        db      01000000b
6c7d c0        db      11000000b

; Frame 4/4 - Cell (0,2)
6c7e 00        db      00000000b
6c7f 00        db      00000000b
6c80 00        db      00000000b
6c81 00        db      00000000b
6c82 00        db      00000000b
6c83 00        db      00000000b
6c84 00        db      00000000b
6c85 00        db      00000000b

; Frame 4/4 - Cell (1,2)
6c86 00        db      00000000b
6c87 f0        db      11110000b
6c88 00        db      00000000b
6c89 70        db      01110000b
6c8a c0        db      11000000b
6c8b 30        db      00110000b
6c8c c0        db      11000000b
6c8d 30        db      00110000b


; Hazard 9 - Axe
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
6c8e 00        db      00000000b
6c8f 00        db      00000000b
6c90 00        db      00000000b
6c91 00        db      00000000b
6c92 00        db      00000000b
6c93 00        db      00000000b
6c94 00        db      00000000b
6c95 00        db      00000000b

; Frame 1/4 - Cell (1,0)
6c96 00        db      00000000b
6c97 00        db      00000000b
6c98 00        db      00000000b
6c99 00        db      00000000b
6c9a 00        db      00000000b
6c9b 00        db      00000000b
6c9c 00        db      00000000b
6c9d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6c9e 01        db      00000001b
6c9f 01        db      00000001b
6ca0 0f        db      00001111b
6ca1 7f        db      01111111b
6ca2 7f        db      01111111b
6ca3 3f        db      00111111b
6ca4 3f        db      00111111b
6ca5 1f        db      00011111b

; Frame 1/4 - Cell (1,1)
6ca6 1e        db      00011110b
6ca7 0c        db      00001100b
6ca8 08        db      00001000b
6ca9 00        db      00000000b
6caa 00        db      00000000b
6cab 00        db      00000000b
6cac 00        db      00000000b
6cad 00        db      00000000b

; Frame 1/4 - Cell (0,2)
6cae 80        db      10000000b
6caf e0        db      11100000b
6cb0 e0        db      11100000b
6cb1 e0        db      11100000b
6cb2 e0        db      11100000b
6cb3 e0        db      11100000b
6cb4 b0        db      10110000b
6cb5 30        db      00110000b

; Frame 1/4 - Cell (1,2)
6cb6 18        db      00011000b
6cb7 18        db      00011000b
6cb8 0c        db      00001100b
6cb9 0c        db      00001100b
6cba 06        db      00000110b
6cbb 06        db      00000110b
6cbc 03        db      00000011b
6cbd 03        db      00000011b

; Frame 2/4 - Cell (0,0)
6cbe 00        db      00000000b
6cbf 00        db      00000000b
6cc0 00        db      00000000b
6cc1 00        db      00000000b
6cc2 00        db      00000000b
6cc3 00        db      00000000b
6cc4 03        db      00000011b
6cc5 07        db      00000111b

; Frame 2/4 - Cell (1,0)
6cc6 0f        db      00001111b
6cc7 1f        db      00011111b
6cc8 0f        db      00001111b
6cc9 07        db      00000111b
6cca 03        db      00000011b
6ccb 01        db      00000001b
6ccc 00        db      00000000b
6ccd 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6cce 00        db      00000000b
6ccf 00        db      00000000b
6cd0 00        db      00000000b
6cd1 00        db      00000000b
6cd2 f0        db      11110000b
6cd3 f0        db      11110000b
6cd4 f0        db      11110000b
6cd5 f8        db      11111000b

; Frame 2/4 - Cell (1,1)
6cd6 dc        db      11011100b
6cd7 ce        db      11001110b
6cd8 87        db      10000111b
6cd9 83        db      10000011b
6cda 01        db      00000001b
6cdb 00        db      00000000b
6cdc 00        db      00000000b
6cdd 00        db      00000000b

; Frame 2/4 - Cell (0,2)
6cde 00        db      00000000b
6cdf 00        db      00000000b
6ce0 00        db      00000000b
6ce1 00        db      00000000b
6ce2 00        db      00000000b
6ce3 00        db      00000000b
6ce4 00        db      00000000b
6ce5 00        db      00000000b

; Frame 2/4 - Cell (1,2)
6ce6 00        db      00000000b
6ce7 00        db      00000000b
6ce8 00        db      00000000b
6ce9 80        db      10000000b
6cea c0        db      11000000b
6ceb e0        db      11100000b
6cec 70        db      01110000b
6ced 30        db      00110000b

; Frame 3/4 - Cell (0,0)
6cee 00        db      00000000b
6cef 00        db      00000000b
6cf0 00        db      00000000b
6cf1 00        db      00000000b
6cf2 00        db      00000000b
6cf3 00        db      00000000b
6cf4 00        db      00000000b
6cf5 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6cf6 00        db      00000000b
6cf7 00        db      00000000b
6cf8 01        db      00000001b
6cf9 01        db      00000001b
6cfa 00        db      00000000b
6cfb 00        db      00000000b
6cfc 00        db      00000000b
6cfd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6cfe 00        db      00000000b
6cff 00        db      00000000b
6d00 00        db      00000000b
6d01 00        db      00000000b
6d02 3e        db      00111110b
6d03 3e        db      00111110b
6d04 1f        db      00011111b
6d05 3f        db      00111111b

; Frame 3/4 - Cell (1,1)
6d06 7c        db      01111100b
6d07 fc        db      11111100b
6d08 fc        db      11111100b
6d09 f8        db      11111000b
6d0a f8        db      11111000b
6d0b 78        db      01111000b
6d0c 30        db      00110000b
6d0d 10        db      00010000b

; Frame 3/4 - Cell (0,2)
6d0e 00        db      00000000b
6d0f 00        db      00000000b
6d10 00        db      00000000b
6d11 00        db      00000000b
6d12 00        db      00000000b
6d13 00        db      00000000b
6d14 00        db      00000000b
6d15 c0        db      11000000b

; Frame 3/4 - Cell (1,2)
6d16 f0        db      11110000b
6d17 3c        db      00111100b
6d18 0f        db      00001111b
6d19 03        db      00000011b
6d1a 00        db      00000000b
6d1b 00        db      00000000b
6d1c 00        db      00000000b
6d1d 00        db      00000000b

; Frame 4/4 - Cell (0,0)
6d1e 00        db      00000000b
6d1f 00        db      00000000b
6d20 00        db      00000000b
6d21 00        db      00000000b
6d22 00        db      00000000b
6d23 00        db      00000000b
6d24 03        db      00000011b
6d25 07        db      00000111b

; Frame 4/4 - Cell (1,0)
6d26 0f        db      00001111b
6d27 1f        db      00011111b
6d28 0f        db      00001111b
6d29 07        db      00000111b
6d2a 03        db      00000011b
6d2b 01        db      00000001b
6d2c 00        db      00000000b
6d2d 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6d2e 00        db      00000000b
6d2f 00        db      00000000b
6d30 00        db      00000000b
6d31 00        db      00000000b
6d32 f0        db      11110000b
6d33 f0        db      11110000b
6d34 f0        db      11110000b
6d35 f8        db      11111000b

; Frame 4/4 - Cell (1,1)
6d36 dc        db      11011100b
6d37 ce        db      11001110b
6d38 87        db      10000111b
6d39 83        db      10000011b
6d3a 01        db      00000001b
6d3b 00        db      00000000b
6d3c 00        db      00000000b
6d3d 00        db      00000000b

; Frame 4/4 - Cell (0,2)
6d3e 00        db      00000000b
6d3f 00        db      00000000b
6d40 00        db      00000000b
6d41 00        db      00000000b
6d42 00        db      00000000b
6d43 00        db      00000000b
6d44 00        db      00000000b
6d45 00        db      00000000b

; Frame 4/4 - Cell (1,2)
6d46 00        db      00000000b
6d47 00        db      00000000b
6d48 00        db      00000000b
6d49 80        db      10000000b
6d4a c0        db      11000000b
6d4b e0        db      11100000b
6d4c 70        db      01110000b
6d4d 30        db      00110000b


; Hazard 10 - Snake
; 2x3 cell sprite / 4 frames in animation

; Frame 1/4 - Cell (0,0)
6d4e 01        db      00000001b
6d4f 02        db      00000010b
6d50 03        db      00000011b
6d51 04        db      00000100b
6d52 08        db      00001000b
6d53 70        db      01110000b
6d54 10        db      00010000b
6d55 10        db      00010000b

; Frame 1/4 - Cell (1,0)
6d56 00        db      00000000b
6d57 00        db      00000000b
6d58 00        db      00000000b
6d59 00        db      00000000b
6d5a 00        db      00000000b
6d5b 00        db      00000000b
6d5c 00        db      00000000b
6d5d 00        db      00000000b

; Frame 1/4 - Cell (0,1)
6d5e 80        db      10000000b
6d5f c0        db      11000000b
6d60 c0        db      11000000b
6d61 60        db      01100000b
6d62 60        db      01100000b
6d63 60        db      01100000b
6d64 60        db      01100000b
6d65 60        db      01100000b

; Frame 1/4 - Cell (1,1)
6d66 61        db      01100001b
6d67 63        db      01100011b
6d68 63        db      01100011b
6d69 66        db      01100110b
6d6a 66        db      01100110b
6d6b 7c        db      01111100b
6d6c 3c        db      00111100b
6d6d 18        db      00011000b

; Frame 1/4 - Cell (0,2)
6d6e 00        db      00000000b
6d6f 00        db      00000000b
6d70 00        db      00000000b
6d71 00        db      00000000b
6d72 00        db      00000000b
6d73 00        db      00000000b
6d74 00        db      00000000b
6d75 00        db      00000000b

; Frame 1/4 - Cell (1,2)
6d76 81        db      10000001b
6d77 c3        db      11000011b
6d78 c3        db      11000011b
6d79 66        db      01100110b
6d7a 66        db      01100110b
6d7b 3c        db      00111100b
6d7c 3c        db      00111100b
6d7d 18        db      00011000b

; Frame 2/4 - Cell (0,0)
6d7e 30        db      00110000b
6d7f 58        db      01011000b
6d80 78        db      01111000b
6d81 8c        db      10001100b
6d82 0c        db      00001100b
6d83 0c        db      00001100b
6d84 0c        db      00001100b
6d85 0c        db      00001100b

; Frame 2/4 - Cell (1,0)
6d86 0d        db      00001101b
6d87 0f        db      00001111b
6d88 0f        db      00001111b
6d89 0e        db      00001110b
6d8a 0e        db      00001110b
6d8b 04        db      00000100b
6d8c 00        db      00000000b
6d8d 00        db      00000000b

; Frame 2/4 - Cell (0,1)
6d8e 00        db      00000000b
6d8f 00        db      00000000b
6d90 00        db      00000000b
6d91 00        db      00000000b
6d92 00        db      00000000b
6d93 00        db      00000000b
6d94 00        db      00000000b
6d95 00        db      00000000b

; Frame 2/4 - Cell (1,1)
6d96 81        db      10000001b
6d97 c3        db      11000011b
6d98 c3        db      11000011b
6999 66        db      01100110b
6d9a 66        db      01100110b
6d9b 3c        db      00111100b
6d9c 3c        db      00111100b
6d9d 18        db      00011000b

; Frame 2/4 - Cell (0,2)
6d9e 00        db      00000000b
6d9f 00        db      00000000b
6da0 00        db      00000000b
6da1 00        db      00000000b
6da2 00        db      00000000b
6da3 00        db      00000000b
6da4 00        db      00000000b
6da5 00        db      00000000b

; Frame 2/4 - Cell (1,2)
6da6 80        db      10000000b
6da7 c0        db      11000000b
6da8 c0        db      11000000b
6da9 60        db      01100000b
6daa 60        db      01100000b
6dab 30        db      00110000b
6dac 30        db      00110000b
6dad 18        db      00011000b

; Frame 3/4 - Cell (0,0)
6dae 01        db      00000001b
6daf 02        db      00000010b
6db0 03        db      00000011b
6db1 00        db      00000000b
6db2 00        db      00000000b
6db3 00        db      00000000b
6db4 00        db      00000000b
6db5 00        db      00000000b

; Frame 3/4 - Cell (1,0)
6db6 00        db      00000000b
6db7 00        db      00000000b
6db8 00        db      00000000b
6db9 00        db      00000000b
6dba 00        db      00000000b
6dbb 00        db      00000000b
6dbc 00        db      00000000b
6dbd 00        db      00000000b

; Frame 3/4 - Cell (0,1)
6dbe 80        db      10000000b
6dbf c0        db      11000000b
6dc0 c0        db      11000000b
6dc1 60        db      01100000b
6dc2 60        db      01100000b
6dc3 60        db      01100000b
6dc4 60        db      01100000b
6dc5 60        db      01100000b

; Frame 3/4 - Cell (1,1)
6dc6 61        db      01100001b
6dc7 63        db      01100011b
6dc8 63        db      01100011b
6dc9 66        db      01100110b
6dca 66        db      01100110b
6dcb 7c        db      01111100b
6dcc 3c        db      00111100b
6dcd 18        db      00011000b

; Frame 3/4 - Cell (0,2)
6dce 00        db      00000000b
6dcf 00        db      00000000b
6dd0 00        db      00000000b
6dd1 00        db      00000000b
6dd2 00        db      00000000b
6dd3 00        db      00000000b
6dd4 00        db      00000000b
6dd5 00        db      00000000b

; Frame 3/4 - Cell (1,2)
6dd6 81        db      10000001b
6dd7 c3        db      11000011b
6dd8 c3        db      11000011b
6dd9 66        db      01100110b
6dda 66        db      01100110b
6ddb 3c        db      00111100b
6ddc 3c        db      00111100b
6ddd 18        db      00011000b

; Frame 4/4 - Cell (0,0)
6dde 30        db      00110000b
6ddf 58        db      01011000b
6de0 78        db      01111000b
6de1 8c        db      10001100b
6de2 0c        db      00001100b
6de3 0c        db      00001100b
6de4 0c        db      00001100b
6de5 0c        db      00001100b

; Frame 4/4 - Cell (1,0)
6de6 0d        db      00001101b
6de7 0f        db      00001111b
6de8 0f        db      00001111b
6de9 0e        db      00001110b
6dea 0e        db      00001110b
6deb 04        db      00000100b
6dec 00        db      00000000b
6ded 00        db      00000000b

; Frame 4/4 - Cell (0,1)
6dee 00        db      00000000b
6def 00        db      00000000b
6df0 00        db      00000000b
6df1 00        db      00000000b
6df2 00        db      00000000b
6df3 00        db      00000000b
6df4 00        db      00000000b
6df5 00        db      00000000b

; Frame 4/4 - Cell (1,1)
6df6 81        db      10000001b
6df7 c3        db      11000011b
6df8 c3        db      11000011b
6df9 66        db      01100110b
6dfa 66        db      01100110b
6dfb 3c        db      00111100b
6dfc 3c        db      00111100b
6dfd 18        db      00011000b

; Frame 4/4 - Cell (0,2)
6dfe 00        db      00000000b
6dff 00        db      00000000b
6e00 00        db      00000000b
6e01 00        db      00000000b
6e02 00        db      00000000b
6e03 00        db      00000000b
6e04 00        db      00000000b
6e05 00        db      00000000b

; Frame 4/4 - Cell (1,2)
6e06 80        db      10000000b
6e07 c0        db      11000000b
6e08 c0        db      11000000b
6e09 60        db      01100000b
6e0a 60        db      01100000b
6e0b 30        db      00110000b
6e0c 30        db      00110000b
6e0d 18        db      00011000b




LifeSym:       ; Lives Remaining symbol GFX

6e0e 18        db      00011000b
6e0f 3c        db      00111100b
6e10 3c        db      00111100b
6e11 18        db      00011000b
6812 7e        db      01111110b
6e13 18        db      00011000b
6e14 24        db      00100100b
6e15 42        db      01000010b




; VARIABLES
;
; All variables are addressed as an offset from IX which is loaded with 6e22h
; (VarsIX) at program startup.

6e16 00        db      0           ; IX-0ch  -  Result of keypress
                                   ;
                                   ; 03 = Jump (CAPS SHIFT)
                                   ; 02 = Right (SPACE)
                                   ; 01 = Left (SYM SHIFT)
                                   ; 00 = Nothing


6e17 a3        db      0a3h        ; IX-0bh  -  Random number
                                   ;
                                   ; Initialised from FRAMES at program startup
                                   ; and randomly updated every frame by
                                   ; FrmDelay.
                                   ;
                                   ; Used to randomize starting Hazard in each
                                   ; level and to randomize position of new gaps


6e18 00        db      0           ; IX-0ah  -  SFX/GFX Frame
                                   ;
                                   ; Frame counter for the current SFX/GFX
                                   ; routine


6e19 00        db      0           ; IX-09h  -  Last SFX/GFX Routine
                                   ;
                                   ; Stores a copy of IX-08h from the last call
                                   ; to SfxGfx. If the 2 values are different
                                   ; on the next call to SfxGfx, then a new
                                   ; routine must have been launched and the
                                   ; procedure knows to reset the SFX/GFX frame
                                   ; counter in IX-0ah


6e1a 00        db      0           ; IX-08h  -  Current SFX/GFX Routine
                                   ;
                                   ; 00 = Standing Still
                                   ; 01 = Running
                                   ; 02 = Hit by Hazard
                                   ; 03 = Good Jump
                                   ; 04 = Falling
                                   ; 05 = Bad Jump
                                   ; 06 = Stunned


6e1b 00        db      0           ; IX-07h  -  Right Gap Tracker
                                   ;
                                   ; Used by AddGap to ensure a new right/down
                                   ; gap doesn't overlap with an existing gap.
                                   ;
                                   ; From 0 at the start of a level, it is
                                   ; incremented every time a right gap moves
                                   ; one cell.


6e1c 00        db      0           ; IX-06h  -  Hazards Draw/Erase flag
                                   ;
                                   ; Bit 0 -->  0 = Erase
                                   ;            1 = Draw
                                   ;
                                   ; Toggled with every call to DrawHzds.


6e1d 00        db      0           ; IX-05h  -  Lost Life flag
                                   ;
                                   ; 1 = Yes, life already lost
                                   ; 0 = No
                                   ;
                                   ; Used when Jack is Stunned at the bottom of
                                   ; the screen to keep track of whether Jack
                                   ; has already lost a life for this incident.


6e1e 0000      dw      0           ; IX-04h  -  Score


6e20 00        db      0           ; IX-02h  -  New Gaps counter
                                   ;
                                   ; Number of gaps (0-6) added so far this
                                   ; level due to good jumps. Each level starts
                                   ; with 2 visible gaps, so after 6 new ones
                                   ; there will be the maximum of 8.


6e21 00        db      0           ; IX-01h  -  Hazard Collision flag
                                   ;
                                   ; 1 = Collision detected
                                   ; 0 = No collision
                                   ;
                                   ; Used by CollDetn - stores the result of the
                                   ; last collision check.


VarsIX:                            ; VARIABLES INDEX MARKER


                                   ; IX+00h --> IX+07h  -  Gap Positions
                                   ;
                                   ; Each byte describes one of the 8 gaps'
                                   ; positions:
                                   ;
                                   ; Bits (7,6,5) = Jline (0-7)
                                   ; Bits (4,3,2,1,0) = Horizontal position
                                   ; (0-31) of gap's internal 'Cell 1' (see
                                   ; DrawGaps comments)

6e22 00        db      0           ; IX+00h  These 4 gaps travel Right & Down
6e23 00        db      0           ; IX+01h
6e24 00        db      0           ; IX+02h
6e25 00        db      0           ; IX+03h

6e26 00        db      0           ; IX+04h  These 4 gaps travel Left & Up
6e27 00        db      0           ; IX+05h
6e28 00        db      0           ; IX+06h
6e29 00        db      0           ; IX+07h


6e2a 00        db      0           ; IX+08h  -  Jack's Animation (Next frame)
                                   ;
                                   ; 00 = Standing Still
                                   ; 03 = Running Left
                                   ; 06 = Running Right
                                   ; 09 = Good Jump Pt1
                                   ; 12 = Falling Pt1
                                   ; 15 = Good Jump Pt2
                                   ; 18 = Falling Pt2
                                   ; 21 = Bad Jump
                                   ; 24 = Stunned
                                   ;
                                   ; Used as a relative jump offset in (and
                                   ; updated by) UpdateGame.


6e2b ea        db      0eah        ; IX+09h  -  Jack's Position (Next frame)
                                   ;
                                   ; Stores (V)ertical & (H)orizontal position:
                                   ;
                                   ; BIT       7 6 5 4 3 2 1 0
                                   ;           V V V H H H H H
                                   ;
                                   ; Bits (7,6,5) = Jline (0-7) immediately
                                   ; above Jack
                                   ; Bits (4,3,2,1,0) = Screen column (0-30) of
                                   ; Jack's left-most* sprite cells.
                                   ;
                                   ; *NB: When Jack is in a GFXJLeft animation
                                   ; (2x3 cell sprite) this indicates the middle
                                   ; column of Jack's cells.


6e2c 00        db      0           ; IX+0ah - Stunned Timer
                                   ;
                                   ; Used by UpdateGame to manage how long Jack
                                   ; is Stunned
                                   ;
                                   ; Decrements every 4 frames Jack is Stunned
                                   ; Increments by 16 when Jack hits Hazard
                                   ; Increments by 8 when Jack falls through gap
                                   ; Set to 24 after a Bad Jump
                                   ; Set to 24 after losing a life


6e2d 00        db      0           ; IX+0bh  -  Game Progress
                                   ;
                                   ; 00 = Game in progress
                                   ; 01 = Level Completed
                                   ; 02 = Game Over (No lives remaining)
                                   ;
                                   ; Set by UpdateGame and tested by GameLoop


6e2e 06        db      6           ; IX+0ch  -  Lives remaining
                                   ;
                                   ; Decremented by UpdateGame when Jack falls
                                   ; through gap in JLine 7
                                   ; Incremented at the start of levels 6, 11 &
                                   ; 16 by CpLvCont.


6e2f 00        db      0           ; IX+0dh  -  Animation Frame (Next frame)
                                   ;
                                   ; BITS       USED BY
                                   ; 6&5        Jack Standing Still (0-3)
                                   ;
                                   ; 1&0        All other Jack animations (0-3)
                                   ;            Gap animation (0-3)
                                   ;
                                   ; Incremented every frame by GameLoop (so
                                   ; bits 6&5 change every 32 frames)


6e30 00        db      0           ; IX+0eh  -  Level / No. of Hazards in play
                                   ;
                                   ; There are 21 levels (0-20) with that
                                   ; number of Hazards in each


6e31 00        db      00h         ; IX+0fh --> IX+22h  -  Hazard Positions x20
6e32 58        db      58h
6e33 11        db      11h         ; Each position byte stores (V)ertical &
6e34 21        db      21h         ; (H)orizontal position:
6e35 82        db      82h
6e36 b3        db      0b3h        ; BIT       7 6 5 4 3 2 1 0
6e37 0d        db      0dh         ;           V V V H H H H H
6e38 88        db      88h         ;
6e39 c8        db      0c8h        ; Bits (7,6,5) = Jline (0-7) immediately
6e3a 45        db      45h         ; above Hazard
6e3b 27        db      27h         ; Bits (4,3,2,1,0) = Screen column (0-31) of
6e3c 4a        db      4ah         ; Hazard's middle sprite column
6e3d 39        db      39h
6e3e 63        db      63h
6e3f 72        db      72h
6e40 79        db      79h
6e41 a7        db      0a7h
6e42 b8        db      0b8h
6e43 9a        db      9ah
6e44 dc        db      0dch


6e45 00        db      0           ; IX+23h  -  Score digit 1 (most sig)
6e46 00        db      0           ; IX+24h  -  Score digit 2
6e47 00        db      0           ; IX+25h  -  Score digit 3
6e48 00        db      0           ; IX+26h  -  Score digit 4
6e49 00        db      0           ; IX+27h  -  Score digit 5 (least sig)


6e4a 00        db      0           ; IX+28h  -  High Score digit 1 (most sig)
6e4b 00        db      0           ; IX+29h  -  High Score digit 2
6e4c 00        db      0           ; IX+2ah  -  High Score digit 3
6e4d 00        db      0           ; IX+2bh  -  High Score digit 4
6e4e 00        db      0           ; IX+2ch  -  High Score digit 5 (least sig)


6e4f 00        db      0           ; IX+2dh  -  Jack's Animation (Current frame)
                                   ;
                                   ; 00 = Standing Still
                                   ; 03 = Running Left
                                   ; 06 = Running Right
                                   ; 09 = Good Jump Pt1
                                   ; 12 = Falling Pt1
                                   ; 15 = Good Jump Pt2
                                   ; 18 = Falling Pt2
                                   ; 21 = Bad Jump
                                   ; 24 = Stunned
                                   ;
                                   ; Used as a relative jmp offset in DrawJack


6e50 00        db      0           ; IX+2eh  -  Jack's Position (Current frame)
                                   ;
                                   ; Stores (V)ertical & (H)orizontal positions:
                                   ;
                                   ; BIT       7 6 5 4 3 2 1 0
                                   ;           V V V H H H H H
                                   ;
                                   ; Bits (7,6,5) = Jline (0-7) immediately
                                   ; above Jack
                                   ; Bits (4,3,2,1,0) = Screen column (0-30) of
                                   ; Jack's left-most* sprite cells.
                                   ;
                                   ; *NB: When Jack is in a GFXJLeft animation
                                   ; (2x3 cell sprite) this indicates the middle
                                   ; column of Jack's cells.


6e51 00        db      0           ; IX+2fh  -  Animation Frame (Current frame)
                                   ;
                                   ; BITS       USED BY
                                   ; 6&5        Jack Standing Still (0-3)
                                   ;
                                   ; 1&0        All other Jack animations (0-3)
                                   ;
                                   ; When all bits apart from 6&5 are zero,
                                   ; the value of this byte (0, 32, 64, 96) will
                                   ; be an offset into the GFX data for the
                                   ; GFXJStil animation


6e52 0000      dw      0           ; IX+30h  -  High Score


6e54 00        db      0           ; IX+32h  -  Jack Draw/Erase flag
                                   ;
                                   ; Bit 0 -->  0 = Erase
                                   ;            1 = Draw
                                   ;
                                   ; Toggled with every call to DrawJack


6e55 00        db      0           ; IX+33h  -  Hazards Current Frame
                                   ;
                                   ; Bits 2&1 = Current GFX frame (0-3) to be
                                   ; drawn/erased for each Hazard (used by
                                   ; DrawHzds).
                                   ;
                                   ; Loaded with IX+0dh (Animation Frame - Next)
                                   ; every other frame in GameLoop


6e56 00        db      0           ; IX+34h  -  Left Gap Tracker
                                   ;
                                   ; Used by AddGap to ensure a new left/up gap
                                   ; doesn't overlap with an existing gap.
                                   ;
                                   ; From 0 at the start of a level, it is
                                   ; decremented every time a left gap moves one
                                   ; cell.


6e57 00        db      0           ; IX+35h  -  Length of delay in PrtDelay
                                   ;
                                   ; Determines the speed that characters are
                                   ; printed by PrtEText. Used in the Completed
                                   ; Level and Game Over screens.


                                   ; Gap Cell Bitmaps (Used by DrawGaps)
6e58 00        db      0           ; IX+36h  -  Gap Cell 1 Bitmap (Right-moving)
6e59 00        db      0           ; IX+37h  -  Gap Cell 3 Bitmap (Left-moving)
6e5a 00        db      0           ; IX+38h  -  Gap Cell 4 Bitmap (Right-moving)
6e5b 00        db      0           ; IX+39h  -  Gap Cell 0 Bitmap (Left-moving)




Rhyme3:        ; 'Once found a peculiar track...'
6e5c           db      3ah, 13h, 08h, 4ah, 0bh, 14h, 1ah, 13h, 49h, 46h, 15h
               db      0ah, 08h, 1ah, 11h, 0eh, 06h, 57h, 19h, 17h, 06h, 08h
               db      90h




;-------------------------------------------------------------------------------
RndGaps:       ; Initialises all 8 gaps to begin from the same random place
;-------------------------------------------------------------------------------
; ENTRY
; IX = Address of Gap position data (8 bytes)

6e73 dd7ef5    ld      a,(ix-0bh)  ; Use random number as gap position
6e76 e6fc      and     0fch        ; Zero low 2 bits so horizontal position
                                   ; is 0,4,8,12,16,20,24 or 28.
6e78 dde5      push    ix
6e7a e1        pop     hl          ; HL points to Gap position bytes
6e7b 0608      ld      b,08h       ; 8 bytes to initialise

6e7d 77        ld      (hl),a      ; Store random position
6e7e 23        inc     hl          ; Point to next gap position byte
6e7f 10fc      djnz    6e7dh       ; Initialise all 8 gaps
6e81 c9        ret




Rhyme4:        ; 'There were dangers galore...'
6e82           db      3fh, 0dh, 0ah, 17h, 4ah, 1ch, 0ah, 17h, 4ah, 09h, 06h
               db      13h, 0ch, 0ah, 17h, 58h, 0ch, 06h, 11h, 14h, 17h, 8ah




;-------------------------------------------------------------------------------
InitScreen:    ; Clears the screen and sets the desired attributes
;-------------------------------------------------------------------------------
6e98 3e07      ld      a,07h
6e9a d3fe      out     (0feh),a    ; Set the border to white

6e9c 3e38      ld      a,00111000b ; A=Attributes (Paper White, Ink Black)
6e9e cdb56e    call    ClrScreen   ; 6eb5h
6ea1 c9        ret




Rhyme5:        ; 'Even holes in the floor...'
6ea2           db      30h, 1bh, 0ah, 53h, 0dh, 14h, 11h, 0ah, 58h, 0eh, 53h
               db      19h, 0dh, 4ah, 0bh, 11h, 14h, 14h, 97h




;-------------------------------------------------------------------------------
ClrScreen:     ; Clears the Display and fills Attributes
;-------------------------------------------------------------------------------
; ENTRY
; A = Desired Attributes

; Clear display memory

6eb5 210040    ld      hl,4000h    ; HL points to screen memory
6eb8 01ff17    ld      bc,17ffh    ; Set counter to size of screen memory
6ebb 110140    ld      de,4001h    ; DE points to second byte of screen memory
6ebe 3600      ld      (hl),00h    ; Zero first byte of screen memory
6ec0 edb0      ldir                ; Zero screen memory

; Set attributes

6ec2 210058    ld      hl,5800h    ; HL points to display attributes
6ec5 01ff02    ld      bc,02ffh    ; Set counter to size of attributes
6ec8 110158    ld      de,5801h    ; DE points to second byte of attributes
6ecb 77        ld      (hl),a      ; Set first byte of attributes
6ecc edb0      ldir                ; Fill display attributes
6ece c9        ret




Rhyme6:        ; 'So he kept falling flat on'
               ; 'his back...'
6ecf           db      3eh, 54h, 0dh, 4ah, 10h, 0ah, 15h, 59h, 0bh, 06h, 11h
               db      11h, 0eh, 13h, 4ch, 0bh, 11h, 06h, 59h, 14h, 0d3h, 0dh
               db      0eh, 58h, 07h, 06h, 08h, 90h




;-------------------------------------------------------------------------------
InfoAtts:      ; Sets the InfoLine attributes so ink is magenta
;-------------------------------------------------------------------------------
6eeb 21c05a    ld      hl,5ac0h    ; HL points to attributes for (22,0)
6eee 0620      ld      b,20h       ; 32 cells in a line
6ef0 3e3b      ld      a,00111011b ; A=Attributes (Paper White, Ink Magenta)

6ef2 77        ld      (hl),a      ; Apply attributes
6ef3 23        inc     hl          ; Point to next cell in line
6ef4 10fc      djnz    6ef2h       ; Fill attributes for rest of line
6ef6 c9        ret




Rhyme7:        ; 'Quite soon he got used to'
               ; 'the place...'
6ef7           db      3ch, 1ah, 0eh, 19h, 4ah, 18h, 14h, 14h, 53h, 0dh, 4ah
               db      0ch, 14h, 59h, 1ah, 18h, 0ah, 49h, 19h, 0d4h, 19h, 0dh
               db      4ah, 15h, 11h, 06h, 08h, 8ah




;-------------------------------------------------------------------------------
DrawScreen:    ; Draws all the screen elements for a new game
;-------------------------------------------------------------------------------
6f13 cdeb6e    call    InfoAtts    ; Set InfoLine ink to magenta (6eebh)
6f16 cd2874    call    DrawJlines  ; Draw all 8 Jlines (7428h)
6f19 cd6979    call    JlineAtts   ; Make the Jlines red (7969h)
6f1c cd3e78    call    CvtHiBCD    ; Convert High Score to BCD (783eh)
6f1f cd6478    call    PrtHigh     ; Print High Score digits (7864h)
6f22 cd837c    call    PrtInfoTxt  ; Print 'HI' & 'SC' on InfoLine (7c83h)
6f25 cde077    call    CvtScBCD    ; Convert Score to BCD (77e0h)
6f28 cd7378    call    PrtScore    ; Print Score digits (7873h)
6f2b cdf578    call    PrtLives    ; Print 'Lives Remaining' symbols (78f5h)
6f2e cd707c    call    UpdJkFrm    ; Copy Jack's Next Frame to Current (7c70h)
6f31 cd6d72    call    DrawJack    ; Draw Jack (726dh)
6f34 c9        ret




;-------------------------------------------------------------------------------
RndHazds:      ; Randomize the starting Hazard
;-------------------------------------------------------------------------------
; The order in which the Hazards appear in consecutive levels is based on the
; order that their GFX data appears in memory. This rotates the Hazards GFX data
; a random number (1-8) times so the starting Hazard is different each game.

6f35 dd7ef5    ld      a,(ix-0bh)  ; A=Random number
6f38 e607      and     07h         ; Zero top 5 bits to make it a number
6f3a 47        ld      b,a         ; between 0-7, and put it in B
6f3b 04        inc     b           ; Make it a number between 1-8.

6f3c cdcb7c    call    RotHzrds    ; Rotate Hazards GFX data B times. (7ccbh)
6f3f 10fb      djnz    6f3ch
6f41 c9        ret



;-------------------------------------------------------------------------------
Start:         ; ENTRY POINT
;-------------------------------------------------------------------------------
; Program initialisation / Setup stack, variables index and random number

6f42 f3        di
6f43 31005c    ld      sp,5c00h    ; Move stack to the 16K/48K printer buffer
6f46 dd21226e  ld      ix,VarsIX   ; Point IX to game variables (6e22h)
6f4a 3a785c    ld      a,(5c78h)   ; Store least sig. byte of FRAMES system
                                   ; variable (3 byte counter incremented every
                                   ; 20ms) for use as a random number in later
6f4d dd77f5    ld      (ix-0bh),a  ; routines

; Setup for new game

6f50 cd736e    call    RndGaps     ; Randomize start position of gaps (6e73h)

6f53 cd986e    call    InitScreen  ; Clear screen & set attributes (6e98h)
6f56 cd136f    call    DrawScreen  ; Draw all the screen elements (6f13h)

6f59 cd356f    call    RndHazds    ; Randomize the starting Hazard (6f35h)
6f5c cddb76    call    DrawHzds    ; No Hazards to actually draw for first level
                                   ; this just toggles draw/erase flag (76dbh)




;-------------------------------------------------------------------------------
GameLoop:      ; Main Game Loop
;-------------------------------------------------------------------------------
; The game loop works on a 4 frame cycle since all elements of the game (Gaps,
; Hazards, Jack) are always in a particular 4-frame animation. (NB: Hazards are
; only drawn every other frame, so actually take 2 game loops to complete their
; animation).
;
; User input is only processed on every 4th frame to determine which animations
; to play for the following 4 frames.  In the interim frames, none of the sprite
; elements actually 'move' - their animations merely give the illusion of
; movement.


; FRAME 1/4
; In Frame 1, the current SfxGfx is played (which also regulates the game
; speed), Jack is erased and redrawn (if required) and the gaps are drawn.

6f5f cd7f79    call    SfxGfx      ; Play SFX/GFX for current animation (797fh)

6f62 dd340d    inc     (ix+0dh)    ; Increment Animation Frame (Next Frame)
6f65 cdb97f    call    TstJkDrw    ; Does Jack need redrawing this frame (7fb9h)
6f68 2809      jr      z,6f73h     ; Skip erase/draw sequence if not

6f6a cd6d72    call    DrawJack    ; Erase Jack (726dh)
6f6d cd707c    call    UpdJkFrm    ; Copy Jack's Next Frame to Current (7c70h)
6f70 cd6d72    call    DrawJack    ; Draw Jack (726dh)

6f73 cdd670    call    DrawGaps    ; Draw Gaps (70d6h)


; FRAME 2/4
; In Frame 2, all the same elements of Frame 1 are repeated, but this time the
; Hazards are also erased and redrawn.

6f76 cd7f79    call    SfxGfx      ; Play SFX/GFX for current animation (797fh)

6f79 dd340d    inc     (ix+0dh)    ; Increment Animation Frame (Next Frame)
6f7c cdb97f    call    TstJkDrw    ; Does Jack need redrawing this frame (7fb9h)
6f7f 2809      jr      z,6f8ah     ; Skip erase/draw sequence if not

6f81 cd6d72    call    DrawJack    ; Erase Jack (726dh)
6f84 cd707c    call    UpdJkFrm    ; Copy Jack's Next Frame to Current (7c70h)
6f87 cd6d72    call    DrawJack    ; Draw Jack (726dh)

6f8a cdd670    call    DrawGaps    ; Draw Gaps (70d6h)

6f8d cddb76    call    DrawHzds    ; Erase Hazards (76dbh)
6f90 dd7e0d    ld      a,(ix+0dh)
6f93 dd7733    ld      (ix+33h),a  ; Copy Hazards' Next Anim Frame to Current
6f96 cddb76    call    DrawHzds    ; Draw Hazards (76dbh)


; FRAME 3/4
; Frame 3 is the same as Frame 1.

6f99 cd7f79    call    SfxGfx      ; Play SFX/GFX for current animation (797fh)

6f9c dd340d    inc     (ix+0dh)    ; Increment Animation Frame (Next Frame)
6f9f cdb97f    call    TstJkDrw    ; Does Jack need redrawing this frame (7fb9h)
6fa2 2809      jr      z,6fadh     ; Skip erase/draw sequence if not

6fa4 cd6d72    call    DrawJack    ; Erase Jack (726dh)
6fa7 cd707c    call    UpdJkFrm    ; Copy Jack's Next Frame to Current (7c70h)
6faa cd6d72    call    DrawJack    ; Draw Jack (726dh)

6fad cdd670    call    DrawGaps    ; Draw Gaps (70d6h)


; FRAME 4/4
; All the game logic and subsequent movements of Jack, Gaps and Hazards are
; performed in Frame 4.  This is also where the game loop can end if the player
; has lost the game or completed a level.

6fb0 cd7f79    call    SfxGfx      ; Play SFX/GFX for current animation (797fh)
6fb3 dd340d    inc     (ix+0dh)    ; Increment Animation Frame (Next Frame)

6fb6 cd8d76    call    GetInput    ; Read player's keypress (768dh)
6fb9 cd8374    call    UpdateGame  ; Process input, move Jack, move Gaps (7483h)
6fbc dd36f400  ld      (ix-0ch),0  ; Reset Keyboard Input to 'Nothing'

6fc0 cdd670    call    DrawGaps    ; Draw Gaps (70d6h)

6fc3 cddb76    call    DrawHzds    ; Erase Hazards (76dbh)
6fc6 dd7e0d    ld      a,(ix+0dh)
6fc9 dd7733    ld      (ix+33h),a  ; Copy Hazards' Next Anim Frame to Current
6fcc cdba76    call    UpdHazds    ; Move all the Hazards (76bah)
6fcf cddb76    call    DrawHzds    ; Draw Hazards (76dbh)

; Has level been completed or game lost?

6fd2 dd7e0b    ld      a,(ix+0bh)  ; A=Game Progress
6fd5 a7        and     a           ; Is it 0? (i.e. game still in progress)
6fd6 281e      jr      z,GLFm4Cont ; If so, continue Frame 4/4 (6ff6h)

6fd8 3d        dec     a           ; Game is no longer in progress - initiate..
6fd9 282c      jr      z,GLLevlWon ; ..completed level sequence (7007h)
6fdb cdec7c    call    GameLost    ; ..or Final SFX & Game Over Screen (7cech)


GLNewGame:     ; Setup for new game

6fde cd736e    call    RndGaps     ; Randomize start position of gaps (6e73h)
6fe1 cd986e    call    InitScreen  ; Clear screen & set attributes (6e98h)
6fe4 cd4570    call    RstLvDat    ; Resets variables for a new level (7045h)
6fe7 cd7670    call    RstGmDat    ; Reset variables for new game (7076h)
6fea cd136f    call    DrawScreen  ; Draw all the screen elements (6f13h)
6fed cd356f    call    RndHazds    ; Randomize the starting monster (6f35h)
6ff0 cddb76    call    DrawHzds    ; No Hazards to actually draw for first level
                                   ; this just toggles draw/erase flag (76dbh)
6ff3 c35f6f    jp      GameLoop    ; 6f5fh


GLFm4Cont:     ; FRAME 4/4 (continued)

6ff6 cdb97f    call    TstJkDrw    ; Does Jack need redrawing this frame (7fb9h)
6ff9 2809      jr      z,7004h     ; Skip erase/draw sequence if not
6ffb cd6d72    call    DrawJack    ; Erase Jack (726dh)
6ffe cd707c    call    UpdJkFrm    ; Copy Jack's Next Frame to Current (7c70h)
7001 cd6d72    call    DrawJack    ; Draw Jack (726dh)

7004 c35f6f    jp      GameLoop    ; Start again from Frame 1 (6f5fh)


GLLevlWon:     ; Level completed

7007 cd5d7e    call    LevlDone    ; Play SFX and show Completed Level
                                   ; screen (7e5dh)
                                   ; This returns with C flag set if there are
                                   ; more levels to play
700a 3808      jr      c,GLNewLevl ; Setup for next level unless player has
                                   ; just completed the game (7014h)

; Player has completed all levels. Show a Game Over screen with final score.

700c dd350e    dec     (ix+0eh)    ; Reset Level/Hazards counter to 20
700f cdf27c    call    GameOver    ; Show Game Over screen, score etc. (7cf2h)
7012 18ca      jr      GLNewGame   ; Setup for new game (6fdeh)


GLNewLevl:     ; Setup for next level

7014 cd986e    call    InitScreen  ; Clear screen & set attributes (6e98h)
7017 cd4570    call    RstLvDat    ; Resets variables for a new level (7045h)
701a cd736e    call    RndGaps     ; Randomize start position of gaps (6e73h)
701d cd136f    call    DrawScreen  ; Draw all the screen elements (6f13h)
7020 cddb76    call    DrawHzds    ; 76dbh
7023 c35f6f    jp      GameLoop    ; 6f5fh




Rhyme8:        ; 'He could jump to escape from'
               ; 'the chase...'
7026           db      33h, 4ah, 08h, 14h, 1ah, 11h, 49h, 0fh, 1ah, 12h, 55h
               db      19h, 54h, 0ah, 18h, 08h, 06h, 15h, 4ah, 0bh, 17h, 14h
               db      0d2h, 19h, 0dh, 4ah, 08h, 0dh, 06h, 18h, 8ah




;-------------------------------------------------------------------------------
RstLvDat:      ; Resets various variables for a new level
;-------------------------------------------------------------------------------
7045 dd36f400  ld      (ix-0ch),0  ; Reset Keyboard Input to 'Nothing'
7049 dd36f800  ld      (ix-08h),0  ; Reset GFX/SFX to Standing Still
704d dd36f900  ld      (ix-07h),0  ; Reset Right Gap Tracker
7051 dd36fa00  ld      (ix-06h),0  ; Reset Hazards Draw/Erase flag to Erase
7055 dd36fe00  ld      (ix-02h),0  ; Reset New Gaps counter
7059 dd360800  ld      (ix+08h),0  ; Set Jack's animation to Standing Still
705d dd3609ea  ld      (ix+9),0eah ; Move Jack to starting position
7061 dd360b00  ld      (ix+0bh),0  ; Reset Game Progress byte to 'In Progress'
7065 dd360d00  ld      (ix+0dh),0  ; Reset Animation Frame
7069 dd363200  ld      (ix+32h),0  ; Reset Jack's Draw/Erase flag to Erase
706d dd363300  ld      (ix+33h),0  ; Reset Hazards current frame
7071 dd363400  ld      (ix+34h),0  ; Reset Left Gap Tracker
7075 c9        ret




;-------------------------------------------------------------------------------
RstGmDat:      ; Resets Score, Level, Stunned and Lives counters for a new game
;-------------------------------------------------------------------------------
7076 dd36fc00  ld      (ix-04h),0  ; Reset Score to zero (Low byte)
707a dd36fd00  ld      (ix-03h),0  ; Reset Score to zero (High byte)
707e dd360a00  ld      (ix+0ah),0  ; Reset Stunned Timer
7082 dd360c06  ld      (ix+0ch),6  ; Reset Remaining Lives to 6
7086 dd360e00  ld      (ix+0eh),0  ; Reset Level/Hazards to 0
708a c9        ret




Rhyme9:        ; 'But without careful thought...'
708b           db      2dh, 1ah, 59h, 1ch, 0eh, 19h, 0dh, 14h, 1ah, 59h, 08h
               db      06h, 17h, 0ah, 0bh, 1ah, 51h, 19h, 0dh, 14h, 1ah, 0ch
               db      0dh, 99h




;-------------------------------------------------------------------------------
UpdtGaps:      ; Update Gap positions
;-------------------------------------------------------------------------------
; This updates the position bytes of all 8 Gaps.
; It is called every 4 frames. In the intermediate frames, the animations
; managed by DrawGaps give the illusion of movement even while the gap positions
; remain unchanged.

; Update Right Gap Tracker (used By AddGap)

70a3 dd34f9    inc     (ix-07h)

; Move the right/down gaps one cell right

70a6 dd3400    inc     (ix+00h)
70a9 dd3401    inc     (ix+01h)
70ac dd3402    inc     (ix+02h)
70af dd3403    inc     (ix+03h)

; Update Left Gap Tracker (used by AddGap)

70b2 dd3534    dec     (ix+34h)

; Move the left/up gaps one cell left

70b5 dd3504    dec     (ix+04h)
70b8 dd3505    dec     (ix+05h)
70bb dd3506    dec     (ix+06h)
70be dd3507    dec     (ix+07h)
70c1 c9        ret




Rhyme10:       ; 'His leaps came to nought...'
70c2           db      33h, 0eh, 58h, 11h, 0ah, 06h, 15h, 58h, 08h, 06h, 12h
               db      4ah, 19h, 54h, 13h, 14h, 1ah, 0ch, 0dh, 99h




;-------------------------------------------------------------------------------
DrawGaps:      ; Draws the gaps in the JLines
;-------------------------------------------------------------------------------
; This works on a 4 frame cycle.
;
; A gap is made by blanking a section in a JLine (a JLine is made by filling the
; top 2 pixel rows in a screen line of cells).
;
; Each gap is 3 cells (24 pixels) wide, but the routine modifies 5 cells for
; each gap. E.g.
;
;         Cell 0   Cell 1   Cell 2   Cell 3   Cell 4
;        :::::::: -------- -------- -------- ::::::::
;
; Above is the situation every Frame 0 (gap falls perfectly within cells 1-3)
; However, in Frame 1 for a right-moving gap, we'd have:
;
;         Cell 0   Cell 1   Cell 2   Cell 3   Cell 4
;        :::::::: ::------ -------- -------- --::::::
;
; Or for a left-moving gap, Frame 1 would be:
;
;         Cell 0   Cell 1   Cell 2   Cell 3   Cell 4
;        ::::::-- -------- -------- ------:: ::::::::
;
; i.e to simulate the gap moving, cells 0,1,3&4 are altered until the gap has
; 'moved' by a whole cell. Then the gap position byte is updated, and the
; animation begins again.
;
; Gaps move 2 pixels per frame.
;
; There are a maximum of 8 gaps at any time. The 'cell 1' positions of each gap
; are stored in the bytes at IX+0 - IX+7.
;
; The 4 gaps IX+0 - IX+3 move Right & Downwards
; The 4 gaps IX+4 - IX+7 move Left & Upwards
;
; NB: Due to the format of the gap position bytes, this routine will
; automatically handle the drawing of gaps which are halfway off the edge of
; the screen (even those travelling between Jlines 0 & 7).
;
; NB: All 8 gaps are always drawn. At the start of a level, there are less than
; 8 'visible' as all the gaps are initialised to the same position meaning some
; gaps are drawn over each other. The process of 'adding a new gap' after a
; successful jump is actually just moving a gap to make it visible.


; First we use the lowest 2 bits of the Animation Frame variable to determine
; which frame we're in.

70d6 dd7e0d    ld      a,(ix+0dh)  ; Get animation frame
70d9 e603      and     03h         ; Isolate bits 1&0 / A = 0, 1, 2 or 3
70db 07        rlca
70dc 07        rlca                ; Mult by 4 / A is now either 0, 4, 8 or 12
70dd 32e170    ld      (70e1h),a   ; Use it as a jump offset
70e0 18fe      jr      70e0h
70e2 c3f170    jp      GapsF0      ; +0 (Frame 0) (70f1h)
70e5 00        nop
70e6 c32671    jp      GapsF1      ; +4 (Frame 1) (7126h)
70e9 00        nop
70ea c33871    jp      GapsF2      ; +8 (Frame 2) (7138h)
70ed 00        nop
70ee c34a71    jp      GapsF3      ; +12 (Frame 3) (714ah)

GapsF0:        ; Gaps Sequence - Frame 0

; This is the simplest case where the gaps fall perfectly within cells 1-3
; First, draw cells 0 & 4 for each gap

70f1 01ff08    ld      bc,08ffh    ; B= Counter (Number of gaps to draw)
                                   ; C= Pixel bitmap for cells 0&4
70f4 78        ld      a,b
70f5 3d        dec     a
70f6 32fb70    ld      (70fbh),a
70f9 dd7e00    ld      a,(ix+00h)  ; A= Position byte for next gap to be drawn
70fc f5        push    af          ; Save copy of position
70fd 3d        dec     a           ; A= Adjusted position to target cell 0
70fe cdf471    call    DrawGpCl    ; Draw cell 0 (71f4h)
7101 f1        pop     af          ; Retrieve copy of position byte
7102 c603      add     a,03h       ; A= Adjusted position to target cell 4
7104 cdf471    call    DrawGpCl    ; Draw cell 4 (71f4h)
7107 10eb      djnz    70f4h       ; Do this for all 8 gaps

; Cells 0&4 are drawn for each gap, now draw the 'gaps' themselves in cells 1-3.
;
; By drawing the 'gap' cells 1-3 after the edge cells 0&4, it means that
; even if two gaps are crossing over one another, it will still look fine.

7109 010008    ld      bc,0800h    ; B= Counter (Number of gaps to draw)
                                   ; C= Pixel bitmap for cells 1,2,3
710c 78        ld      a,b
710d 3d        dec     a
710e 321371    ld      (7113h),a
7111 dd7e00    ld      a,(ix+00h)  ; A= Position byte for next gap to be drawn
7114 f5        push    af          ; Save copy of position
7115 cdf471    call    DrawGpCl    ; Draw cell 1 (71f4h)
7118 f1        pop     af          ; Retrieve copy of position byte
7119 3c        inc     a           ; A= Adjusted position to target cell 2
711a f5        push    af          ; Save copy of position
711b cdf471    call    DrawGpCl    ; Draw cell 2 (71f4h)
711e f1        pop     af          ; Retrieve copy of position byte
711f 3c        inc     a           ; A= Adjusted position to target cell 3
7120 cdf471    call    DrawGpCl    ; Draw cell 3 (71f4h)
7123 10e7      djnz    710ch       ; Do this for all 8 gaps
7125 c9        ret                 ; Frame 0 complete

GapsF1:        ; Gaps Sequence - Frame 1

; Get bitmap data for Gap Cells

7126 dd3636c0  ld      (ix+36h),11000000b      ; Cell 1 (Right-moving gaps)
712a dd363703  ld      (ix+37h),00000011b      ; Cell 3 (Left-moving gaps)
712e dd36383f  ld      (ix+38h),00111111b      ; Cell 4 (Right-moving gaps)
7132 dd3639fc  ld      (ix+39h),11111100b      ; Cell 0 (Left-moving gaps)
7136 1822      jr      GapsF123    ; 715ah

GapsF2:        ; Gaps Sequence - Frame 2

; Get bitmap data for Gap Cells

7138 dd3636f0  ld      (ix+36h),11110000b      ; Cell 1 (Right-moving gaps)
713c dd36370f  ld      (ix+37h),00001111b      ; Cell 3 (Left-moving gaps)
7140 dd36380f  ld      (ix+38h),00001111b      ; Cell 4 (Right-moving gaps)
7144 dd3639f0  ld      (ix+39h),11110000b      ; Cell 0 (Left-moving gaps)
7148 1810      jr      GapsF123    ; 715ah

GapsF3:        ; Gaps Sequence - Frame 3

; Get bitmap data for Gap Cells

714a dd3636fc  ld      (ix+36h),11111100b      ; Cell 1 (Right-moving gaps)
714e dd36373f  ld      (ix+37h),00111111b      ; Cell 3 (Left-moving gaps)
7152 dd363803  ld      (ix+38h),00000011b      ; Cell 4 (Right-moving gaps)
7156 dd3639c0  ld      (ix+39h),11000000b      ; Cell 0 (Left-moving gaps)

GapsF123:

; Apart from the different pixel bitmaps above, the procedure for Frames 1-3
; is the same. However, because of the possibility of gaps crossing over one
; another, it's more complicated than Frame 0.

; Draw Cell 1 in gaps 0-3 (the Right/Down gaps)

715a 0604      ld      b,04h       ; 4 gaps to draw
715c dd4e36    ld      c,(ix+36h)  ; Get pixel bitmap for this cell

715f 78        ld      a,b
7160 3d        dec     a           ; Start with Gap 3 and work down
7161 326671    ld      (7166h),a
7164 dd7e04    ld      a,(ix+04h)  ; A= Position byte for next gap to be drawn
7167 cdf471    call    DrawGpCl    ; Draw Cell 1 (71f4h)
716a 10f3      djnz    715fh       ; Do this for all 4 Right/Down gaps

; Draw Cell 3 in gaps 4-7 (the Left/Up gaps)

716c 0604      ld      b,04h       ; 4 gaps to draw
716e dd4e37    ld      c,(ix+37h)  ; Get pixel bitmap for this cell

7171 78        ld      a,b
7172 c603      add     a,03h       ; Start with Gap 7 and work down
7174 327971    ld      (7179h),a
7177 dd7e08    ld      a,(ix+08h)  ; A= Position byte for next gap to be drawn
717a 3c        inc     a
717b 3c        inc     a           ; Point to Cell 3 in this gap
717c cdf471    call    DrawGpCl    ; Draw Cell 3 (71f4h)
717f 10f0      djnz    7171h       ; Do this for all 4 Left/Up gaps

; Draw gaps 0-3 (the Right/Down gaps)
; For each, AND the desired contents of cells 1 & 4 with what's already on the
; screen to allow for overlapping left-moving gaps.

7181 0604      ld      b,04h       ; 4 gaps to draw

7183 dd4e36    ld      c,(ix+36h)  ; Get pixel bitmap for this cell
7186 78        ld      a,b
7187 3d        dec     a           ; Start with Gap 3 and work down
7188 328d71    ld      (718dh),a
718b dd7e04    ld      a,(ix+04h)  ; A= Position byte for next gap to be drawn
718e f5        push    af          ; Save copy of position
718f cd4372    call    AndGpCl     ; AND Cell 1 with desired bitmap (7243h)
7192 f1        pop     af          ; Retrieve position
7193 c603      add     a,03h       ; Point to Cell 4
7195 f5        push    af          ; Save copy of position
7196 dd4e38    ld      c,(ix+38h)  ; Get pixel bitmap for this cell
7199 cd4372    call    AndGpCl     ; AND Cell 4 with desired bitmap (7243h)
719c f1        pop     af          ; Retrieve position
719d 3d        dec     a           ; Point to Cell 3
719e f5        push    af          ; Save copy of position
719f 0e00      ld      c,00h       ; C= Pixel bitmap for this cell (empty)
71a1 cdf471    call    DrawGpCl    ; Draw Cell 3 (71f4h)
71a4 f1        pop     af          ; Retrieve position
71a5 3d        dec     a           ; Point to Cell 2
71a6 cdf471    call    DrawGpCl    ; Draw Cell 2 (71f4h)
71a9 10d8      djnz    7183h

; Draw gaps 4-7 (the Left/Up gaps)
; For each, AND the desired contents of cells 0 & 3 with what's already on the
; screen to allow for overlapping right-moving gaps.

71ab 0604      ld      b,04h       ; 4 gaps to draw

71ad dd4e37    ld      c,(ix+37h)  ; Get pixel bitmap for this cell
71b0 78        ld      a,b
71b1 c603      add     a,03h       ; Start with Gap 7 and work down
71b3 32b871    ld      (71b8h),a
71b6 dd7e08    ld      a,(ix+08h)  ; A= Position byte for next gap to be drawn
71b9 3c        inc     a
71ba 3c        inc     a           ; Point to Cell 3
71bb f5        push    af          ; Save copy of position
71bc cd4372    call    AndGpCl     ; AND Cell 3 with desired bitmap (7243h)
71bf f1        pop     af          ; Retrieve position
71c0 d603      sub     03h         ; Point to Cell 0
71c2 f5        push    af          ; Save copy of position
71c3 dd4e39    ld      c,(ix+39h)  ; Get pixel bitmap for this cell
71c6 cd4372    call    AndGpCl     ; AND Cell 0 with desired bitmap (7243h)
71c9 f1        pop     af          ; Retrieve position
71ca 3c        inc     a           ; Point to Cell 1
71cb f5        push    af          ; Save copy of position
71cc 0e00      ld      c,00h       ; C= Pixel bitmap for this cell (empty)
71ce cdf471    call    DrawGpCl    ; Draw Cell 1 (71f4h)
71d1 f1        pop     af          ; Retrieve position
71d2 3c        inc     a           ; Point to Cell 2
71d3 cdf471    call    DrawGpCl    ; Draw Cell 2 (71f4h)
71d6 10d5      djnz    71adh
71d8 c9        ret




Rhyme11:       ; 'And he left with a much'
               ; 'wider face...'
71d9           db      2ch, 13h, 49h, 0dh, 4ah, 11h, 0ah, 0bh, 59h, 1ch, 0eh
               db      19h, 4dh, 46h, 12h, 1ah, 08h, 0cdh, 1ch, 0eh, 09h, 0ah
               db      57h, 0bh, 06h, 08h, 8ah




;-------------------------------------------------------------------------------
DrawGpCl:      ; Draws one of the cells that makes a gap.
;-------------------------------------------------------------------------------
; ENTRY
; A = Cell position (Bits 7,6,5 = Jline 0-7 / Bits 4,3,2,1,0 = Cell 0-31)
; C = 8-bit pixel bitmap to be drawn to the top 2 rows of the cell

71f4 cdfb71    call    GetClPtr    ; HL points to cell in Display (71fbh)
71f7 71        ld      (hl),c      ; Draw top pixel line
71f8 24        inc     h           ; Point at second row down in cell
71f9 71        ld      (hl),c      ; Draw second pixel line
71fa c9        ret




;-------------------------------------------------------------------------------
GetClPtr:      ; Converts a gap cell position into a Display pointer
;-------------------------------------------------------------------------------
; ENTRY
; A = Cell position (Bits 7,6,5 = Jline 0-7 / Bits 4,3,2,1,0 = Cell 0-31)
; EXIT
; HL = Pointer to cell in Display memory

71fb f5        push    af          ; Save copy of position byte
71fc e6e0      and     0e0h        ; Isolate bits 7,6,5 (i.e which JLine 0-7)
71fe 07        rlca
71ff 07        rlca
7200 07        rlca                ; Rotate bits so A = 2xJLine
7201 07        rlca                ; i.e A= 0, 2, 4, 6, 8, 10, 12 or 14
7202 5f        ld      e,a         ; This will be an offset into ptr table..
7203 1600      ld      d,00h       ; Put it into DE
7205 210b72    ld      hl,JLnOffs  ; HL points to JLines offsets table (720bh)
7208 19        add     hl,de       ; HL now points to offset of correct JLine
7209 1810      jr      721bh

JLnOffs:       ; Data: Display pointers to the left-most cells in each JLine

720b 0040      dw      4000h       ; (0,0)
720d 6040      dw      4060h       ; (3,0)
720f c040      dw      40c0h       ; (6,0)
7211 2048      dw      4820h       ; (9,0)
7213 8048      dw      4880h       ; (12,0)
7215 e048      dw      48e0h       ; (15,0)
7217 4050      dw      5040h       ; (18,0)
7219 a050      dw      50a0h       ; (21,0)

721b 5e        ld      e,(hl)
721c 23        inc     hl
721d 56        ld      d,(hl)      ; DE= Display Pointer from table
721e eb        ex      de,hl       ; HL now points to left-most cell in JLine
721f f1        pop     af          ; Retrieve gap position byte
7220 e61f      and     1fh         ; Isolate bits 5,4,3,2,1,0 (which cell 0-31)
7222 b5        or      l
7223 6f        ld      l,a         ; Add this onto display pointer
7224 c9        ret                 ; HL now points to desired gap cell




Rhyme12:       ; 'Things seemed just as bad as'
               ; 'could be...'
7225           db      3fh, 0dh, 0eh, 13h, 0ch, 58h, 18h, 0ah, 0ah, 12h, 0ah
               db      49h, 0fh, 1ah, 18h, 59h, 06h, 58h, 07h, 06h, 49h, 06h
               db      0d8h, 08h, 14h, 1ah, 11h, 49h, 07h, 8ah




;-------------------------------------------------------------------------------
AndGpCl:       ; Alters one of the cells that makes a gap.
;-------------------------------------------------------------------------------
; This ANDs the contents of C with the pixels in the top two rows of a cell on
; screen, and updates the Display with the result.
;
; ENTRY
; A = Cell position (Bits 7,6,5 = Jline 0-7 / Bits 4,3,2,1,0 = Cell 0-31)
; C = 8-bit pixel bitmap to be ANDed with top 2 rows of the cell on screen

7243 cdfb71    call    GetClPtr    ; HL points to cell in Display (71fbh)
7246 7e        ld      a,(hl)      ; A= Pixel data from screen
7247 a1        and     c           ; AND with pixel bitmap
7248 77        ld      (hl),a      ; Replace it on screen
7249 24        inc     h           ; Point to next pixel row down in cell..
724a 7e        ld      a,(hl)
724b a1        and     c
724c 77        ld      (hl),a      ; ..and do the same.
724d c9        ret




Rhyme13:       ; 'Hostile faces were all Jack'
               ; 'could see...'
724e           db      33h, 14h, 18h, 19h, 0eh, 11h, 4ah, 0bh, 06h, 08h, 0ah
               db      58h, 1ch, 0ah, 17h, 4ah, 06h, 11h, 51h, 35h, 06h, 08h
               db      0d0h, 08h, 14h, 1ah, 11h, 49h, 18h, 0ah, 8ah




;-------------------------------------------------------------------------------
DrawJack:      ; Draw/Erase Jack
;-------------------------------------------------------------------------------
; This uses PtSprite which XORs pixels onto the screen, so drawing to the same
; location will also erase Jack.
;
; This routine also toggles the Jack draw/erase flag (Bit 0 of IX+32h) to
; alternate the action on every call to this procedure.

726d 08        ex      af,af'

; A' will be used to store an attributes byte for some of screen cells that make
; up part of Jack. This is used when Jack is jumping or falling through cells
; that make up a Jline.  When drawing, these cells need to have black ink and
; when erasing, they need resetting back to red ink.

726e dd3432    inc     (ix+32h)    ; Toggle Draw/Erase flag
7271 ddcb3246  bit     0,(ix+32h)  ; Test flag
7275 3e3a      ld      a,00111010b ; Make attribs byte with red ink..
7277 2802      jr      z,727bh     ; ..and continue if we're erasing
7279 3e38      ld      a,00111000b ; Otherwise, we're drawing - set ink to black

727b 08        ex      af,af'      ; Store attributes byte in A'

; The other attributes to consider are when Jack is on the bottom of the screen
; and potentially clashing with the magenta text on the InfoLine. Here, the top
; row of his sprite cells need the ink setting to black (when drawing), and back
; to magenta (when erasing)

727c dd7e2e    ld      a,(ix+2eh)  ; A=Jack position
727f fee0      cp      0e0h        ; Is Jack at bottom of screen?
7281 d4b47c    call    nc,MdInfAts ; If so, modify InfoLine attributes (7cb4h)

7284 dd7e2d    ld      a,(ix+2dh)  ; A=Jmp Block offset for current animation
7287 328e72    ld      (728eh),a

728a dd7e2e    ld      a,(ix+2eh)  ; A=Jack position

728d 18fe      jr      728dh       ; Depending on offset, jump to one of below:

728f c3aa72    jp      DJStill     ; +0  (72aah)
7292 c3ba72    jp      DJLeft      ; +3  (72bah)
7295 c3e872    jp      DJRight     ; +6  (72e8h)
7298 c31773    jp      DJGoodJmpP1 ; +9  (7317h)
729b c32573    jp      DJFallP1    ; +12 (7325h)
729e c34473    jp      DJGoodJmpP2 ; +15 (7344h)
72a1 c35273    jp      DJFallP2    ; +18 (7352h)
72a4 c36073    jp      DJBadJump   ; +21 (7360h)
72a7 c36b73    jp      DJStunned   ; +24 (736bh)


DJStill:       ; DrawJack / Standing Still

; The Standing Still sprite is 2x2 cells and Jack's position byte refers to the
; left column of cells

72aa 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72ac cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
72af 218e5d    ld      hl,GFXJStil ; HL=GFX data for current animation (5d8eh)
72b2 dd7e2f    ld      a,(ix+2fh)  ; A=Current frame data (Bits 6&5 = frame)
72b5 e660      and     60h         ; A=Offset into GFX data for current frame
72b7 c3a073    jp      DJPrt2x2ASt ; 73a0h


DJLeft:        ; DrawJack / Running Left

; There are 2 possibilites which determine the animation to draw:-
; 1) Jack is not touching either edge
; 2) Jack is half-way off the left-edge and re-appearing on the right-edge

72ba e61f      and     1fh         ; Test position, Z will be set if Jack's
                                   ; horizontal position is 0 - i.e. Jack is one
                                   ; cell off the left-edge of the screen
72bc dd7e2e    ld      a,(ix+2eh)  ; Put fresh copy of position in A
72bf 280c      jr      z,72cdh     ; Jump if Jack is off left edge

; It's (1) - Jack isn't at the edge. In this case, use GFXJLeft animation which
; is 2x3 cells. Jack's position byte refers to the sprite's middle column.

72c1 3d        dec     a           ; Adjust position byte to left column
72c2 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72c4 cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
72c7 210e5e    ld      hl,GFXJLeft ; HL=GFX data for current animation (5e0eh)
72ca c37673    jp      DJPrt2x3    ; 7376h

; It's (2) - Jack is half-way off the left edge.
; Here two sprites must be drawn - GFXJLEOf for Jack going off the left edge.
; This is a 2x2 cell sprite and Jack's position refers to the left column.

72cd 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72cf cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
72d2 218e5f    ld      hl,GFXJLEOf ; HL=GFX data for current animation (5f8eh)
72d5 cd9c73    call    DJPrt2x2    ; 739ch

; Now draw GFXJREOn for Jack re-appearing on the right edge - also 2x2.

72d8 dd7e2e    ld      a,(ix+2eh)  ; Put fresh copy of position in A
72db c61e      add     a,1eh       ; Make Jack's horizontal position 30
72dd 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72df cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
72e2 210e60    ld      hl,GFXJREOn ; HL=GFX data for current animation (600eh)
72e5 c39c73    jp      DJPrt2x2    ; 739ch


DJRight:       ; DrawJack / Running Right

; There are 2 possibilites which determine the animation to draw:-
; 1) Jack is not touching either edge
; 2) Jack is half-way off the right-edge and re-appearing on the left-edge

72e8 e61f      and     1fh         ; Strip Jline info so A=Screen column
72ea fe1e      cp      1eh         ; Is it 30 - is Jack 1 cell off right edge?
72ec dd7e2e    ld      a,(ix+2eh)  ; Put fresh copy of position in A
72ef 280b      jr      z,72fch     ; Jump if Jack is off right edge

; It's (1) - Jack isn't at the edge. In this case, use GFXJRgt animation which
; is 2x3 cells. Jack's position byte refers to the sprite's left column.

72f1 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72f3 cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
72f6 21ce5e    ld      hl,GFXJRgt  ; HL=GFX data for current animation (5eceh)
72f9 c37673    jp      DJPrt2x3    ; 7376h

; It's (2) - Jack is half-way off the right edge.
; Here two sprites must be drawn - GFXJREOf for Jack going off the right edge.
; This is a 2x2 cell sprite and Jack's position refers to the left column.

72fc 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
72fe cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
7301 210e61    ld      hl,GFXJREOf ; HL=GFX data for current animation (610eh)
7304 cd9c73    call    DJPrt2x2    ; 739ch

; Now draw GFXJLEOn for Jack re-appearing on the left edge - also 2x2.

7307 dd7e2e    ld      a,(ix+2eh)  ; Put fresh copy of position in A
730a d61e      sub     1eh         ; Make Jack's horizontal position 0
730c 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
730e cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
7311 218e60    ld      hl,GFXJLEOn ; HL=GFX data for current animation (608eh)
7314 c39c73    jp      DJPrt2x2    ; 739ch


DJGoodJmpP1:   ; DrawJack / Jumping through a gap (Part 1)

; This animation is the first part of a successful jump. It is a 3x2 cell sprite
; which therefore requires an appropriate vertical offset when calling
; GetDspPtr. Jack's position byte refers to the sprite's left column.
;
; The sprite also overlaps with 2 cells forming part of the above Jline so
; their attributes must be changed.
;
; This animation is followed by GFXJGJp2

7317 cd0d79    call    MdJLAtsA    ; Modify Attribs in Jline cells above (790dh)
731a 0e00      ld      c,00h       ; Vertical Offset for GetDspPtr
731c cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
731f 218e61    ld      hl,GFXJGJp1 ; HL=GFX data for current animation (618eh)
7322 c38073    jp      DJPrt3x2    ; 7380h


DJFallP1:      ; DrawJack / Falling through a gap (Part 1)

; This animation is the first part of a fall through a gap. It is a 4x2 cell
; sprite and Jack's position byte refers to the sprite's left column.
;
; The sprite also overlaps with 2 cells forming part of the below Jline so
; their attributes must be changed.
;
; This animation is followed by GFXJFal2

7325 cd1279    call    MdJLAtsB    ; Modify Attribs in Jline cells below (7912h)
7328 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
732a cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
732d 214e63    ld      hl,GFXJFal1 ; HL=GFX data for current animation (634eh)
7330 c3a973    jp      DJPrt4x2    ; 73a9h




Rhyme14:       ; 'He tried to stay calm...'
7333           db      33h, 4ah, 19h, 17h, 0eh, 0ah, 49h, 19h, 54h, 18h, 19h
               db      06h, 5eh, 08h, 06h, 11h, 92h




DJGoodJmpP2:   ; DrawJack / Jumping through a gap (Part 2)

; This animation is the second part of a successful jump through a gap and
; follows on from GFXJGJp1. It is a 4x2 cell sprite which therefore requires an
; appropriate vertical offset when calling GetDspPtr. Jack's position byte
; refers to the sprite's left column.
;
; The sprite also overlaps with 2 cells forming part of the above Jline so
; their attributes must be changed.

7344 cd0d79    call    MdJLAtsA    ; Modify Attribs in Jline cells above (790dh)
7347 0efe      ld      c,0feh      ; Vertical Offset for GetDspPtr
7349 cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
734c 214e62    ld      hl,GFXJGJp2 ; HL=GFX data for current animation (624eh)
734f c3a973    jp      DJPrt4x2    ; 73a9h


DJFallP2:      ; DrawJack / Falling through a gap (Part 2)

; This animation is the second part of a fall through a gap and follows on from
; GFXJFal1. It is a 4x2 cell sprite and requires an appropriate vertical offset
; when calling GetDspPtr. Jack's position byte refers to the sprite's left
; column.
;
; The sprite also overlaps with 2 cells forming part of the above Jline (Jack's
; vertical position will have been decremented since GFXJFal1) so their
; attributes must be changed.

7352 cd0d79    call    MdJLAtsA    ; Modify Attribs in Jline cells above (790dh)
7355 0eff      ld      c,0ffh      ; Vertical Offset for GetDspPtr
7357 cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
735a 218e65    ld      hl,GFXJFal2 ; HL=GFX data for current animation (658eh)
735d c3a973    jp      DJPrt4x2    ; 73a9h


DJBadJump:     ; DrawJack / Jumping into Jline, hitting head, falling back down

; This is a 3x2 cell sprite which therefore requires an appropriate vertical
; offset when calling GetDspPtr. Jack's position byte refers to the sprite's
; left column.
;
; The sprite does overlap with 2 cells forming part of the above Jline but no
; attributes are changed as we want Jack to go red when he hits Jline.
;
; Unless this failed jump takes Jack's last remaining life, it will be followed
; by the GFXJStun animation.

7360 0e00      ld      c,00h       ; Vertical Offset for GetDspPtr
7362 cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
7365 214e64    ld      hl,GFXJBdJp ; HL=GFX data for current animation (644eh)
7368 c38073    jp      DJPrt3x2    ; 7380h


DJStunned:     ; DrawJack / Stunned

; The Stunned sprite is 2x2 cells and Jack's position byte refers to the left
; column of cells

736b 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
736d cdc673    call    GetDspPtr   ; DE=Display address to draw Jack (73c6h)
7370 210e65    ld      hl,GFXJStun ; HL=GFX data for current animation (650eh)
7373 c39c73    jp      DJPrt2x2    ; 739ch


DJPrt2x3:      ; Print Jack (2x3 sprites)

; Jack is in one of the following: GFXJLeft, GFXJRgt
; These animations are 2x3 sprites (48 bytes per GFX frame). At this point:
;
; HL= Address of Frame 0 GFX data for current animation
; DE= Display address to print sprite

7376 cd8873    call    DJSet48Off  ; Adjust HL to point to current frame (7388h)
7379 010203    ld      bc,0302h    ; 2x3 sprite to be printed


DJPrtJack:

737c cd0374    call    PtSprite    ; 7403h
737f c9        ret


DJPrt3x2:      ; Print Jack (3x2 sprites)

; Jack is in one of the following: GFXJGJp1, GFXJBdJp
; These animations are 3x2 sprites (48 bytes per GFX frame). At this point:
;
; HL= Address of Frame 0 GFX data for current animation
; DE= Display address to print sprite

7380 cd8873    call    DJSet48Off  ; Adjust HL to point to current frame (7388h)
7383 010302    ld      bc,0203h    ; 3x2 sprite to be printed
7386 18f4      jr      DJPrtJack   ; 737ch


DJSet48Off:    ; Adjusts HL to point to current GFX frame (48 bytes per frame)

7388 cd9473    call    DJFrameX64  ; A=Current frame x64 (0,64,128,192) (7394h)
738b 0f        rrca                ; Divide by 4..
738c 0f        rrca                ; A=0,16,32,48 (current frame x16)
738d 4f        ld      c,a
738e 0600      ld      b,00h       ; BC=0,16,32,48
7390 09        add     hl,bc
7391 09        add     hl,bc
7392 09        add     hl,bc       ; Add to HL 3 times (current frame x48)
7393 c9        ret


DJFrameX64:    ; Returns A with Jack's Animation Frame x 64

7394 dd7e2f    ld      a,(ix+2fh)  ; A=Current animation frame (Bits 1&0)
7397 e603      and     03h         ; Isolate Bits 1&0 - A=0,1,2,3
7399 0f        rrca
739a 0f        rrca                ; Multiply by 64
739b c9        ret                 ; A=0,64,128,192


DJPrt2x2:      ; Print Jack (2x2 sprites)

; Jack is in one of the following: GFXJLEOf, GFXJREOn, GFXJLEOn, GFXJREOf,
; GFXJStun. All these animations are 2x2 sprites (32 bytes per GFX frame). At
; this point:
;
; HL= Address of Frame 0 GFX data for current animation
; DE= Display address to print sprite
;
; Now, adjust HL to point to the current GFX frame.

739c cd9473    call    DJFrameX64  ; A=Current frame x 64 (0,64,128,192) (7394h)
739f 0f        rrca                ; Divide by 2, A=(0,32,64,96)


DJPrt2x2ASt:   ; GFXJStil enters this routine here with A already set as above

73a0 4f        ld      c,a
73a1 0600      ld      b,00h       ; Put GFX offset in BC..
73a3 09        add     hl,bc       ; ..and use it to adjust HL
73a4 010202    ld      bc,0202h    ; 2x2 sprite to be printed
73a7 18d3      jr      DJPrtJack   ; 737ch


DJPrt4x2:      ; Print Jack (4x2 sprites)

; Jack is in one of the following animations: GFXJGJp2, GFXJFal1 or GFXJFal2
; All these animations are 4x2 sprites (64 bytes per GFX frame). At this point:
;
; HL= Address of Frame 0 GFX data for current animation
; DE= Display address to print sprite
;
; Now, adjust HL to point to the current GFX frame.
;
73a9 cd9473    call    DJFrameX64  ; A=Current frame x 64 (0,64,128,192) (7394h)
73ac 4f        ld      c,a
73ad 0600      ld      b,00h       ; Put GFX offset in BC..
73af 09        add     hl,bc       ; ..and use it to adjust HL
73b0 010402    ld      bc,0204h    ; 4x2 sprite to be printed
73b3 18c7      jr      DJPrtJack   ; 737ch




Rhyme15:       ; 'And to come to no harm...'
73b5           db      2ch, 13h, 49h, 19h, 54h, 08h, 14h, 12h, 4ah, 19h, 54h
               db      13h, 54h, 0dh, 06h, 17h, 92h




;-------------------------------------------------------------------------------
GetDspPtr:     ; Calculates the Display address to print a sprite
;-------------------------------------------------------------------------------
; Calculates the Display address for a sprite (Jack or Hazard) based on it's
; position byte and a given vertical offset.
;
; NB: Sprite position bytes only store vertical positions as a number 0-7
; relating to the Jline the sprite is under.  Since different animations require
; sprites of varying heights, a vertical offset needs to be supplied to target
; the specific screen cell that will be the sprite's top-left cell.
;
; ENTRY
; A = Sprite position: Bits (7,6,5) = Jline (0-7) immediately above sprite
;                      Bits (4,3,2,1,0) = Horizontal screen column (0-31)
; C = Vertical offset:
;                      --------------------
;                             C=FE
;                      --------------------
;                             C=FF
;                      ====================  JLINE ABOVE SPRITE
;                             C=00
;                      --------------------
;                             C=01
;                      --------------------
;                             C=02
;                      ====================  JLINE BELOW SPRITE
; EXIT
; DE = Address in display memory to print sprite's top-left cell

; First we need to convert the position byte (A) & vertical offset (C) into
; screen coordinates.
; We want the line (0-23) in D, and column (0-31) in E.

73c6 47        ld      b,a         ; Save copy of the position byte
73c7 e61f      and     1fh         ; Zero top 3 bits - leave horiz position
73c9 5f        ld      e,a         ; E = Screen Column

73ca 78        ld      a,b         ; Retrieve copy of position byte
73cb e6e0      and     0e0h        ; Zero low 5 bits - leave Jline info in 7,6,5
73cd 07        rlca                ; Rotate the top 3 bits into positions 0,1,2
73ce 07        rlca                ; so A equals Jline above sprite.
73cf 07        rlca
73d0 57        ld      d,a         ; D = Jline

; Now convert to screen line:
; If x = Jline above sprite, then screen line = 3x + vertical offset

73d1 07        rlca                ; 2x
73d2 82        add     a,d         ; 3x
73d3 81        add     a,c         ; + Vertical offset
73d4 57        ld      d,a         ; D=Screen line, E=Screen column

; Now we convert the screen line and screen column into a Display pointer.
;
; NOTES
; A 16 bit pointer to a cell in Display memory has the form;
;
;              High Byte           Low Byte
;    BIT       7 6 5 4 3 2 1 0     7 6 5 4 3 2 1 0
;              0 1 0 T T 0 0 0     R R R C C C C C
;
; T = Which third of the screen 00=Top, 01=Middle, 10=Bottom
; R = 3 bit value for screen line within that third of screen (0-7)
; C = 5 bit value for screen column (0-31)
;
; AT THIS POINT
; A = Screen line (0-23) - Bits 4&3=TT, Bits 2,1,0=RRR
; D = Screen line (0-23)
; E = Screen column (0-31) - Bits 4,3,2,1,0=CCCCC
;
; N.B. The top 3 bits in A, D & E will all be zero.
;
; EXIT
; DE = Address of cell in Display memory

73d5 e607      and     07h         ; Zero top five bits of screen line - lower
                                   ; 3 bits indicate line number (0-7) within
                                   ; whichever screen-third it's in.
73d7 0f        rrca                ; Rotate them into bits 7,6,5 (as required in
73d8 0f        rrca                ; Display pointer low byte)
73d9 0f        rrca
73da b3        or      e           ; Copy lower 5 bits (screen column) from E
                                   ; into A
73db 5f        ld      e,a         ; And put copy in E

; Lower byte is now complete in E. Now construct High byte.

73dc 7a        ld      a,d         ; A = Screen line
73dd e618      and     18h         ; Zero all bits except 4&3 (screen third-TT)
73df c640      add     a,40h       ; Set top 3 bits to 010, completing High byte
73e1 57        ld      d,a         ; Put copy in D

; DE now points to required cell in Display memory

73e2 c9        ret




Rhyme16:       ; 'But more often got squashed'
               ; 'like a flea...'
73e3           db      2dh, 1ah, 59h, 12h, 14h, 17h, 4ah, 14h, 0bh, 19h, 0ah
               db      53h, 0ch, 14h, 59h, 18h, 16h, 1ah, 06h, 18h, 0dh, 0ah
               db      0c9h, 11h, 0eh, 10h, 4ah, 46h, 0bh, 11h, 0ah, 86h




;-------------------------------------------------------------------------------
PtSprite:      ; Prints/erases a multi-cell sprite to/from the screen
;-------------------------------------------------------------------------------
; This routine is used to print & erase sprites on screen. Pixels are XOR'd onto
; the screen - so reprinting to the same location will erase an image.
;
; This is also used to print text (where each character is treated as a 1x1 cell
; sprite).
;
; ENTRY:
; HL = Pointer to GFX data to be printed
; DE = Pointer into Display memory - where to print top left cell
; BC = Size of GFX in cells (B=Width, C=Height)

7403 d5        push    de          ; Save a copy of current print location
7404 c5        push    bc          ; Save a copy of the width, height counter

; Next horizontal cell

7405 c5        push    bc          ; Another copy (for width)

; Starting painting a cell

7406 0608      ld      b,08h       ; 8 rows of pixels in this cell

; Next pixel row

7408 4e        ld      c,(hl)      ; C=pixel data for this row
7409 1a        ld      a,(de)      ; A=pixels currently on screen at position
740a a9        xor     c           ; Turn on/off pixels as required
740b 12        ld      (de),a      ; Copy back to Display memory
740c 23        inc     hl          ; HL points to next row of pixel data
740d 14        inc     d           ; Move Display pointer to next pixel row
740e 10f8      djnz    7408h       ; Print next pixel row

; We've painted a complete cell.

7410 c1        pop     bc          ; Retrieve width counter (B)
7411 7a        ld      a,d
7412 d608      sub     08h
7414 57        ld      d,a         ; Return Display pointer (DE) to top of cell
7415 13        inc     de          ; Point DE to top of adjacent right cell
7416 10ed      djnz    7405h       ; Paint next horizontal cell

; We've finished painting a row of cells.

7418 c1        pop     bc          ; BC= Width, Height counter
7419 d1        pop     de          ; Reset DE to top of left-most cell in row
741a 7b        ld      a,e
741b c620      add     a,20h
741d 5f        ld      e,a         ; Point DE to top of cell immediately below
741e 3004      jr      nc,7424h    ; Did we cross screen-third boundary?

; We've crossed a screen-third boundary

7420 7a        ld      a,d         ; If so, adjust DE to point to intended cell
7421 c608      add     a,08h       ; i.e add 2048 bytes (800h)
7423 57        ld      d,a

; No boundary cross

7424 0d        dec     c           ; Decrement height counter
7425 20dc      jr      nz,PtSprite ; Paint next row of cells if req (7403h)

; We've finished painting the last row of cells.

7427 c9        ret




;-------------------------------------------------------------------------------
DrawJlines:    ; Draws the 8 Jlines
;-------------------------------------------------------------------------------
7428 3eff      ld      a,0ffh
742a 110040    ld      de,4000h    ; AT 0,0
742d cd5b74    call    DrawJline   ; 745bh

7430 116040    ld      de,4060h    ; AT 3,0
7433 cd5b74    call    DrawJline   ; 745bh

7436 11c040    ld      de,40c0h    ; AT 6,0
7439 cd5b74    call    DrawJline   ; 745bh

743c 112048    ld      de,4820h    ; AT 9,0
743f cd5b74    call    DrawJline   ; 745bh

7442 118048    ld      de,4880h    ; AT 12,0
7445 cd5b74    call    DrawJline   ; 745bh

7448 11e048    ld      de,48e0h    ; AT 15,0
744b cd5b74    call    DrawJline   ; 745bh

744e 114050    ld      de,5040h    ; AT 18,0
7451 cd5b74    call    DrawJline   ; 745bh

7454 11a050    ld      de,50a0h    ; AT 21,0
7457 cd5b74    call    DrawJline   ; 745bh

745a c9        ret




;-------------------------------------------------------------------------------
DrawJline:     ; Draws a complete Jline on the screen
;-------------------------------------------------------------------------------
; A Jline is made by filling the top two pixel rows in a screen-line of cells.
;
; ENTRY:
; A  = 0FFh - Pixel bitmap for top two rows of each cell
; DE = Pointer into Display memory - left-most cell of Jline to be drawn

745b 37        scf                 ; Use Carry to mean we're on pixel row 1 of 2

; Next pixel line

745c 0620      ld      b,20h       ; 32 cells in a line
745e d5        push    de          ; Save copy of display pointer
745f d5        push    de
7460 e1        pop     hl          ; HL points to first cell in line

; Next cell

7461 77        ld      (hl),a      ; Set row of pixels in cell
7462 23        inc     hl          ; Point to next cell along
7463 10fc      djnz    7461h       ; Keep going until end of line

7465 d1        pop     de          ; Retrieve original display address
7466 3f        ccf                 ; Toggle Carry
7467 d8        ret     c           ; Return if we've just drawn pixel row 2 of 2

7468 14        inc     d           ; Otherwise point to next pixel row down and
7469 18f1      jr      745ch       ; draw second pixel line




Rhyme17:       ; 'By now Jack was in a'
               ; 'great flap...'
746b           db      2dh, 5eh, 13h, 14h, 5ch, 35h, 06h, 08h, 50h, 1ch, 06h
               db      58h, 0eh, 53h, 0c6h, 0ch, 17h, 0ah, 06h, 59h, 0bh, 11h
               db      06h, 95h




;-------------------------------------------------------------------------------
UpdateGame:    ; Updates Gaps & Jack, processes input and performs game logic
;-------------------------------------------------------------------------------
; This is called every 4 frames. As well as updating the Gap positions, it
; processes player input and sets up accordingly everything for Jack's next
; 4-frame animation.
; Collision & gap detection are also done here and acted upon as necessary
; along with any score and life adjustments.

7483 cda370    call    UpdtGaps    ; Move Gaps (70a3h)
7486 dd7e08    ld      a,(ix+08h)  ; A=Jack's current animation
7489 328d74    ld      (748dh),a   ; Use it as a jump offset
748c 1800      jr      748eh

748e c3a974    jp      UGStill     ; +0  (74a9h)
7491 c32375    jp      UGLeft      ; +3  (7523h)
7494 c32975    jp      UGRight     ; +6  (7529h)
7497 c32f75    jp      UGGoodJmpP1 ; +9  (752fh)
749a c34f75    jp      UGFallP1    ; +12 (754fh)
749d c35c75    jp      UGGoodJmpP2 ; +15 (755ch)
74a0 c36d75    jp      UGFallP2    ; +18 (756dh)
74a3 c36d75    jp      UGBadJump   ; +21 (756dh)
74a6 c37175    jp      UGStunned   ; +24 (7571h)


UGStill:       ; UpdateGame / Standing Still

; This is called if Jack was previously standing still or running left/right.
; Hazard and Gap detection takes place and if neither occurs, keyboard input
; is processed to determine next action/animation etc.

; Hazard detection

74a9 cda577    call    CollDetn    ; Is Jack touching a Hazard? (77a5h)
74ac 3013      jr      nc,74c1h    ; If not, check for gaps under Jack


UGInitHit:     ; Jack is touching a Hazard. Setup for Stunned animation.

74ae dd360818  ld      (ix+08h),24 ; Set Jack animation to Stunned
74b2 dd36f802  ld      (ix-08h),2  ; Set SFX/GFX routine to Hit by Hazard
74b6 3e10      ld      a,16
74b8 dd860a    add     a,(ix+0ah)
74bb dd770a    ld      (ix+0ah),a  ; Increment Stunned Timer by 16
74be c3a475    jp      UGStunChks  ; Continue to process Stunned status (75a4h)

; Gap detection

74c1 cdbb75    call    GapDetn     ; Is Jack standing on a gap? (75bbh)
74c4 dafd74    jp      c,UGInitFal ; If yes, launch Fall animation (74fdh)

; No Hazard collision or gap below. Process keyboard input:

74c7 dd7ef4    ld      a,(ix-0ch)  ; A=Keypress data from GetInput
74ca fe03      cp      03h         ; Is it Jump (CAPS SHIFT)?
74cc 2814      jr      z,UGInitJmp ; 74e2h

; Input is not Jump so must be Right(2), Left(1), or Nothing(0). Convert this
; to appropriate value for Jack animation

74ce 07        rlca                ; A=0,2 or 4
74cf dd86f4    add     a,(ix-0ch)  ; A=0(Standing Still),3(Left) or 6(Right)
74d2 dd7708    ld      (ix+08h),a  ; Set Jack animation
74d5 a7        and     a           ; Was it Standing Still?
74d6 2005      jr      nz,74ddh    ; Jump if not

74d8 dd36f800  ld      (ix-08h),0  ; Set SFX/GFX routine to Standing Still
74dc c9        ret

; Player has pressed 'Left' or 'Right'

74dd dd36f801  ld      (ix-08h),1  ; Set SFX/GFX routine to Running
74e1 c9        ret


UGInitJmp:     ; Player has pressed 'Jump'

74e2 cddb75    call    TestJump    ; Is there a gap above Jack? (75dbh)
74e5 380d      jr      c,UGInitGJp ; If so, launch Good Jump animation (74f4h)
                                   ; else fall through to..

UGInitBJp:     ; Setup for Bad Jump animation

74e7 dd360815  ld      (ix+08h),21 ; Set Jack animation to Bad Jump
74eb dd36f805  ld      (ix-08h),5  ; Set SFX/GFX routine to Bad Jump
74ef dd360a18  ld      (ix+0ah),24 ; Set Stunned Timer to 24
74f3 c9        ret


UGInitGJp:     ; Setup for Good Jump animation

74f4 dd360809  ld      (ix+08h),9 ; Set Jack animation to Good Jump (Part 1)
74f8 dd36f803  ld      (ix-08h),3 ; Set SFX/GFX routine to Good Jump
74fc c9        ret


UGInitFal:     ; Setup for Falling animation

74fd dd36080c  ld      (ix+08h),12 ; Set Jack animation to FallPt1
7501 dd36f804  ld      (ix-08h),4  ; Set SFX/GFX routine to Falling
7505 3e08      ld      a,8
7507 dd860a    add     a,(ix+0ah)
750a dd770a    ld      (ix+0ah),a  ; Increment Stunned Timer by 8
750d c9        ret




Rhyme18:       ; 'He felt like a rat in a trap...'
750e           db      33h, 4ah, 0bh, 0ah, 11h, 59h, 11h, 0eh, 10h, 4ah, 46h
               db      17h, 06h, 59h, 0eh, 53h, 46h, 19h, 17h, 06h, 95h




UGLeft:        ; UpdateGame / Running Left

; This is called if Jack has just completed a Running Left animation

7523 cd1876    call    MoveLeft    ; Adjust Jack's position 1 cell left (7618h)
7526 c3a974    jp      UGStill     ; Check collisions / Process Input (74a9h)


UGRight:       ; UpdateGame / Running Right

; This is called if Jack has just completed a Running Right animation

7529 cd0576    call    MoveRight   ; Adjust Jack's position 1 cell right (7605h)
752c c3a974    jp      UGStill     ; Check collisions / Process Input (74a9h)


UGGoodJmpP1    ; UpdateGame / Good Jump (Part 1)

; This is called if Jack has just completed the first part of a Good Jump. It
; sets everything up for Part 2 as well as increasing the score, adding a new
; gap and checking if Jack has completed the level.

752f dd36080f  ld      (ix+08h),15 ; Set Jack animation to GoodJumpPt2
7533 cd2b76    call    AddGap      ; Add a new gap (762bh)
7536 cd4d76    call    IncScore    ; Increase score (764dh)
7539 cd7378    call    PrtScore    ; Erase previous score digits (7873h)
753c cde077    call    CvtScBCD    ; Convert Score to BCD (77e0h)
753f cd7378    call    PrtScore    ; Print new score digits (7873h)
7542 cde775    call    TestTop     ; Is Jack jumping through Jline 0? (75e7h)
7545 d0        ret     nc          ; Return if not

; Jack is jumping through top Jline (completing level)

7546 dd360b01  ld      (ix+0bh),1  ; Update Game Progress to 'Level Completed'
754a dd360800  ld      (ix+08h),0  ; Set Jack animation to Standing Still
754e c9        ret                 ; i.e. no need to complete jump


UGFallP1:      ; UpdateGame / Falling through gap (Part 1)

; This is called if Jack has just completed the first part of Falling through
; a gap. It sets everything up for Part 2 including updating Jack's position
; to Jline below (as GFXJFal2 animation is drawn 'from below')

754f dd360812  ld      (ix+08h),18 ; Set Jack animation to FallingPt2
7553 dd7e09    ld      a,(ix+09h)
7556 c620      add     a,20h
7558 dd7709    ld      (ix+09h),a  ; Update Jack's position byte to Jline below
755b c9        ret


UGGoodJmpP2:   ; UpdateGame / Good Jump (Part 2)

; This is called if Jack has just completed the second part of a Good Jump. It
; updates Jack's position to reflect he's now on the Jline above and resets
; his animation back to Standing Still.

755c dd360800  ld      (ix+08h),0  ; Set Jack animation to Standing Still
7560 dd36f800  ld      (ix-08h),0  ; Set SFX/GFX routine to Standing Still
7564 dd7e09    ld      a,(ix+09h)
7567 d620      sub     20h
7569 dd7709    ld      (ix+09h),a  ; Update Jack's position byte to Jline above
756c c9        ret


UGFallP2:      ; UpdateGame / Falling through gap (Part 2)
UGBadJump:     ; UpdateGame / Bad Jump

; This is called if Jack has just completed Falling through a gap or a Bad
; Jump. It sets up the Stunned animation, then falls through into the code
; for if Jack was already Stunned.

756d dd360818  ld      (ix+08h),24 ; Set Jack animation to Stunned


UGStunned:     ; UpdateGame / Stunned

; This is called if Jack was previously Stunnned (or has just been put into this
; animation from a Fall or Bad Jump)

7571 dd36f806  ld      (ix-08h),6  ; Set GFX/SFX routine to Stunned

; Hazard/Gap detection

7575 cded75    call    TestBot     ; Is Jack at the bottom of screen? (75edh)
7578 3808      jr      c,7582h     ; Skip Hazard/Gap detection if yes
757a cda577    call    CollDetn    ; Is Jack touching a Hazard? (77a5h)
757d daae74    jp      c,UGInitHit ; Launch appropriate GFX/SFX if so (74aeh)
7580 1822      jr      UGStunChks  ; Gap detection & Wake-up check (75a4h)

; Jack is Stunned at the bottom of the screen, but has he just got there (from
; Fall or Bad Jump) i.e. should he lose a life?

7582 dd34fb    inc     (ix-05h)
7585 dd35fb    dec     (ix-05h)    ; Test Lost Life flag
7588 2020      jr      nz,UGWakeCk ; If a life's already been lost, is it time
                                   ; to wakeup? (75aah)

; Jack has only just arrived at the bottom from a Fall or Bad Jump - so he loses
; a life

758a cdf578    call    PrtLives    ; Erase 'lives remaining' symbols (78f5h)
758d dd350c    dec     (ix+0ch)    ; Decrement lives counter
7590 2005      jr      nz,7597h    ; Was that his last life?
7592 dd360b02  ld      (ix+0bh),2  ; If so, update Game Progress to 'Game Over'
7596 c9        ret

7597 cdf578    call    PrtLives    ; Print 'lives remaining' symbols (78f5h)
759a dd36fb01  ld      (ix-05h),1  ; Set Lost Life flag
759e dd360a18  ld      (ix+0ah),24 ; Set Stunned Timer to 24
75a2 1806      jr      UGWakeCk    ; 75aah


UGStunChks:    ; Checks to perform when Jack is Stunned

; This is called when Jack is Stunned to check for gaps below, and to check
; if it's time for Jack to wake-up.
; NB: Hazard collision has already been checked when calling this.

75a4 cdbb75    call    GapDetn     ; Is Jack lying on a gap? (75bbh)
75a7 dafd74    jp      c,UGInitFal ; If yes, launch Fall animation (74fdh)


UGWakeCk:      ; Is it time to wake-up from being Stunned?

75aa dd350a    dec     (ix+0ah)    ; Decrement Stunned Timer..
75ad c0        ret     nz          ; ..and return if still time remaining

; Stunned Timer has run out - Setup for Standing Still animation

75ae dd360800  ld      (ix+08h),0  ; Set Jack animation to Standing Still
75b2 dd36f800  ld      (ix-08h),0  ; Set SFX/GFX routine to Standing Still
75b6 dd36fb00  ld      (ix-05h),0  ; Reset Lost Life flag
75ba c9        ret




;-------------------------------------------------------------------------------
GapDetn:       ; Gap Detection - Is Jack standing on a hole?
;-------------------------------------------------------------------------------
; EXIT
;  Carry Flag = 1 if stood on gap / 0 if not

; First check if Jack is at the bottom of the screen - if so, he can't be stood
; on a gap

75bb dd7e09    ld      a,(ix+09h)  ; A=Jack's position
75be c620      add     a,20h
75c0 fe20      cp      20h         ; This will set Carry if Jack's at bottom
75c2 3f        ccf                 ; If Jack's at bottom, Carry is now 0..
75c3 d0        ret     nc          ; ..so return

; Jack's stood on a Jline. Since we've altered the position byte in A (moving
; Jack down a Jline) we can use TestGap which looks for a gap above.

; Since gaps are 3 cells wide, and their positions are based on their
; left-most cells, we need to look for a gap matching Jack's position byte or
; the position adjacent to the left.

75c4 cdcd75    call    TestGap     ; Check against first position (75cdh)
75c7 d8        ret     c           ; Return if match found

75c8 3d        dec     a           ; Alter Jack's position 1 cell left..
75c9 cdcd75    call    TestGap     ; ..and check again (75cdh)
75cc c9        ret




;-------------------------------------------------------------------------------
TestGap:       ; Looks for a Gap above Jack
;-------------------------------------------------------------------------------
; This compares Jack's position byte against the positions of all 8 gaps. Gaps
; are 3 cells wide and their position refers to their left-most cell so
; 2 calls to this procedure with different Jack positions are needed.
;
; ENTRY
; A = Jack's position byte
; EXIT
; Carry = 1 if gap above Jack
;       = 0 if no gap

75cd dde5      push    ix
75cf e1        pop     hl          ; HL points to 8 Gap position bytes
75d0 010800    ld      bc,8        ; 8 gaps to test
75d3 edb1      cpir                ; Compare them with Jack's position in A
75d5 2802      jr      z,75d9h     ; Jump if match found
75d7 a7        and     a           ; Otherwise clear Carry and return
75d8 c9        ret

75d9 37        scf                 ; Match found. Set Carry and return
75da c9        ret




;-------------------------------------------------------------------------------
TestJump:      ; Is there a gap above Jack for him to jump through?
;-------------------------------------------------------------------------------
; Since gaps are 3 cells wide, and their positions are based on their
; left-most cells, we need to look for a gap matching Jack's position byte or
; the position adjacent to the left.
;
; EXIT
; Carry = 1 if gap above Jack
;       = 0 if no gap

75db dd7e09    ld      a,(ix+09h)  ; A=Jack's position
75de cdcd75    call    TestGap     ; Check against first position (75cdh)
75e1 d8        ret     c           ; Return if match found

75e2 3d        dec     a           ; Alter Jack's position 1 cell left..
75e3 cdcd75    call    TestGap     ; ..and check again (75cdh)
75e6 c9        ret




;-------------------------------------------------------------------------------
TestTop:       ; Is Jack at the top of the screen (under Jline 0)?
;-------------------------------------------------------------------------------
; EXIT
; Carry = 1 if Yes
;         0 if No

75e7 dd7e09    ld      a,(ix+09h)  ; A=Jack's position
75ea fe20      cp      20h         ; Carry will be set if he's under Jline 0
75ec c9        ret




;-------------------------------------------------------------------------------
TestBot:       ; Is Jack at the bottom of the screen (under Jline 7)?
;-------------------------------------------------------------------------------
; EXIT
; Carry = 1 if Yes
;         0 if No

75ed dd7e09    ld      a,(ix+09h)  ; A=Jack's position
75f0 fee0      cp      0e0h        ; Carry will be clear if he's under Jline 7
75f2 3f        ccf
75f3 c9        ret




Rhyme19:       ; 'If only he'd guessed...'
75f4           db      34h, 4bh, 14h, 13h, 11h, 5eh, 0dh, 0ah, 24h, 49h, 0ch
               db      1ah, 0ah, 18h, 18h, 0ah, 89h




;-------------------------------------------------------------------------------
MoveRight:     ; Update Jack's position one cell right
;-------------------------------------------------------------------------------
7605 dd3409    inc     (ix+09h)    ; Update Jack's position byte one cell right
7608 dd7e09    ld      a,(ix+09h)
760b 47        ld      b,a         ; Put a copy in A & B
760c e61f      and     1fh         ; Strip Vertical info / A=Horizontal column
760e fe1f      cp      1fh         ; Was Jack half-way off the right edge?
7610 c0        ret     nz          ; Return if not

; Jack must have been at screen column 30 before move (half-way off right edge
; and half-way on left). Update will have made his new horizontal position 31
; so need to adjust it to position 0 (fully on left edge).
;
; NB: Jack is never at position 31 - that is simulated when he's at position 30
; and in the off-right/on-left animations.

7611 78        ld      a,b         ; Retrieve copy of new position in A
7612 d61f      sub     1fh         ; Adjust position..
7614 dd7709    ld      (ix+09h),a  ; ..and store it
7617 c9        ret




;-------------------------------------------------------------------------------
MoveLeft:      ; Update Jack's position one cell left
;-------------------------------------------------------------------------------
7618 dd3509    dec     (ix+09h)    ; Update Jack's position byte one cell left
761b dd7e09    ld      a,(ix+09h)
761e 47        ld      b,a         ; Put a copy in A & B
761f e61f      and     1fh         ; Strip Vertical info / A=Horizontal column
7621 fe1f      cp      1fh         ; Was Jack half-way off the left edge?
7623 c0        ret     nz          ; Return if not

; Jack must have been at screen column 0 before move (half-way off left edge
; and half-way on right). Update will have made his new horizontal position 31
; and moved him up 1 Jline so need to adjust it to position 30 on Jline below.
;
; NB: Jack is never at position 31 - that is simulated when he's at position 0
; and in the off-left/on-right animations.

7624 78        ld      a,b         ; Retrieve copy of new position in A
7625 c61f      add     a,1fh       ; Adjust position..
7627 dd7709    ld      (ix+09h),a  ; ..and store it
762a c9        ret




;-------------------------------------------------------------------------------
AddGap:        ; Adds a new Gap
;-------------------------------------------------------------------------------
; All 8 gaps already 'exist' from the beginning of the game, but only two are
; visible as all 4 descenders and all 4 ascenders are in the same positions,
; meaning they are drawn on top of one another. Adding a new gap is just a case
; of changing the position of an existing gap so it becomes visible.

762b dd7efe    ld      a,(ix-02h)  ; A=New Gaps counter
762e fe06      cp      06h         ; If we've already added 6 gaps to the
7630 d0        ret     nc          ; original visible 2, then no more to add.

7631 3c        inc     a
7632 dd77fe    ld      (ix-02h),a  ; Increment New Gaps counter

; Which sort of gap to add? The first 3 'new' gaps descend, and the next 3
; ascend

7635 fe04      cp      04h         ; Have we already added 3 descenders?
7637 dd4ef9    ld      c,(ix-07h)  ; C=Right Gap Tracker (for descenders)
763a 3804      jr      c,7640h     ; Jump if not

763c dd4e34    ld      c,(ix+34h)  ; C=Left Gap Tracker (for ascenders)
763f 3c        inc     a           ; Adjust A to become IX offset for new gap
                                   ; position byte
7640 324b76    ld      (764bh),a   ; Adjust later code to target byte where new
                                   ; gap position is to be stored

; Two variables, Right Gap Tracker (IX-07h) and Left Gap Tracker (IX+34) are
; used to ensure that new gaps don't partially overlap with any current gaps.

; When the position of all 8 gaps is randomized at the start of each level
; (RndGaps), they are set with a horizontal position that is a multiple of 4.
; Every time a gap moves one cell (in UpdtGaps), the tracking variables are also
; updated accordingly (becoming an offset of how far the gaps have moved from
; their multiple-of-4 cell positions).
;
; So, to set a new random non-overlapping gap position:
; 1) Start with a random position
; 2) Adjust it horizontally to make it 0,4,8,12,16,20,24 or 28.
; 3) Add on relevant Tracker variable
;
; NB: Occasionally this will generate a position that is exactly the same as a
; current gap and no new gap will appear to have been created.

7643 dd7ef5    ld      a,(ix-0bh)  ; Start with a random value (1)
7646 e6fc      and     0fch        ; Make it a multiple of 4 (2)
7648 81        add     a,c         ; Add tracker variable (3)
7649 dd7700    ld      (ix+00h),a  ; Store it
764c c9        ret




;-------------------------------------------------------------------------------
IncScore:      ; Increases score after a good jump
;-------------------------------------------------------------------------------
; Points per good jump are awarded increasingly with each new level:
; Score Increase = (5 x Current Level) + 5 (up to maximum of 100)

764d dd7e0e    ld      a,(ix+0eh)  ; A=Current Level
7650 216576    ld      hl,PntsTbl  ; HL points to score lookup table (7665h)
7653 85        add     a,l         ; Use level as offset into table
7654 3001      jr      nc,7657h    ; Check for carry..
7656 24        inc     h           ; ..and fix if necessary. NB: This check is
                                   ; unneccessary with the addresses the game
                                   ; is assembled at - but useful if assembled
                                   ; with different ORG
7657 6f        ld      l,a         ; HL points to score increment amount
7658 7e        ld      a,(hl)      ; A=Score increment amount
7659 dd86fc    add     a,(ix-04h)  ; Add to current score (least sig byte)
765c 3003      jr      nc,7661h    ; Check for Carry, and if so..
765e dd34fd    inc     (ix-03h)    ; ..increment most sig byte

7661 dd77fc    ld      (ix-04h),a  ; Update new score (least sig byte)
7664 c9        ret

PntsTbl:       ; DATA: Lookup table - Points awarded per good jump in each level

7665 05        db      5           ; Level 0
7666 0a        db      10          ; Level 1
7667 0f        db      15          ; Level 2
7668 14        db      20          ; Level 3
7669 19        db      25          ; Level 4
766a 1e        db      30          ; Level 5
766b 23        db      35          ; Level 6
766c 28        db      40          ; Level 7
766d 2d        db      45          ; Level 8
766e 32        db      50          ; Level 9
766f 37        db      55          ; Level 10
7670 3c        db      60          ; Level 11
7671 41        db      65          ; Level 12
7672 46        db      70          ; Level 13
7673 4b        db      75          ; Level 14
7674 50        db      80          ; Level 15
7675 55        db      85          ; Level 16
7676 5a        db      90          ; Level 17
7677 5f        db      95          ; Level 18
7678 64        db      100         ; Level 19
7679 64        db      100         ; Level 20




Rhyme20:       ; 'That soon he could rest...'
767a           db      3fh, 0dh, 06h, 59h, 18h, 14h, 14h, 53h, 0dh, 4ah, 08h
               db      14h, 1ah, 11h, 49h, 17h, 0ah, 18h, 99h




;-------------------------------------------------------------------------------
GetInput:      ; Reads keyboard input
;-------------------------------------------------------------------------------
; The result of the player's keyboard input is stored in the byte at IX-0ch.
;
; 03 = Jump (CAPS SHIFT)
; 02 = Right (SPACE)
; 01 = Left (SYM SHIFT)
; 00 = Nothing

768d dd7ef4    ld      a,(ix-0ch)  ; A=Last keyboard input
7690 a7        and     a           ; Return if it was anything other than
7691 c0        ret     nz          ; 'Nothing' as previous input has yet to be
                                   ; processed
; Test for Jump

7692 01fefe    ld      bc,0fefeh   ; B=Keyboard section containing CAPS SHIFT
                                   ; C=Keyboard port
7695 ed78      in      a,(c)       ; Scan keyboard
7697 cb47      bit     0,a         ; Bit 0 = 'CAPS SHIFT'. Is it pressed? (Jump)
7699 2005      jr      nz,76a0h    ; If not, test for Right
769b dd36f403  ld      (ix-0ch),3  ; If yes, store result as 'Jump' and return
769f c9        ret

; Test for Right

76a0 01fe7f    ld      bc,7ffeh    ; B=Keyboard section containing SPACE
                                   ; C=Keyboard port
76a3 ed78      in      a,(c)
76a5 cb47      bit     0,a         ; Bit 0 = 'SPACE'. Is it pressed? (Right)
76a7 2005      jr      nz,76aeh    ; If not, test for Left
76a9 dd36f402  ld      (ix-0ch),2  ; If yes, store result as 'Right' and return
76ad c9        ret

; Test for Left

76ae cb4f      bit     1,a         ; Bit 1 = 'SYM SHIFT'. Is it pressed? (Left)
76b0 dd36f400  ld      (ix-0ch),0  ; Store result as 'Nothing'
76b4 c0        ret     nz          ; and return if it isn't pressed
76b5 dd36f401  ld      (ix-0ch),1  ; Otherwise store result as 'Left' and return
76b9 c9        ret




;-------------------------------------------------------------------------------
UpdHazds:      ; Update Hazards
;-------------------------------------------------------------------------------
; This updates the positions of all 20 Hazards (regardless of how many Hazards
; are currently in play)
;
; It is called every 4 frames. In the intermediate frames, the Hazards' GFX
; animations give the illusion of leftwards movement even while the sprite
; position remains unchanged.

76ba 0614      ld      b,14h       ; Set counter - 20 Hazards to update

76bc c5        push    bc          ; Save counter
76bd cdc476    call    76c4h       ; Update current Hazard
76c0 c1        pop     bc          ; Retrieve counter
76c1 10f9      djnz    76bch       ; Update next Hazard if more to do
76c3 c9        ret

76c4 3e0e      ld      a,0eh       ; Add 14 to counter to make it an IX offset
76c6 80        add     a,b         ; into Hazard position bytes (start at IX+22h
                                   ; and work down through them to IX+0fh)
76c7 32d976    ld      (76d9h),a
76ca 32cf76    ld      (76cfh),a   ; Update code with this offset
76cd dd7e00    ld      a,(ix+00h)  ; A=Current Hazard position byte

; To move a Hazard one cell left, the position byte is decremented. Even when
; the Hazard reaches the left edge of the screen, this will automatically move
; the Hazard up a Jline and back to the right edge.

76d0 3d        dec     a           ; Move Hazard position one cell left

; The exception lies when a Hazard reaches the left edge of Jline 1 and goes off
; the screen. At this point the position byte = 0 (and DrawHzrd will not print
; it).  With single decrements, it will not become printable again until it
; reaches 0DEh (Jline 7, Cell 30) - however, this will be a significant time
; off screen, so the following code reduces the wait leaving a shorter delay..

76d1 fefe      cp      0feh        ; Has Hazard gone off the edge of Jline 1?
76d3 2002      jr      nz,76d7h    ; If not, continue
76d5 3ef4      ld      a,0f4h      ; If it has, skip 10 cycles to make position
                                   ; f4h.
76d7 dd7700    ld      (ix+00h),a  ; Save updated position byte
76da c9        ret




;-------------------------------------------------------------------------------
DrawHzds:      ; Draws/erases the Hazards
;-------------------------------------------------------------------------------
; This draws or erases the Hazards in the current level by calling DrawHzrd
; for each.
;
; It also toggles the Hazards draw/erase flag (Bit 0 of IX-06h) to alternate
; the action on every call to this procedure.

76db dd7e0e    ld      a,(ix+0eh)  ; A=Number of Hazards in this level
76de dd34fa    inc     (ix-06h)    ; Toggle draw/erase flag
76e1 a7        and     a           ; Are there 0 Hazards in this level?
76e2 c8        ret     z           ; If so, return

; Setup the required info for DrawHzrd

76e3 47        ld      b,a         ; B=Number of Hazards - use as counter
76e4 218e66    ld      hl,GFXHzrds ; HL points to GFX data of 1st Hazard (668eh)
76e7 dd7e33    ld      a,(ix+33h)  ; Bits 2&1 represent Hazards' current frame
76ea e606      and     06h         ; Isolate bits 2&1 - A=0, 2, 4 or 6
76ec 07        rlca                ; Turn it into an offset into 1st Hazard's
76ed 07        rlca                ; GFX data by multiplying it by 24
76ee 07        rlca                ; A=A*8
76ef 5f        ld      e,a
76f0 07        rlca                ; A=A*16
76f1 83        add     a,e
76f2 5f        ld      e,a         ; E=A*24
76f3 1600      ld      d,00h       ; DE=Offset into Hazard GFX for current frame
                                   ; i.e. 0, 48, 96 or 144
76f5 19        add     hl,de       ; HL=Hazard GFX for current frame
76f6 3e0f      ld      a,0fh       ; A=Offset from IX to first Hazard position
                                   ; (Hazard position bytes begin at IX+0fh)
; Draw/Erase each Hazard

76f8 c5        push    bc          ; Save Hazards counter
76f9 cd0077    call    DrawHzrd    ; Draw/Erase current Hazard (7700h)
                                   ; NB. DrawHzrd returns with HL & A updated
                                   ; to target next Hazard
76fc c1        pop     bc          ; Retrieve counter
76fd 10f9      djnz    76f8h       ; Repeat for every Hazard in level
76ff c9        ret




;-------------------------------------------------------------------------------
DrawHzrd:      ; Draws/Erases a Hazard
;-------------------------------------------------------------------------------
; This routine draws or erases a Hazard. Pixels are XOR'd onto the screen - so
; reprinting to the same location will erase an image. Depending on the Hazard
; Draw/Erase flag (IX-06h), the attributes of the Hazard cells on screen will
; either be set or reset appropriately.
;
; ENTRY
; HL = Address of Hazard GFX data for current frame
;  A = Offset from IX to Hazard position byte
; EXIT
; HL = Address of current frame GFX data for next Hazard
;  A = Offset from IX to position byte of next Hazard (A=A+1)
;
;
; Each Hazard is a 2x3 cell sprite:
;      _________________
;     |     |     |     |
;     |  1  |  2  |  3  |
;     |_____|_____|_____|
;     |     |     |     |
;     |  4  |  5  |  6  |
;     |_____|_____|_____|
;
; The screen column data (Bits 4-0) in each Hazard's position byte refers to
; the middle column of each Hazard (Cells 2 & 5)
;
; The actual drawing is done by separate calls to PtHzdCol (Print Hazard Column)
; which draws a 2-cell column of the sprite:
; e.g. Column 1 = Cells 1 & 4.  Column 2 = Cells 2 & 5.  Column 3 = Cells 3 & 6.
;
; Drawing in this way allows the routine to cope when a Hazard is partly on/off
; the edge of the screen and parts of the same Hazard need to be drawn on
; different Jlines.
;
; There are three cases (remember Hazards travel right to left, and move up one
; Jline everytime they reach the left edge of the screen. Upon reaching the
; top-left on Jline 1, they re-appear at the bottom-right on Jline 7)
;
; Case 1: Hazard is fully on the screen not touching either edge - all three
;         columns need to be drawn next to each other.
;
; Case 2: Hazard is going off the left edge of Jlines 2-7 and reappearing on the
;         right edge on the Jline above. The Hazard horizontal position will
;         either be:
;         A) 0, in which case columns 2 & 3 must be drawn on the lower Jline and
;            column 1 must be drawn on the upper Jline.
;         B) 31, in which case column 3 must be drawn on the lower Jline and
;            columns 1 & 2 must be drawn on the upper Jline.
;
; Case 3: Hazard has gone off the left edge of Jline 1 and not yet appeared on
;         Jline 7. In this case, there is no animation off the left edge, the
;         Hazard just disappears. Equally, when it does reappear on Jline 7,
;         (and there is a short gap before it does) there is no animation on, it
;         just appears at position 30. No columns need to be drawn for Case 3.


7700 cd3479    call    GetHzAtt    ; A'=Attributes for Hazard cells - either a
                                   ; colour (drawing) or black (erasing) (7934h)
7703 e5        push    hl          ; Save GFX pointer
7704 f5        push    af          ; Save offset to position byte
7705 320a77    ld      (770ah),a
7708 dd7e00    ld      a,(ix+00h)  ; A= Hazard position byte

; Test for Case 3

770b a7        and     a           ; Has Hazard reached cell 0 on Jline1?
                                   ; i.e. it's gone off the screen.
770c 2850      jr      z,775eh     ; If so, we're finished drawing

770e fedf      cp      0dfh        ; Is Hazard already off the screen, but not
                                   ; yet back on Jline 7?
7710 304c      jr      nc,775eh    ; If so, we're finished drawing

; It's not Case 3 - test for Case 2A

7712 f5        push    af          ; Save position byte
7713 e61f      and     1fh         ; Strip top 3 bits (Jline info) to leave
                                   ; cell info (A=0-31)
7715 2019      jr      nz,7730h    ; Is Hazard at cell 0 on Jline? Test for case
                                   ; 2B if not.

; It's Case 2A - draw column 1 on upper Jline

7717 f1        pop     af          ; Retrieve position byte in A
7718 f5        push    af          ; and save a copy
7719 3d        dec     a           ; Adjust position to cell 31 on upper Jline
771a 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
771c cdc673    call    GetDspPtr   ; DE=Display address for column 1 (73c6h)
771f cd6e77    call    PtHzdCol    ; Print/Erase column 1 (776eh)

; Now draw columns 2 & 3 on lower Jline

7722 f1        pop     af          ; Retrieve position byte in A
7723 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
7725 cdc673    call    GetDspPtr   ; DE=Display address for column 2 (73c6h)
7728 cd6e77    call    PtHzdCol    ; Print/Erase column 2 (776eh)
772b cd6e77    call    PtHzdCol    ; Print/Erase column 3 (776eh)
772e 182e      jr      775eh       ; Finished drawing

; Test for Case 2B

7730 fe1f      cp      1fh         ; Is Hazard at cell 31?
7732 201a      jr      nz,774eh    ; If not, it must be Case 1

; It's Case 2B - draw columns 1 & 2 on upper Jline

7734 f1        pop     af          ; Retrieve position byte in A
7735 f5        push    af          ; and save a copy
7736 3d        dec     a           ; Adjust position to cell 30 on upper Jline
7737 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
7739 cdc673    call    GetDspPtr   ; DE=Display address for column 1 (73c6h)
773c cd6e77    call    PtHzdCol    ; Print/Erase column 1 (776eh)
773f cd6e77    call    PtHzdCol    ; Print/Erase column 2 (776eh)

; Now draw column 3 on lower Jline

7742 f1        pop     af          ; Retrieve position byte in A
7743 3c        inc     a           ; Adjust position to cell 0 on lower Jline
7744 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
7746 cdc673    call    GetDspPtr   ; DE=Display address for column 3 (73c6h)
7749 cd6e77    call    PtHzdCol    ; Print/Erase column 3 (776eh)
774c 1810      jr      775eh       ; Finished drawing

; It's Case 1 - draw 3 columns together

774e f1        pop     af          ; Retrieve position byte
774f 3d        dec     a           ; Modify position byte to point to Hazard's
                                   ; left column (rather than middle)
7750 0e01      ld      c,01h       ; Vertical Offset for GetDspPtr
7752 cdc673    call    GetDspPtr   ; DE=Display address to print Hazard (73c6h)
7755 cd6e77    call    PtHzdCol    ; Print/Erase column 1 (776eh)
7758 cd6e77    call    PtHzdCol    ; Print/Erase column 2 (776eh)
775b cd6e77    call    PtHzdCol    ; Print/Erase column 3 (776eh)

; Finished drawing columns - setup return values for HL & A

775e f1        pop     af          ; Retrieve offset to position byte
775f e1        pop     hl          ; Retrieve GFX pointer
7760 3c        inc     a           ; Inc offset to next Hazard's position byte
7761 11c000    ld      de,00c0h    ; Add 192 bytes to HL so it points to the
7764 19        add     hl,de       ; next Hazard's GFX data
7765 fe19      cp      19h         ; Is the next Hazard the 11th?
7767 c0        ret     nz          ; If not, return
7768 118007    ld      de,0780h    ; If it is, then we've run out of Hazard GFX
776b ed52      sbc     hl,de       ; as there are only 10 different designs so
776d c9        ret                 ; adjust HL to point to the first one again




;-------------------------------------------------------------------------------
PtHzdCol:      ; Print/Erase Hazard Column
;-------------------------------------------------------------------------------
; Prints 2 cells of a Hazard sprite and sets their attributes.
;
; ENTRY
; DE = Display address - where to print top cell
; HL = Address of GFX data for top cell (Bottom cell data to be 8 bytes later)
; EXIT
; DE = Display address of adjacent right cell (DE=DE+1)
; HL = Address of GFX data for next column in sprite (HL=HL+16)

776e cd9677    call    SetHzAtt    ; Set attributes for top cell (7796h)
7771 d5        push    de          ; Save display address
7772 d5        push    de          ; Save display address
7773 0608      ld      b,08h       ; Counter for 8 pixel rows in cell

; Print/Erase top cell

7775 1a        ld      a,(de)      ; A=Pixel row data already on screen
7776 ae        xor     (hl)        ; Turn on/off pixels as required
7777 12        ld      (de),a      ; Copy back to Display memory
7778 23        inc     hl          ; HL points to next row of Hazard GFX data
7779 14        inc     d           ; Move Display pointer to next pixel row
777a 10f9      djnz    7775h       ; Next pixel row

; Move display pointer to bottom cell

777c d1        pop     de          ; Retrieve display pointer
777d 7b        ld      a,e
777e c620      add     a,20h       ; Move forward 32 cells, then check if we've
7780 5f        ld      e,a         ; crossed a screen-third boundary
7781 3004      jr      nc,7787h    ; Continue, if not
7783 7a        ld      a,d         ; Otherwise increase DE by (8x256) to
7784 c608      add     a,08h       ; correctly address the bottom cell and
7786 57        ld      d,a         ; continue..

; Setup for bottom cell

7787 cd9677    call    SetHzAtt    ; Set attributes for bottom cell (7796h)
778a 0608      ld      b,08h       ; Counter for 8 pixel rows in cell

; Print/Erase bottom cell

778c 1a        ld      a,(de)      ; A=Pixel row data already on screen
778d ae        xor     (hl)        ; Turn on/off pixels as required
778e 12        ld      (de),a      ; Copy back to Display memory
778f 23        inc     hl          ; HL points to next row of Hazard GFX data
7790 14        inc     d           ; Move Display pointer to next pixel row
7791 10f9      djnz    778ch       ; Next pixel row

; Bottom cell complete

7793 d1        pop     de          ; Retrieve display pointer to top cell
7794 13        inc     de          ; Move pointer to adjacent right cell
7795 c9        ret




;-------------------------------------------------------------------------------
SetHzAtt:      ; Set Hazard Attributes
;-------------------------------------------------------------------------------
; Sets the attributes of a Hazard sprite cell on screen. When drawing, this
; gives the Hazard it's colour. When erasing, it returns the screen attributes
; to their default.
;
; ENTRY
; DE = Display address of cell
; A' = Desired attributes for cell
; EXIT
; DE = Preserved
; A' = Preserved

7796 d5        push    de          ; Preserve display pointer

; To convert Display address (DE) into corresponding Attributes address:
; D = ((D-40h) / 8) + 58h
; E = Unchanged

7797 7a        ld      a,d
7798 d640      sub     40h         ; Subtract 40h
779a 0f        rrca
779b 0f        rrca
779c 0f        rrca                ; Divide by 8
779d c658      add     a,58h       ; Add 58h
779f 57        ld      d,a         ; DE points to cell in Attributes memory
77a0 08        ex      af,af'      ; A=Desired attribs byte
77a1 12        ld      (de),a      ; Update screen
77a2 08        ex      af,af'      ; Save attribs byte back in A'
77a3 d1        pop     de          ; Retrieve display pointer
77a4 c9        ret




;-------------------------------------------------------------------------------
CollDetn:      ; Collision Detection - Is Jack touching a Hazard?
;-------------------------------------------------------------------------------
; EXIT
;  Carry Flag = 1 if collision / 0 if no collision

77a5 dd7e0e    ld      a,(ix+0eh)  ; A=Number of Hazards in this level
77a8 a7        and     a           ; Are there none? (Also clear Carry)
77a9 c8        ret     z           ; If no Hazards, then no collision - return

; The nature of the collision detection means that the same 'hit' will be
; detected on two consecutive calls to this routine - so check there wasn't a
; hit last time

77aa dd34ff    inc     (ix-01h)    ; Test Collision flag. Was collision detected
77ad dd35ff    dec     (ix-01h)    ; on last call to CollDetn?
77b0 2806      jr      z,77b8h     ; Jump if not
77b2 dd36ff00  ld      (ix-01h),0  ; If yes, reset Collision flag - we've
                                   ; already detected the current Hazard.
77b6 a7        and     a           ; Clear Carry
77b7 c9        ret

77b8 32d277    ld      (77d2h),a   ; Load counter with number of Hazards
77bb dd7e09    ld      a,(ix+09h)  ; A=Jack's position
77be fee0      cp      0e0h        ; Is Jack at the bottom of the screen? If so,
77c0 d0        ret     nc          ; return as he can't be touching a Hazard

; As Jack's sprite is at least 2 cells wide, we need to check for a collision
; on both sides. First, Jack's position byte (which corresponds with his left
; side) is compared with that of every active Hazard, then the position one cell
; to the right is also compared.

77c1 cdca77    call    77cah       ; Compare Jack position with Hazards
77c4 d8        ret     c           ; Finish here if there was a collision

77c5 3c        inc     a           ; Update position byte one cell right
77c6 cdca77    call    77cah       ; Compare positions again
77c9 c9        ret

; Subroutine below does the actual comparisons. It compares Jack's position byte
; in A with the Hazard position bytes starting at IX+0fh

77ca dde5      push    ix
77cc e1        pop     hl
77cd 110f00    ld      de,000fh    ; DE=Offset from HL to Hazard position bytes
77d0 19        add     hl,de       ; HL points to Hazard position bytes
77d1 010000    ld      bc,0000h    ; BC=Counter for no. Hazards (loaded earlier)
77d4 edb1      cpir                ; Compare position bytes
77d6 2802      jr      z,77dah     ; Jump if there a match
77d8 a7        and     a           ; No collision detected - clear Carry
77d9 c9        ret

; Collision detected

77da dd36ff01  ld      (ix-01h),1  ; Set Collision flag
77de 37        scf                 ; Set Carry to indicate collision
77df c9        ret




;-------------------------------------------------------------------------------
CvtScBCD:      ; Converts Score word to 5 byte Binary Coded Decimal
;-------------------------------------------------------------------------------
; This just sets up the required variables and falls through to CvtBCD

77e0 dd362300  ld      (ix+23h),0  ; Zero Score digit 1
77e4 dd362400  ld      (ix+24h),0  ; Zero Score digit 2
77e8 dd362500  ld      (ix+25h),0  ; Zero Score digit 3
77ec dd362600  ld      (ix+26h),0  ; Zero Score digit 4
77f0 dd362700  ld      (ix+27h),0  ; Zero Score digit 5
77f4 dd6efc    ld      l,(ix-04h)
77f7 dd66fd    ld      h,(ix-03h)  ; HL = Score




;-------------------------------------------------------------------------------
CvtBCD:        ; Converts a 16 bit word into a 5 byte Binary Coded Decimal
;-------------------------------------------------------------------------------
; ENTRY
; HL = 16 bit word to be converted
; IX = Pointer such that IX+23 points to 5 zero'd bytes to be filled with BCD

77fa 111027    ld      de,2710h    ; DE=10,000

; This is the 10,000s digit

77fd a7        and     a           ; Zero carry flag
77fe ed52      sbc     hl,de       ; Subtract 10,000 from word
7800 3805      jr      c,7807h     ; If less than zero, move to 1,000s
7802 dd3423    inc     (ix+23h)    ; Otherwise inc BCD digit 1 (10,000s)
7805 18f6      jr      77fdh       ; and repeat

; BCD digit 1 done, set up for digit 2

7807 19        add     hl,de       ; Add 10,000 back onto word
7808 11e803    ld      de,03e8h    ; DE=1,000

; This is the 1,000s digit

780b a7        and     a           ; Zero carry flag
780c ed52      sbc     hl,de       ; Subtract 1,000 from word
780e 3805      jr      c,7815h     ; If less than zero, move to 100s
7810 dd3424    inc     (ix+24h)    ; Otherwise inc BCD digit 2 (1,000s)
7813 18f6      jr      780bh       ; and repeat

; BCD digit 2 done, set up for digit 3

7815 19        add     hl,de       ; Add 1,000 back onto word
7816 116400    ld      de,0064h    ; DE=100

; This is the 100s digit

7819 a7        and     a           ; Zero carry flag
781a ed52      sbc     hl,de       ; Subtract 100 from word
781c 3805      jr      c,7823h     ; If less than zero, move to 10s
781e dd3425    inc     (ix+25h)    ; Otherwise inc BCD digit 3 (100s)
7821 18f6      jr      7819h       ; and repeat

; BCD digit 3 done, set up for digit 4

7823 19        add     hl,de       ; Add 100 back onto word
7824 110a00    ld      de,000ah    ; DE=10

; This is the 10s digit

7827 a7        and     a           ; Zero carry flag
7828 ed52      sbc     hl,de       ; Subtract 10 from word
782a 3805      jr      c,7831h     ; If less than zero, move to 1s
782c dd3426    inc     (ix+26h)    ; Otherwise inc BCD digit 4 (10s)
782f 18f6      jr      7827h       ; and repeat

; BCD digit 4 done, set up for digit 5

7831 19        add     hl,de       ; Add 10 back onto word
7832 110100    ld      de,0001h    ; DE=1

; This is the 1s digit

7835 a7        and     a           ; Zero carry flag
7836 ed52      sbc     hl,de       ; Subtract 1 from word
7838 d8        ret     c           ; If less than zero, we're finished
7839 dd3427    inc     (ix+27h)    ; Otherwise inc BCD digit 5 (1s)
783c 18f7      jr      7835h       ; and repeat




;-------------------------------------------------------------------------------
CvtHiBCD:      ; Converts High Score word to 5 byte Binary Coded Decimal
;-------------------------------------------------------------------------------
; This just sets up the required variables for a call to CvtBCD

783e dd6631    ld      h,(ix+31h)
7841 dd6e30    ld      l,(ix+30h)  ; HL = High score
7844 dd21276e  ld      ix,VarsIX+5 ; Adjust IX for CvtBCD (6e27h)
7848 dd362300  ld      (ix+23h),0  ; Zero High Score digit 1
784c dd362400  ld      (ix+24h),0  ; Zero High Score digit 2
7850 dd362500  ld      (ix+25h),0  ; Zero High Score digit 3
7854 dd362600  ld      (ix+26h),0  ; Zero High Score digit 4
7858 dd362700  ld      (ix+27h),0  ; Zero High Score digit 5
785c cdfa77    call    CvtBCD      ; 77fah
785f dd21226e  ld      ix,VarsIX   ; Restore variables pointer in IX (6e22h)
7863 c9        ret




;-------------------------------------------------------------------------------
PrtHigh:       ; Prints the 5-digit High Score on InfoLine
;-------------------------------------------------------------------------------
7864 11d350    ld      de,50d3h    ; DE points to (22,19)=First digit after 'HI'
7867 dd21276e  ld      ix,VarsIX+5 ; Adjust IX for PtScDgts (6e27h)
786b cd7678    call    PtScDgts    ; 7876h
786e dd21226e  ld      ix,VarsIX   ; Restore variables pointer in IX (6e22h)
7872 c9        ret




;-------------------------------------------------------------------------------
PrtScore:      ; Prints the 5-digit Score on InfoLine
;-------------------------------------------------------------------------------
7873 11db50    ld      de,50dbh    ; DE points to (22,27)=First digit after 'SC'




;-------------------------------------------------------------------------------
PtScDgts:      ; Prints the score digits to the screen
;-------------------------------------------------------------------------------
; ENTRY:
; DE=Pointer into Display - where to print

7876 dd7e23    ld      a,(ix+23h)  ; A=Score digit 1 (most sig.)
7879 cdc178    call    GetDigDef   ; HL points to char definition (78c1h)
787c 010101    ld      bc,0101h    ; 1x1 cell to be printed
787f d5        push    de          ; Preserve display pointer
7880 cd0374    call    PtSprite    ; 7403h
7883 d1        pop     de

7884 dd7e24    ld      a,(ix+24h)  ; A=Score digit 2
7887 cdc178    call    GetDigDef   ; HL points to char definition (78c1h)
788a 13        inc     de          ; Point to next cell along
788b 010101    ld      bc,0101h    ; 1x1 cell to be printed
788e d5        push    de          ; Preserve display pointer
788f cd0374    call    PtSprite    ; 7403h
7892 d1        pop     de

7893 dd7e25    ld      a,(ix+25h)  ; A=Score digit 3
7896 cdc178    call    GetDigDef   ; HL points to char definition (78c1h)
7899 13        inc     de          ; Point to next cell along
789a 010101    ld      bc,0101h    ; 1x1 cell to be printed
789d d5        push    de          ; Preserve display pointer
789e cd0374    call    PtSprite    ; 7403h
78a1 d1        pop     de

78a2 dd7e26    ld      a,(ix+26h)  ; A=Score digit 4
78a5 cdc178    call    GetDigDef   ; HL points to char definition (78c1h)
78a8 13        inc     de          ; Point to next cell along
78a9 010101    ld      bc,0101h    ; 1x1 cell to be printed
78ac d5        push    de          ; Preserve display pointer
78ad cd0374    call    PtSprite    ; 7403h
78b0 d1        pop     de

78b1 dd7e27    ld      a,(ix+27h)  ; A=Score digit 5 (least sig.)
78b4 cdc178    call    GetDigDef   ; HL points to char definition (78c1h)
78b7 13        inc     de          ; Point to next cell along
78b8 010101    ld      bc,0101h    ; 1x1 cell to be printed
78bb d5        push    de          ; Preserve display pointer
78bc cd0374    call    PtSprite    ; 7403h
78bf d1        pop     de
78c0 c9        ret




;-------------------------------------------------------------------------------
GetDigDef:     ; Returns pointer to ROM character definition for digit
;-------------------------------------------------------------------------------
; Given a number between 0-9 in A, this will return with HL pointing to the ROM
; 8-byte character set definition of the same digit.
;
; ENTRY:
; A = Number between 0-9
; EXIT:
; HL = Address in ROM of 8-byte pixel definition.
; DE = Preserved

78c1 d5        push    de
78c2 21803d    ld      hl,3d80h    ; HL points to char definition of '0' in ROM
78c5 07        rlca
78c6 07        rlca
78c7 07        rlca                ; A=A*8
78c8 5f        ld      e,a
78c9 1600      ld      d,00h       ; DE=offset from 3d80h to required data
78cb 19        add     hl,de       ; HL points to char definition of digit in A
78cc d1        pop     de
78cd c9        ret




Rhyme21:       ; 'After jumping the very'
               ; 'last gap.      - WELL DONE'
78ce           db      2ch, 0bh, 19h, 0ah, 57h, 0fh, 1ah, 12h, 15h, 0eh, 13h
               db      4ch, 19h, 0dh, 4ah, 1bh, 0ah, 17h, 0deh, 11h, 06h, 18h
               db      59h, 0ch, 06h, 15h, 6bh, 63h, 63h, 63h, 6ah, 02h, 30h
               db      37h, 77h, 2fh, 3ah, 39h, 30h




;-------------------------------------------------------------------------------
PrtLives:      ; Prints the 'lives remaining' symbols on InfoLine
;-------------------------------------------------------------------------------
78f5 dd7e0c    ld      a,(ix+0ch)  ; A=Number of lives remaining
78f8 11c050    ld      de,50c0h    ; DE=Display location to print (AT 22,0)

78fb 210e6e    ld      hl,LifeSym  ; HL points to pixel def for symbol (6e0eh)
78fe 010101    ld      bc,0101h    ; 1x1 cell to be printed
7901 d5        push    de          ; Preserve print position
7902 f5        push    af          ; Preserve lives counter
7903 cd0374    call    PtSprite    ; 7403h
7906 f1        pop     af          ; Retrieve lives counter
7907 d1        pop     de          ; Retrieve print position
7908 3d        dec     a           ; Decrement lives counter
7909 c8        ret     z           ; Return if printed enough symbols

790a 13        inc     de          ; Otherwise, point DE to next cell along
790b 18ee      jr      78fbh       ; Print another symbol




;-------------------------------------------------------------------------------
MdJLAtsA:      ; Modify Jline Attributes (Above)
;-------------------------------------------------------------------------------
; Sets the attributes of the 2 cells which are part of the Jline immediately
; above (or below - see alternate entry point) Jack.
;
; This is called from DrawJack when drawing/erasing a Jack sprite which overlaps
; with part of a Jline. When drawing, the ink is set to Black (Jack's colour).
; When erasing, the ink is set to red (Jline colour).
;
; The sprite in this situation is always 2 cells wide and the position byte
; refers to the left sprite column.
;
; ENTRY
; A' = Desired attributes for cells
; A = Jack's position byte
; EXIT:
; A' = Preserved
; A = Preserved

790d 110000    ld      de,0000h    ; Initialise pointer into Attribs so as to
                                   ; target Jline above.
7910 1803      jr      7915h       ; Skip alternate entry point
;-------------------------------------------------------------------------------
MdJLAtsB:      ; Modify Jline Attributes (Below)
;-------------------------------------------------------------------------------
7912 116000    ld      de,0060h    ; Initialise pointer into Attribs so as to
                                   ; target Jline below. 60h=90 cells=3 lines.

; Calculate address of attributes byte for left Jline cell.
; Address = 57a0h + ( (Jline below Jack) * (96 cells) + (Jack's column) )

7915 f5        push    af          ; Save 2 copies of position byte
7916 f5        push    af
7917 e61f      and     1fh         ; Strip top 3 bits / A=Jack's screen column
7919 4f        ld      c,a         ; C=Jack's screen column
791a f1        pop     af          ; Retrieve position byte
791b e6e0      and     0e0h        ; Isolate top 3 bits (Jline above Jack)
791d 07        rlca
791e 07        rlca
791f 07        rlca                ; Rotate them so A=Jline above Jack
7920 47        ld      b,a
7921 04        inc     b           ; B=Jline beneath Jack
7922 21a057    ld      hl,57a0h    ; HL points to 96 bytes before starts of Atts
7925 19        add     hl,de       ; Add initialiser (to target above/below)
7926 116000    ld      de,0060h    ; 60h = 96 cells = 3 screen lines

7929 19        add     hl,de       ; (Jline below Jack) * (96 cells)
792a 10fd      djnz    7929h

792c 09        add     hl,bc       ; + (Jack's column)
                                   ; HL points to left Jline cell to be changed
792d 08        ex      af,af'      ; A=Desired attribs
792e 77        ld      (hl),a      ; Modify attribs
792f 23        inc     hl          ; Target adjacent right cell
7930 77        ld      (hl),a      ; Modify attribs
7931 08        ex      af,af'      ; Store Attribs byte back in A'
7932 f1        pop     af          ; Retrieve position byte
7933 c9        ret




;-------------------------------------------------------------------------------
GetHzAtt:      ; Get Hazard Attributes
;-------------------------------------------------------------------------------
; This sets A' with the desired attributes for the current Hazard being drawn
; or erased. When drawing, it sets the Ink to be one of 6 colours. When erasing
; it resets the Ink back to the game default of 0.
;
; ENTRY
; A = Offset from IX to current Hazard position byte
; EXIT
; A'= Attributes
; A = Preserved

7934 ddcbfa46  bit     0,(ix-06h)  ; Test the Hazard Draw/Erase flag
7938 2005      jr      nz,793fh    ; Jump if it's 'Draw'

793a 08        ex      af,af'      ; It's 'Erase' - set A' to screen default
793b 3e38      ld      a,00111000b ; Flash Off, Bright Off, Paper 7, Ink 0
793d 08        ex      af,af'      ; Retrieve A and return
793e c9        ret

; Choose a colour depending on which Hazard we're drawing

; With 6 colours and up to 20 Hazards, colours are distributed as follows:
; Hazards 0, 6, 12, 18 - Blue
; Hazards 1, 7, 13, 19 - Green
; Hazards 2, 8, 14     - Magenta
; Hazards 3, 9, 15     - Yellow
; Hazards 4, 10, 16    - Black
; Hazards 5, 11, 17    - Red

793f f5        push    af          ; Save offset to current Hazard position byte
7940 d60f      sub     0fh         ; Change A from offset to Hazard no. (0-19)

; Transform Hazard number (0-19) into a number between (0-6)

7942 d606      sub     06h         ; Calculate the remainder when divided by 6
7944 30fc      jr      nc,7942h    ; by subtracting 6 until below zero,
7946 c606      add     a,06h       ; then add 6 back on

7948 07        rlca                ; Transform A (0-6) into a jump offset
7949 07        rlca                ; A=A*4
794a 324f79    ld      (794fh),a   ; A=0, 4, 8, 12, 16, 20 or 24
794d 08        ex      af,af'      ; Prepare A' ready for Attributes..
794e 18fe      jr      794eh       ; ..and set accordingly

7950 3e39      ld      a,00111001b ; (+0) Ink Blue
7952 1812      jr      7966h

7954 3e3c      ld      a,00111100b ; (+4) Ink Green
7956 180e      jr      7966h

7958 3e3b      ld      a,00111011b ; (+8) Ink Magenta
795a 180a      jr      7966h

795c 3e3e      ld      a,00111110b ; (+12) Ink Yellow
795e 1806      jr      7966h

7960 3e38      ld      a,00111000b ; (+16) Ink Black
7962 1802      jr      7966h

7964 3e3a      ld      a,00111010b ; (+20) Ink Red


7966 08        ex      af,af'      ; Store Attributes in A'
7967 f1        pop     af          ; Retrieve offset to Hazard position byte
7968 c9        ret




;-------------------------------------------------------------------------------
JlineAtts:     ; Makes the Jlines red
;-------------------------------------------------------------------------------
; This changes the ink attribute to red in every cell in screen lines 0, 3, 6
; 9, 12, 15, 18, 21 - i.e. the screen lines which hold the Jlines.

7969 3e3a      ld      a,00111010b ; A=Attributes (Paper White, Ink Red)
796b 114000    ld      de,0040h    ; Offset to advance attribs ptr (64 cells)
796e 0608      ld      b,08h       ; 8 lines to change
7970 210058    ld      hl,5800h    ; HL points to display attributes

; Next Jline

7973 c5        push    bc          ; Save lines counter
7974 0620      ld      b,20h       ; 32 cells in a line

; Next horizontal cell

7976 77        ld      (hl),a      ; Set attribs for current cell
7977 23        inc     hl          ; Point to next cell in line
7978 10fc      djnz    7976h       ; Continue until the end of the line

797a 19        add     hl,de       ; Advance HL 2 screen lines down (64 cells)
797b c1        pop     bc          ; Retrieve lines counter
797c 10f5      djnz    7973h       ; Change attribs on next line if req
797e c9        ret




;-------------------------------------------------------------------------------
SfxGfx:        ; Sound Effects & Graphics Effects
;-------------------------------------------------------------------------------
; This is called by GameLoop every frame. It plays the appropriate SFX & GFX for
; Jack's current animation. It also scans the keyboard for player input and
; regulates the speed of the game.

797f dd7ef8    ld      a,(ix-08h)  ; A=Current sfx/gfx routine
7982 ddbef7    cp      (ix-09h)    ; Has it changed since last call to SfxGfx?
7985 2807      jr      z,798eh     ; Carry on if not
7987 dd77f7    ld      (ix-09h),a  ; Otherwise store new routine value, and
798a dd36f6ff  ld      (ix-0ah),0ffh ; reset the SFX/GFX frame counter

798e dd34f6    inc     (ix-0ah)    ; Increment SFX/GFX frame counter

7991 07        rlca                ; Multiply current routine value by 4 to
7992 07        rlca                ; make it a jump offset
7993 329779    ld      (7997h),a
7996 1800      jr      7998h
7998 c3b379    jp      SGStill     ; +0  (79b3h)
799b 00        nop
799c c3d979    jp      SGRunning   ; +4  (79d9h)
799f 00        nop
79a0 c3ff79    jp      SGHitHzd    ; +8  (79ffh)
79a3 00        nop
79a4 c3137a    jp      SGGoodJmp   ; +12 (7a13h)
79a7 00        nop
79a8 c3497a    jp      SGFall      ; +16 (7a49h)
79ab 00        nop
79ac c37f7a    jp      SGBadJump   ; +20 (7a7fh)
79af 00        nop
79b0 c3d17a    jp      SGStunned   ; +24 (7ad1h)


SGStill:       ; SfxGfx / Jack is standing still

; This animation has a sound effect for each time Jack turns his head (every 32
; game frames). There are two different notes - one plays on GFXJStil animation
; frames 0 & 2, the other on frames 1 & 3.

79b3 dd7e0d    ld      a,(ix+0dh)  ; A=Animation frame
79b6 e63f      and     3fh         ; Isolate lowest 6 bits. Has anim just begun
79b8 200a      jr      nz,79c4h    ; frame 0 or 2? If no, test for 1 or 3
79ba cd637b    call    PlayJmp4    ; If yes, play note (7b63h)
79bd 21fd01    ld      hl,509      ; Set frame delay
79c0 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79c3 c9        ret

79c4 fe20      cp      20h         ; Has anim just begun frame 1 or 3?
79c6 200a      jr      nz,79d2h    ; If not, skip sfx
79c8 cd5a7b    call    PlayJmp3    ; If yes, play note (7b5ah)
79cb 21fd01    ld      hl,509      ; Set frame delay
79ce cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79d1 c9        ret

; No SFX to play this time

79d2 21e503    ld      hl,997      ; Set frame delay
79d5 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79d8 c9        ret


SGRunning:     ; SfxGfx / Jack is running left or right

; This animation plays a sound effect every 4 frames. There are two notes which
; play alternately. Bit 3 of the Animation Frame counter (IX+0dh) determines
; which note to play since it flips every 4 frames.

79d9 dd7e0d    ld      a,(ix+0dh)  ; A=Animation frame
79dc e607      and     07h         ; Isolate lowest 3 bits. Has bit 3 just
79de 200a      jr      nz,79eah    ; turned 0? If no, test for 1
79e0 cd637b    call    PlayJmp4    ; If yes, play note (7b63h)
79e3 21fd01    ld      hl,509      ; Set frame delay
79e6 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79e9 c9        ret

79ea fe04      cp      04h         ; Has bit 3 just turned 1?
79ec 200a      jr      nz,79f8h    ; If no, skip sfx
79ee cd6c7b    call    PlayJmp5    ; If yes, play note (7b6ch)
79f1 21fd01    ld      hl,509      ; Set frame delay
79f4 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79f7 c9        ret

; No SFX to play this time

79f8 21e503    ld      hl,997      ; Set frame delay
79fb cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
79fe c9        ret


SGHitHzd:      ; SfxGfx / Jack has touched a Hazard

; This is a 1 frame effect. The screen is flashed magenta and a squawk SFX is
; generated. The current GFX/SFX routine is then set to Stunned.

79ff cd1e7c    call    MagScnOn    ; Turn screen Magenta (7c1eh)
7a02 cdba7b    call    PlaySqwk    ; Play squawk SFX (7bbah)
7a05 21271c    ld      hl,7207     ; Set frame delay
7a08 cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7a0b cd2d7c    call    MagScnOff   ; Turn screen back to white (7c2dh)
7a0e dd36f806  ld      (ix-08h),6  ; Set GFX/SFX animation to Stunned
7a12 c9        ret


SGGoodJmp:     ; SfxGfx / Jack is in a good jump

; The good jump animation consists of 8 frames (4 each in Pt1 & Pt2) and there
; is a different note played for each.

7a13 dd7ef6    ld      a,(ix-0ah)  ; A=Current SFX/GFX frame
7a16 e607      and     07h         ; Isolate lowest 3 bits
7a18 07        rlca
7a19 07        rlca                ; Multiply it by 4 to make jump offset
7a1a 21427a    ld      hl,7a42h    ; Put return address on stack for ret after
7a1d e5        push    hl          ; note has been played
7a1e 32227a    ld      (7a22h),a   ; Set jump offset and play relevant note
7a21 18fe      jr      7a21h
7a23 c3487b    jp      PlayJmp1    ; +0  (7b48h)
7a26 00        nop
7a27 c3517b    jp      PlayJmp2    ; +4  (7b51h)
7a2a 00        nop
7a2b c35a7b    jp      PlayJmp3    ; +8  (7b5ah)
7a2e 00        nop
7a2f c3637b    jp      PlayJmp4    ; +12 (7b63h)
7a32 00        nop
7a33 c36c7b    jp      PlayJmp5    ; +16 (7b6ch)
7a36 00        nop
7a37 c3757b    jp      PlayJmp6    ; +20 (7b75h)
7a3a 00        nop
7a3b c37e7b    jp      PlayJmp7    ; +24 (7b7eh)
7a3e 00        nop
7a3f c3877b    jp      PlayJmp8    ; +28 (7b87h)

; Note played

7a42 216b09    ld      hl,2411     ; Set frame delay
7a45 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
7a48 c9        ret


SGFall:        ; SfxGfx / Jack is falling through a gap

; The falling animation consists of 8 frames (4 each in Pt1 & Pt2) and there
; is a different note played for each.
; NB: These are the good jump notes in reverse.

7a49 dd7ef6    ld      a,(ix-0ah)  ; A=Current SFX/GFX frame
7a4c e607      and     07h         ; Isolate lowest 3 bits
7a4e 07        rlca
7a4f 07        rlca                ; Multiply it by 4 to make jump offset
7a50 21787a    ld      hl,7a78h    ; Put return address on stack for ret after
7a53 e5        push    hl          ; note has been played
7a54 32587a    ld      (7a58h),a   ; Set jump offset and play relevant note
7a57 18fe      jr      7a57h
7a59 c3877b    jp      PlayJmp8    ; +0  (7b87h)
7a5c 00        nop
7a5d c37e7b    jp      PlayJmp7    ; +4  (7b7eh)
7a60 00        nop
7a61 c3757b    jp      PlayJmp6    ; +8  (7b75h)
7a64 00        nop
7a65 c36c7b    jp      PlayJmp5    ; +12 (7b6ch)
7a68 00        nop
7a69 c3637b    jp      PlayJmp4    ; +16 (7b63h)
7a6c 00        nop
7a6d c35a7b    jp      PlayJmp3    ; +20 (7b5ah)
7a70 00        nop
7a71 c3517b    jp      PlayJmp2    ; +24 (7b51h)
7a74 00        nop
7a75 c3487b    jp      PlayJmp1    ; +28 (7b48h)

; Note played

7a78 216b09    ld      hl,2411     ; Set frame delay
7a7b cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
7a7e c9        ret


SGBadJump:     ; SfxGfx / Jack is in a bad jump

; The bad jump animation consists of 4 frames. On frame 0, 3 notes are played
; in succession (the first 3 notes of a good jump sfx). On frames 1 & 2, a white
; flash GFX and electric shock SFX are played. On frame 3, the 3 notes are
; played again but in reverse order (the last 3 notes of a fall sfx).

7a7f dd7ef6    ld      a,(ix-0ah)  ; A=Current SFX/GFX frame
7a82 a7        and     a           ; Are we on frame 0?
7a83 201c      jr      nz,7aa1h    ; Jump if not

; Frame 0 - play notes

7a85 cd487b    call    PlayJmp1    ; (7b48h)
7a88 21b90b    ld      hl,3001     ; Set frame delay
7a8b cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7a8e cd517b    call    PlayJmp2    ; (7b51h)
7a91 21b90b    ld      hl,3001     ; Set frame delay
7a94 cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7a97 cd5a7b    call    PlayJmp3    ; (7b5ah)
7a9a 21b90b    ld      hl,3001     ; Set frame delay
7a9d cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7aa0 c9        ret

; Not frame 0.

7aa1 fe03      cp      03h         ; Are we on frame 3?
7aa3 3010      jr      nc,7ab5h    ; Jump if so

; Frame 1 or 2 - Play GFX/SFX

7aa5 cd007c    call    BrightOn    ; Flash screen bright white (7c00h)
7aa8 cd907b    call    PlayShck    ; Play electric shock SFX (7b90h)
7aab cd0f7c    call    BrightOff   ; Reset screen colour (7c0fh)
7aae 212923    ld      hl,9001     ; Set frame delay
7ab1 cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7ab4 c9        ret

; Frame 3 - play notes

7ab5 cd5a7b    call    PlayJmp3    ; (7b5ah)
7ab8 21b90b    ld      hl,3001     ; Set frame delay
7abb cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7abe cd517b    call    PlayJmp2    ; (7b51h)
7ac1 21b90b    ld      hl,3001     ; Set frame delay
7ac4 cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7ac7 cd487b    call    PlayJmp1    ; (7b48h)
7aca 21b90b    ld      hl,3001     ; Set frame delay
7acd cd0a7b    call    FrmDelay    ; Short pause (7b0ah)
7ad0 c9        ret


SGStunned:     ; SfxGfx / Jack is stunned

; This animation plays a sound effect every 8 frames. There are four notes which
; play on a rotation. Bits 4 & 3 of the SFX/GFX Frame counter (IX-0ah) determine
; which note to play since they update every 8 frames.

7ad1 dd7ef6    ld      a,(ix-0ah)  ; A=Current SFX/GFX frame
7ad4 47        ld      b,a         ; Save a copy
7ad5 e607      and     07h         ; Test low 3 bits (if they're all 0, bits
                                   ; 4&3 must have just updated)
7ad7 78        ld      a,b         ; Retrieve copy
7ad8 2029      jr      nz,7b03h    ; Skip sfx if frame not multiple of 8

7ada e618      and     18h         ; Isolate bits 4&3 to determine which note
7adc 32e07a    ld      (7ae0h),a   ; Set jump offset and play relevant note
7adf 18fe      jr      7adfh
7ae1 cddc7b    call    PlayStn1    ; +0  (7bdch)
7ae4 1816      jr      7afch
7ae6 00        nop
7ae7 00        nop
7ae8 00        nop
7ae9 cde57b    call    PlayStn2    ; +8  (7be5h)
7aec 180e      jr      7afch
7aee 00        nop
7aef 00        nop
7af0 00        nop
7af1 cdee7b    call    PlayStn3    ; +16 (7beeh)
7af4 1806      jr      7afch
7af6 00        nop
7af7 00        nop
7af8 00        nop
7af9 cdf77b    call    PlayStn4    ; +24 (7bf7h)

; Note played

7afc 21fd01    ld      hl,509      ; Set frame delay
7aff cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
7b02 c9        ret

; No SFX to play this time

7b03 21e503    ld      hl,997      ; Set frame delay
7b06 cd0a7b    call    FrmDelay    ; Regulate game speed (7b0ah)
7b09 c9        ret




;-------------------------------------------------------------------------------
FrmDelay:      ; Frame Delay - regulates the speed of the game
;-------------------------------------------------------------------------------
; This is called every frame from SfxGfx. The value passed in HL determines the
; length of a delay loop which in turn regulates the speed of the game.
; The value passed reflects how much processing there is to do elsewhere for the
; current frame. It is then further adjusted based on the number of Hazards to
; draw in the current level.
;
; This routine also scans the keyboard for input (including for Pause) and
; further randomizes the game's random value in IX-0bh.
;
; ENTRY
; HL = Length of Frame Delay

7b0a e5        push    hl          ; Save delay value
7b0b cd2a7b    call    ChkPause    ; Has player pressed Pause? (7b2ah)
7b0e cd8d76    call    GetInput    ; Check for other keys (768dh)
7b11 e1        pop     hl          ; Retrieve delay value

; Reduce the delay value based on the number of active Hazards

7b12 111e00    ld      de,001eh    ; Reduce by 30 for each Hazard
7b15 dd7e0e    ld      a,(ix+0eh)  ; A=No. of Hazards
7b18 a7        and     a           ;
7b19 2806      jr      z,7b21h     ; Skip if 0 Hazards
7b1b 47        ld      b,a         ; Use no. of Hazards as loop counter

7b1c ed52      sbc     hl,de       ; Reduce delay value by 30
7b1e d8        ret     c           ; Return if delay value's gone below 0
7b1f 10fb      djnz    7b1ch       ; Repeat for every active Hazard

; Delay loop

7b21 dd34f5    inc     (ix-0bh)    ; Inc Random Number
7b24 2b        dec     hl          ; Decrease delay counter
7b25 7d        ld      a,l
7b26 b4        or      h           ; Is it 0?
7b27 20f8      jr      nz,7b21h    ; Loop until 0
7b29 c9        ret




;-------------------------------------------------------------------------------
ChkPause:     ; Has the player pressed Pause?
;-------------------------------------------------------------------------------
; This scans the keyboard for the Pause key 'Z'. If it's pressed, a pause is
; implemented by waiting for 'Z' to be pressed again.

7b2a 01fefe    ld      bc,0fefeh   ; B=Keyboard section containing 'Z'
                                   ; C=Keyboard port
7b2d ed78      in      a,(c)       ; Scan keyboard
7b2f cb4f      bit     1,a         ; Bit 1 = 'Z'. Is it pressed?
7b31 c0        ret     nz          ; Return if not

; Player has paused the game. Wait until Z is pressed again.

7b32 cd3f7b    call    ScnDelay    ; Wait before re-scanning keyboard (7b3fh)

7b35 ed78      in      a,(c)       ; Re-scan keyboard
7b37 cb4f      bit     1,a         ; Bit 1 = 'Z'. Is it pressed?
7b39 20fa      jr      nz,7b35h    ; Keep scanning until it is

; Player unpaused the game.

7b3b cd3f7b    call    ScnDelay    ; Brief delay before returning (7b3fh)
7b3e c9        ret




;-------------------------------------------------------------------------------
ScnDelay:      ; Waits a short time
;-------------------------------------------------------------------------------
; Called from ChkPause to insert a delay which gives the player time to release
; the Pause key so one keypress isn't read multiple times.

7b3f 21007d    ld      hl,7d00h    ; Number of times to loop (32,000)

7b42 2b        dec     hl
7b43 7d        ld      a,l
7b44 b4        or      h
7b45 20fb      jr      nz,7b42h    ; Loop until HL=0
7b47 c9        ret




;-------------------------------------------------------------------------------
; PlayJmp Routines
;-------------------------------------------------------------------------------
; These play the individual notes in the Standing Still, Running, Good & Bad
; Jumps and Falling animations.

PlayJmp1:

7b48 219006    ld      hl,0690h    ; Pitch
7b4b 110300    ld      de,0003h    ; Duration
7b4e c3f77f    jp      Beep        ; (7ff7h)

PlayJmp2:

7b51 218405    ld      hl,0584h    ; Pitch
7b54 110300    ld      de,0003h    ; Duration
7b57 c3f77f    jp      Beep        ; (7ff7h)

PlayJmp3:

7b5a 21a304    ld      hl,04a3h    ; Pitch
7b5d 110300    ld      de,0003h    ; Duration
7b60 c3f77f    jp      Beep        ; (7ff7h)

PlayJmp4:

7b63 21e603    ld      hl,03e6h    ; Pitch
7b66 110400    ld      de,0004h    ; Duration
7b69 c3f77f    jp      Beep        ; (7ff7h)

PlayJmp5:

7b6c 214703    ld      hl,0347h    ; Pitch
7b6f 110500    ld      de,0005h    ; Duration
7b72 c3f77f    jp      Beep        ; (7ff7h)

PlayJmp6:

7b75 21c202    ld      hl,02c2h    ; Pitch
7b78 110600    ld      de,0006h    ; Duration
7b7b c3f77f    jp      Beep        ; (7ff7h)

PlayJmp7:

7b7e 215202    ld      hl,0252h    ; Pitch
7b81 110800    ld      de,0008h    ; Duration
7b84 c3f77f    jp      Beep        ; (7ff7h)

PlayJmp8:

7b87 21f401    ld      hl,01f4h    ; Pitch
7b8a 110900    ld      de,0009h    ; Duration
7b8d c3f77f    jp      Beep        ; (7ff7h)




;-------------------------------------------------------------------------------
PlayShck:      ; Plays the electric shock SFX (when Jack hits head on Jline)
;-------------------------------------------------------------------------------
; The electric shock noise is generated from 512 successive calls to the ROM
; Beep routine using 'random' data from the ROM as input.

7b90 dde5      push    ix          ; Save data index
7b92 010002    ld      bc,0200h    ; Set loop counter to 512
7b95 dd210000  ld      ix,0000h    ; Point to random data in ROM

7b99 dd6e00    ld      l,(ix+00h)  ; Get random byte from ROM..
7b9c 3e0f      ld      a,0fh
7b9e a5        and     l           ; ..and make it 0-15
7b9f 6f        ld      l,a
7ba0 2600      ld      h,00h       ; Put it in HL (Pitch)
7ba2 dd5e01    ld      e,(ix+01h)  ; Get another random byte from ROM..
7ba5 3e03      ld      a,03h
7ba7 a3        and     e           ; ..and make it 0-7
7ba8 5f        ld      e,a
7ba9 1600      ld      d,00h       ; Put it in DE (Duration)
7bab c5        push    bc          ; Save counter
7bac cdf77f    call    Beep        ; Make sound (7ff7h)
7baf c1        pop     bc          ; Retrieve counter
7bb0 dd23      inc     ix          ; Point to next random number in ROM
7bb2 0b        dec     bc
7bb3 79        ld      a,c
7bb4 b0        or      b
7bb5 20e2      jr      nz,7b99h    ; Repeat 512 times
7bb7 dde1      pop     ix          ; Reset IX to point to game data
7bb9 c9        ret




;-------------------------------------------------------------------------------
PlaySqwk:      ; Plays the squawk-like SFX (when Jack hits Hazard)
;-------------------------------------------------------------------------------
; The squawk noise is generated from 84 successive calls to the ROM Beep routine
; using 'random' data from the ROM as input.

7bba dde5      push    ix          ; Save data index
7bbc 0654      ld      b,54h       ; Set loop counter to 84
7bbe dd216400  ld      ix,0064h    ; Point to random data in ROM

7bc2 dd6e00    ld      l,(ix+00h)
7bc5 2600      ld      h,00h       ; Put random number into HL (Pitch)
7bc7 dd5e01    ld      e,(ix+01h)  ; Put another into DE (Duration)..
7bca 3e07      ld      a,07h
7bcc a3        and     e           ; ..but make it between 0-7
7bcd 5f        ld      e,a
7bce 1600      ld      d,00h
7bd0 c5        push    bc          ; Save counter
7bd1 cdf77f    call    Beep        ; Make sound (7ff7h)
7bd4 c1        pop     bc          ; Retrieve counter
7bd5 dd23      inc     ix          ; Point to next random number in ROM
7bd7 10e9      djnz    7bc2h       ; Repeat 84 times
7bd9 dde1      pop     ix          ; Reset IX to point to game data
7bdb c9        ret




;-------------------------------------------------------------------------------
; PlayStn Routines
;-------------------------------------------------------------------------------
; These play the individual notes in the Stunned animation.

PlayStn1:

7bdc 216900    ld      hl,0069h    ; Pitch
7bdf 111c00    ld      de,001ch    ; Duration
7be2 c3f77f    jp      Beep        ; (7ff7h)

PlayStn2:

7be5 217300    ld      hl,0073h    ; Pitch
7be8 111800    ld      de,0018h    ; Duration
7beb c3f77f    jp      Beep        ; (7ff7h)

PlayStn3:

7bee 217d00    ld      hl,007dh    ; Pitch
7bf1 111700    ld      de,0017h    ; Duration
7bf4 c3f77f    jp      Beep        ; (7ff7h)

PlayStn4:

7bf7 218800    ld      hl,0088h    ; Pitch
7bfa 111400    ld      de,0014h    ; Duration
7bfd c3f77f    jp      Beep        ; (7ff7h)




;-------------------------------------------------------------------------------
BrightOn:      ; Sets the Bright attribute in every screen cell
;-------------------------------------------------------------------------------
7c00 210058    ld      hl,5800h    ; HL points to Display Attributes
7c03 010003    ld      bc,0300h    ; BC=Size of Attributes

7c06 cbf6      set     6,(hl)      ; Set Bright bit
7c08 23        inc     hl          ; Point to next Attribute byte
7c09 0b        dec     bc          ; Decrease counter
7c0a 79        ld      a,c
7c0b b0        or      b           ; Is it zero?
7c0c 20f8      jr      nz,7c06h    ; Loop until all Attributes changed
7c0e c9        ret




;-------------------------------------------------------------------------------
BrightOff:     ; Turns off the Bright attribute in every screen cell
;-------------------------------------------------------------------------------
7c0f 210058    ld      hl,5800h    ; HL points to Display Attributes
7c12 010003    ld      bc,0300h    ; BC=Size of Attributes

7c15 cbb6      res     6,(hl)      ; Turn off Bright bit
7c17 23        inc     hl          ; Point to next Attribute byte
7c18 0b        dec     bc          ; Decrease counter
7c19 79        ld      a,c
7c1a b0        or      b           ; Is it zero?
7c1b 20f8      jr      nz,7c15h    ; Loop until all Attributes changed
7c1d c9        ret




;-------------------------------------------------------------------------------
MagScnOn:      ; Sets screen paper colour to magenta
;-------------------------------------------------------------------------------
; This assumes the paper colour is currently white, as it works by turning off
; the Green bit in every Display Attribute byte.

7c1e 210058    ld      hl,5800h    ; HL points to Display Attributes
7c21 010003    ld      bc,0300h    ; BC=Size of Attributes

7c24 cbae      res     5,(hl)      ; Turn off Paper Green bit
7c26 23        inc     hl          ; Point to next Attribute byte
7c27 0b        dec     bc          ; Decrease counter
7c28 79        ld      a,c
7c29 b0        or      b           ; Is it zero?
7c2a 20f8      jr      nz,7c24h    ; Loop until all Attributes changed
7c2c c9        ret




;-------------------------------------------------------------------------------
MagScnOff:     ; Returns screen paper colour to white
;-------------------------------------------------------------------------------
; This assumes the paper colour is currently magenta, as it works by turning on
; the Green bit in every Display Attribute byte.

7c2d 210058    ld      hl,5800h    ; HL points to Display Attributes
7c30 010003    ld      bc,0300h    ; BC=Size of Attributes

7c33 cbee      set     5,(hl)      ; Set Paper Green bit
7c35 23        inc     hl          ; Point to next Attribute byte
7c36 0b        dec     bc          ; Decrease counter
7c37 79        ld      a,c
7c38 b0        or      b           ; Is it zero?
7c39 20f8      jr      nz,7c33h    ; Loop until all Attributes changed
7c3b c9        ret




Rhyme1:        ; 'Jumping Jack is quick and bold'
               ; 'With skill his story will unfold'
7c3c           db      35h, 1ah, 12h, 15h, 0eh, 13h, 4ch, 35h, 06h, 08h, 50h
               db      0eh, 58h, 16h, 1ah, 0eh, 08h, 50h, 06h, 13h, 49h, 07h
               db      14h, 11h, 0c9h, 02h, 0eh, 19h, 4dh, 18h, 10h, 0eh, 11h
               db      51h, 0dh, 0eh, 58h, 18h, 19h, 14h, 17h, 5eh, 1ch, 0eh
               db      11h, 51h, 1ah, 13h, 0bh, 14h, 11h, 09h




;-------------------------------------------------------------------------------
UpdJkFrm:      ; Update Jack's frame
;-------------------------------------------------------------------------------
; This is called after Jack has been erased. It copies the pre-prepared Next
; Frame data (position, animation, animation frame) into the Current Frame
; variables ready for quick drawing of his next frame.

7c70 dd7e08    ld      a,(ix+08h)
7c73 dd772d    ld      (ix+2dh),a  ; Update animation

7c76 dd7e09    ld      a,(ix+09h)
7c79 dd772e    ld      (ix+2eh),a  ; Update position

7c7c dd7e0d    ld      a,(ix+0dh)
7c7f dd772f    ld      (ix+2fh),a  ; Update animation frame
7c82 c9        ret




;-------------------------------------------------------------------------------
PrtInfoTxt:    ; Prints the text 'HI' & 'SC' on InfoLine
;-------------------------------------------------------------------------------
7c83 21403e    ld      hl,3e40h    ; HL points to char definition of 'H' in ROM
7c86 11d150    ld      de,50d1h    ; DE=Display location to print (AT 22,17)
7c89 010101    ld      bc,0101h    ; 1x1 cell to be printed
7c8c cd0374    call    PtSprite    ; 7403h

7c8f 21483e    ld      hl,3e48h    ; HL points to char definition of 'I' in ROM
7c92 11d250    ld      de,50d2h    ; DE=Display location to print (AT 22,18)
7c95 010101    ld      bc,0101h    ; 1x1 cell to be printed
7c98 cd0374    call    PtSprite    ; 7403h

7c9b 21983e    ld      hl,3e98h    ; HL points to char definition of 'S' in ROM
7c9e 11d950    ld      de,50d9h    ; DE=Display location to print (AT 22,25)
7ca1 010101    ld      bc,0101h    ; 1x1 cell to be printed
7ca4 cd0374    call    PtSprite    ; 7403h

7ca7 21183e    ld      hl,3e18h    ; HL points to char definition of 'C' in ROM
7caa 11da50    ld      de,50dah    ; DE=Display location to print (AT 22,26)
7cad 010101    ld      bc,0101h    ; 1x1 cell to be printed
7cb0 cd0374    call    PtSprite    ; 7403h
7cb3 c9        ret




;-------------------------------------------------------------------------------
MdInfAts:      ; Modify InfoLine Attributes
;-------------------------------------------------------------------------------
; This is called from DrawJack when Jack is at the bottom of the screen and
; potentially clashing with the magenta ink on the InfoLine.
;
; The attributes for the 2 cells that form Jack's upper half (i.e. those on
; screen line 22 - the InfoLine) are changed to black (when drawing) and back to
; magenta (when erasing).
;
; ENTRY
; A = Jack's position byte

7cb4 ddcb3246  bit     0,(ix+32h)  ; Test Jack's draw/erase flag
7cb8 0e3b      ld      c,00111011b ; C=Attribs byte (Paper White, Ink Magenta)
7cba 2802      jr      z,7cbeh     ; Continue if erasing
7cbc 0e38      ld      c,00111000b ; Otherwise Ink Black if drawing

7cbe 21c05a    ld      hl,5ac0h    ; HL points to Attribs for (22,0)
7cc1 d6e0      sub     0e0h        ; Adjust Jack position byte to just leave
                                   ; horizontal cell position (0-30)
7cc3 5f        ld      e,a
7cc4 1600      ld      d,00h       ; Add to HL, so HL points to Attribs byte for
7cc6 19        add     hl,de       ; Jack's top-left cell
7cc7 71        ld      (hl),c      ; Update Attribs on screen
7cc8 23        inc     hl          ; Target Jack's top-right cell
7cc9 71        ld      (hl),c      ; Update Attribs on screen
7cca c9        ret




;-------------------------------------------------------------------------------
RotHzrds:      ; Rotates the Hazards GFX data in memory
;-------------------------------------------------------------------------------
; The Hazards GFX data occupies 1920 consecutive bytes in memory (192 bytes per
; Hazard). This routine rotates that memory by 192 bytes so the first Hazard
; becomes the last.
;
; Step by step - the lowest 192 bytes are put in a temporary buffer (it uses
; 5b00h, the 16/48K Spectrum printer buffer), the rest of the data is moved
; down to fill the space and then the original 192 bytes are placed on the top.
;
; EXIT
; BC = Preserved

7ccb c5        push    bc
7ccc 218e66    ld      hl,GFXHzrds ; HL points to Hazards data (668eh)
7ccf 11005b    ld      de,5b00h    ; DE points to Printer buffer
7cd2 01c000    ld      bc,00c0h    ; BC=192 bytes to move
7cd5 edb0      ldir                ; Copy 192 bytes to buffer
7cd7 118e66    ld      de,GFXHzrds ; DE points to Hazards data (668eh)
7cda 01c006    ld      bc,06c0h    ; BC=1728 bytes to move down
7cdd edb0      ldir                ; Copy 1728 bytes down to fill space
7cdf 21005b    ld      hl,5b00h    ; HL points to original 192 bytes in buffer
7ce2 114e6d    ld      de,GFXHzrds+1728 ; DE points to new space at top (6d4eh)
7ce5 01c000    ld      bc,00c0h    ; Copy bytes back from printer buffer
7ce8 edb0      ldir
7cea c1        pop     bc
7ceb c9        ret




;-------------------------------------------------------------------------------
GameLost:      ; Plays final SFX and shows Game Over Screen
;-------------------------------------------------------------------------------
; This is called when Jack has lost his final life. It plays the Falling SFX 3
; times then falls through to the Game Over sequence.

7cec 010403    ld      bc,0304h    ; B=3 times to play, C=Falling
7cef cd787e    call    PlaySFX     ; (7e78h)




;-------------------------------------------------------------------------------
GameOver:      ; The Game Over sequence
;-------------------------------------------------------------------------------
; This is called if Jack has died, or if the player has just completed the very
; last level (in which case this follows the final Completed Level screen).

7cf2 dd363519  ld      (ix+35h),25 ; Set print speed (used by PrtDelay)
7cf6 cdfb7c    call    YelScrn     ; 7cfbh
7cf9 1820      jr      GmOvScrn    ; 7d1bh




;-------------------------------------------------------------------------------
YelScrn:       ; Clears the screen to yellow and prints Jumping Jack title.
;-------------------------------------------------------------------------------
; This is the basis for either a 'Game Over' or 'Completed Level' screen.

7cfb 3e31      ld      a,00110001b ; A=Attributes (Paper Yellow, Ink Black)
7cfd cdb56e    call    ClrScreen   ; Clear screen and fill it yellow (6eb5h)

7d00 3e06      ld      a,06h
7d02 d3fe      out     (0feh),a    ; Set the Border to yellow

; Draw green rectangle to go behind 'JUMPING JACK' text

7d04 012003    ld      bc,0320h    ; B=Rect Height, C=Attributes (Paper Green)
7d07 3e10      ld      a,10h       ; A=Rect Width
7d09 214858    ld      hl,5848h    ; HL points to (2,8) in Attributes memory
7d0c cda27d    call    ColRect     ; Draw green rectangle (7da2h)

; Print 'JUMPING JACK' text

7d0f 212f7e    ld      hl,Text1    ; HL points to encrypted chars (7e2fh)
7d12 060b      ld      b,0bh       ; 11 encrypted chars to decode
7d14 116a40    ld      de,406ah    ; DE points to (3,10) in Display memory
7d17 cdb27d    call    PrtEText    ; 7db2h
7d1a c9        ret




;-------------------------------------------------------------------------------
GmOvScrn:      ; Draws the 'Game Over' screen & waits for ENTER to be pressed
;-------------------------------------------------------------------------------
; Draw cyan rectangle to go behind 'FINAL SCORE' text

7d1b 3e16      ld      a,16h       ; A=Rect Width
7d1d 012805    ld      bc,0528h    ; B=Rect Height, C=Attributes (Paper Cyan)
7d20 212559    ld      hl,5925h    ; HL points to (9,5) in Attributes memory
7d23 cda27d    call    ColRect     ; Draw cyan rectangle (7da2h)

; Print 'FINAL SCORE' text

7d26 213a7e    ld      hl,Text2    ; HL points to encrypted chars (7e3ah)
7d29 060a      ld      b,0ah       ; 10 encrypted chars to decode
7d2b 114748    ld      de,4847h    ; DE points to (10,7) in Display memory
7d2e cdb27d    call    PrtEText    ; 7db2h

; Print Score

7d31 115448    ld      de,4854h    ; DE points to (10,20) in Display memory
7d34 cd7678    call    PtScDgts    ; Prints Score digits at (10,20) (7876h)

; Print 'WITH' text

7d37 21667f    ld      hl,Text6    ; HL points to encrypted chars (7f66h)
7d3a 118848    ld      de,4888h    ; DE points to (12,8) in Display memory
7d3d 0604      ld      b,04h       ; 4 encrypted chars to decode
7d3f cdb27d    call    PrtEText    ; 7db2h

; Print number of Hazards in last level

7d42 118d48    ld      de,488dh    ; DE points to (12,13) in Display memory
7d45 dd7e0e    ld      a,(ix+0eh)  ; A=Number of Hazards in last level
7d48 cdbd7e    call    PtHzDgts    ; 7ebdh

; Print 'HAZARDS' or 'HAZARD' text

7d4b 216a7f    ld      hl,Text7    ; HL points to encrypted chars (7f6ah)
7d4e 0607      ld      b,07h       ; 7 encrypted chars to decode
7d50 dd7e0e    ld      a,(ix+0eh)  ; A=Number of Hazards in last level
7d53 fe01      cp      01h         ; Was there only 1?
7d55 2001      jr      nz,7d58h    ; If not, carry on
7d57 05        dec     b           ; If there was, decrease length of string to
                                   ; be printed so we write 'HAZARD' singular

7d58 119148    ld      de,4891h    ; DE points to (12,17) in Display memory
7d5b cdb27d    call    PrtEText    ; 7db2h

; Have we got a new High Score?

7d5e dd56fd    ld      d,(ix-03h)
7d61 dd5efc    ld      e,(ix-04h)  ; DE=Score at the end of game
7d64 dd6631    ld      h,(ix+31h)
7d67 dd6e30    ld      l,(ix+30h)  ; HL=Previous High Score
7d6a a7        and     a           ; Clear Carry flag
7d6b ed52      sbc     hl,de       ; Is the new score more?
7d6d 301e      jr      nc,7d8dh    ; If not, skip the New High message

; We have a new High Score

7d6f d5        push    de          ; Save new High Score

; Draw flashing magenta rectangle to go behind 'NEW HIGH' text

7d70 019f03    ld      bc,039fh    ; B=Rect Height
                                   ; C=Atts (Flash On, Paper Magenta, Ink White)
7d73 3e0c      ld      a,0ch       ; A=Rect Width
7d75 210a5a    ld      hl,5a0ah    ; HL points to (16,10) in Attributes memory
7d78 cda27d    call    ColRect     ; Draw flashing rectangle (7da2h)

; Print 'NEW HIGH' text

7d7b 21447e    ld      hl,Text3    ; HL points to encrypted chars (7e44h)
7d7e 0607      ld      b,07h       ; 7 encrypted chars to decode
7d80 112c50    ld      de,502ch    ; DE points to (17,12) in Display memory
7d83 cdb27d    call    PrtEText    ; 7db2h

7d86 d1        pop     de          ; Retrieve new High Score..
7d87 dd7231    ld      (ix+31h),d
7d8a dd7330    ld      (ix+30h),e  ; ..and overwite the previous one

; Print 'Press ENTER to replay' text

7d8d 214b7e    ld      hl,Text4    ; HL points to encrypted chars (7e4bh)
7d90 0612      ld      b,12h       ; 18 encrypted chars to decode
7d92 11c550    ld      de,50c5h    ; DE points to (22,5) in Display memory
7d95 cdb27d    call    PrtEText    ; 7db2h

; Wait for ENTER to be pressed

7d98 01febf    ld      bc,0bffeh   ; B=Keyboard section containing ENTER
                                   ; C=Keyboard port
7d9b ed78      in      a,(c)       ; Scan keyboard
7d9d cb47      bit     0,a         ; Bit 0 represents 'ENTER'. Is it pressed?
7d9f 20f7      jr      nz,7d98h    ; Loop until it is
7da1 c9        ret




;-------------------------------------------------------------------------------
ColRect:       ; Draws a coloured rectangle by changing the display attributes
;-------------------------------------------------------------------------------
; ENTRY
; HL = Pointer into Atrributes memory for top-left cell of rectangle
;  A = Width of rectangle
;  B = Height of rectangle
;  C = Attributes for rectangle

7da2 c5        push    bc          ; Save Height
7da3 e5        push    hl          ; Save pointer
7da4 47        ld      b,a         ; B=Width counter

7da5 71        ld      (hl),c      ; Write desired attribute to memory
7da6 23        inc     hl          ; Point to next cell along
7da7 10fc      djnz    7da5h       ; Repeat for all cells in this row

7da9 e1        pop     hl          ; Reset counter to first cell in this row
7daa 112000    ld      de,0020h
7dad 19        add     hl,de       ; Move pointer 32 cells along (1 cell down)
7dae c1        pop     bc          ; Retrieve Height counter
7daf 10f1      djnz    ColRect     ; Repeat for number of rows necessary (7da2h)
7db1 c9        ret




;-------------------------------------------------------------------------------
PrtEText:      ; Prints a string of encrypted text
;-------------------------------------------------------------------------------
; This uses DecptTxt to translate the encrypted chars into character codes but
; does it's own translation of Bits 7 & 6 in the encrypted chars - which signify
; other formatting and characters to insert.
; PtSprite is used to put each character on screen.
;
; ENTRY:
; HL = Pointer to encrypted text
; DE = Pointer into Display memory - where to print
;  B = Length of encrypted text (NB. Not necessarily same as unencrypted length)

7db2 c5        push    bc          ; Save length counter
7db3 e5        push    hl          ; Save pointer to next character
7db4 7e        ld      a,(hl)      ; A=Next encrypted character
7db5 f5        push    af          ; Save a copy
7db6 cd107e    call    DecptTxt    ; A=Character code-32 (7e10h)

; 3d00h + (A*8) = Address of character pixel definition in ROM

7db9 21003d    ld      hl,3d00h    ; HL points to ROM char set pixel definitions
7dbc a7        and     a           ; Does A=0? (i.e. it's a SPACE character)
7dbd 2809      jr      z,7dc8h     ; If so, go straight to printing it
7dbf 47        ld      b,a         ; Otherwise, add 8*A to HL

7dc0 c5        push    bc
7dc1 010800    ld      bc,0008h
7dc4 09        add     hl,bc       ; HL points to next ROM char pixel definition
7dc5 c1        pop     bc
7dc6 10f8      djnz    7dc0h       ; Keep going until we reach our char

; HL = Address of character pixel definition in ROM
; DE = Pointer into Display memory - where to print

7dc8 d5        push    de          ; Save copy of Display pointer
7dc9 010101    ld      bc,0101h    ; 1x1 cell to be printed
7dcc cd0374    call    PtSprite    ; 7403h

7dcf d1        pop     de          ; Retrieve Display pointer
7dd0 13        inc     de          ; Point to next cell for next character
7dd1 f1        pop     af          ; Retrieve encrypted char just printed
7dd2 cdde7d    call    7ddeh       ; Was there formatting info as well?
7dd5 cd487f    call    PrtDelay    ; Pause briefly (7f48h)
7dd8 e1        pop     hl          ; Retrieve pointer to encrypted text
7dd9 23        inc     hl          ; Point to next character for decryption
7dda c1        pop     bc          ; Retrieve length counter
7ddb 10d5      djnz    PrtEText    ; Print next character (7db2h)
7ddd c9        ret

; Were bits 7 or 6 set in the encrypted character?
; Bit 6 means a SPACE should be inserted next.

7dde 010101    ld      bc,0101h    ; Set BC ready for possible call to PtSprite
7de1 e6c0      and     0c0h        ; Isolate top 2 bits in encrypted char
7de3 c8        ret     z           ; Return if neither are set

7de4 fe40      cp      40h         ; Is just bit 6 set? (i.e. print SPACE next)
7de6 200a      jr      nz,7df2h    ; If not, check for bit 7
7de8 21003d    ld      hl,3d00h    ; HL points to ROM pixel definition for SPACE
7deb d5        push    de          ; Save copy of Display pointer
7dec cd0374    call    PtSprite    ; Print a SPACE (7403h)
7def d1        pop     de          ; Retrieve Display pointer
7df0 13        inc     de          ; Point to next cell for next character
7df1 c9        ret

; Bit 7 means print 3 Full Stops next (...)

7df2 fe80      cp      80h         ; Is just bit 7 set?
7df4 2016      jr      nz,7e0ch    ; If not, bits 7 AND 6 must be set
7df6 3e03      ld      a,03h       ; 3 Full Stops to print

7df8 f5        push    af          ; Save Full Stop counter
7df9 21703d    ld      hl,3d70h    ; HL points to ROM pixel def for Full Stop
7dfc c5        push    bc          ; Save 1x1 cell info for PtSprite
7dfd d5        push    de          ; Save copy of Display pointer
7dfe cd0374    call    PtSprite    ; Print a Full Stop (7403h)
7e01 cd487f    call    PrtDelay    ; Pause briefly (7f48h)
7e04 d1        pop     de          ; Retrieve Display pointer
7e05 13        inc     de          ; Point to next cell for next character
7e06 c1        pop     bc          ; Retrieve 1x1 cell info for PtSprite
7e07 f1        pop     af          ; Retrieve full stop counter
7e08 3d        dec     a
7e09 20ed      jr      nz,7df8h    ; Repeat until 3 are printed
7e0b c9        ret

; If both bits 7 & 6 were set, it means re-position the Display pointer to
; (18,0).  This is used when printing the second line of each rhyme.

7e0c 114050    ld      de,5040h    ; DE points to (18,0) in Display memory
7e0f c9        ret




;-------------------------------------------------------------------------------
DecptTxt:      ; Decrypts encoded characters
;-------------------------------------------------------------------------------
; This takes an encoded byte of text, and returns the unencoded character's
; offset from SPACE(32) in the Spectrum character set.
; i.e. It returns 32 less than the Spectrum character code for the unencoded
; character.
;
; Encoded bytes contain a mixture of (C)haracter and (F)ormatting information.
;
;   7 6 5 4 3 2 1 0
;   F F C C C C C C
;
; Bits 7 & 6 contain formatting information which is used by PrtEText.
;     Bit 7 means print three full stops (...) next.
;     Bit 6 means print a SPACE next.
;     Bits 7&6 together mean reposition the Display pointer to (18,0)
;
; Bits 5 - 0 hold a number 0-63 which represents a character as follows:

; 00-05 = U-Z (Spectrum character codes 85-90)
; 06-31 = a-z (Spectrum character codes 97-122)
; 32-34 = "#" - "%" (Spectrum character codes 35-37)
;    35 = SPACE (Spectrum character code 32)
; 36-43 = "'" - "." (Spectrum character codes 39-46)
; 44-63 = A-T (Spectrum character codes 65-84)
;
; NB. Of the non-letter codes, the game only makes use of 35(SPACE), 36('),
; 42(-) and 43(.)
;
; ENTRY:
; A = Encrypted character byte
; EXIT:
; A = Spectrum character code-32

7e10 e63f      and     3fh         ; Zero bits 7&6 (strip formatting info)

7e12 fe06      cp      06h         ; Is it 'U'-'Z'?
7e14 3003      jr      nc,7e19h    ; If not, test for 'a'-'z'
7e16 c635      add     a,35h       ; If so, decode and return
7e18 c9        ret

7e19 fe20      cp      20h         ; Is it 'a'-'z'
7e1b 3003      jr      nc,7e20h    ; If not, test for non-letters
7e1d c63b      add     a,3bh       ; If so, decode and return
7e1f c9        ret

7e20 fe2c      cp      2ch         ; Is it a non-letter character?
7e22 3008      jr      nc,7e2ch    ; If not, it must be 'A'-'T'
7e24 d61d      sub     1dh         ; If so, decode
7e26 fe06      cp      06h         ; Was it SPACE?
7e28 c0        ret     nz          ; If not, return
7e29 af        xor     a           ; If it was, decode and return
7e2a c9        ret

7e2b c9        ret                 ; Unused instruction (never reached)

7e2c d60b      sub     0bh         ; It's 'A'-'T' - decode and return
7e2e c9        ret




Text1:         ; 'JUMPING JACK'
7e2f           db      35h, 00h, 38h, 3bh, 34h, 39h, 72h, 35h, 2ch, 2eh, 36h

Text2:         ; 'FINAL SCORE'
7e3a           db      31h, 34h, 39h, 2ch, 77h, 3eh, 2eh, 3ah, 3dh, 30h

Text3:         ; 'NEW HIGH'
7e44           db      39h, 30h, 42h, 33h, 34h, 32h, 33h

Text4:         ; 'Press ENTER to replay'
7e4b           db      3bh, 17h, 0ah, 18h, 58h, 30h, 39h, 3fh, 30h, 7dh, 19h
               db      54h, 17h, 0ah, 15h, 11h, 06h, 1eh




;-------------------------------------------------------------------------------
LevlDone:      ; Plays the end of level SFX & calls the Completed Level screen
;-------------------------------------------------------------------------------
7e5d dd340e    inc     (ix+0eh)    ; Increment Level / No. of Hazards counter

; At this point Jack will have just completed a Good Jump Part 1 animation (as
; part 2 is never played if jumping through the top Jline). However, the Good
; Jump SFX will only have played 4 of the 8 notes - so need to complete it.

7e60 0604      ld      b,04h       ; 4 remaining notes to play

7e62 c5        push    bc          ; Save counter
7e63 cd7f79    call    SfxGfx      ; Play next note in sequence (797fh)
7e66 c1        pop     bc          ; Retrieve counter
7e67 10f9      djnz    7e62h       ; Loop until 4 notes played

; Now play the whole Good Jump SFX 3 more times

7e69 010303    ld      bc,0303h    ; B=3 times to play, C=Good Jump
7e6c cd787e    call    PlaySFX     ; Play it (7e78h)

; Launch completed level screen

7e6f dd363501  ld      (ix+35h),1  ; Set print speed (used by PrtDelay)
7e73 cdfb7c    call    YelScrn     ; Prepare screen (7cfbh)
7e76 1815      jr      CpLvScrn    ; Show Completed Level screen (7e8dh)




;-------------------------------------------------------------------------------
PlaySFX:       ; Plays a complete SFX sequence a number of times
;-------------------------------------------------------------------------------
; This is called when Jack has completed a level or lost the game. It plays a
; complete SFX sequence (Good Jump or Fall) a specified number of times. To play
; each sequence, SfxGfx is called 8 times (once for each note in the sequence).
;
; ENTRY
; B = Number of times to play sequence
; C = SFX to play (Used as a value for IX-08h so 3=Good Jump, 4=Fall)

7e78 c5        push    bc          ; Save sequence counter
7e79 0608      ld      b,08h       ; 8 notes to play in a sequence
7e7b dd36f6ff  ld      (ix-0ah),0ffh ; Reset SfxGfx frame counter
7e7f dd71f8    ld      (ix-08h),c  ; Set SfxGfx routine to play

7e82 c5        push    bc          ; Save note counter
7e83 cd7f79    call    SfxGfx      ; Play note (797fh)
7e86 c1        pop     bc          ; Retrieve note counter
7e87 10f9      djnz    7e82h       ; Play 8 notes

7e89 c1        pop     bc          ; Retrieve sequence counter
7e8a 10ec      djnz    PlaySFX     ; Repeat whole sequence as required (7e78h)
7e8c c9        ret




;-------------------------------------------------------------------------------
CpLvScrn:      ; The 'Completed Level' screen
;-------------------------------------------------------------------------------
; EXIT
; C = Flag set if there are more levels to play

7e8d dd7e0e    ld      a,(ix+0eh)  ; A=Number of next level
7e90 fe15      cp      15h         ; Has player just completed final level?
7e92 2852      jr      z,CpLvCont  ; Skip text about Next Level if yes.. (7ee6h)

; Draw white rectangle to go behind 'NEXT LEVEL -     HAZARDS' text

7e94 013903    ld      bc,0339h    ; B=Rect Height
                                   ; C=Attributes (Paper White, Ink Blue)
7e97 3e1c      ld      a,1ch       ; A=Rect Width
7e99 210259    ld      hl,5902h    ; HL points to (8,2) in Attributes memory
7e9c cda27d    call    ColRect     ; Draw white rectangle (7da2h)

; Print 'NEXT LEVEL -     HAZARD(S)' text

7e9f 21537f    ld      hl,Text5    ; HL points to encrypted chars (7f53h)
7ea2 0613      ld      b,13h       ; 19 encrypted chars to decode
7ea4 dd7e0e    ld      a,(ix+0eh)  ; A=Number of Hazards in next level
7ea7 f5        push    af          ; Save this
7ea8 fe01      cp      01h         ; Is there 1 Hazard in next level?
7eaa 2002      jr      nz,7eaeh    ; If not, carry on
7eac 0612      ld      b,12h       ; Otherwise, decrease length of string to
                                   ; be printed so we write 'HAZARD' singular
7eae 112448    ld      de,4824h    ; DE points to (9,4) in Display memory
7eb1 cdb27d    call    PrtEText    ; 7db2h

; Print the number of Hazards digit(s)

7eb4 f1        pop     af          ; Retrieve number of Hazards in next level
7eb5 113148    ld      de,4831h    ; DE points to (9,17) in Display memory
7eb8 cdbd7e    call    PtHzDgts    ; 7ebdh
7ebb 1829      jr      CpLvCont    ; Continue Completed Level screen (7ee6h)




;-------------------------------------------------------------------------------
PtHzDgts:      ; Prints the digits for number of Hazards to the screen
;-------------------------------------------------------------------------------
; ENTRY
; DE = Address in Display memory - where to print
;  A = Number of Hazards

7ebd f5        push    af          ; Save number to print
7ebe d5        push    de          ; Save Display pointer
7ebf fe0a      cp      0ah         ; Is the number less than 10? (i.e. 1 digit)
7ec1 3810      jr      c,7ed3h     ; Jump if yes..

; We have a 2-digit number. Start by printing the first digit which is 1 or 2.

7ec3 fe14      cp      14h         ; Is the number 20?
7ec5 21883d    ld      hl,3d88h    ; HL points to ROM pixel definition for '1'
7ec8 2003      jr      nz,7ecdh    ; Print this unless A=20. In which case..
7eca 21903d    ld      hl,3d90h    ; HL points to ROM pixel definition for '2'

7ecd 010101    ld      bc,0101h    ; 1x1 cell sprite to print
7ed0 cd0374    call    PtSprite    ; Print first digit (7403h)

; We've either printed the first digit or there wasn't one - now print the
; remaining digit.

7ed3 d1        pop     de          ; Retrieve Display pointer
7ed4 f1        pop     af          ; Retrieve number to be printed
7ed5 13        inc     de          ; Move Display pointer to next cell along

7ed6 d60a      sub     0ah         ; Subtract 10 in case it was 2 digits
7ed8 30fc      jr      nc,7ed6h    ; If it's still zero or above, repeat
7eda c60a      add     a,0ah       ; Now add 10 back, so we have single digit
7edc cdc178    call    GetDigDef   ; HL points to ROM digit pixel def (78c1h)
7edf 010101    ld      bc,0101h    ; 1x1 cell sprite to print
7ee2 cd0374    call    PtSprite    ; Print remaining digit (7403h)
7ee5 c9        ret




;-------------------------------------------------------------------------------
CpLvCont:      ; Continuation of the Completed Level screen
;-------------------------------------------------------------------------------
7ee6 0602      ld      b,02h       ; Length of delay
7ee8 cd387f    call    CLDelay     ; Pause before displaying rhyme (7f38h)

; Print the next line(s) of the rhyme
;
; The lines of the rhyme are stored as encrypted text, scattered throughout
; memory.  The locations and lengths of each line are stored in a table at
; RhymOffs. For each line of the rhyme, the table contains a 2-byte address and
; 1-byte length of encrypted characters in that line. So:
;
; RhymOffs + (Last Level * 3) = Address of next line of rhyme
; RhymOffs + (Last Level * 3) + 2 = Length of encrypted characters

7eeb dd7e0e    ld      a,(ix+0eh)  ; A=Number of next level
7eee 3d        dec     a           ; A=Number of last level
7eef 5f        ld      e,a
7ef0 07        rlca
7ef1 83        add     a,e         ; A=A*3
7ef2 5f        ld      e,a
7ef3 1600      ld      d,00h       ; DE=Offset into RhymOffs table
7ef5 217a7f    ld      hl,RhymOffs ; 7f7ah
7ef8 19        add     hl,de       ; HL points to 3-byte data in table
7ef9 5e        ld      e,(hl)      ; Get address low-byte..
7efa 23        inc     hl          ; ..and high byte
7efb 56        ld      d,(hl)      ; DE=Address of next rhyme line chars
7efc 23        inc     hl
7efd 46        ld      b,(hl)      ; B=Length of encryted chars
7efe eb        ex      de,hl       ; HL=Address of next rhyme line chars
7eff 110050    ld      de,5000h    ; DE points to (16,0) in Display memory
7f02 dd36353c  ld      (ix+35h),60 ; Set print speed (used by PrtDelay)
7f06 cdb27d    call    PrtEText    ; Print the next rhyme line(s) (7db2h)

; Rhyme printed. Brief pause before continuing.

7f09 0601      ld      b,01h       ; Length of delay
7f0b cd387f    call    CLDelay     ; Pause before next part of screen (7f38h)

; Has the player earned a new life? One new life is awarded before the start of
; levels 6, 11 & 16.

7f0e dd7e0e    ld      a,(ix+0eh)  ; A=Number of next level
7f11 fe06      cp      06h         ; Is player about to start level 6?
7f13 2808      jr      z,7f1dh     ; Jump if yes..
7f15 fe0b      cp      0bh         ; Is player about to start level 11?
7f17 2804      jr      z,7f1dh     ; Jump if yes..
7f19 fe10      cp      10h         ; Is player about to start level 16?
7f1b 2019      jr      nz,7f36h    ; Skip new life section if no..

; New life to be awarded

7f1d dd340c    inc     (ix+0ch)    ; Increment lives counter

; Draw flashing magenta rectangle to go behind 'EXTRA LIFE' text

7f20 019f03    ld      bc,039fh    ; B=Rect Height
                                   ; C=Atts (Flash On, Paper Magenta, Ink White)
7f23 3e0e      ld      a,0eh       ; A=Rect Width
7f25 21a95a    ld      hl,5aa9h    ; HL points to (21,9) in Attributes memory
7f28 cda27d    call    ColRect     ; Draw flashing rectangle (7da2h)

; Print 'EXTRA LIFE' text

7f2b 21717f    ld      hl,Text8    ; HL points to encrypted chars (7f71h)
7f2e 0609      ld      b,09h       ; 9 encrypted chars to decode
7f30 11cb50    ld      de,50cbh    ; DE points to (22,11) in Display memory
7f33 cdb27d    call    PrtEText    ; 7db2h

; Screen complete. Brief pause before returning.

7f36 0606      ld      b,06h       ; Length of delay




;-------------------------------------------------------------------------------
CLDelay:       ; Generates pauses during Completed Level screen
;-------------------------------------------------------------------------------
; ENTRY:
; B = Length of delay required (It will loop 65535 x this value)
; EXIT
; Carry Flag = 1 if there are more levels to play

7f38 210000    ld      hl,0000h    ; Set HL so loop begins with 0ffffh

7f3b 2b        dec     hl
7f3c 7c        ld      a,h
7f3d b5        or      l
7f3e 20fb      jr      nz,7f3bh    ; Loop until HL=0
7f40 10f6      djnz    CLDelay     ; Repeat loop B times (7f38h)

; Delay done. This next test is only relevant at the end of the Completed Level
; screen so CpLvScrn returns with the C flag set appropriately. This result is
; ignored during the previous calls to CLDelay.

7f42 dd7e0e    ld      a,(ix+0eh)  ; A=Number of next level to play
7f45 fe15      cp      15h         ; Is it 21? (i.e. game is complete)
7f47 c9        ret                 ; Return Carry set if more levels to play




;-------------------------------------------------------------------------------
PrtDelay:      ; Generates a delay
;-------------------------------------------------------------------------------
; This is called from PrtEText to pause between printing individual characters.
; The length of the pause is determined by the value of IX+35.
;
; ENTRY:
; IX+35 = Length of delay required (It will loop approx 256 x this value)
; EXIT:
; HL = Preserved

7f48 e5        push    hl
7f49 dd6635    ld      h,(ix+35h)  ; Set HL with number of times to loop
                                   ; (L will contain whatever it had previously)
7f4c 2b        dec     hl
7f4d 7c        ld      a,h
7f4e b5        or      l
7f4f 20fb      jr      nz,7f4ch    ; Loop until HL=0
7f51 e1        pop     hl
7f52 c9        ret




Text5:         ; 'NEXT LEVEL -     HAZARDS'
7f53           db      39h, 30h, 03h, 7fh, 37h, 30h, 01h, 30h, 77h, 6ah, 63h
               db      63h, 33h, 2ch, 05h, 2ch, 3dh, 2fh, 3eh

Text6:         ; 'WITH'
7f66           db      02h, 34h, 3fh, 33h

Text7:         ; 'HAZARDS'
7f6a           db      33h, 2ch, 05h, 2ch, 3dh, 2fh, 3eh

Text8:         ; 'EXTRA LIFE'
7f71           db      30h, 03h, 3fh, 3dh, 6ch, 37h, 34h, 31h, 30h




RhymOffs:      ; DATA - Table containing locations and lengths of each line in
               ; the rhyme.

7f7a 3c7c      dw      Rhyme1      ; Mem address for line 1 data (7c3ch)
7f7c 34        db      34h         ; No. of encryted chars in this line

7f7d c97f      dw      Rhyme2      ; Mem address for line 2 data (7fc9h)
7f7f 2e        db      2eh         ; No. of encryted chars in this line

7f80 5c6e      dw      Rhyme3      ; Mem address for line 3 data (6e5ch)
7f82 17        db      17h         ; No. of encryted chars in this line

7f83 826e      dw      Rhyme4      ; Mem address for line 4 data (6e82h)
7f85 16        db      16h         ; No. of encryted chars in this line

7f86 a26e      dw      Rhyme5      ; Mem address for line 5 data (6ea2h)
7f88 13        db      13h         ; No. of encryted chars in this line

7f89 cf6e      dw      Rhyme6      ; Mem address for line 6 data (6ecfh)
7f8b 1c        db      1ch         ; No. of encryted chars in this line

7f8c f76e      dw      Rhyme7      ; Mem address for line 7 data (6ef7h)
7f8e 1c        db      1ch         ; No. of encryted chars in this line

7f8f 2670      dw      Rhyme8      ; Mem address for line 8 data (7026h)
7f91 1f        db      1fh         ; No. of encryted chars in this line

7f92 8b70      dw      Rhyme9      ; Mem address for line 9 data (708bh)
7f94 18        db      18h         ; No. of encryted chars in this line

7f95 c270      dw      Rhyme10     ; Mem address for line 10 data (70c2h)
7f97 14        db      14h         ; No. of encryted chars in this line

7f98 d971      dw      Rhyme11     ; Mem address for line 11 data (71d9h)
7f9a 1b        db      1bh         ; No. of encryted chars in this line

7f9b 2572      dw      Rhyme12     ; Mem address for line 12 data (7225h)
7f9d 1e        db      1eh         ; No. of encryted chars in this line

7f9e 4e72      dw      Rhyme13     ; Mem address for line 13 data (724eh)
7fa0 1f        db      1fh         ; No. of encryted chars in this line

7fa1 3373      dw      Rhyme14     ; Mem address for line 14 data (7333h)
7fa3 11        db      11h         ; No. of encryted chars in this line

7fa4 b573      dw      Rhyme15     ; Mem address for line 15 data (73b5h)
7fa6 11        db      11h         ; No. of encryted chars in this line

7fa7 e373      dw      Rhyme16     ; Mem address for line 16 data (73e3h)
7fa9 20        db      20h         ; No. of encryted chars in this line

7faa 6b74      dw      Rhyme17     ; Mem address for line 17 data (746bh)
7fac 18        db      18h         ; No. of encryted chars in this line

7fad 0e75      dw      Rhyme18     ; Mem address for line 18 data (750eh)
7faf 15        db      15h         ; No. of encryted chars in this line

7fb0 f475      dw      Rhyme19     ; Mem address for line 19 data (75f4h)
7fb2 11        db      11h         ; No. of encryted chars in this line

7fb3 7a76      dw      Rhyme20     ; Mem address for line 20 data (767ah)
7fb5 13        db      13h         ; No. of encryted chars in this line

7fb6 ce78      dw      Rhyme21     ; Mem address for line 21 data (78ceh)
7fb8 27        db      27h         ; No. of encryted chars in this line




;-------------------------------------------------------------------------------
TstJkDrw:      ; Tests if Jack needs to be re-drawn this frame
;-------------------------------------------------------------------------------
; This tests to see if Jack is currently Standing Still, and if so whether the
; next Jack sprite to be drawn is the same as the one on screen. (The Standing
; Still GFX animation only updates every 32 frames, so this saves GameLoop from
; unnecessarily erasing and re-drawing the same Jack sprite 31 out of 32 frames)
;
; EXIT
; Z Flag = 0 No need to re-draw
;        = 1 Need to re-draw

7fb9 dd7e08    ld      a,(ix+08h)  ; A= Jack's animation (Next frame)
7fbc dd862d    add     a,(ix+2dh)  ; Add Jack's animation (Current frame)
7fbf c0        ret     nz          ; Return if not Standing Still - needs redraw

; Jack is Standing Still - but is it time for a new sprite?

7fc0 dd7e0d    ld      a,(ix+0dh)  ; A= Animation frame (Next)
7fc3 ddae2f    xor     (ix+2fh)    ; Isolate changed bits from last frame
7fc6 e660      and     60h         ; Have bits 6&5 changed (Standing Still
7fc8 c9        ret                 ; frame data), Z will be set if they have




Rhyme2:        ; 'THE BALLAD OF JUMPING JACK'
               ; 'A daring explorer named Jack...'
7fc9           db      3fh, 33h, 70h, 2dh, 2ch, 37h, 37h, 2ch, 6fh, 3ah, 71h
               db      35h, 00h, 38h, 3bh, 34h, 39h, 72h, 35h, 2ch, 2eh, 0f6h
               db      6ch, 09h, 06h, 17h, 0eh, 13h, 4ch, 0ah, 1dh, 15h, 11h
               db      14h, 17h, 0ah, 57h, 13h, 06h, 12h, 0ah, 49h, 35h, 06h
               db      08h, 90h




;-------------------------------------------------------------------------------
Beep:          ; Calls the ROM Beep routine
;-------------------------------------------------------------------------------
; ENTRY
; HL = Pitch
; DE = Duration

7ff7 dde5      push    ix          ; Save pointer to game data
7ff9 cdb503    call    03b5h       ; Call ROM Beep
7ffc f3        di                  ; ROM routine re-enabled the interrupts
7ffd dde1      pop     ix          ; Restore data pointer
7fff c9        ret

================================================================================