; Rad Racer 83 v1.0 ; simple version without multiple tracks for ashell ; ; Coding- Harper Maddox, Graphics- Nathan Powell ; email: jerky@ebicom.net ; ; Date- 12/16/97 .NOLIST #define equ .equ #define EQU .equ #define end .end RINDOFF .equ 4795h ; Turn off runindicator BUFCOPY .equ 5164h ; copies the graph backup screen to the display. BUFCLR .equ 515Bh ; Clear the graph backup #include "ti83asm.inc" #include "tokens.inc" .LIST .org 9327h #DEFINE temp SAVESSCREEN #DEFINE speed SAVESSCREEN+1 #DEFINE dir SAVESSCREEN+2 #DEFINE trackdir SAVESSCREEN+3 #DEFINE tim SAVESSCREEN+4 #DEFINE time SAVESSCREEN+5 #DEFINE score SAVESSCREEN+7 #DEFINE temphi SAVESSCREEN+9 nop ;these 2 lines identify the program jr prog_start ;as AShell-compatable .dw $0000 ;Version of table .dw desc ;Points to the program description .dw $0000 ;Points to an 8x8 icon .dw $0000 ;For future use ( *Libraries*? :) prog_start: call _clrtxtshd call _zerooop1 call RINDOFF ;turn on run indicator call BUFCLR ld hl,rrtitle ld de,8e29h ld bc,764 ldir call BUFCOPY ld a,25 ld (temp),a titlescr: call revline call _getkey push af call revline pop af cp 09h ret z cp 04h jp z,bdwn cp 03h jp z,bup cp 05h jp z,bentr jp titlescr revline: ld a,(temp) inc a rlop: dec a ld c,a ld a,(temp) sub 8 cp c ret z ld a,c ld e,c ld b,2 ld d,43 ld h,2 call _iline jp rlop bdwn: ld a,(temp) cp 11 jp z,titlescr sub 7 ld (temp),a jp titlescr bup: ld a,(temp) cp 25 jp z,titlescr add a,7 ld (temp),a jp titlescr bentr: ld a,(temp) cp 11 ret z cp 18 jp z,hiscores ld a,99 ld (speed),a call BUFCLR ld hl,rr2 ld de,8e29h ld bc,768 ldir call BUFCOPY st: ld a,0ffh ;reset the keyport out (1),a ld a,0bfh ;load row that has 2nd out (1),a in a,(1) cp 223 ;did you press 2nd? jp nz,st ld a,0 ld (tim),a ld hl,0 ld (time),hl ld a,2 ld (dir),a game: ld a,(tim) inc a ld (tim),a ld b,a ld a,(track) cp b jp z,done ld a,0ffh ;reset the keyport out (1),a ld a,0feh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 251 call z,mrt cp 253 call z,mlf ld hl,track ld a,(tim) ld b,a inct: inc hl djnz inct ld de,65000 ; If Time>255:00 stop game call _cphlde ret nc ld a,(hl) ld b,a ld a,(dir) add a,b ld (trackdir),a ld a,(speed) inc a ld (speed),a cp 100 call nc,spd2 call rclpic ld hl,58*256+10 ld (pencol),hl ld a,(speed) ld b,a ld a,99 sub b inc a call _setxxop1 ld a,2 call _DISPOP1A ld hl,56*256+66 ld (pencol),hl ld hl,(time) ld a,h call _setxxop1 ld a,3 call _dispop1a ; Time Allotted... call loop 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??? ret z ld a,0ffh ;reset the keyport out (1),a ld a,0bfh ;load row that has 2nd out (1),a in a,(1) cp 223 ;did you press 2nd? call z,spdup ld a,0ffh ;reset the keyport out (1),a ld a,0dfh ;load row that has alpha out (1),a in a,(1) cp 127 ;did you press alpha? call z,spdown ld a,0ffh ;reset the keyport out (1),a ld a,0feh ;enable row with clear out (1),a ;necessary code in a,(1) ;get # of any key pressed->a cp 251 call z,mrt cp 253 call z,mlf ld a,(trackdir) add a,10 ld (trackdir),a call rclpic ld hl,58*256+10 ld (pencol),hl ld a,(speed) ld b,a ld a,99 sub b call _setxxop1 ld a,2 call _DISPOP1A ld hl,56*256+66 ld (pencol),hl ld hl,(time) ld a,h call _setxxop1 ld a,3 call _dispop1a ; Time Allotted... call loop jp game mlf: ld a,(dir) cp 4 ret z inc a ld (dir),a ret mrt: ld a,(dir) cp 0 ret z dec a ld (dir),a ret spdup: ld a,(speed) call _setxxop1 call _op2set5 call _fpdiv call _convop1 cp 2 jp c,sup2 ld b,a ld a,(speed) sub b ld (speed),a ret sup2: ld a,(speed) dec a ld (speed),a cp 2 ret c dec a ld (speed),a ret spdown: ld a,(speed) cp 75 jp nc,spd2 add a,25 ld (speed),a ret spd2: ld a,99 ld (speed),a ret hiscores: call BUFCLR call _clrLCDFULL call hiscors ld a,1 ld (currow),a ld a,3 ld (curcol),a ld hl,his call _puts call _getkey jp prog_start loop: ld hl,(time) ld a,(speed) ld b,a lop1: inc hl inc hl inc hl inc hl halt djnz lop1 ld (time),hl ret delay: push bc ld b,255 call delay2 pop bc djnz delay ret delay2: push bc ld b,7 call del3 pop bc djnz delay2 ret del3: djnz del3 ret rclpic: call BUFCLR ld a,(trackdir) cp 0 jp z,wreck1 cp 10 jp z,wreck2 cp 6 jp z,wreck1 cp 16 jp z,wreck2 cp 1 jp z,lt1 cp 11 jp z,lt2 cp 2 jp z,rt1 cp 12 jp z,rt2 cp 3 jp z,rt1 cp 13 jp z,rt2 cp 4 jp z,rt1 cp 14 jp z,rt2 cp 5 jp z,r1 cp 15 jp z,r2 call BUFCOPY ret picrest: ld de,8e29h ld bc,768 ldir call BUFCOPY ld a,(trackdir) cp 2 jp z,sleft cp 12 jp z,sleft cp 4 jp z,sright cp 14 jp z,sright ret rt1: ld hl,rr1 jr picrest rt2: ld hl,rr2 jr picrest r1: ld hl,rtur jp picrest r2: ld hl,rtur2 jp picrest lt1: ld hl,ltur jp picrest lt2: ld hl,ltur2 jp picrest wreck1: ld hl,crsh jp picrest wreck2: call lwr2 ld a,2 ld (dir),a ld a,99 ld (speed),a ret lwr2: ld hl,crsh2 jp picrest sleft: ld h,1 ld b,34 ld c,56 ld d,31 ld e,59 call _iline ld h,1 ld b,31 ld c,59 ld d,25 ld e,62 call _iline ld h,1 ld b,60 ld c,56 ld d,56 ld e,59 call _iline ld h,1 ld b,56 ld c,59 ld d,47 ld e,62 call _iline ret sright: ld h,1 ld b,34 ld c,56 ld d,38 ld e,59 call _iline ld h,1 ld b,38 ld c,59 ld d,47 ld e,62 call _iline ld h,1 ld b,60 ld c,56 ld d,63 ld e,59 call _iline ld h,1 ld b,63 ld c,59 ld d,69 ld e,62 call _iline ret done: ld hl,fin1 ld de,8e29h ld bc,768 ldir call BUFCOPY ld b,50 call delay ld hl,fin2 ld de,8e29h ld bc,768 ldir call BUFCOPY ld b,100 call delay call BUFCLR ;start highscores call _clrlcdfull ld a,2 ld (currow),a ld a,8 ld (curcol),a ld hl,(time) ld (score),hl call dispscor ld a,3 ld (curcol),a ld hl,dtime call _puts ld hl,(tim1) ;are you #1? ex de,hl ld hl,(time) call _cphlde jp c,hisc1 ld hl,(tim2) ; #2? ex de,hl ld hl,(time) call _cphlde jp c,hisc2 ld hl,(tim3) ; #3? ex de,hl ld hl,(time) call _cphlde jp c,hisc3 call _homeup ld hl,cong call _puts call hiscors dun: call _getkey cp 09h jr nz,dun jp prog_start hisc1: ld hl,(tim2) ld (tim3),hl ld hl,(tim1) ld (tim2),hl ld hl,(time) ld (tim1),hl ld hl,(ini2) ld (ini3),hl ld a,(ini2+2) ld (ini3+2),a ld hl,(ini1) ld (ini2),hl ld a,(ini1+2) ld (ini2+2),a ld a,$5F ld (ini1+1),a ld a,$5F ld (ini1+2),a call newhi ld a,4 ld (currow),a ld a,11 call getinitial ld a,(temp) ld (ini1),a ld a,12 call getinitial ld a,(temp) ld (ini1+1),a ld a,13 call getinitial ld a,(temp) ld (ini1+2),a jp prog_start hisc2: ld hl,(tim2) ld (tim3),hl ld hl,(time) ld (tim2),hl ld hl,(ini2) ld (ini3),hl ld a,(ini2+2) ld (ini3+2),a ld a,$5F ld (ini2+1),a ld a,$5F ld (ini2+2),a call newhi ld a,5 ld (currow),a ld a,11 call getinitial ld a,(temp) ld (ini2),a ld a,12 call getinitial ld a,(temp) ld (ini2+1),a ld a,13 call getinitial ld a,(temp) ld (ini2+2),a jp prog_start hisc3: ld hl,(time) ld (tim3),hl ld a,$5F ld (ini3+1),a ld a,$5F ld (ini3+2),a call newhi ld a,6 ld (currow),a ld a,11 call getinitial ld a,(temp) ld (ini3),a ld a,12 call getinitial ld a,(temp) ld (ini3+1),a ld a,13 call getinitial ld a,(temp) ld (ini3+2),a jp prog_start newhi: ;same crap every time you get a high score ld a,2 ld (CURCOL),a ld a,0 ld (currow),a ld hl,new call _puts call hiscors ret getinitial: ld (curcol),a ld a,65 ld (temp),a call draw_letter iniloop: call _getk ld a,25 call _SETXXOP1 call _CPOP1OP2 call z,iniup ld a,34 call _SETXXOP1 call _CPOP1OP2 call z,inidown ld a,45 call _SETXXOP1 call _CPOP1OP2 ret Z jp iniloop draw_letter: ld a,(temp) call _putmap ret iniup: ld a,(temp) inc a cp 91 call Z,toohigh ld (temp),a jp draw_letter toohigh: ld a,65 ret inidown: ld a,(temp) dec a cp 64 call Z,toolow ld (temp),a jp draw_letter toolow: ld a,90 ret hiscors: ; displays the high scores ld h,1 ld b,3 ld c,37 ld d,3 ld e,5 call _iline ;lf1 ld h,1 ld b,93 ld c,37 ld d,93 ld e,5 call _iline ;r1 ld h,1 ld b,3 ld c,35 ld d,93 ld e,35 call _iline ;top1 ld h,1 ld b,3 ld c,37 ld d,93 ld e,37 call _iline ;top0 ld h,1 ld b,3 ld c,5 ld d,93 ld e,5 call _iline ; bot 0 ld a,4 ld (currow),a ld a,5 ld (curcol),a ld hl,(tim1) ld (score),hl call dispscor ld a,1 ld (curcol),a ld hl,num1 call _puts ld a,11 ld (curcol),a ld hl,ini1 push hl ld a,(hl) call _putc pop hl inc hl push hl ld a,(hl) call _putc pop hl inc hl ld a,(hl) call _putc ld a,5 ld (currow),a ld a,5 ld (curcol),a ld hl,(tim2) ld (score),hl call dispscor ld a,1 ld (curcol),a ld hl,num2 call _puts ld a,11 ld (curcol),a ld hl,ini2 push hl ld a,(hl) call _putc pop hl inc hl push hl ld a,(hl) call _putc pop hl inc hl ld a,(hl) call _putc ld a,6 ld (currow),a ld a,5 ld (curcol),a ld hl,(tim3) ld (score),hl call dispscor ld a,1 ld (curcol),a ld hl,num3 call _puts ld a,11 ld (curcol),a ld hl,ini3 push hl ld a,(hl) call _putc pop hl inc hl push hl ld a,(hl) call _putc pop hl inc hl ld a,(hl) call _putc ld hl,24*256+32 ld (pencol),hl ld hl,prac call _vputs ret dispscor: ; Phat Floating point intense routine for displaying the time ld hl,(score) ld h,0 call _setxxxxop2 ; set "l" to OP2 call _op2toop1 ; move op2 to op1 ld hl,100 call _setxxxxop2 call _fpmult ; multiply OP1 by 100 ld hl,255 call _setxxxxop2 call _fpdiv ; divide OP1 by 255 to produce a num between 0 and 99 call _int ; make it an integer call _convop1 ex de,hl ; de to hl push hl call _disphl ; display the hundreths of seconds pop hl ld a,l cp 10 call c,draw0 ld a,(curcol) ; move cursor back 8 spaces sub 8 ld (curcol),a ld hl,(score) ld l,h ld h,0 call _disphl ; display seconds ld a,Lcolon ; set accumulator to the colon's number call _putc ; display the colon ret draw0: ld a,(curcol) sub 2 ld (curcol),a ld a,L0 call _putc ld a,(curcol) inc a ld (curcol),a ret track: .db 68 ; 161 is the value for the full track .db 2,2,2,1,0,0,1,2,2,3,4,4,3,2,2,1,0 .db 0,1,2,3,4,4,3,2,2,1,0,1,1,2,2,1,0 .db 1,2,2,3,4,3,2,1,0,1,2,2,1,0,0,1,2 .db 2,3,4,4,3,2,1,0,1,2,1,0,0,1,2,2,3 .include rrpics.asm his: .db "Best Times",0 none: .db "-none-",0 desc: .db "Rad Racer by: HM & NP",0 cong: .db "Congratulations!",0 new: .db "Record Time!",0 ini: .db "Enter Your Initials:",0 dtime: .db "Time",0 prac: .db " Practice",0 num1: .db "#1",0 num2: .db "#2",0 num3: .db "#3",0 tim1: .db $CF,$BF ini1: .db LcapN,LcapB,LcapP tim2: .db $DF,$CF ini2: .db LcapG,LcapE,LcapO tim3: .db $FE,$FF ini3: .db LcapJ,LcapE,LcapB .end END