; ~AssemblyBandit~ http://briandm82.com ;Tunnel v1.0 ;created using Assembly Studio 8x v4.0 ;Program size: 15,342 bytes ;This code is public and can be used by anyone ;Not fully commented, rushed to make deadline ;Email any bugs, questions, comments, suggestions to briandm82@briandm82.com ;Macro definitions #define bcall(xxxx) rst 28h \ .dw xxxx #define bjump(xxxx) call 50h \ .dw xxxx ;Ports KeypadPort equ $01 IntPort equ $03 ;Ack/Enable int: bit 0=On, bit 1=HW1, bit 2=HW2, bit 3=low power, bit 4=link IntStatusPort equ $04 ;use to determine int device/ map memory/ set timer speeds/ check if on pressed LCDInstPort equ $10 ;set register LCDDataPort equ $11 ;set value ;/--LCD Registers and Bits------------------\ LCDEntry equ $03 ;max colors,color format,origin,GRAM update LCDLORG equ 7 ;0=absolute (def) 1=window LCDLAM equ 3 ;0=Vertical 1=Horizontal (def) LCDControl equ $07 ;partial image enable, base image enable, 8 color mode LCDLCL equ 3 ;0=full color (def) 1=8 color mode LCDCursorY equ $20 ;cursor Y LCDGRAM equ $22 ;read/write data to the graphics ram LCDWinYStart equ $50 ;window y top LCDWinXStart equ $52 ;window x left LCDBaseCtrl equ $61 ;horizontal scrolling, color reverse LCDLVLE equ 1 ;0=disable horizontal scrolling (def) 1=enable horizontal scrolling LCDScrollCtrl equ $6a ;0-8 horizontal scroll offset (0-319) ;\--LCD Registers and Bits------------------/ SpeedPort equ $20 ;write 0=6 Mhz, write 1=15 Mhz Timer1Port equ $30 ;set clock and divisor Timer2Port equ $33 ;set clock and divisor Timer3Port equ $36 ;set clock and divisor ;ROM Routines _Arc_Unarc equ $4fbd _Mov9ToOP1 equ $4177 _ChkFindSym equ $42e8 _DelVarArc equ $4fab _CreateAppVar equ $4e4f _JForceCmdNoChar equ $4027 ;RAM Addresses tempSwapArea equ $8b8c ;Addresses #include "RAM.inc" ; Keys KDown equ $00 KLeft equ $01 KRight equ $02 KUp equ $03 KF5 equ $04 KF4 equ $05 KF2 equ $06 KF1 equ $07 .org $4000 ;Header (128 bytes) .db 080h, 00Fh .db 000h, 000h, 000h, 000h .db 080h, 012h .db 001h, 00Fh .db 080h, 021h .db 001h .db 080h, 031h .db 0A1h .db 080h, 048h .db "Tunnel", 000h, 000h .db 080h, 081h .db 001h .db 080h, 090h .db 003h, 026h, 009h, 004h .db 01Eh, 0FFh, 02Bh, 057h .db 002h, 00Dh, 040h, 0A1h, 06Bh, 099h, 0F6h, 059h, 0BCh, 067h .db 0F5h, 085h, 09Ch, 009h, 06Ch, 00Fh, 0B4h, 003h, 09Bh, 0C9h .db 003h, 032h, 02Ch, 0E0h, 003h;, 020h, 0E3h, 02Ch IntJump: ;4040 ;fit the jump right in here jp Interrupt .db 0F4h, 02Dh .db 073h, 0B4h, 027h, 0C4h, 0A0h, 072h, 054h, 0B9h, 0EAh, 07Ch .db 03Bh, 0AAh, 016h, 0F6h, 077h, 083h, 07Ah, 0EEh, 01Ah, 0D4h .db 042h, 04Ch, 06Bh, 08Bh, 013h, 01Fh, 0BBh, 093h, 08Bh, 0FCh .db 019h, 01Ch, 03Ch, 0ECh, 04Dh, 0E5h, 075h .db 080h, 07Fh .db 000h, 000h, 000h, 000h .db 000h, 000h, 000h, 000h .db 000h, 000h, 000h, 000h .db 000h, 000h, 000h, 000h .db 000h, 000h, 000h, 000h AppStart: ;$4080 jp AppContinue ;*Interrupt* Interrupt: ;$4083 ;125 bytes max or run over int table! ex af,af' exx call UpdateTimers ld hl,(KeyTimer) ld a,l and $07 jp nz,EndInt UpdateKeys: ;--- UpdateKeys --- ;Stores pressed keys to KeyFlag ;doesnt allow repeating keypresses ld a,$fe ; a=(||||,up,right,left,down) out (KeypadPort),a nop nop nop nop nop nop nop nop in a,(KeypadPort) and $0f ; a=(||||,up,right,left,down) ld b,a ld a,$ff out (KeypadPort),a nop nop nop nop nop nop nop nop ld a,$bf ; a=(|||,f1,f2,f3,f4,f5) out (KeypadPort),a nop nop nop nop nop nop nop nop in a,(KeypadPort) rra rr c rra rr c rra ; lose f3 rra rr c rra rr c ld a,c and $f0 or b ; a=(f1,f2,f4,f5,up,right,left,down) ld b,a ld a,$ff out (KeypadPort),a ld a,(OldKey) xor 255 and $f6 or b ;ignore key while held down ld c,a ld a,(KeyFlag) and c ;keep key clear if not acknowledged but add any new presses ld (KeyFlag),a ;reset bit = button pressed ld a,b ld (OldKey),a EndInt: ld a,$08 out (IntPort),a ;clear ld a,$0a out (IntPort),a ;acknowledge ld a,$0a out (IntPort),a ;enable ex af,af' exx ei reti .pad $4100 IntTable: ;257 bytes .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40, $40 .db $40 AppContinue: ;$4201 ;*Load High Scores* Load: ld hl,VarName ;find or create high score appvar bcall(_Mov9ToOP1) bcall(_ChkFindSym) jp nc,VarFound CreateVar: ld hl,VarName bcall(_Mov9ToOP1) ld hl,70 ;high score app var is 70 bytes long bcall(_CreateAppVar) ;expecting os to handle a memory error push de inc de inc de ld hl,InitHighScoreData ld bc,70 ldir pop de jp VarInRam VarFound: ld a,b or a jp z,VarInRam ld hl,VarName bcall(_Mov9ToOP1) bcall(_Arc_Unarc) ;expecting os to handle a memory error jp Load ;find again in ram VarInRam: inc de ;skip over size inc de ld (HighScoreTable),de ;store pointer to HighScoreTable ;*Initialize Calc* di ;Clear timers xor a out (Timer1Port),a ; turn off timers out (Timer2Port),a out (Timer3Port),a ;Set up fast int only enabling hw1 out ($04),a ;fast ints out ($5b),a ;disable usb ints (XXXXXXX doesnt disable upon disconnecting and pressing on) ld a,$41 ld i,a im 2 ld a,$08 out (IntPort),a ;clear in a,(IntStatusPort) and $07 or $08 out (IntPort),a ;acknowledge any pending ints ld a,$0a out (IntPort),a ;enable only HW1 Timer ints call ClearTemp ;clear tempswap except for HighScoreTable pointer ld a,1 out (SpeedPort),a ;set speed to 15Mhz call InitializeScroll call EnableScrolling call SetOrigin ;*Display Blog* Blog: xor a ld (CharColor),a call DrawBWScreen call DisplayBlog call Wait ;*Display Title Screen* Title: di call SetAM call InitializeScroll ld a,$ff ld (CharColor),a ;set white on black text call DrawBWScreen call DisplayTitle call WriteStart call WriteHighScores call Wait ;*Start Game* GameInit: call ResetAM call DrawBWScreen call SetUpGame ld hl,112 ld (ShipY),hl ld a,5 ld (LineRepeat),a ld a,4 ld (BlackLineStart),a ld a,200 ld (BlackLineLength),a ld a,36 ld (BlackLineDone),a ld hl,Rand ld a,r add a,l ld (RandIndex),hl ei MainKeyLoop: ; halt ld a,(KeyFlag) ; bit KRight,a ;purposely mess up the screen to get a screen capture ; jp nz,DebugSkip ; ld a,$ff ; ld (ShipY),a ; call DrawShipNC ; jp Exit ;DebugSkip: bit KUp,a call z,UpPress ;use calls to read simultaneous presses must save a! bit KDown,a call z,DownPress in a,(IntStatusPort) ;have on button exit immediately out of program bit 3,a jp z,Exit ld hl,(UpdateTimer) dec hl ld (UpdateTimer),hl ld a,h or l call z,Update jp MainKeyLoop GetRand: ld hl,(RandIndex) ld a,r or a rla ld e,a ld a,(hl) add a,e ld e,a ld a,(RandOld) add a,e ld (RandOld),a inc hl ld de,RandEnd or a sbc hl,de jp nz,RandGood ld hl,Rand RandGood: ld (RandIndex),hl ret Update: ;calc line, shift screen left, check collision, shift ship right, draw a new line ld a,(Score) ld hl,(Score+1) ld de,1 add hl,de adc a,0 ld (Score),a ld (Score+1),hl ld a,(Level) or a rra or a rra or a rra sub 10 jp z,Fastest jp c,Negate Fastest: ld hl,1 ld (UpdateTimer),hl jp SpeedDone Negate: neg ld h,a ld l,0 ld (UpdateTimer),hl SpeedDone: CalcLine: ;get line info before moving to screen ld a,(Level) sub 200 neg cp 200 jp c,MaxLengthGood ld a,200 MaxLengthGood: cp 8 jp nc,MinLengthGood ld a,8 MinLengthGood: ld (BlackLineLength),a ld a,(LineRepeat) dec a ld (LineRepeat),a jp nz,LineSame call GetRand and $0f jp nz,LRGood inc a LRGood: ld (LineRepeat),a ld a,(AtBottom) or a jp nz,GoDown ld a,(AtTop) or a jp nz,GoUp LineSame: ld a,(AtBottom) or a jp nz,GoUp ld a,(AtTop) or a jp nz,GoDown CheckDir: ld a,(Dir) or a jp z,GoDown jp GoUp GoDown: ld a,(BlackLineStart) add a,4 ld (BlackLineStart),a jp GoDone GoUp: ld a,(BlackLineStart) sub 4 ld (BlackLineStart),a GoDone: ld a,(BlackLineStart) cp 4 jp nc,HighGood xor a ld (AtBottom),a ld a,1 ld (AtTop),a ld a,4 ld (BlackLineStart),a HighGood: ld b,a ld a,(BlackLineLength) add a,b cp 236 jp c,Good xor a ld (AtTop),a ld a,1 ld (AtBottom),a jp GoUp Good: ld a,(BlackLineStart) ld b,a ld a,(BlackLineLength) add a,b jp c,GoUp ld b,a ld a,240 sub b ld (BlackLineDone),a ScrollLeft: ld hl,(Scroll) ld de,16 add hl,de push hl ld de,320 sbc hl,de jp nz,SL ld hl,0 ex (sp),hl SL: pop hl ld (Scroll),hl xor a out (LCDInstPort),a ld a,LCDScrollCtrl out (LCDInstPort),a ld a,h out (LCDDataPort),a ld a,l out (LCDDataPort),a call DrawShip DrawLine: ld hl,0 ld de,239 ld a,LCDWinYStart call DisplayWriteHLDE ;set y ld de,(Scroll) ld hl,319 ld a,e or d jp z,ZeroDL ex de,hl dec hl ZeroDL: push hl ld de,15 or a sbc hl,de pop de ld a,LCDWinXStart call DisplayWriteHLDE ;set x ld hl,0 ld de,0 ld a,LCDCursorY call DisplayWriteHLDE xor a out (LCDInstPort),a ld a,LCDGRAM out (LCDInstPort),a ld b,16 DLMultLoop: push bc ld a,(BlackLineStart) ld b,a ld a,60 sub b ld c,a DrawL1: ld a,c inc c out (LCDDataPort),a out (LCDDataPort),a djnz DrawL1 ld a,(BlackLineLength) ld b,a DrawL2: ld a,$00 out (LCDDataPort),a out (LCDDataPort),a djnz DrawL2 ld a,(BlackLineDone) ld b,a ld c,100 DrawL3: ld a,c dec c out (LCDDataPort),a out (LCDDataPort),a djnz DrawL3 pop bc djnz DLMultLoop ret ScrollRight: ld hl,(Scroll) ld de,16 or a sbc hl,de push hl jp nc,SR ld hl,320-16 ex (sp),hl SR: pop hl ld (Scroll),hl xor a out (LCDInstPort),a ld a,LCDScrollCtrl out (LCDInstPort),a ld a,h out (LCDDataPort),a ld a,l out (LCDDataPort),a ret DrawShip: ld hl,(ShipY) ld de,19 add hl,de ex de,hl ld hl,(ShipY) ld a,LCDWinYStart call DisplayWriteHLDE ;set y ld hl,(Scroll) ld de,15 add hl,de ex de,hl ld hl,(Scroll) ld a,LCDWinXStart call DisplayWriteHLDE ;set x ld hl,0 ld de,0 ld a,LCDCursorY call DisplayWriteHLDE xor a out (LCDInstPort),a ld a,LCDGRAM out (LCDInstPort),a ld hl,ShipImage DrawShipNS: ld a,(hl) cp $ff ;no white allowed in ship!!! ret z cp $20 jp nz, SC4 ld c,a in a,(LCDDataPort) in a,(LCDDataPort) ;dummy reads in a,(LCDDataPort) cp $20 jp z, SC44 or a jp nz,Collision SC44: ld a,c SC4: out (LCDDataPort),a out (LCDDataPort),a inc hl jp DrawShipNS DrawShipNC: ld hl,(ShipY) ld de,19 add hl,de ex de,hl ld hl,(ShipY) ld a,LCDWinYStart call DisplayWriteHLDE ;set y ld hl,(Scroll) ld de,15 add hl,de ex de,hl ld hl,(Scroll) ld a,LCDWinXStart call DisplayWriteHLDE ;set x ld hl,0 ld de,0 ld a,LCDCursorY call DisplayWriteHLDE xor a out (LCDInstPort),a ld a,LCDGRAM out (LCDInstPort),a ld hl,ShipImage DrawShipNCNS: ld a,(hl) cp $ff ;no white allowed in ship!!! ret z out (LCDDataPort),a out (LCDDataPort),a inc hl jp DrawShipNCNS UpPress: ;move ship up and check for collision set KUp,a ld (KeyFlag),a ;acknowledge key press push af ;save button presses ld a,(ShipY) dec a jp z,SkipUp dec a jp z,SkipUp dec a jp z,SkipUp ld (ShipY),a call DrawShipNC SkipUp: pop af ret DownPress: ;move ship down and check for collision set KDown,a ld (KeyFlag),a ;acknowledge key press push af ;save button presses ld a,(ShipY) inc a cp 224 jp z,SkipDown inc a cp 224 jp z,SkipDown inc a cp 224 jp z,SkipDown ld (ShipY),a call DrawShipNC SkipDown: pop af ret Collision: di call DrawLine ld hl,(ShipY) ld de,15 add hl,de ex de,hl ld hl,(ShipY) ld a,LCDWinYStart call DisplayWriteHLDE ;set y ld hl,(Scroll) ld de,15 add hl,de ex de,hl ld hl,(Scroll) ld a,LCDWinXStart call DisplayWriteHLDE ;set x ld hl,0 ld de,0 ld a,LCDCursorY call DisplayWriteHLDE xor a out (LCDInstPort),a ld a,LCDGRAM out (LCDInstPort),a ld hl,Explosion DrawExNS: ld a,(hl) cp $ff ;no white allowed in explosion!!! jp z,CollisionDone or a jp nz, ESC4 in a,(LCDDataPort) in a,(LCDDataPort) ;dummy reads in a,(LCDDataPort) ESC4: out (LCDDataPort),a out (LCDDataPort),a inc hl jp DrawExNS CollisionDone: jp GameOver ;--- Exit --- ;Exits program with everything intact Exit: ;jp to exit, make sure nothing is left on stack! di call SetAM xor a ld (CharColor),a call DrawBWScreen call DisableScrolling call SetFullWindow call SetCursor ld hl,VarName bcall(_Mov9ToOP1) bcall(_Arc_Unarc) ;archive high scores ld a,0 out (SpeedPort),a im 1 ld a,$06 ;set slow ints out ($04),a ld a,$08 out (IntPort),a ;clear in a,(IntStatusPort) and $04 or $08 out (IntPort),a ;acknowledge pending int if necessary ld a,$0b bit 0,(iy+$16) ;is this necessary??? jp z,OnlyHW1 add a,$04 OnlyHW1: out (IntPort),a ;enable hw1, on, maybe hw2 ld a,1 out ($5B),a ;turn usb ints back on ei bjump(_JForceCmdNoChar) DrawBWScreen: ;draws black or white depending on char color call SetFullWindow call SetCursor ;draw screen xor a out ($10),a ld a,$22 out ($10),a ld de,19200 DBSLoop1: ld a,(CharColor) xor $ff out ($11),a out ($11),a out ($11),a out ($11),a out ($11),a out ($11),a out ($11),a out ($11),a dec de ld a,d or e jp nz,DBSLoop1 ret SetCursor: ld hl,0 ld de,0 ld a,$20 jp DisplayWriteHLDE SetFullWindow: ld hl,0 ld de,239 ld a,$50 call DisplayWriteHLDE ;set y ld hl,0 ld de,319 ld a,$52 jp DisplayWriteHLDE ;set x ClearTemp: ;clear tempSwapArea ld hl,tempSwapArea+2 ;skip over HighScoreTable xor a ld (hl),a ld de,tempSwapArea+3 ld bc,RamEnd-RamStart-1 ldir ret SetUpGame: call ClearTemp ld a,$ff ld (KeyFlag),a ;initialize KeyFlag ld (CharColor),a ;set white on black text ld hl,150 ;150 to start ld (UpdateTimer),hl ret UpdateTimers: ld de,$0100 ;change this value to change line length rate ld hl,(LevelUpTimer) inc hl ld (LevelUpTimer),hl sbc hl,de jp nz,SkipLevelUp LevelInc: ld hl,0 ld (LevelUpTimer),hl ld a,(Level) inc a ld (Level),a SkipLevelUp: ld hl,(KeyTimer) inc hl ld (KeyTimer),hl ret ;--- DisplayWriteHLDE --- ;Writes hl to a, de to consecutive address ;inputs: ;a=start address ;hl,de DisplayWriteHLDE: ld c,$10 ld b,$00 out (c),b out (c),a inc c out (c),h out (c),l dec c inc a out (c),b out (c),a inc c out (c),d out (c),e ret ;--- DisplayWriteHL --- ;Writes hl to a ;inputs: ;a=address ;hl DisplayWriteHL: ld c,$11 ld b,a xor a out ($10),a ld a,b out ($10),a out (c),h out (c),l ret ;--- DisplayReadHL --- ;read hl at a ;inputs: ;a=address ;hl DisplayReadHL: ld c,$11 ld b,a xor a out ($10),a ld a,b out ($10),a in h,(c) in l,(c) ret InitializeScroll: ld a,LCDScrollCtrl call DisplayReadHL ld a,h ;init scroll value to 0 and $fe ld h,a xor a ld l,a ld a,LCDScrollCtrl jp DisplayWriteHL SetOrigin: ld a,LCDEntry call DisplayReadHL set LCDLORG,l ;set origin jp DisplayWriteHL ResetOrigin: ld a,LCDEntry call DisplayReadHL res LCDLORG,l ;reset origin jp DisplayWriteHL DisableScrolling: ld a,LCDBaseCtrl call DisplayReadHL res LCDLVLE,l ;disable horizontal scrolling jp DisplayWriteHL EnableScrolling: ld a,LCDBaseCtrl call DisplayReadHL set LCDLVLE,l ;enable horizontal scrolling jp DisplayWriteHL SetAM: ld a,LCDEntry call DisplayReadHL set LCDLAM,l jp DisplayWriteHL ResetAM: ld a,LCDEntry call DisplayReadHL res LCDLAM,l jp DisplayWriteHL ;*Enter High Score* HighScore: ;a = position ;save 10 char name, 3 byte score, and 1 byte level to appropriate position (0-4) push af call DrawBWScreen call DisplayTitle call WriteEnterName ld hl,112 ld (TextCol),hl ld hl,136 ld (TextRow),hl ld hl,StringRam+9 ld a,':' ld (hl),a dec hl pop af push af inc a add a,$30 ld (hl),a call DisplayString ;display 1: ld hl,128 ld (TextCol),hl ld hl,138 ld (TextRow),hl ld hl,StringRam+9 ld a,'_' ld b,10 USLoop: ld (hl),a dec hl djnz USLoop inc hl call DisplayString ;display 10 '_' call ResetCursor pop ix ;save position in ix for now HighScoreKeyLoop: ;check for character,left,right,del,enter ld bc,$1000 call Pause ;slow it down some in a,(IntStatusPort) ;have on button exit immediately out of program bit 3,a jp z,Exit Row1: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$bf ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(del,|||||||) ld b,'0' bit 7,a jp z,HandleChar Row2: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$df ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(|,A,D,I,N,S,X,|) ld b,'A' bit 6,a jp z,HandleChar ld b,'D' bit 5,a jp z,HandleChar ld b,'I' bit 4,a jp z,HandleChar ld b,'N' bit 3,a jp z,HandleChar ld b,'S' bit 2,a jp z,HandleChar ld b,'X' bit 1,a jp z,HandleChar Row3: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$ef ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(|,B,E,J,O,T,Y, ) ld b,'B' bit 6,a jp z,HandleChar ld b,'E' bit 5,a jp z,HandleChar ld b,'J' bit 4,a jp z,HandleChar ld b,'O' bit 3,a jp z,HandleChar ld b,'T' bit 2,a jp z,HandleChar ld b,'Y' bit 1,a jp z,HandleChar ld b,' ' bit 0,a jp z,HandleChar Row4: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$f7 ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(|,C,F,K,P,U,Z,|) ld b,'C' bit 6,a jp z,HandleChar ld b,'F' bit 5,a jp z,HandleChar ld b,'K' bit 4,a jp z,HandleChar ld b,'P' bit 3,a jp z,HandleChar ld b,'U' bit 2,a jp z,HandleChar ld b,'Z' bit 1,a jp z,HandleChar Row5: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$fb ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(||,G,L,Q,V,||) ld b,'G' bit 5,a jp z,HandleChar ld b,'L' bit 4,a jp z,HandleChar ld b,'Q' bit 3,a jp z,HandleChar ld b,'V' bit 2,a jp z,HandleChar Row6: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$fd ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(|,clear,H,M,R,W,|,Enter) ld b,'1' bit 6,a jp z,HandleChar ld b,'H' bit 5,a jp z,HandleChar ld b,'M' bit 4,a jp z,HandleChar ld b,'R' bit 3,a jp z,HandleChar ld b,'W' bit 2,a jp z,HandleChar ld b,'2' bit 0,a jp z,HandleChar Row7: ld a,$ff out (KeypadPort),a push ix pop ix ld a,$fe ld c,a ;save to wait for release out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;a=(|||||,right,left,|) ld b,'3' bit 2,a jp z,HandleChar ld b,'4' bit 1,a jp z,HandleChar jp HighScoreKeyLoop HandleChar: ;handle char or function in b ;wait for key release ld a,$ff out (KeypadPort),a push ix pop ix ld a,c out (KeypadPort),a push ix pop ix in a,(KeypadPort) inc a jp nz,HandleChar ld a,b cp '2' jp z,HighScoreContinue cp '0' jp z,DeleteChar cp '1' jp z,ClearChar cp '3' jp z,RightChar cp '4' jp z,LeftChar ;set value at cursor to char and inc cursor ld hl,StringRam ld d,0 ld a,(CharCursor) ld e,a add hl,de ld a,b ld (hl),a ;set StringRam to value jp RightChar ;display char,inc cursor, display cursor DeleteChar: ;set the cursor position value to ' ' w/o moving cursor ld hl,StringRam ld d,0 ld a,(CharCursor) ld e,a add hl,de ld a,' ' ld (hl),a jp HighScoreKeyLoop ClearChar: ;set all chars to ' ' and move cursor to start call ResetCursor jp HighScoreKeyLoop RightChar: ;move cursor to right call DisplayHiddenChar ld a,(CharCursor) inc a cp 10 jp c,CharRGood xor a CharRGood: ld (CharCursor),a call DisplayCursor jp HighScoreKeyLoop LeftChar: ;move cursor to left call DisplayHiddenChar ld a,(CharCursor) dec a jp p,CharLGood ld a,9 CharLGood: ld (CharCursor),a call DisplayCursor jp HighScoreKeyLoop HighScoreContinue: push ix pop af or a ld c,a ld e,a ld d,0 rla rla rla add a,e add a,e add a,e add a,e add a,e add a,e ;mult by 14 ld e,a ld hl,(HighScoreTable) add hl,de ;hl now points to spot in table to overwrite push hl ;move current entries down to fit in new score ld a,c ;a = 0-4 location sub 4 neg ld b,a ;b = move count jp z,SkipMove ld hl,(HighScoreTable) ld de,69 add hl,de push hl ld hl,(HighScoreTable) ld de,55 add hl,de pop de ld c,a ld b,0 rla rla rla add a,c add a,c add a,c add a,c add a,c add a,c ld c,a ;bc=14*count lddr SkipMove: ld hl,StringRam pop de ld bc,10 ldir ld a,(Score) ld (de),a inc de ld a,(Score+1) ld (de),a inc de ld a,(Score+2) ld (de),a inc de ld a,(Level) ld (de),a jp Title ResetCursor: xor a ld (CharCursor),a ld hl,StringRam ld b,10 ld a,' ' HSInitLoop: ld (hl),a inc hl djnz HSInitLoop ;initialize name with all spaces ld hl,128 ld (TextCol),hl ld hl,136 ld (TextRow),hl ld hl,StringRam call DisplayString ld hl,128 ld (TextCol),hl ld hl,136 ld (TextRow),hl ld a,$7f jp DisplayChar ;display cursor DisplayHiddenChar: ld a,(CharCursor) ld hl,StringRam ld d,0 ld a,(CharCursor) ld e,a add hl,de ld a,(CharCursor) rla rla rla add a,128 ;set text col ld (TextCol),a ld a,(hl) ;get character at cursor jp DisplayChar ;display char cursor was hiding DisplayCursor: ld a,(CharCursor) or a rla rla rla add a,128 ;set text col for cursor ld (TextCol),a ld a,$7f ;character= cursor jp DisplayChar ;*Display Game Over* GameOver: di ld bc,0 call Pause call Pause call Pause call SetAM ld a,$ff ld (CharColor),a ;set white on black text call DrawBWScreen call InitializeScroll call WriteGameOver ;check for high score ld hl,(HighScoreTable) ld de,10 add hl,de ld de,14 ld b,5 CheckScoreLoop: ;loop through high scores ld a,(hl) ld c,a ld a,(Score) cp c jp nc,CheckScore add hl,de djnz CheckScoreLoop jp NoHighScore CheckScore: jp nz,NewHighScore push hl inc hl ld e,(hl) inc hl ld d,(hl) ;de= current high score ld hl,(Score+1) or a sbc hl,de ;cp hl de pop hl jp nc,NewHighScore ld de,14 add hl,de dec b jp z,NoHighScore jp CheckScoreLoop NewHighScore: ld a,b sub 5 neg ld c,a ;save high score position push bc call WriteNewHighScore pop bc call Wait ;shouldn't have anything pushed when calling wait ld a,c jp HighScore NoHighScore: call Wait jp Title WriteHighScores: ;pure laziness ld hl,112 ld (TextCol),hl ld hl,158 ld (TextRow),hl ld hl,HighScoreStr call DisplayString ld ix,(HighScoreTable) ;1 ld hl,80 ld (TextCol),hl ld hl,172 ld (TextRow),hl call WriteColon ld a,'1' ld (hl),a call DisplayString ld hl,(HighScoreTable) call DisplayName call WriteSpace ld a,(ix+10) ld l,(ix+11) ld h,(ix+12) call DisplayDecAHL ;2 ld hl,80 ld (TextCol),hl ld hl,184 ld (TextRow),hl call WriteColon ld a,'2' ld (hl),a call DisplayString ld hl,(HighScoreTable) ld de,14 add hl,de call DisplayName call WriteSpace ld a,(ix+24) ld l,(ix+25) ld h,(ix+26) call DisplayDecAHL ;3 ld hl,80 ld (TextCol),hl ld hl,196 ld (TextRow),hl call WriteColon ld a,'3' ld (hl),a call DisplayString ld hl,(HighScoreTable) ld de,28 add hl,de call DisplayName call WriteSpace ld a,(ix+38) ld l,(ix+39) ld h,(ix+40) call DisplayDecAHL ;4 ld hl,80 ld (TextCol),hl ld hl,208 ld (TextRow),hl call WriteColon ld a,'4' ld (hl),a call DisplayString ld hl,(HighScoreTable) ld de,42 add hl,de call DisplayName call WriteSpace ld a,(ix+52) ld l,(ix+53) ld h,(ix+54) call DisplayDecAHL ;5 ld hl,80 ld (TextCol),hl ld hl,220 ld (TextRow),hl call WriteColon ld a,'5' ld (hl),a call DisplayString ld hl,(HighScoreTable) ld de,56 add hl,de call DisplayName call WriteSpace ld a,(ix+66) ld l,(ix+67) ld h,(ix+68) jp DisplayDecAHL WriteColon: ld hl,StringRam+9 ld a,':' ld (hl),a dec hl ret WriteSpace: ld a,' ' call DisplayChar ld de,8 ld hl,(TextCol) add hl,de ld (TextCol),hl ret WriteEnterName: ld hl,96 ld (TextCol),hl ld hl,123 ld (TextRow),hl ld hl,EnterStr jp DisplayString WriteNewHighScore: ld hl,100 ld (TextCol),hl ld hl,128 ld (TextRow),hl ld hl,NewHSStr jp DisplayString WriteGameOver: ld hl,124 ld (TextCol),hl ld hl,114 ld (TextRow),hl ld hl,GameOverStr jp DisplayString WriteStart: ld hl,68 ld (TextCol),hl ld hl,113 ld (TextRow),hl ld hl,StartStr jp DisplayString WriteScore: ;draw 3 byte 7 (9,999,999 max) digit score in decimal ld hl,66 ld (TextCol),hl ld hl,1 ld (TextRow),hl ld a,(Score) ld hl,(Score+1) DisplayDecAHL: ld de,StringRam+9 ld b,7 LoopDDAHL: push bc push de call DivAHLby10 ld c,a ld a,e add a,$30 pop de ld (de),a dec de ld a,c pop bc djnz LoopDDAHL inc de ex de,hl jp DisplayString WriteLevel: ld hl,275 ld (TextCol),hl ld hl,1 ld (TextRow),hl ld a,(Level) DisplayDecA: call DivAby10 ld hl,StringRam+9 add a,$30 ld (hl),a dec hl ld a,c add a,$30 ld (hl),a jp DisplayString ;Waits for any key press then returns (except on) Wait: ld a,$00 ld (WaitKey),a Waiting: in a,(IntStatusPort) ;have on button exit immediately out of program bit 3,a jp z,WaitExit ld a,$00 ;check all out (KeypadPort),a push ix pop ix in a,(KeypadPort) ;get keys ld b,a ld a,$ff out (KeypadPort),a ;clear key port ld a,(WaitKey) xor $ff; ignore any key being held down upon routine entrance and its release or b cp $ff ld a,b ld (WaitKey),a jp z,Waiting ;loop if no new keys have been pressed ret WaitExit: pop hl ;get rid of return jp Exit Pause: push hl pop hl push hl pop hl push hl pop hl push hl pop hl dec bc ld a,b or c jp nz,Pause ret DisplayBlog: ;call to display blog info ;set window ld hl,95 ld de,95+49 ld a,$50 call DisplayWriteHLDE ;set y ld hl,28 ld de,28+263 ld a,$52 call DisplayWriteHLDE ;set x call SetCursor ld hl,BlogPalette ld (ImagePalette),hl ld hl,BlogData+1 ld ix,BlogData jp DrawImage DisplayTitle: ;call to display title ;set window ld hl,0 ld de,$0053 ld a,$50 call DisplayWriteHLDE ;set y ld hl,0 ld de,$013f ld a,$52 call DisplayWriteHLDE ;set x call SetCursor ld hl,TitlePalette ld (ImagePalette),hl ld hl,TitleData+1 ld ix,TitleData jp DrawImage ;call to draw 16 color rle image on screen ;window,cursor,gram,ImagePalette must be set ;hl points to data, ix points to signal DrawImage: xor a out ($10),a ld a,$22 out ($10),a ld a,(hl) inc hl cp (ix) ;if not signal, drawcolor jp z,Decompress ;if signal wait for other 2 bytes then loop draw push hl call DrawPixels pop hl jp DrawImage Decompress: ;gets next two bytes to loop draw ld a,(hl) or a ret z inc hl ld b,a ; save loop count ld a,(hl) ld c,a inc hl push hl ;save hl for main loop DCLoop: ld a,c push bc call DrawPixels ;draw color b times pop bc djnz DCLoop pop hl jp DrawImage ;--- DrawPixels --- ;Switches image depth and draws pixels DrawPixels: ;a=data byte ld c,a ld b,2 B4Loop: xor a rl c rla rl c rla rl c rla rl c rla ld hl,(ImagePalette) ld d,0 rla ld e,a add hl,de ;add color offset to palette ld a,(hl) out (LCDDataPort),a inc hl ld a,(hl) out (LCDDataPort),a ;draw color djnz B4Loop ret ;displays 10 character name DisplayName: ld b,10 DName: ld a,(hl) push bc push hl call DisplayChar ld hl,(TextCol) ld de,8 add hl,de ld (TextCol),hl pop hl pop bc inc hl djnz DName ret ;inputs-hl points to null terminated string ;set textrow,col DisplayString: ld a,(hl) or a ret z push hl call DisplayChar ld hl,(TextCol) ld de,8 add hl,de ld (TextCol),hl pop hl inc hl jp DisplayString ;a-char ;set textrow,col DisplayChar: push af ;set window ld hl,(TextRow) ld de,9 add hl,de ex de,hl ld hl,(TextRow) ld a,$50 call DisplayWriteHLDE ;set window y ld hl,(TextCol) ld de,7 add hl,de ex de,hl ld hl,(TextCol) ld a,$52 call DisplayWriteHLDE ;set window x call SetCursor ;get ready to draw xor a out ($10),a ld a,$22 out ($10),a pop af ;get font char offset sub $20 ;subtract offset (font data starts at $20) ld d,0 ld e,a ld h,0 ld l,a or a rl l rl h rl l rl h rl l rl h add hl,de add hl,de ;mult by 10 ld de,FontData add hl,de ;point to char data ld de,CharColor ld b,10 DCLoop1: ld a,(hl) ld c,b ld b,8 DCLoop2: rla push af jp c,DispTextColor ld a,(de) xor $ff ;will draw opposite of char color for background out ($11),a out ($11),a pop af djnz DCLoop2 jp EndDCLoop2 DispTextColor: ld a,(de) out ($11),a out ($11),a pop af djnz DCLoop2 EndDCLoop2: ld b,c inc hl djnz DCLoop1 ret ; Divides a by 10 / converts a to decimal (0-99) DivAby10: ;c=tens digit a=ones digit (a=$11 -> c=$01 a=$07) ld c,a ld b,8 sub a DA101: sla c rla cp $0a jr c,DA102 sub $0a inc c DA102: djnz DA101 ret ; Divides HL by 10 or a DivHLby10: ld a,$0a DivHLbyA: ld c,a sub a ld b,$10 DHLLoop1: add hl,hl rla cp c jr c,DHLLoop2 sub c inc l DHLLoop2: djnz DHLLoop1 ret ;mega divide ;ahl = value ;e = decimal value remainder ;used for getting decimal ahl up to 9,999,999 ;original verified by jacobly of omnimaga.org ;optimized by Xeda112358 of omnimaga.org DivAHLby10: ld d,a ld bc,$180a sub a DAHLLoop1: add hl,hl rl d rla cp c jr c,DAHLLoop2 sub c inc l DAHLLoop2: djnz DAHLLoop1 ld e,a ld a,d ret FontData: .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00; ' ' $20 .db $30, $78, $78, $78, $30, $30, $00, $30, $30, $00; '!' .db $CC, $CC, $CC, $00, $00, $00, $00, $00, $00, $00; '"' .db $6C, $6C, $FE, $6C, $6C, $6C, $FE, $6C, $6C, $00; '#' .db $7C, $D6, $D0, $70, $38, $1C, $16, $D6, $7C, $00; '$' .db $E0, $A4, $EC, $18, $30, $60, $DC, $94, $1C, $00; '%' .db $70, $D8, $D8, $70, $C0, $DE, $CC, $CC, $76, $00; '&' .db $30, $30, $30, $00, $00, $00, $00, $00, $00, $00; ''' .db $18, $30, $30, $60, $60, $60, $30, $30, $18, $00; '(' .db $60, $30, $30, $18, $18, $18, $30, $30, $60, $00; ')' .db $00, $00, $6C, $38, $FE, $38, $6C, $00, $00, $00; '*' .db $00, $00, $30, $30, $FC, $30, $30, $00, $00, $00; '+' .db $00, $00, $00, $00, $00, $00, $38, $38, $18, $30; ',' .db $00, $00, $00, $00, $FC, $00, $00, $00, $00, $00; '-' .db $00, $00, $00, $00, $00, $00, $00, $00, $38, $38; '.' .db $00, $0C, $18, $18, $30, $30, $60, $60, $C0, $00; '/' .db $78, $CC, $DC, $DC, $CC, $EC, $EC, $CC, $78, $00; '0' $30 .db $18, $38, $F8, $18, $18, $18, $18, $18, $18, $00; '1' .db $78, $CC, $CC, $0C, $18, $30, $60, $C0, $FC, $00; '2' .db $78, $CC, $CC, $0C, $38, $0C, $CC, $CC, $78, $00; '3' .db $60, $60, $6C, $6C, $6C, $CC, $FE, $0C, $0C, $00; '4' .db $FC, $C0, $C0, $C0, $F8, $0C, $0C, $18, $F0, $00; '5' .db $38, $30, $60, $F8, $CC, $CC, $CC, $CC, $78, $00; '6' .db $FC, $0C, $18, $18, $30, $30, $60, $60, $60, $00; '7' .db $78, $CC, $CC, $EC, $78, $DC, $CC, $CC, $78, $00; '8' .db $78, $CC, $CC, $CC, $CC, $7C, $18, $30, $70, $00; '9' .db $00, $38, $38, $00, $00, $00, $38, $38, $00, $00; ':' .db $00, $38, $38, $00, $00, $00, $38, $38, $18, $30; ';' .db $0C, $18, $30, $60, $C0, $60, $30, $18, $0C, $00; '<' .db $00, $00, $00, $FC, $00, $FC, $00, $00, $00, $00; '=' .db $C0, $60, $30, $18, $0C, $18, $30, $60, $C0, $00; '>' .db $78, $CC, $CC, $18, $30, $30, $00, $30, $30, $00; '?' .db $FC, $86, $86, $9E, $B6, $B6, $9E, $80, $FE, $00; '@' .db $30, $78, $CC, $CC, $CC, $FC, $CC, $CC, $CC, $00; 'A' $41 .db $F8, $CC, $CC, $CC, $F8, $CC, $CC, $CC, $F8, $00; 'B' .db $78, $CC, $CC, $C0, $C0, $C0, $CC, $CC, $78, $00; 'C' .db $F0, $D8, $CC, $CC, $CC, $CC, $CC, $D8, $F0, $00; 'D' .db $FC, $C0, $C0, $C0, $F8, $C0, $C0, $C0, $FC, $00; 'E' .db $FC, $C0, $C0, $C0, $F8, $C0, $C0, $C0, $C0, $00; 'F' .db $78, $CC, $CC, $C0, $C0, $DC, $CC, $CC, $7C, $00; 'G' .db $CC, $CC, $CC, $CC, $FC, $CC, $CC, $CC, $CC, $00; 'H' .db $78, $30, $30, $30, $30, $30, $30, $30, $78, $00; 'I' .db $0C, $0C, $0C, $0C, $0C, $0C, $CC, $CC, $78, $00; 'J' .db $CC, $CC, $D8, $D8, $F0, $D8, $D8, $CC, $CC, $00; 'K' .db $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $FC, $00; 'L' .db $C6, $C6, $EE, $D6, $D6, $D6, $C6, $C6, $C6, $00; 'M' .db $C6, $C6, $E6, $F6, $DE, $CE, $C6, $C6, $C6, $00; 'N' .db $78, $CC, $CC, $CC, $CC, $CC, $CC, $CC, $78, $00; 'O' .db $F8, $CC, $CC, $CC, $F8, $C0, $C0, $C0, $C0, $00; 'P' .db $78, $CC, $CC, $CC, $CC, $CC, $CC, $DC, $78, $1C; 'Q' .db $F8, $CC, $CC, $CC, $F8, $D8, $CC, $CC, $CC, $00; 'R' .db $78, $CC, $C0, $60, $30, $18, $0C, $CC, $78, $00; 'S' .db $FC, $30, $30, $30, $30, $30, $30, $30, $30, $00; 'T' .db $CC, $CC, $CC, $CC, $CC, $CC, $CC, $CC, $78, $00; 'U' .db $CC, $CC, $CC, $CC, $CC, $CC, $CC, $78, $30, $00; 'V' .db $C6, $C6, $C6, $D6, $D6, $D6, $6C, $6C, $6C, $00; 'W' .db $CC, $CC, $68, $30, $30, $58, $CC, $CC, $CC, $00; 'X' .db $CC, $CC, $CC, $CC, $78, $30, $30, $30, $30, $00; 'Y' .db $FC, $0C, $0C, $18, $30, $60, $C0, $C0, $FC, $00; 'Z' .db $78, $60, $60, $60, $60, $60, $60, $60, $78, $00; '[' .db $00, $C0, $60, $60, $30, $30, $18, $18, $0C, $00; '\' .db $78, $18, $18, $18, $18, $18, $18, $18, $78, $00; ']' .db $30, $78, $CC, $00, $00, $00, $00, $00, $00, $00; '^' .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $FE; '_' .db $70, $30, $18, $00, $00, $00, $00, $00, $00, $00; '`' .db $00, $00, $78, $0C, $0C, $7C, $CC, $CC, $7C, $00; 'a' $61 .db $C0, $C0, $F8, $CC, $CC, $CC, $CC, $CC, $F8, $00; 'b' .db $00, $00, $78, $CC, $C0, $C0, $C0, $CC, $78, $00; 'c' .db $0C, $0C, $7C, $CC, $CC, $CC, $CC, $CC, $7C, $00; 'd' .db $00, $00, $78, $CC, $CC, $FC, $C0, $C0, $78, $00; 'e' .db $3C, $60, $60, $60, $FC, $60, $60, $60, $60, $00; 'f' .db $00, $00, $7C, $CC, $CC, $CC, $CC, $7C, $0C, $78; 'g' .db $C0, $C0, $F8, $CC, $CC, $CC, $CC, $CC, $CC, $00; 'h' .db $30, $30, $00, $F0, $30, $30, $30, $30, $FC, $00; 'i' .db $18, $18, $00, $78, $18, $18, $18, $18, $18, $F0; 'j' .db $C0, $C0, $CC, $CC, $D8, $F0, $D8, $CC, $CC, $00; 'k' .db $F0, $30, $30, $30, $30, $30, $30, $30, $FC, $00; 'l' .db $00, $00, $FC, $D6, $D6, $D6, $D6, $D6, $C6, $00; 'm' .db $00, $00, $F8, $CC, $CC, $CC, $CC, $CC, $CC, $00; 'n' .db $00, $00, $78, $CC, $CC, $CC, $CC, $CC, $78, $00; 'o' .db $00, $00, $F8, $CC, $CC, $CC, $CC, $F8, $C0, $C0; 'p' .db $00, $00, $7C, $CC, $CC, $CC, $CC, $7C, $0C, $0C; 'q' .db $00, $00, $CC, $DC, $E0, $C0, $C0, $C0, $C0, $00; 'r' .db $00, $00, $7C, $C0, $C0, $78, $0C, $0C, $F8, $00; 's' .db $60, $60, $FC, $60, $60, $60, $60, $60, $3C, $00; 't' .db $00, $00, $CC, $CC, $CC, $CC, $CC, $CC, $7C, $00; 'u' .db $00, $00, $CC, $CC, $CC, $CC, $CC, $78, $30, $00; 'v' .db $00, $00, $C6, $D6, $D6, $D6, $D6, $6C, $6C, $00; 'w' .db $00, $00, $CC, $CC, $78, $30, $78, $CC, $CC, $00; 'x' .db $00, $00, $CC, $CC, $CC, $CC, $CC, $78, $18, $F0; 'y' .db $00, $00, $FC, $0C, $18, $30, $60, $C0, $FC, $00; 'z' .db $18, $30, $30, $60, $C0, $60, $30, $30, $18, $00; '{' .db $30, $30, $30, $30, $30, $30, $30, $30, $30, $00; '|' .db $60, $30, $30, $18, $0C, $18, $30, $30, $60, $00; '}' .db $E2, $B6, $1C, $00, $00, $00, $00, $00, $00, $00; '~' .db $FF, $E7, $C3, $99, $99, $81, $99, $99, $99, $FF; 'A' $7f (special-inverted a) .db $FE, $C6, $BA, $BA, $F6, $EE, $EE, $FE, $EE, $FE; '?' $80 (special-unknown char) ShipImage: .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $18, $00, $E6, $00, $00, $00, $10, $10, $00, $00, $00, $E6, $00, $18, $00, $00, $00 .db $00, $00, $00, $18, $E6, $E5, $E6, $18, $00, $10, $10, $00, $18, $E6, $E5, $E6, $18, $00, $00, $00 .db $00, $00, $00, $18, $E5, $E3, $E5, $18, $18, $10, $10, $18, $18, $E5, $E3, $E5, $18, $00, $00, $00 .db $00, $00, $00, $18, $E3, $E2, $E3, $18, $18, $10, $10, $18, $18, $E3, $E2, $E3, $18, $00, $00, $00 .db $00, $00, $00, $18, $E2, $E0, $E2, $18, $18, $10, $10, $18, $18, $E2, $E0, $E2, $18, $00, $00, $00 .db $00, $00, $00, $18, $10, $10, $10, $18, $18, $18, $18, $18, $18, $10, $10, $10, $18, $00, $00, $00 .db $00, $00, $00, $18, $18, $10, $10, $18, $18, $18, $18, $18, $18, $10, $10, $18, $18, $00, $00, $00 .db $00, $00, $00, $18, $18, $18, $18, $18, $10, $18, $18, $10, $18, $18, $18, $18, $18, $00, $00, $00 .db $00, $00, $00, $00, $18, $18, $18, $18, $10, $18, $18, $10, $18, $18, $18, $18, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $18, $18, $18, $10, $18, $18, $10, $18, $18, $18, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $18, $18, $10, $5C, $5C, $10, $18, $18, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $18, $10, $5C, $5C, $10, $18, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $18, $18, $5C, $5C, $18, $18, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $18, $18, $18, $18, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $20, $20, $20, $00, $00, $18, $18, $00, $00, $20, $20, $20, $00, $00, $00, $00 .db $ff Explosion: .db $00, $00, $00, $00, $00, $40, $81, $41, $00, $20, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $61, $C1, $A1, $81, $61, $80, $80, $60, $41, $41, $21, $00 .db $20, $61, $61, $82, $E3, $E1, $C0, $C0, $A1, $A1, $C0, $A0, $81, $81, $41, $21 .db $A1, $81, $C3, $E4, $E3, $E3, $E3, $E0, $E1, $E2, $E1, $C0, $A0, $61, $20, $00 .db $80, $81, $C3, $E4, $C3, $E5, $E4, $E2, $E4, $E4, $E5, $E3, $C1, $81, $20, $00 .db $20, $41, $82, $E4, $E4, $E6, $E5, $E5, $E6, $E4, $E6, $E6, $E2, $A1, $81, $62 .db $00, $20, $61, $E3, $E6, $E7, $E6, $E5, $E7, $E6, $E6, $E6, $E3, $80, $81, $62 .db $00, $60, $A1, $E2, $E6, $E7, $E5, $E4, $E4, $E6, $E6, $E3, $A1, $80, $40, $21 .db $00, $A0, $E2, $E3, $E5, $E5, $E5, $E6, $E6, $E6, $E6, $C2, $A0, $80, $00, $00 .db $00, $80, $E2, $E5, $E4, $E5, $E5, $E6, $E6, $E4, $E4, $C3, $C0, $A1, $20, $00 .db $00, $20, $C2, $E5, $E5, $E5, $E4, $E4, $C3, $C2, $E1, $E2, $C1, $E3, $61, $20 .db $00, $20, $82, $E4, $E5, $E3, $E1, $E1, $E3, $C4, $E3, $C1, $C2, $A2, $41, $00 .db $20, $61, $81, $C3, $E4, $E2, $A0, $C2, $C3, $C3, $A3, $A1, $82, $20, $20, $00 .db $60, $40, $61, $41, $80, $A1, $80, $60, $40, $40, $60, $A0, $61, $20, $00, $00 .db $00, $20, $40, $20, $40, $81, $61, $20, $00, $00, $40, $81, $81, $21, $00, $00 .db $00, $00, $00, $00, $20, $20, $20, $00, $00, $00, $21, $61, $41, $00, $00, $00 .db $ff Rand: .db 77 , 93 , 9 , 49 , 254 , 93 , 55 , 41 , 175 , 253 , 87 , 24 , 113 , 64 , 38 , 169 .db 231 , 173 , 133 , 171 , 219 , 30 , 45 , 245 , 212 , 138 , 213 , 112 , 80 , 122 , 208 , 42 .db 91 , 49 , 7 , 82 , 128 , 197 , 168 , 29 , 58 , 47 , 119 , 121 , 63 , 207 , 79 , 153 .db 79 , 113 , 123 , 182 , 219 , 134 , 250 , 125 , 52 , 59 , 117 , 127 , 82 , 9 , 238 , 97 .db 135 , 25 , 32 , 115 , 225 , 121 , 54 , 181 , 103 , 34 , 196 , 250 , 111 , 229 , 131 , 9 .db 104 , 105 , 49 , 41 , 119 , 101 , 18 , 28 , 108 , 36 , 236 , 148 , 162 , 41 , 142 , 16 .db 127 , 198 , 77 , 166 , 51 , 75 , 5 , 77 , 159 , 32 , 11 , 86 , 42 , 9 , 96 , 222 .db 220 , 236 , 84 , 249 , 85 , 194 , 74 , 54 , 156 , 195 , 78 , 130 , 63 , 8 , 87 , 198 .db 45 , 209 , 82 , 103 , 81 , 195 , 35 , 19 , 66 , 99 , 84 , 168 , 95 , 137 , 169 , 121 .db 163 , 123 , 75 , 163 , 148 , 142 , 19 , 16 , 235 , 115 , 79 , 64 , 22 , 120 , 54 , 146 .db 146 , 34 , 137 , 14 , 154 , 220 , 36 , 63 , 243 , 91 , 11 , 215 , 189 , 96 , 239 , 253 .db 88 , 181 , 93 , 68 , 156 , 204 , 47 , 63 , 78 , 221 , 201 , 106 , 2 , 178 , 137 , 217 .db 133 , 9 , 240 , 255 , 231 , 250 , 15 , 127 , 134 , 92 , 105 , 248 , 47 , 73 , 47 , 10 .db 248 , 119 , 183 , 100 , 137 , 52 , 132 , 171 , 202 , 43 , 12 , 49 , 84 , 92 , 217 , 196 .db 239 , 56 , 103 , 19 , 72 , 60 , 184 , 181 , 146 , 138 , 180 , 50 , 18 , 2 , 6 , 175 .db 223 , 145 , 137 , 148 , 73 , 82 , 179 , 184 , 21 , 159 , 55 , 157 , 252 , 108 , 165 , 112 .db 208 , 108 , 163 , 40 , 90 , 116 , 222 , 102 , 174 , 111 , 25 , 196 , 36 , 250 , 178 , 29 .db 114 , 20 , 220 , 22 , 245 , 70 , 128 , 239 , 158 , 133 , 27 , 136 , 125 , 142 , 88 , 129 .db 145 , 242 , 98 , 223 , 238 , 80 , 169 , 184 , 69 , 145 , 202 , 249 , 161 , 8 , 239 , 217 .db 11 , 192 , 29 , 17 , 63 , 169 , 113 , 229 , 171 , 82 , 87 , 204 , 244 , 56 , 25 , 185 .db 204 , 31 , 215 , 79 , 148 , 235 , 72 , 238 , 121 , 173 , 225 , 215 , 161 , 5 , 194 , 161 .db 243 , 27 , 57 , 24 , 230 , 141 , 187 , 182 , 246 , 5 , 75 , 10 , 164 , 17 , 39 , 4 .db 210 , 114 , 100 , 116 , 32 , 189 , 102 , 120 , 71 , 86 , 212 , 119 , 152 , 158 , 155 , 249 .db 80 , 91 , 238 , 95 , 71 , 181 , 189 , 63 , 181 , 189 , 113 , 239 , 240 , 13 , 71 , 35 .db 214 , 198 , 231 , 185 , 60 , 55 , 91 , 152 , 72 , 255 , 35 , 16 , 20 , 51 , 32 , 232 .db 30 , 99 , 82 , 228 , 36 , 76 , 15 , 28 , 201 , 103 , 102 , 139 , 4 , 110 , 112 , 124 .db 239 , 198 , 208 , 3 , 212 , 73 , 253 , 99 , 149 , 214 , 245 , 193 , 13 , 15 , 204 , 233 .db 43 , 236 , 36 , 230 , 131 , 58 , 244 , 39 , 169 , 192 , 236 , 120 , 131 , 235 , 251 , 175 .db 44 , 176 , 0 , 157 , 208 , 136 , 112 , 22 , 214 , 234 , 30 , 183 , 61 , 157 , 110 , 143 .db 107 , 97 , 115 , 30 , 116 , 189 , 110 , 145 , 81 , 107 , 6 , 215 , 30 , 237 , 137 , 12 .db 71 , 16 , 216 , 159 , 143 , 241 , 19 , 233 , 107 , 66 , 224 , 120 , 116 , 108 , 192 , 30 .db 137 , 68 , 107 , 145 , 162 , 219 , 169 , 72 , 19 , 238 , 128 , 109 , 102 , 166 , 200 , 124 .db 23 , 93 , 146 , 101 , 173 , 255 , 57 , 81 , 54 , 237 , 195 , 66 , 244 , 183 , 96 , 60 .db 192 , 154 , 131 , 34 , 103 , 81 , 84 , 22 , 222 , 157 , 134 , 236 , 251 , 158 , 76 , 77 .db 73 , 214 , 127 , 52 , 3 , 68 , 74 , 133 , 13 , 254 , 147 , 195 , 55 , 204 , 61 , 230 .db 1 , 139 , 85 , 165 , 33 , 83 , 241 , 159 , 78 , 75 , 81 , 86 , 248 , 151 , 90 , 21 .db 37 , 56 , 246 , 144 , 125 , 184 , 47 , 125 , 162 , 246 , 16 , 227 , 2 , 168 , 47 , 30 .db 45 , 27 , 16 , 115 , 202 , 35 , 120 , 46 , 106 , 224 , 179 , 89 , 55 , 223 , 30 , 219 .db 119 , 28 , 239 , 180 , 242 , 144 , 207 , 45 , 41 , 160 , 27 , 232 , 13 , 81 , 130 , 252 .db 246 , 220 , 84 , 177 , 73 , 74 , 130 , 211 , 227 , 209 , 255 , 216 , 68 , 186 , 197 , 237 .db 34 , 187 , 122 , 237 , 59 , 78 , 158 , 193 , 113 , 9 , 192 , 139 , 160 , 35 , 94 , 42 .db 75 , 199 , 195 , 243 , 107 , 188 , 155 , 185 , 158 , 48 , 38 , 238 , 95 , 186 , 199 , 75 .db 150 , 221 , 139 , 47 , 38 , 14 , 92 , 9 , 100 , 141 , 189 , 197 , 78 , 27 , 109 , 0 .db 165 , 115 , 224 , 112 , 18 , 183 , 210 , 185 , 229 , 227 , 38 , 93 , 231 , 88 , 142 , 85 .db 17 , 61 , 32 , 200 , 37 , 35 , 59 , 242 , 151 , 40 , 104 , 179 , 86 , 149 , 97 , 54 .db 1 , 71 , 101 , 22 , 31 , 40 , 218 , 1 , 50 , 104 , 49 , 91 , 119 , 229 , 204 , 31 .db 202 , 199 , 246 , 124 , 0 , 135 , 3 , 189 , 168 , 137 , 57 , 210 , 6 , 49 , 141 , 247 .db 253 , 246 , 111 , 132 , 221 , 142 , 113 , 219 , 251 , 250 , 40 , 97 , 244 , 20 , 117 , 81 .db 98 , 198 , 93 , 143 , 128 , 89 , 36 , 66 , 219 , 106 , 103 , 30 , 14 , 206 , 50 , 9 .db 171 , 207 , 115 , 230 , 226 , 215 , 232 , 184 , 151 , 147 , 218 , 83 , 252 , 69 , 238 , 5 .db 52 , 14 , 246 , 240 , 254 , 35 , 194 , 97 , 29 , 97 , 172 , 165 , 30 , 24 , 254 , 20 .db 12 , 252 , 60 , 82 , 168 , 192 , 131 , 147 , 54 , 31 , 209 , 117 , 240 , 251 , 214 , 61 .db 40 , 114 , 23 , 250 , 32 , 231 , 3 , 103 , 30 , 27 , 183 , 17 , 8 , 179 , 1 , 185 .db 212 , 135 , 224 , 227 , 158 , 89 , 92 , 251 , 150 , 245 , 237 , 61 , 219 , 46 , 200 , 116 .db 57 , 154 , 28 , 2 , 183 , 167 , 180 , 30 , 17 , 49 , 166 , 115 , 177 , 66 , 147 , 14 .db 50 , 233 , 203 , 226 , 221 , 113 , 229 , 74 , 247 , 115 , 101 , 129 , 12 , 53 , 236 , 35 .db 4 , 133 , 109 , 142 , 222 , 254 , 39 , 182 , 213 , 41 , 33 , 9 , 50 , 156 , 216 , 209 .db 118 , 86 , 240 , 165 , 219 , 167 , 175 , 15 , 183 , 64 , 25 , 1 , 238 , 189 , 242 , 159 .db 215 , 110 , 42 , 136 , 34 , 132 , 210 , 32 , 215 , 208 , 115 , 152 , 190 , 21 , 57 , 120 .db 239 , 21 , 9 , 140 , 106 , 250 , 19 , 194 , 35 , 53 , 237 , 241 , 139 , 205 , 48 , 245 .db 86 , 155 , 124 , 16 , 4 , 80 , 46 , 242 , 56 , 11 , 21 , 112 , 70 , 93 , 236 , 216 .db 224 , 245 , 154 , 122 , 192 , 27 , 148 , 134 , 124 , 190 , 172 , 212 , 79 , 251 , 94 , 162 .db 245 , 49 , 20 , 190 , 231 , 176 , 89 , 66 RandEnd: ;Appvar info VarName: .db $15,"TunnelD",0 InitHighScoreData: .db "ASM BANDIT",0 .dw 2772 .db 0 .db "**********", 0,0,0,0 .db "**********", 0,0,0,0 .db "**********", 0,0,0,0 .db "**********", 0,0,0,0 StartStr: .db "Press Any Key To Start!",0 HighScoreStr: .db "High Scores:",0 GameOverStr: .db "Game Over",0 NewHSStr: .db "New High Score!",0 EnterStr: .db "Enter Your Name:",0 #include "title.asm" #include "blog.asm" .end