; Avalanch, Coded by Harper Maddox ; sprites and ideas by Nathan Powell ; ; 82 port by Ilya Winham and an 86 port by Ahmed El-Helw ; ; thanks to Bill Nagel and Movax for some rather useful routines ; ; feel free to use any routines and what not, and email me at ; jerky@ebicom.net if you have any questions ; ; New *optimized* edition created on 11-22-97 .NOLIST #define equ .equ #define EQU .equ #define end .end #include "ti83asm.inc" #include "tokens.inc" .LIST temp = SAVESSCREEN ;temporary vars y1 = SAVESSCREEN+1 y2 = SAVESSCREEN+2 y3 = SAVESSCREEN+3 y4 = SAVESSCREEN+4 y5 = SAVESSCREEN+5 y6 = SAVESSCREEN+6 y7 = SAVESSCREEN+7 y8 = SAVESSCREEN+8 y9 = SAVESSCREEN+9 y10 = SAVESSCREEN+10 y11 = SAVESSCREEN+11 y12 = SAVESSCREEN+12 x = SAVESSCREEN+13 you = SAVESSCREEN+14 inix = SAVESSCREEN+15 score = SAVESSCREEN+16 .org 9327h ;---------initialize and draw logo------------- call _runindicOFF call BUFCLR ld hl,title ld de,plotsscreen ld bc,132 ;bytes to paint (Y*X)/8 ldir call BUFCOPY ld hl,16*256+19 ;y=20 x=17 ld (pencol),hl ld hl,nat ; pointer to string call _vputs ; display sting ld hl,23*256+18 ld (pencol),hl ld hl,harp call _vputs ld hl,58*256+12 ld (pencol),hl ld hl,hi call _vputs call _RCLY ld a,6 call _DISPOP1A ld hl,by call _vputs CALL _ZEROOOP1 LD HL,'A' LD (OP1+1),HL call _RCLVARSYM call _CONVOP1 ld a,e call _vputmap CALL _ZEROOOP1 LD HL,'B' LD (OP1+1),HL call _RCLVARSYM call _CONVOP1 ld a,e call _vputmap CALL _ZEROOOP1 LD HL,'C' LD (OP1+1),HL call _RCLVARSYM call _CONVOP1 ld a,e call _vputmap ld a,0 ;\___ initialize reverse variable ld (temp),a ;/ ;-----------wait on intro screen, flashing "PRESS 2nd"------------ introwait: ld b,255 loop: push bc ld b,255 call delay pop bc ld a,0ffh ;reset keyport out (1),a ;necessary code ld a,0fdh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 191 ;clear??? jp z,quit ld a,0ffh ;reset keyport out (1),a ;necessary code ld a,0bfh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 223 jp z,start djnz loop res textinverse,(iy+textflags) ;-------erase reverse line to left of "Press 2nd" ld bc,16*256+15 ld de,16*256+8 ld hl,0 call _iline ;-----end erase line---------- ld a,(temp) ;1=norm,0=reverse inc a ld (temp),a cp 2 ;is it at 2 (when we only want 1 or 0) jp nz,not2 ld a,0 ld (temp),a set textinverse,(iy+textflags) not2: ld a,6 ld (currow),a ld a,3 ld (curcol),a ld hl,secnd call _puts res textinverse,(iy+textflags) jp introwait randstart: call _zerooop1 CALL _PUSHREALO1 call _op2set0 call _RANDOM ;Calls Random ld a,30 call _setxxop2 call _FPMULT call _CONVOP1 add a,a ret start: call BUFCLR ld hl,0 ld (score),hl ld a,0 ld (you),a ld b,12 ld hl,SAVESSCREEN randlop: ; Creates random starting points for ICICLES! push bc inc hl push hl call randstart pop hl ld (hl),a pop bc djnz randlop icelop: ld hl,(score) inc hl inc hl ld (score),hl ld b,12 ld hl,SAVESSCREEN ld a,0 ld (x),a ilop: push bc inc hl ld a,(hl) ; obtain each icicles Y position from a memory location ld e,a push hl call drawice ; draw/erase icicle pop hl ld a,(x) add a,8 ld (x),a pop bc djnz ilop ld a,(you) ld e,55 ld hl,man call SPRITE call BUFCOPY ld a,0ffh ;reset keyport out (1),a ;necessary code ld a,0fdh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 191 ;clear??? jp z,quit ld a,0ffh ;reset keyport out (1),a ;necessary code ld a,0bfh out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 191 ; check for mode call z,pause ld a,0ffh out (1),a ;necessary code ld a,0feh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 251 jp z,right cp 253 jp z,left lop2: ld b,15 call delay2 call BUFCLR ld a,(temp) cp 187 jp z,youdie ld a,(y1) cp 104 call nc,chg1 add a,2 ld (y1),a ld a,(y2) cp 104 call nc,chg2 add a,3 ld (y2),a ld a,(y3) cp 104 call nc,chg3 add a,2 ld (y3),a ld a,(y4) cp 104 call nc,chg4 add a,3 ld (y4),a ld a,(y5) cp 104 call nc,chg5 add a,2 ld (y5),a ld a,(y6) cp 104 call nc,chg6 add a,3 ld (y6),a ld a,(y7) cp 104 call nc,chg7 add a,4 ld (y7),a ld a,(y8) cp 104 call nc,chg8 add a,3 ld (y8),a ld a,(y9) cp 104 call nc,chg9 add a,2 ld (y9),a ld a,(y10) cp 104 call nc,chg10 add a,2 ld (y10),a ld a,(y11) cp 104 call nc,chg11 add a,3 ld (y11),a ld a,(y12) cp 104 call nc,chg12 add a,2 ld (y12),a jp icelop left: ld a,(you) cp 0 jp z,jplft dec a dec a ld (you),a jp lop2 jplft: ld a,88 ld (you),a jr left right: ; move the character one to the right ld a,(you) cp 88 jp z,jprt inc a inc a ld (you),a jp lop2 jprt: ld a,0 ld (you),a jr right ; you can use "jr" instead of "jp" for little jumps chkhit: ; check to see if the icicle is at the same xposition as you ld a,(x) ; icicle x-pos +6 -> b add a,4 ld b,a ld a,(you) ; your x-pos ->a cp b ; IF a=>b goto di2 jp nc,di2 ld a,(x) ; icicle x-pos ->b ld b,a ld a,(you) ; your x-pos +6 ->a add a,4 cp b jp c,di2 ; IF asprite ld d,a ; d=how many bits to shift each line ld e,8 ; Line loop LILOP: ld b,(ix+0) ; Get sprite data ld c,0 ; Shift loop push de SHLOP: srl b rr c dec d jp nz,SHLOP pop de ld a,b ; Write line to graphbuf xor (hl) ld (hl),a inc hl ld a,c xor (hl) ld (hl),a ld bc,11 ; Calculate next line address add hl,bc inc ix ; Inc spritepointer dec e jp nz,LILOP ; Next line jp DONE1 ;ÛÛÛÛ Aligned sprite blit starts here ÛÛÛÛ ALIGN: ; Blit an aligned sprite to graphbuf pop de ; de->sprite ld b,8 ALOP1: ld a,(de) xor (hl) ld (hl),a inc de push bc ld bc,12 add hl,bc pop bc djnz ALOP1 DONE1: ret ;ÛÛÛÛÛÛÛÛÛÛÛÛÜ SPRITE ÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ÛÛÛÛÛ Z80 ÛÛÛÛÛÛ³ EQUALS ³ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ³ movax ³ÛÛÛÛÛÛÛÛÛÛÛÛ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÙ WAITKEY .equ 4CFEh ; Wait for a key and read BUFCLR .equ 515Bh ; Clear the graph backup BUFCOPY .equ 5164h ; Copy the graph backup to the screen RINDOFF .equ 4795h ; Turn off runindicator PRINTHL .equ 4709h ; Print HL in dec. on the screen OP2TOP1 .equ 41C2h ; Move OP2 to OP1 CONVOP1 .equ 4EFCh ; Convert fp value in OP1 to a 2 byte hex READKEY .equ 4A18h ; Read key and place it in OP2 as a fp value GOHOME .equ 47A1h ; Go to home screen (finish gfx program) CLRTSHD .equ 4765h ; Clear text shadow HOMEUP .equ 4775h ; Place cursor at home STRING .equ 470Dh ; Print 0 terminated string to screen (hl->string) title: .db 0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,7,0,0,0,0,96,0,0,0,112,0,0,7,0,0 .db 0,0,224,0,0,0,112,0,0,7,0,0,0,0,224,0,0,0,120,241,195,135,7,15,240,126,255,15,192,0,252 .db 113,199,199,15,207,249,254,255,159,224,1,220,115,193,231,3,206,121,196,243,156,240,3,220,63,31,231,63,204,59,128 .db 227,159,240,3,254,63,158,231,61,206,59,128,243,191,240,3,191,30,57,231,115,206,57,204,243,191,0,7,7,142,63 .db 247,191,238,56,254,115,159,224,7,7,140,15,118,30,110,56,56,67,131,192,0,0,0,0,0,0,0,0,0,0,0 secnd .db "Press 2nd",0 nat: .db "By: Nathan Powell",0 harp: .db "and Harper Maddox",0 die: .db "You Died",0 sc: .db "Score: ",0 hi: .db "Hi-Score: ",0 by: .db " by ",0 ptxt: .db "*Paused*",0 new: .db "New Hi-Score!",0 ini: .db "Enter Your Initials:",0 pts: .db " Points",0 icicle: .db 01111100b .db 01100100b .db 01000100b .db 00101000b .db 00101000b .db 00111000b .db 00010000b .db 00010000b drop1: .db 01111100b .db 00111000b .db 00000000b .db 00000000b .db 00000000b .db 00000000b .db 00000000b .db 00000000b drop2: .db 11111110b .db 11000110b .db 01000100b .db 00111000b .db 00000000b .db 00000000b .db 00000000b .db 00000000b man: .db 01110000b .db 10101000b .db 01110000b .db 00100000b .db 11111000b .db 00100000b .db 01110000b .db 11011000b .end END