;-------------------------------------------------------------------------------
;PLAINJUMP (C) 1996 BY ANDREAS ESS
;                      TUFERS 156
;                      A-6811 GOEFIS
;                      AUSTRIA/EUROPE
;                      ess.andreas@computerhaus.at
;
;The:
;
;				Eighty Bits - Project
;				=====================
;
;(okay, okay, it's a stupid name, mail me if you know a better one...)
;Well this project is just to encourage you all to program for ZShell! There
;are really to less programmers for this operating system, and we need new
;ones with ideas, enthusiasm, ...
;All I want you to do is to code a nice game, and you'll see after a bit trying
;you'll be able to write fantastic games! And release your stuff to
; CONTRIB@TICALC.ORG
;so that everybody can see what you have done and will try to program something
;like that, too.
;
;I released the XC-1701 and the Plainjump source code to learn a bit from it.
;Please give it a try, and if you've got problems, then mail me:
; ess.andreas@computerhaus.at
;
;Happy programming!
; Andreas
;
;Hi folks,
;it's ZShell's birthday so I release the code of Plainjump I, coded in 5 days!
;Do with it whatever you want, but if you:
; a) use a major portion of code -> credit, please
; b) modify it and want to re-release it -> mail me first!
;It's bad commented and not very well optimized... but you can learn at
;least a little bit from it(I hope)
;Have fun,
; Andreas
;-------------------------------------------------------------------------------

#INCLUDE "TI-85.H"

;-------------------------------------------------------------------------------
;Variables in text-memory:
;-------------------------------------------------------------------------------
LEVELY =  TEXT_MEM 	;position in level
SCROLLY = TEXT_MEM+1	;position in level-y
LEVELPT = TEXT_MEM+2    ;pointer to level data
BKPT =    TEXT_MEM+4    ;pointer to background
PLAYERPT = TEXT_MEM+6   ;pointer to player
JUMPFLAG = TEXT_MEM+8   ;0 = no jump; 1 = up; 2 = down
PLAYERPT1 = TEXT_MEM+9  ;pointer to black-player image
ANICOUNT = TEXT_MEM+11  ;animation counter
SPEED = TEXT_MEM+12     ;speed of ball
LIFE = TEXT_MEM+14      ;lifes of player
SCORE = TEXT_MEM+15     ;contains player's score
ORIGLVL = TEXT_MEM+17   ;pointer to start of level
BALLX = TEXT_MEM+19     ;only needed for savegame
BALLY = TEXT_MEM+20
Data = TEXT_MEM+21      ;needed for ZCP
StringPlace = TEXT_MEM+22
ZeroByte = TEXT_MEM+27
HiScoreTemp = TEXT_MEM+28
Count = TEXT_MEM+30
TempByte = TEXT_MEM+31
MASK = TEXT_MEM+32
ANISCROLLC = TEXT_MEM+33
KEYPRESS = TEXT_MEM+34
;-------------------------------------------------------------------------------
BITMAPMEM = $8641 ;this points to the graph mem

.org 0
.db  "PLAIN-JUMP v1.0 BY AE",0

;-------------------------------------------------------------------------------
;Program start!
;-------------------------------------------------------------------------------
Title:
; di
 ld   hl, ZS_BITS
 set  0, (hl)     ;Tell ZShell to update me....
 ld   a, 4
 out  (5), a
 ROM_CALL(CLEARLCD)
 ld   hl, (PROGRAM_ADDR)
 ld   de, TitlePicture
 add  hl, de
 CALL_(ShowZCP)
 ld   hl, $3030
 ld   ($8333), hl
 ld   de, (PROGRAM_ADDR)
 ld   hl, ByStr
 add  hl, de
 ROM_CALL(D_ZM_STR)
 ld   hl, HiScore
 add  hl, de
 call LD_HL_MHL
 CALL_(HL_DECIMAL_MENU)
 ld   hl, $3901
 ld   ($8333), hl
 ld   hl, Instr
 add  hl, de
 ROM_CALL(D_ZM_STR)
WaitForKey:
 call GET_KEY
 cp   0
 jr   z, WaitForKey
 cp   $37
 JUMP_Z(ExitGame)
 cp   $33
 JUMP_Z(LevelEditor)
 cp   $34
 jr   z, LoadExternGame
 cp   $35
 jr   nz, RegularGame
 ROM_CALL(CLEARLCD)
 ld   hl, (PROGRAM_ADDR)
 ld   de, LevelSaved
 add  hl, de
 ld   a, (hl)
 cp   0
 jr   z, RegularGame
 ;Copy saved game(20 bytes) to TEXT_MEM
 ld   bc, 21
 inc  hl
 ld   de, LEVELY
 ldir
 CALL_(DrawScreen)
 ld   a, (BALLX)
 ld   b, a
 ld   a, (BALLY)
 ld   c, a
 ld   a, 0
 ld   (SCROLLY), a
 CALL_(ScanBk)
 JUMP_(GameLoop)
LoadExternGame:
 ld   hl, (PROGRAM_ADDR)
 ld   de, Level
 add  hl, de
 ld   (LEVELPT), hl
 ld   (ORIGLVL), hl
 ld   de, (PROGRAM_ADDR)
 jr   BuiltInLevels
RegularGame:
 ;Do some initialisation
 ld   de, (PROGRAM_ADDR)
 ld   hl, Level1
 add  hl, de
 ld   (LEVELPT), hl
 ld   (ORIGLVL), hl
BuiltInLevels:
 ld   hl, BackgroundTemp
 add  hl, de
 ld   (BKPT), hl
 ld   hl, WhiteBall
 add  hl, de
 ld   (PLAYERPT), hl
 ld   hl, BlackBall1
 add  hl, de
 ld   (PLAYERPT1), hl
 ROM_CALL(CLEARLCD)
 ld   a, 0
 ld   (SCROLLY), a
 ld   (LEVELY), a
 ld   (JUMPFLAG), a
 ld   (ANICOUNT), a
 ld   (SPEED), a
 ld   hl, 0
 ld   (SCORE), hl
 ld   a, 6
 ld   (LIFE), a
 ;Draw screen first time:
StartGameLoop:
 CALL_(ClearDBuf)
 CALL_(DrawScreen)
 ld   hl, (LEVELPT)
 inc  hl
 ld   (LEVELPT), hl
 ld   b, 52
 ld   c, 38
 CALL_(ScanBk)

;-------------------------------------------------------------------------------
;The game loop:
;-------------------------------------------------------------------------------
GameLoop:
 CALL_(DrawBk)  ;erase ball
 ld   a, c
 cp   38
 jr   nz, TestKeys
 push bc
 ld   a, b
 add  a, 12
 ld   b, a
 ld   a, 63
 sub  c
 sub  20
 ld   c, a
 CALL_(TestPixel)
 cp   0
 pop  bc
 JUMP_Z(LostLife)
TestKeys:
 ld  a, $3E
 out (1), a
 in  a, (1)
 ld  (KEYPRESS), a
 cp  0
 JUMP_Z(Redraw)
TestLeftKey:
 ld   a, (KEYPRESS)
 and  4
 jr   z, TestRightKey
 ld   a, b
 cp   2
 jr   c, TestRightKey
 dec  b
 ld   a, (SPEED)
 cp   3
 jr   nz, TestRightKey
 dec  b
TestRightKey:
 ld   a, (KEYPRESS)
 and  2
 jr   z, TestUpKey
 ld   a, b
 cp   103
 jr   nc, TestUpKey
 inc  b
 ld   a, (SPEED)
 cp   3
 jr   nz, TestUpKey
 inc  b
TestUpKey:
 ld   a, (KEYPRESS)
 and  1
 jr   z, TestDownKey
 ld   a, (SPEED)
 cp   3
 jr   nc, TestDownKey
 inc  a
 ld   (SPEED), a
TestDownKey:
 ld   a, (KEYPRESS)
 and  8
 jr   z, Test2ndKey
 ld   a, (SPEED)
 cp   0
 jr   z, Test2ndKey
 dec  a
 ld   (SPEED), a
Test2ndKey:     ;JUMP?
 ld   a, (KEYPRESS)
 and 32
 jr  nz, TestExitKey
 ld  a, (JUMPFLAG)
 cp  0
 jr  nz, TestExitKey
 ld  a, 1
 ld  (JUMPFLAG), a

TestExitKey:
 ld   a, (KEYPRESS)
 and  64
 JUMP_Z(ExitGame)
TestPauseKey:
 ld   a, (KEYPRESS)
 and 128
 JUMP_Z(Pause)
TestF1Key:
 ld  a, $3F
 out (1), a
 in  a, (1)
 and 16
 JUMP_Z(LSaveGame)

Redraw:
 ld   a, (JUMPFLAG)
 cp   0
 jr   z, ReallyRedraw
 cp   1
 jr   nz, FlyDown
 ld   a, c
 cp   20
 jr   z, SetFlyDown
 dec  c
 jr   ReallyRedraw
SetFlyDown:
 ld   a, 2
 ld   (JUMPFLAG), a
FlyDown:
 ld   a, c
 cp   38
 jr   nz, FlyDown1
 ld   a, 0
 ld   (JUMPFLAG), a
 jr   ReallyRedraw
FlyDown1:
 inc  c
ReallyRedraw:
 ld   a, (SPEED)
 cp   0
 jr   z, RedrawBall
 push bc
 ld   b, a
DoScrolling:
 CALL_(DoScroll)
 djnz DoScrolling
 pop  bc

RedrawBall:
 CALL_(ScanBk)
 ld   de, (PLAYERPT)
 CALL_(WhiteSprite)
 ld   de, (PLAYERPT1)
 CALL_(BlackSprite)

 ld   a, (ANISCROLLC)
 ld   hl, SPEED
 add  a, (hl)
 ld   (ANISCROLLC), a
 cp   6
 jr   c, GoOnMainLoop

 ld   a, 0
 ld   (ANISCROLLC), a
 ld   a, (ANICOUNT)
 inc  a
 ld   (ANICOUNT), a
 cp   3
 jr   nz, NextFrame
 ld   a,  0
 ld   (ANICOUNT), a
 ld   hl, (PROGRAM_ADDR)
 ld   de, BlackBall1
 add  hl, de
 ld   (PLAYERPT1), hl
 jr   GoOnMainLoop
NextFrame:
 ld   hl, (PLAYERPT1)
 ld   de, 72
 add  hl, de
 ld   (PLAYERPT1), hl

GoOnMainLoop:
 ;copy GRAPH-MEM to LCD-MEM
 ld   de, VIDEO_MEM
 ld   hl, BITMAPMEM
 push bc
 ld   bc, 1024
 ldir
 pop  bc
 JUMP_(GameLoop)

Pause:
 call GET_KEY
 cp   0
 jr   z, Pause
 JUMP_(GameLoop)

LostLife:
 ld   a, 0
 ld   (SPEED), a
 ld   a, (CONTRAST)
FadeLoop:
 ld   b, 6
DelayL:
 CALL_(Delay)
 djnz DelayL
 dec  a
 out  (2), a
 cp   0
 jr   nz, FadeLoop
 ld   a, (LIFE)
 dec  a
 jr   z, GameOver
 ROM_CALL(CLEARLCD)
 ld   (LIFE), a
 ld   hl, (LEVELPT)
 ld   a, 0
 ld   (SCROLLY), a
FindStone:
 dec  hl
 ld   (LEVELPT), hl
 ld   a, (LEVELY)
 dec  a
 ld   (LEVELY), a
 JUMP_Z(StartGameLoop)
 ld   c, $C0
 ld   b, 1
FindStone1:
 ld   a, (hl)
 and  c
 jr   nz, FoundDone
 srl  c
 srl  c
 jr   z, FindStone
 ld   a, b
 add  a, 32
 ld   b, a
 jr   FindStone1
FoundDone:
 ld   c, 38
 ld   a, (CONTRAST)
 out  (2), a
 push bc
 CALL_(DrawScreen)
 pop  bc
 CALL_(ScanBk)
 JUMP_(GameLoop)

GameOver:
 ld   a, (CONTRAST)
 out  (2), a
 ROM_CALL(CLEARLCD)
 CALL_(HiScoreHand)
 JUMP_(Title)

LSaveGame:
 ld  a, b
 ld  (BALLX), a
 ld  a, c
 ld  (BALLY), a
 ld  hl, (PROGRAM_ADDR)
 ld  de, LevelSaved
 add hl, de
 ld  a, 1
 ld  (hl), a
 inc hl
 ld  de, LEVELY
 ex  de, hl
 ld  bc, 21
 ldir
 ld  hl, ZS_BITS
 set 1, (hl)              ;Tell ZShell to warp out...
 ret

ExitGame:
; ei
 ld   a, (CONTRAST)
 out  (2), a
 ROM_CALL(CLEARLCD)
 ld   hl, $0000
 ld   ($800C), hl
 ld   hl, (PROGRAM_ADDR)
 ld   de, EndingTxt
 add  hl, de
 ROM_CALL(D_ZT_STR)
WaitEnter:
 call GET_KEY
 cp   $09
 jr   nz, WaitEnter
 CALL_(ClearDBuf)
 ret

;-------------------------------------------------------------------------------
;ClearDBuf: clears graphmem which is used as double buffer
;-------------------------------------------------------------------------------
ClearDBuf:
 ld   hl, BITMAPMEM
 ld   bc, 1024
ClearGraph:
 ld   a, 0
 ld   (hl), a
 inc  hl
 dec  bc
 ld   a, b
 or   c
 jr   nz, ClearGraph

;-------------------------------------------------------------------------------
;WhiteLine: draws a horizontal, white line from (B,D) to (C,D)
;-------------------------------------------------------------------------------
WhiteLine:
 push hl
 push de
 ld   h, 0
 ld   l, d
 add  hl, hl    ;multiply a by 2
 add  hl, hl    ;            * 4
 add  hl, hl    ;            * 8
 add  hl, hl    ;            * 16
 push bc
 srl  b         ;divide b by 8
 srl  b
 srl  b
 ld   d, 0
 ld   e, b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 pop  bc
 ;HL now contains video-offset
 ld   a, b      ;load real x1-pos into a
 ld   d, a      ;d=real x1-pos is needed later...
 and  7         ;and make the mask
 ld   b, 128    ;b is the video-mask
 jr   z, WLoop  ;mod(a,7) = 0->no mask-shift needed
 ld   e, 128
 ld   b, a      ;times to shift
ShiftWLoop:
 srl  e
 djnz ShiftWLoop
 ld   b, e
WLoop:          ;ready-go!
 ld   a, b                 ;erase point
 xor  255
 and  (hl)
 ld   (hl), a   ;and save it back to vid-ram

 dec  c         ;decrement X2 if X2 = X1 -> end
 ld   a, c
 cp   d         ;now know for what d was needed?
 jr   z, EndWhite

 srl  b         ;shift mask
 jr   nz, WLoop
 ld   b, 128
 inc  hl
 jr   WLoop
EndWhite:
 pop  de
 pop  hl
 ret

;-------------------------------------------------------------------------------
;BlackLine: draws a horizontal, black line from (B,D) to (C,D)
;-------------------------------------------------------------------------------
BlackLine:
 push hl
 push de
 ld   h, 0
 ld   l, d
 add  hl, hl    ;multiply a by 2
 add  hl, hl    ;            * 4
 add  hl, hl    ;            * 8
 add  hl, hl    ;            * 16
 push bc
 srl  b         ;divide b by 8
 srl  b
 srl  b
 ld   d, 0
 ld   e, b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 pop  bc
 ;HL now contains video-offset
 ld   a, b      ;load real x1-pos into a
 ld   d, a      ;d=real x1-pos is needed later...
 and  7         ;and make the mask
 ld   b, 128    ;b is the video-mask
 jr   z, BLoop  ;mod(a,7) = 0->no mask-shift needed
 ld   e, 128
 ld   b, a      ;times to shift
ShiftBLoop:
 srl  e
 djnz ShiftBLoop
 ld   b, e
BLoop:          ;ready-go!
 ld   a, (hl)   ;load byte from vid-ram
 or   b         ;set it to black
 ld   (hl), a   ;and save it back to vid-ram

 dec  c         ;decrement X2 if X2 = X1 -> end
 ld   a, c
 cp   d         ;now know for what d was needed?
 jr   z, EndBlack

 srl  b         ;shift mask
 jr   nz, BLoop
 ld   b, 128
 inc  hl
 jr   BLoop
EndBlack:
 pop  de
 pop  hl
 ret

;-------------------------------------------------------------------------------
;DrawLine: this draws a line at y-pos D, accoriding to bits in E
;-------------------------------------------------------------------------------
DrawLine:
 push bc
 ld   hl, (PROGRAM_ADDR)
 ld   bc, StartLine1
 add  hl, bc
 ld   b,  0
 ld   a,  63
 sub  d
 srl  a
 ld   c,  a
 add  hl, bc

 ;HL now contains pointer to StartLine1

 ld   b, (hl)  ;\   set
 push de
 ld   de, 32
 add  hl, de   ;  > &
 pop  de
 ld   c, (hl)  ; /  X2

 ld   a, e
 srl  a
 and  $C0
 jr   z, WhiteLn1
 CALL_(BlackLine)
 jr   Line2
WhiteLn1:
 CALL_(WhiteLine)

Line2:
 ld   b, (hl)  ;\   set
 push de
 ld   de, 32
 add  hl, de   ;  > &
 pop  de
 ld   c, (hl)  ; /  X2

 ld   a, e
 and  $30
 jr   z, WhiteLn2
 CALL_(BlackLine)
 jr   Line3
WhiteLn2:
 CALL_(WhiteLine)

Line3:
 ld   b, (hl)  ;\   set
 push de
 ld   de, 32
 add  hl, de   ;  > &
 pop  de
 ld   c, (hl)  ; /  X2

 ld   a, e
 and  $0C
 jr   z, WhiteLn3
 CALL_(BlackLine)
 jr   Line4
WhiteLn3:
 CALL_(WhiteLine)

Line4:
 ld   b, (hl)  ;\   set
 push de
 ld   de, 32
 add  hl, de   ;  > &
 pop  de
 ld   c, (hl)  ; /  X2
 ld   a, e
 and  $03
 jr   z, WhiteLn4
 CALL_(BlackLine)
 jr   EndLine4
WhiteLn4:
 CALL_(WhiteLine)

EndLine4:
 pop  bc
 ret

;-------------------------------------------------------------------------------
;Drawscreen
;-------------------------------------------------------------------------------
DrawScreen:
 ld   hl, (LEVELPT)
 ld   e, (hl)
 ld   b, 32
DrawScrLoop:
 ld   a, b
 add  a, 32
 ld   d, a
 CALL_(DrawLine)
 djnz DrawScrLoop
 ld   hl, (LEVELPT)
 inc  hl
 ld   e, (hl)
 ld   b, 32
DrawScrLoop1:
 ld   d, b
 CALL_(DrawLine)
 djnz DrawScrLoop1
 ret

;-------------------------------------------------------------------------------
;DoScroll: handles scrolling
;-------------------------------------------------------------------------------
DoScroll:
 ld   a, (SCROLLY)   ;increment SCROLLY
 inc  a
 ld   d, a
 ld   (SCROLLY), a   ;save it
 cp   32             ;SCROLLY = 32 ?
 jr   nz, LoadHLScr
 ld   a, 0           ;yes, set it to 0,
 ld   d, 0
 ld   (SCROLLY), a
 ld   hl, $0000
 ld   ($8333), hl
 ld   hl, (SCORE)
 CALL_(HL_DECIMAL_MENU)
 push bc
 ld   b, 6
 ld   de, BITMAPMEM
 ld   hl, VIDEO_MEM
CopyVid2Grf:
 push bc
 ldi
 ldi
 ldi
 ld   bc, 13
 add  hl, bc
 ex   de, hl
 add  hl, bc
 ex   de, hl
 pop  bc
 djnz CopyVid2Grf
 pop  bc
 ld   a, (LEVELY)    ;increment LEVELY
 inc  a
 ld   (LEVELY), a
 cp   254
 jr   nz, GoOnScroll
 ld   a, 0
 ld   (LEVELY), a
 ld   hl, (ORIGLVL)
 ld   (LEVELPT), hl
GoOnScroll:
 ld   hl, (SCORE)
 ld   de, $0002
 add  hl, de
 ld   (SCORE), hl
 ld   hl, (LEVELPT)  ;and increment LEVELPT
 inc  hl
 ld   (LEVELPT), hl
LoadHLScr:
 ld   hl, (LEVELPT)  ;get Levelinformation from LEVELPT
 inc  hl
 ld   e, (hl)
 CALL_(DrawLine)
 ld   a, (SCROLLY)
 add  a, 32
 ld   d, a
 ld   hl, (LEVELPT)
 ld   e, (hl)
 CALL_(DrawLine)
 ret

;-------------------------------------------------------------------------------
;ScanBk: stores background from(B,C)-(B+24,C+24) in BKPT
;-------------------------------------------------------------------------------
ScanBk:
 push bc
 ld   h, 0
 ld   l, c
 add  hl, hl    ;multiply a by 2
 add  hl, hl    ;            * 4
 add  hl, hl    ;            * 8
 add  hl, hl    ;            * 16
 srl  b         ;divide b by 8
 srl  b
 srl  b
 ld   d, 0
 ld   e, b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 ld   de, (BKPT)
 ;HL contains Video-Offset
 ;DE contains BkPt
 ;Now we are ready...
 ld   b, 23       ;23 lines to scan
ScanLoop:
 push bc
 ld   bc, 4
 ldir             ;move 4 bytes from hl to de
 pop  bc
 push de          ;next line in vid-ram
 ld   de, 12
 add  hl, de
 pop  de
 djnz ScanLoop
 pop  bc
 ret

;-------------------------------------------------------------------------------
;DrawBk: draws background from(B,C)-(B+24,C+24) in BKPT
;-------------------------------------------------------------------------------
DrawBk:
 push bc
 ld   h, 0
 ld   l, c
 add  hl, hl    ;multiply a by 2
 add  hl, hl    ;            * 4
 add  hl, hl    ;            * 8
 add  hl, hl    ;            * 16
 srl  b         ;divide b by 8
 srl  b
 srl  b
 ld   d, 0
 ld   e, b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 ld   de, (BKPT)
 ex   de, hl
 ;DE contains Video-Offset
 ;HL contains BkPt
 ;Now we are ready...
 ld   b, 23       ;23 lines to draw
PutLoop:
 push bc
 ld   bc, 4
 ldir              ;move 4 bytes from hl to de
 pop  bc
 push hl          ;next line in vid-ram
 ld   hl, 12
 add  hl, de
 ex   de, hl
 pop  hl
 djnz PutLoop
 pop  bc
 ret

;-----------------------------------------------------------------------------
;WhiteSprite: draws each white element of a 24*24 sprite
;-----------------------------------------------------------------------------
WhiteSprite:
 push bc
 ld   a, 0
 ld   (TempByte), a ;Line
 ld   (Count), a    ;Column
 ld   h, 0
 ld   l, c
 add  hl, hl ;*2
 add  hl, hl ;*4
 add  hl, hl ;*8
 add  hl, hl ;*16
 push de
 push bc
 srl  b
 srl  b
 srl  b
 ld   d,  0
 ld   e,  b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 pop  bc
 pop  de
 ld   a, b
 and  7
 ld   c, 128
 ld   b, 128
 jr   z, WSLoop
 ld   b, a
WSShift:
 srl  c
 djnz WSShift
 ld   b, 128
WSLoop:
 ld   a, (de)
 and  b
 jr   nz, WSLoop1
 ld   a, c
 xor  255
 and  (hl)
 ld   (hl), a
WSLoop1:
 srl  c
 jr   nz, WSLoop2
 ld   c, 128
 inc  hl
WSLoop2:
 srl  b
 jr   nz, WSLoop
WSNextLine:
 inc  de
 ld   b, 128
 ld   a, (Count)
 inc  a
 ld   (Count), a
 cp   3
 jr   nz, WSLoop
 ld   a, 0
 ld   (Count), a
 push de
 ld   de, 13
 add  hl, de
 pop  de
 ld   a, (TempByte)
 inc  a
 ld   (TempByte), a
 cp   23
 jr   nz, WSLoop
WSEndBMP:
 pop  bc
 ret

;-----------------------------------------------------------------------------
;BlackSprite: draws each black element of a 24*24 sprite
;-----------------------------------------------------------------------------
BlackSprite:
 push bc
 ld   a, 0
 ld   (TempByte), a ;Line
 ld   (Count), a    ;Column
 ld   h, 0
 ld   l, c
 add  hl, hl ;*2
 add  hl, hl ;*4
 add  hl, hl ;*8
 add  hl, hl ;*16
 push de
 push bc
 srl  b
 srl  b
 srl  b
 ld   d,  0
 ld   e,  b
 add  hl, de
 ld   de, BITMAPMEM
 add  hl, de
 pop  bc
 pop  de
 ld   a, b
 and  7
 ld   c, 128
 ld   b, 128
 jr   z, BSLoop
 ld   b, a
BSShift:
 srl  c
 djnz BSShift
 ld   b, 128
BSLoop:
 ld   a, (de)
 and  b
 jr   z, BSLoop1
 ld   a, (hl)
 or   c
 ld   (hl), a
BSLoop1:
 srl  c
 jr   nz, BSLoop2
 ld   c, 128
 inc  hl
BSLoop2:
 srl  b
 jr   nz, BSLoop
BSNextLine:
 inc  de
 ld   b, 128
 ld   a, (Count)
 inc  a
 ld   (Count), a
 cp   3
 jr   nz, BSLoop
 ld   a, 0
 ld   (Count), a
 push de
 ld   de, 13
 add  hl, de
 pop  de
 ld   a, (TempByte)
 inc  a
 ld   (TempByte), a
 cp   23
 jr   nz, BSLoop
BSEndBMP:
 pop  bc
 ret

;-----------------------------------------------------------------------------
;Delay: waits
;-----------------------------------------------------------------------------
Delay:
 push af
 push bc
 ld bc, $1000
DelayLoop:
 dec bc
 ld a, b
 or c
 jr nz, DelayLoop
 pop bc
 pop af
 ret

;-------------------------------------------------------------------------------
;Testpixel : returns A = 0 if pixel white
;-------------------------------------------------------------------------------
TestPixel:
 push bc
 ROM_CALL(FIND_PIXEL)
 ld   de, BITMAPMEM
 add  hl, de
 and  (hl)
 pop  bc
 ret

;-----------------------------------------------------------------------------
;ShowZCP: shows in HL stored picture
;-----------------------------------------------------------------------------
ShowZCP:
 push    HL
 ROM_CALL(CLEARLCD)
 pop     HL
 ex      DE, HL
 ld      HL, $FC00
 ld      C,128
CLoop:
 inc     DE
 ld      A,(DE)
 cp      $00
 jr      Z,EndDecode
 ld      (Data),A
 bit     7,A
 jr      NZ,Copy
Stream:
 ld      A,(Data)
 and     $3F
 ld      B, A
StreamLoop:
 ld      A,(Data)
 bit     6,A
 CALL_NZ(DrwPoint)
 srl     C
 jr      NZ, GoOnZCP1
 inc     HL
 ld      C, 128
GoOnZCP1:
 djnz    StreamLoop
 jr      CLoop
Copy:
 ld      A,$07
 ld      B, A
CopyLoop:
 ld      A,(Data)
 rla
 ld      (Data),A
 bit     7,A
 CALL_NZ(DrwPoint)
 srl     C
 jr      NZ, GoOnZCP
 inc     HL
 ld      C, 128
GoOnZCP:
 djnz    CopyLoop
 jr      CLoop
EndDecode:
 ret

DrwPoint:
 ld      A, (HL)
 or      C
 ld      (HL), A
 ret

;-----------------------------------------------------------------------------
;Handle Hi-score
;-----------------------------------------------------------------------------
HiScoreHand:
 ROM_CALL(CLEARLCD)
 ld  de, (PROGRAM_ADDR)
 ld  hl, HiScore
 add hl, de
 call LD_HL_MHL
 ld  de, (SCORE)
 ld  (HiScoreTemp), de
;DE contains hiscore, HL actual score
 call CP_HL_DE
 ret  nc
 ld   hl, (PROGRAM_ADDR)
 ld   de, HiScore
 add  hl, de
 ex   de, hl
 ld   hl, HiScoreTemp
 ld   b, 2
 ldi
 ldi
 ld   hl, $0300
 ld   ($800C), hl
 ld   de, (PROGRAM_ADDR)
 ld   hl, HiScr
 add  hl, de
 ROM_CALL(D_ZT_STR)
 ld  hl, $0A1F
 ld  ($8333), hl
 ld  de, (PROGRAM_ADDR)
 ld  hl, EnterInit
 add hl, de
 ROM_CALL(D_ZM_STR)
 ld  hl, $0803
 ld  ($800C), hl
 ld  hl, (PROGRAM_ADDR)
 ld  de, HiScrName
 add hl, de   		;hl points to hi-score name
 ld  b, 3
InitLoop:
 CALL_(GetLetter)
 ld  (hl), a
 inc hl
 djnz InitLoop
 ret

;-----------------------------------------------------------------------------
;GetLetter: gets a letter(magnus hagander)
;-----------------------------------------------------------------------------
GetLetter:
  push hl
  push bc
  ld   hl,(PROGRAM_ADDR)
  ld   de,ASCII_Table-1   ;Point to one before, since we always inc once
  add  hl,de              ;HL now points right
ConvertLoop:
  push hl
  CALL GET_KEY                 ;ACC holds key
  pop  hl
  cp   0
  jr   z,ConvertLoop
  push hl                      ;save away...
  ld   b,a
  ld   c,0
ConversionLoop:
  inc  hl
  djnz ConversionLoop          ;After this, we have the correct offset...
  ld   a,(HL)
  pop  hl
  cp   0
  jr   z,ConvertLoop           ;Invalid key
  ROM_CALL(TX_CHARPUT)         ;Show the char
  pop  bc
  pop  hl
  ret                          ;Value is in acc

;-----------------------------------------------------------------------------
;HL_DECIMAL_MENU(Magnus Hagander):Writes the in HL stored word in menu font
;-----------------------------------------------------------------------------
HL_DECIMAL_MENU:
 push bc
 push de
 ld   de, StringPlace+4
 ld   b,  5
ConvLoop:
 call UNPACK_HL
 add  a,'0'
 ld   (de), a
 dec  de
 djnz ConvLoop
 ld   hl, StringPlace
 ROM_CALL(D_ZM_STR)
 pop de
 pop bc
 ret

;-------------------------------------------------------------------------------
;Built-in Level editor:
;-------------------------------------------------------------------------------
LevelEditor:
 ld  hl, (PROGRAM_ADDR)
 ld  de, Level
 add hl, de
 ld  (LEVELPT), hl
 ld  a, 0
 ld  (LEVELY), a
 CALL_(EDrwScreen)
 ld  a, $C0
 ld  (MASK), a
 ld  b, 0
 ld  c, 60
KeyLoop:
 CALL_(PointChg)
WaitKey:
 call GET_KEY
 cp   0
 jr   z, WaitKey
 push af
 CALL_(PointChg)
 pop  af
 cp   $01
 jr   z, MoveDown
 cp   $02
 jr   z, MoveLeft
 cp   $03
 jr   z, MoveRight
 cp   $04
 jr   z, MoveUp
 cp   $36
 JUMP_Z(ChangeStone)
 cp   $37
 JUMP_Z(ExitEditor)
 cp   $0F
 JUMP_Z(ClearLevel)
 jr   KeyLoop
MoveDown:
 ld   a, (LEVELY)
 cp   0
 jr   z, KeyLoop
 dec  a
 ld   (LEVELY), a
 inc  c
 inc  c
 ld   a, c
 cp   62
 jr   nz, KeyLoop
 ld   hl, (LEVELPT)
 dec  hl
 ld   (LEVELPT), hl
 ld   c, 60
 CALL_(EDrwScreen)
 jr   KeyLoop
MoveLeft:
 ld   a, b
 cp   0
 jr   z, KeyLoop
 dec  b
 dec  b
 ld   a, (MASK)
 add  a, a
 add  a, a
 ld   (MASK), a
 jr   KeyLoop
MoveRight:
 ld   a, b
 cp   6
 jr   z, KeyLoop
 inc  b
 inc  b
 ld   a, (MASK)
 srl  a
 srl  a
 ld   (MASK), a
 jr   KeyLoop
MoveUp:
 ld   a, (LEVELY)
 cp   253
 JUMP_Z(KeyLoop)
 inc  a
 ld   (LEVELY), a
 dec  c
 dec  c
 ld   a, c
 cp   0
 JUMP_NZ(KeyLoop)
 ld   hl, (LEVELPT)
 inc  hl
 ld   (LEVELPT), hl
 ld   c, 2
 CALL_(EDrwScreen)
 JUMP_(KeyLoop)
ChangeStone:
 ld   hl, (LEVELPT)
 ld   a, 60
 sub  c
 ld   e, a
 srl  e
 ld   d, 0
 add  hl, de
 ld   a, (MASK)
 xor  (hl)
 ld   (hl), a
 CALL_(EDrwScreen)
 JUMP_(KeyLoop)

ClearLevel:
 ld   hl, (LEVELPT)
 ld   b, 255
 ld   a, 0
ClearLL:
 ld   (hl), a
 inc  hl
 djnz ClearLL
 CALL_(EDrwScreen)
 JUMP_(KeyLoop)

ExitEditor:
 ld   hl, (LEVELPT)
 ld   de, (LEVELPT)
 ld   bc, 254
 add  hl, bc
 ex   de, hl
 ldi
 ldi
 JUMP_(Title)

;-----------------------------------------------------------------------------
;EDrwScreen: draws screen
;-----------------------------------------------------------------------------
EDrwScreen:
 push bc
 ROM_CALL(CLEARLCD)
 ld  hl, (LEVELPT)
 ld  b, 30
DrawLoop:
 ld   a, b
 add  a, a
 ld   c, a
 push bc
 bit 6, (hl)
 ld  b, 0
 CALL_NZ(DrawBox)
 bit 4, (hl)
 ld  b, 2
 CALL_NZ(DrawBox)
 bit 2, (hl)
 ld  b, 4
 CALL_NZ(DrawBox)
 bit 0, (hl)
 ld  b, 6
 CALL_NZ(DrawBox)
 pop bc
 inc  hl
 djnz DrawLoop
 pop bc
 ld  l, 10
 ld  h, 1
 ld  de, Arrow
 CALL_(DisplayText)
 ld  h, 8
 ld  de, Second
 CALL_(DisplayText)
 ld  h, 15
 ld  de, Exit
 CALL_(DisplayText)
 ret

;------------------------------------------------------------------------------
;DisplayText: displays the text in DE at position(H,L) in menustyle
;------------------------------------------------------------------------------
DisplayText:
 push hl
 ld   ($8333), hl
 ld   hl, (PROGRAM_ADDR)
 add  hl, de
 ROM_CALL(D_ZM_STR)
 pop  hl
 ret

;-----------------------------------------------------------------------------
;DrawBox
;-----------------------------------------------------------------------------
DrawBox:
 push bc
 CALL_(PointOn)
 inc b
 CALL_(PointOn)
 inc c
 CALL_(PointOn)
 dec b
 CALL_(PointOn)
 pop bc
 ret

;-----------------------------------------------------------------------------
;PointOn: draws point at b=x, c=y
;-----------------------------------------------------------------------------
PointOn:
 push hl
 push bc
 ld   a, 63
 sub  c
 ld   c, a
 ROM_CALL(FIND_PIXEL)  ;HL=byte offset in video buffer, A=2^(bit to change)
 ld de, $FC00
 add hl, de
 or (hl)
 ld (hl),a
 pop bc
 pop hl
 ret

;-----------------------------------------------------------------------------
;PointChg: changes point at b=x, c=y
;-----------------------------------------------------------------------------
PointChg:
 push bc
 push hl
 ld   a, 63
 sub  c
 ld   c, a
 ROM_CALL(FIND_PIXEL)
 ld   de,$FC00
 add  hl,de
 xor  (hl)
 ld   (hl),a
 pop  hl
 pop  bc
 ret

;-------------------------------------------------------------------------------
;Some important variables:
;-------------------------------------------------------------------------------
Arrow:     .db "USE ARROWS TO MOVE,",0
Second:    .db "2nd TO CHANGE BLOCK",0
Exit:      .db "EXIT TO SAVE&RETURN",0
Instr:     .db "F1-Restore F2-User F3-Edit",0
HiScr:     .db "NEW HIGH SCORE!",0
EnterInit: .db "ENTER YOUR INITIALS:",0
HiScore:   .dw 10    			;This is standard hi-score
ByStr:     .db "HI-SCR BY "
HiScrName: .db "AND:",0
	       ;123456789012345678901
EndingTxt: .db "PLAIN JUMP (C) 1996  "
	   .db "SEND COMMENTS,BUG-RS,"
	   .db "SUGGESTIONS,... TO:  "
	   .db " ANDREAS ESS         "
	   .db " TUFERS 156          "
	   .db " A-6811 GOEFIS       "
	   .db " AUSTRIA/EUROPE",0

;-------------------------------------------------------------------------------
;This array contains start&end-line indexes(?)
;-------------------------------------------------------------------------------
StartLine1:
 .db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
 .db 28,29,30,31
StartLine2:
 .db 31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42
 .db 43,43,44,44,45,45,46,46
StartLine3:
 .db 63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63
 .db 63,63,63,63,63,63,63,63
StartLine4:
 .db 96,96,95,95,94,94,93,93,92,92,91,91,90,90,89,89,88,88,87,87,86,86,85,85
 .db 84,84,83,83,82,82,81,81
StartLine5:
 .db 127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110
 .db 109,108,107,106,105,104,103,102,101,100,99,98,97,96

;-------------------------------------------------------------------------------
;ASCIItable for input
;-------------------------------------------------------------------------------
ASCII_Table:                   ;Thanks to Magnus H. for this Table!!!
  .db 0,0,0,0,0,0,0,0,0       ;00-09 - not valid
  .db 'X,'T','O','J','E'      ;0A-0E - valid
  .db 0,0                     ;0F-10 - not valid
  .db ' ','W','S','N','I'     ;11-15 - valid
  .db 'D'                     ;16    - valid
  .db 0,0                     ;17-18 - not valid
  .db 'Z','V','R','M','H','C' ;19-1E- valid
  .db 0,0                     ;1F-20 - not valid
  .db 'Y','U','Q','L','G','B' ;21-26 - valid
  .db 0,0,0,0                 ;27-2A - not valid
  .db 'P','K','F','A'         ;2B-2E - valid
  .db 0,0,0,0,0,0,0,0,0,0,0   ;Rest  - not valid

;-------------------------------------------------------------------------------
;This is the built-in level:
;-------------------------------------------------------------------------------
Level1:
 .db $FF,$3C,$FF,$3C,$0C,$0C,$0F,$03,$03,$03,$C0,$C0,$C0,$FF,$FF,$00 ;16
 .db $FF,$FF,$00,$3C,$3C,$00,$03,$0C,$30,$C0,$FF,$3C,$C3,$C3,$03,$FF ;32
 .db $33,$33,$03,$30,$03,$30,$03,$C0,$FF,$03,$03,$C0,$0C,$C3,$CF,$CF ;48
 .db $C0,$C0,$FF,$00,$0C,$00,$30,$00,$03,$00,$C0,$F3,$F3,$F3,$F0,$C0 ;72
 .db $C0,$F0,$30,$3C,$0C,$0F,$03,$03,$03,$F0,$F0,$00,$FF,$3C,$FF,$C0 ;80
 .db $00,$30,$FF,$FC,$F0,$C0,$03,$C0,$03,$FF,$FF,$F3,$FF,$CF,$FF,$C3 ;96
 .db $3C,$00,$C3,$00,$03,$00,$00,$FF,$FF,$03,$0C,$30,$C0,$30,$C0,$03 ;112
 .db $FF,$00,$00,$3C,$00,$03,$00,$00,$FF,$00,$00,$FF,$FF,$F3,$CF,$F3 ;128
 .db $00,$00,$C0,$00,$00,$00,$FF,$0C,$0C,$0F,$03,$03,$0F,$0C,$0F,$30 ;144
 .db $F0,$C0,$C0,$00,$FF,$00,$00,$03,$03,$03,$03,$03,$C0,$C0,$00,$00 ;160
 .db $FF,$F3,$FC,$F3,$CF,$3F,$3F,$00,$00,$FF,$00,$00,$FF,$00,$00,$FF ;176
 .db $C3,$3C,$C3,$F3,$FC,$FF,$00,$00,$00,$03,$FF,$C0,$F0,$03,$3C,$0C ;192
 .db $0F,$03,$03,$00,$00,$C0,$FF,$FF,$F3,$CF,$CF,$F3,$FF,$03,$0C,$03 ;208
 .db $00,$FF,$3C,$FF,$00,$FF,$33,$CC,$CC,$33,$3C,$00,$FF,$00,$00,$00 ;224
 .db $FF,$FF,$03,$C0,$30,$0C,$30,$0C,$FF,$00,$FF,$F3,$CF,$3F,$00,$FF ;240
 .db $FF,$00,$FF,$00,$3C,$00,$3C,$00,$3C,$00,$30,$00,$30,$00,$00,$00,$FF ;256

;-------------------------------------------------------------------------------
;This is the edit-able level:
;-------------------------------------------------------------------------------
Level:
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$00,$FF,$00

;-------------------------------------------------------------------------------
;Bitmapdata:
;-------------------------------------------------------------------------------
BackgroundTemp:
 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 .db 0,0,0

WhiteBall:
 .db $FF,$FF,$FF,$FF,$1,$FF,$FC,$0,$7F,$F8,$0,$3F,$F0,$0,$1F,$E0
 .db $0,$F,$C0,$0,$7,$C0,$0,$7,$80,$0,$3,$80,$0,$3,$80,$0
 .db $3,$80,$0,$3,$80,$0,$3,$80,$0,$3,$80,$0,$3,$C0,$0,$7
 .db $C0,$0,$7,$E0,$0,$F,$F0,$0,$1F,$F8,$0,$3F,$FC,$0,$7F,$FF
 .db $1,$FF,$FF,$FF,$FF,$FF,$FF,$FF

BlackBall1:
 .db $0,$FE,$0,$3,$1,$80,$4,$0,$40,$8,$0,$20,$10,$0,$10,$20
 .db $0,$8,$40,$0,$4,$40,$0,$4,$80,$0,$2,$80,$0,$2,$80,$0
 .db $2,$80,$0,$2,$80,$0,$2,$80,$0,$2,$A0,$0,$A,$50,$0,$14
 .db $6A,$0,$AC,$35,$55,$58,$1A,$AA,$B0,$D,$55,$60,$6,$AA,$C0,$3
 .db $55,$80,$0,$FE,$0,$0,$0,$0

BlackBall2:
 .db $0,$FE,$0,$3,$1,$80,$4,$0,$40,$8,$0,$20,$10,$0,$10,$20
 .db $0,$8,$40,$AA,$4,$45,$55,$44,$AA,$AA,$AA,$D5,$55,$56,$AA,$AA
 .db $AA,$D5,$55,$56,$AA,$AA,$AA,$D5,$55,$56,$AA,$AA,$AA,$45,$55,$44
 .db $40,$AA,$4,$20,$0,$8,$10,$0,$10,$8,$0,$20,$4,$0,$40,$3
 .db $1,$80,$0,$FE,$0,$0,$0,$0

BlackBall3:
 .db $0,$FE,$0,$3,$55,$80,$6,$AA,$C0,$D,$55,$60,$1A,$AA,$B0,$35
 .db $55,$58,$6A,$0,$AC,$50,$0,$14,$A0,$0,$A,$80,$0,$2,$80,$0
 .db $2,$80,$0,$2,$80,$0,$2,$80,$0,$2,$80,$0,$2,$40,$0,$4
 .db $40,$0,$4,$20,$0,$8,$10,$0,$10,$8,$0,$20,$4,$0,$40,$3
 .db $1,$80,$0,$FE,$0,$0,$0,$0

;-------------------------------------------------------------------------------
;This contains savegame
;-------------------------------------------------------------------------------
LevelSaved: .db 0  ;standard: no level saved
SavedLevel: .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

;--- ZCP encoder - Stephane JANTZEN - 12/95
;--- Beginning of ZCP data stream

TitlePicture:
      .db    $00
      .db    $3F,$3F,$0B,$F8,$8E,$30,$F0,$39,$48,$87,$12,$F0,$18,$F0,$38,$4A
      .db    $8E,$11,$F0,$18,$F0,$38,$F9,$F1,$E0,$0D,$F0,$18,$F0,$37,$F8,$BC
      .db    $F0,$2D,$F0,$37,$F0,$9C,$F0,$2D,$F0,$37,$F0,$9C,$F0,$9F,$C0,$F0
      .db    $BE,$11,$F3,$C1,$E0,$F0,$B8,$81,$FC,$0D,$F0,$BC,$F0,$4A,$87,$8F
      .db    $FC,$0E,$F3,$C1,$E3,$FD,$FE,$87,$FF,$0D,$F0,$F8,$F1,$4B,$8E,$9F
      .db    $F8,$0D,$F3,$C1,$E3,$4D,$87,$49,$0C,$F3,$F8,$F1,$F0,$F8,$F3,$E3
      .db    $E0,$0A,$F3,$C1,$E7,$CF,$CF,$8F,$87,$C0,$81,$E7,$E1,$E7,$C0,$F9
      .db    $E7,$83,$C0,$09,$F3,$C1,$E7,$87,$87,$9E,$83,$E0,$81,$E7,$81,$E7
      .db    $08,$F3,$CE,$87,$0F,$F3,$C1,$E7,$87,$87,$9C,$81,$E0,$81,$E0,$81
      .db    $E7,$08,$F3,$CE,$87,$0F,$F3,$C1,$E7,$87,$87,$9C,$81,$E0,$81,$E0
      .db    $81,$E7,$08,$F3,$CE,$87,$0F,$F3,$C1,$E7,$87,$87,$9C,$81,$E0,$81
      .db    $E0,$81,$E7,$08,$F3,$CE,$87,$0F,$F3,$C1,$E7,$87,$87,$9C,$81,$E0
      .db    $81,$E0,$81,$E7,$08,$F3,$CE,$87,$0F,$F3,$C1,$E7,$87,$87,$9C,$81
      .db    $E0,$81,$E0,$81,$E7,$C0,$B9,$E7,$83,$C0,$08,$F9,$E0,$F3,$C3,$C3
      .db    $CE,$81,$F0,$80,$F0,$80,$F1,$F0,$9C,$F3,$C1,$E0,$08,$F8,$F8,$F9
      .db    $E1,$E1,$E7,$91,$F0,$08,$F0,$80,$F1,$FF,$9C,$F3,$C1,$E0,$83,$FC
      .db    $9F,$F8,$F0,$F0,$F3,$CF,$F8,$09,$F0,$80,$F0,$FF,$9C,$F3,$C1,$E0
      .db    $83,$F8,$9F,$F8,$F0,$F0,$F3,$CF,$F0,$09,$F0,$80,$F0,$9F,$9C,$F3
      .db    $C1,$E0,$83,$E0,$87,$E0,$F0,$F0,$F3,$C7,$C0,$3F,$31,$F0,$16,$EE
      .db    $E2,$F7,$A0,$B2,$C7,$BB,$9D,$EE,$F1,$EE,$F0,$0F,$F0,$16,$C8,$A2
      .db    $D5,$A0,$AA,$C5,$AA,$D5,$8A,$C1,$88,$C0,$0F,$F0,$16,$C8,$A2,$F7
      .db    $A0,$BB,$C7,$AA,$D9,$CE,$F1,$CE,$F0,$0F,$F0,$16,$C8,$A2,$91,$B8
      .db    $A9,$85,$AA,$D5,$8A,$91,$82,$90,$0F,$F0,$16,$C8,$A2,$91,$A8,$A9
      .db    $85,$AA,$D5,$8A,$91,$82,$90,$0F,$F0,$16,$EE,$E2,$91,$B8,$B9,$85
      .db    $AB,$D5,$EA,$F1,$EE,$F0,$0F,$F0,$3F,$3F,$3F,$3F,$1D,$FF,$2B,$F0
      .db    $3F,$83,$FB,$F8,$23,$E3,$3F,$83,$FE,$48,$22,$F0,$98,$3E,$F7,$AB
      .db    $DC,$1D,$E3,$99,$C0,$38,$F7,$D5,$F7,$1C,$E0,$98,$88,$39,$D2,$DB
      .db    $A9,$A0,$14,$EC,$8D,$83,$E0,$33,$DB,$A8,$D6,$E8,$13,$E0,$EC,$99
      .db    $86,$34,$C9,$BF,$FD,$92,$12,$E0,$8C,$81,$C0,$B0,$2F,$DF,$F4,$AF
      .db    $FA,$10,$E4,$8C,$E0,$CC,$8B,$30,$CE,$D2,$92,$DC,$C0,$08,$E0,$E4
      .db    $84,$E0,$E4,$98,$2B,$D9,$50,$9A,$0B,$E0,$86,$80,$E0,$86,$81,$E0
      .db    $26,$48,$A4,$A5,$FF,$0A,$E8,$86,$C0,$B4,$82,$E0,$9C,$27,$FC,$C9
      .db    $89,$93,$F0,$8C,$90,$E1,$C2,$8C,$90,$E1,$8C,$25,$FB,$53,$BC,$8C
      .db    $82,$A0,$8B,$80,$C8,$86,$C0,$E0,$20,$FE,$C9,$89,$97,$F1,$C0,$86
      .db    $09,$C0,$86,$09,$E0,$88,$21,$C8,$C9,$89,$91,$96,$A0,$9A,$80,$E8
      .db    $82,$A0,$89,$08,$F0,$1D,$FE,$C9,$89,$97,$F8,$A0,$E1,$C3,$86,$84
      .db    $98,$90,$E0,$C6,$1E,$FB,$53,$BC,$84,$E0,$89,$08,$CC,$83,$90,$8C
      .db    $C0,$E0,$18,$FC,$C9,$89,$93,$F0,$8C,$09,$E0,$83,$0B,$E0,$83,$C0
      .db    $98,$19,$48,$A4,$A5,$FF,$80,$F0,$81,$A0,$83,$C0,$87,$0A,$F0,$83
      .db    $1A,$D9,$50,$9A,$86,$A0,$8C,$A0,$88,$C0,$91,$08,$C6,$81,$B0,$14
      .db    $CE,$D2,$92,$DC,$C6,$84,$84,$84,$8C,$88,$88,$98,$90,$90,$91,$C0
      .db    $11,$DF,$F4,$AF,$FA,$90,$84,$B0,$84,$A0,$8C,$A0,$88,$A0,$98,$C0
      .db    $E0,$10,$C9,$BF,$FD,$92,$E0,$82,$C0,$82,$C0,$82,$C0,$86,$C0,$86
      .db    $C0,$98,$11,$DB,$A8,$D6,$EE,$0B,$E0,$08,$C0,$80,$C0,$80,$C0,$80
      .db    $E0,$83,$13,$D2,$DB,$A9,$B4,$09,$D0,$80,$E8,$08,$D0,$80,$D8,$08
      .db    $D8,$80,$E0,$0D,$F7,$D5,$F7,$88,$81,$C4,$80,$C2,$08,$C6,$08,$C6
      .db    $80,$C2,$08,$D8,$0E,$F7,$AB,$DC,$88,$84,$84,$82,$82,$81,$81,$80
      .db    $C0,$C0,$A0,$E0,$91,$C0,$09,$49,$BF,$E0,$A0,$E0,$88,$90,$84,$88
      .db    $82,$84,$81,$C2,$80,$E0,$C1,$C0,$83,$8F,$EF,$E0,$84,$A0,$82,$98
      .db    $80,$C4,$08,$E4,$09,$C4,$08,$E4,$81,$C0,$B0,$87,$F8,$09,$D8,$09
      .db    $D0,$09,$D0,$09,$D0,$08,$F0,$09,$F0,$81,$C6,$0D,$C0,$09,$C0,$09
      .db    $C0,$09,$C0,$09,$C0,$09,$C0,$09,$C0,$81,$C0,$00

.end
