; ***************************************************************** ; * ; * O R Z U N O I D v7.1 ; * ; *Programmed by Patrick Davidson/Sam Heald ; * ; * last updated : 11-25-2000 ; * ; ;***************************************************************** .nolist #include "ion.inc" #include "keys.inc" .list #ifdef TI83P .org progstart-2 .db $BB,$6D APD_BUF = $86EC MUL_HL = $4276 #else .org progstart APD_BUF = $8265 MUL_HL = $4382 #endif xor a jr nc,Start progdesc: .db "Orzunoid v7.2",0 #DEFINE LOCATE(xc,yc) ld de,(xc*256)+yc \ ld (currow),de TEXT_MEM = APD_BUF+600 scrlpos =TEXT_MEM temp =TEXT_MEM+5 temp3 =TEXT_MEM+10 aball =TEXT_MEM+15 LvlNo = TEXT_MEM+20 Top = TEXT_MEM+21 LvlMinusTop = TEXT_MEM+22 ; ------------- INITIALIZATION ;------------------------------------------- Start: ld (iy+13),0 ld (exit_game+1),sp ; ------------- GAME REPEATING LOOP ;-------------------------------------- main: call stuff ;Play the game!!! bcall(_clrlcdf) ld hl,hstitle call DTX2 LOCATE(11,1) ld de,hsdata ld b,7 high_display_loop: ;Display high scores #ifdef TI83P ;Display high scores ld a,(de) ld l,a inc de ld a,(de) ld h,a inc de push de bcall(_disphl) ld hl,CURCOL ld (hl),0 pop hl bcall(_puts) ex de,hl ld hl,CURROW inc (hl) ld a,11 ld (CURCOL),a djnz high_display_loop jp wait_key #else ld a,(de) ld l,a inc de ld a,(de) ld h,a inc de push de bcall(_disphl) ld hl,CURROW dec (hl) pop hl bcall(_puts) ex de,hl ld hl,CURROW inc (hl) djnz high_display_loop #endif call wait_key cp G_CLEAR jr nz,main exit_game: ;Exit the game ld sp,0 ret restore_game: ;Restore the game ld (hl),0 call init_display jp restore_position r3: pop af ret stuff: ld hl,saved_flag ;Check for saved game ld a,(hl) or a jr nz,restore_game title: bcall(_clrlcdf) ld h,1 ld BC, 0*256+55 ld DE, 96*256+55 bcall(_ILine) ld de,$0200 ;Display title tex ld hl,initial_msg call DTX ld de,$0904 call DMX ld de,$1016 call DMX ld de,$171F call DMX ld de,$2402 call DMX ld de,$2C08 call DMX ; -------------- INTRODUCTION SCROLL------------------------------------ main_loop: bcall(_getcsc) cp G_CLEAR jr z,r3 cp G_ALPHA ret z sub $31 jp m,main_loop cp 5 jp p,main_loop ld hl,speed ld (hl),a ld hl,0 ld (score),hl ld hl,stop ;clear text memory ld (hl),0 ld de,p ld bc,167 ldir ld hl,lives ld (hl),3 dec hl dec hl ld (hl),5 set 7,(iy+$14) call LoadLevel res 7,(iy+$14) call un_expand ; ------------------- OUTER GAME LOOP ---------------------------------- call init_display play_da_game: ld b,20 lgain: djnz lgain level_addr: ld hl,universe-24 ld a,(level) ld b,a inc b ld de,24 find_level_loop: add hl,de djnz find_level_loop ld b,8 ;Copy the map ld de,data set_up_1: push bc ld b,3 set_up_2: push bc ld b,4 ld c,(hl) loop_row: rlc c rlc c ld a,c and 3 ld (de),a inc de djnz loop_row inc hl pop bc djnz set_up_2 inc de inc de inc de inc de pop bc djnz set_up_1 ld hl,level inc (hl) level_loop: ld hl,p ld (hl),80 inc hl ld (hl),96 inc hl ld (hl),-1 inc hl ld (hl),50 inc hl ld (hl),-1 inc hl xor a ld (hl),a ld de,x2+1 ld bc,7 ldir ld (guard),a ld (bthru),a ld hl,laserstatus ;Clear data storage ld de,laserstatus+1 ld (hl),0 ld bc,65 ldir call un_expand restore_position: call play_level xor a out (1),a ld a,(won) or a jr z,finished_level ld hl,lives dec (hl) jr z,game_over call update_lives jr level_loop finished_level: ld b,0 ld a,(x+3) or a jr z,n1 inc b n1: ld a,(x2+3) or a jr z,n2 inc b n2: ld a,(x3+3) or a jr z,n3 inc b n3: ld a,b add a,a add a,a add a,a add a,a gp: ld hl,(score) ld de,10 add hl,de ld (score),hl push af call update_score pop af dec a jr nz,gp ld a,(level) cp 5 jp nz,play_da_game ld a,(lives) add a,a add a,a add a,a ld b,a lgain2: ld hl,(score) ld de,100 add hl,de ld (score),hl call update_score djnz lgain2 ; ---------------------- END OF GAME ------------------------- game_won: jr scoring game_over: ld de,$2920 ld hl,lost call DMX call wait_key scoring: ;Set up score page ld hl,(lowest) ;See if ya got a hi-score ld de,(score) bcall(_cphlde) ret nc bcall(_clrlcdf) ld hl,hi_score_str call DTX2 ld hl,lowest+2 ld (temp),hl ld b,11 space_loop: ld (hl),32 inc hl djnz space_loop ld ix,(temp) ld b,0 enter_name_loop: bcall(_getcsc) or a jr z,enter_name_loop cp G_DEL jr z,backup cp G_ENTER jr z,nomore ld c,a ld a,10 cp b jr z,enter_name_loop ld hl,chartable-10 ld e,c ld d,0 add hl,de ld a,(hl) ld (ix),a bcall(_putc) inc b inc ix jr enter_name_loop backup: dec b ld a,255 cp b jr z,too_far dec ix ld (ix),32 ld hl,curcol dec (hl) ld a,32 bcall(_putc) dec (hl) jr enter_name_loop too_far: inc b jr enter_name_loop nomore: ld hl,lowest ld de,(score) ld (hl),e push hl inc hl ld (hl),d pop ix ; hiscore table ld b,6 sort_scores: ld e,(ix) ld d,(ix+1) ld l,(ix-14) ld h,(ix-13) bcall(_cphlde) ret nc push bc ld b,14 ld d,0 exg_loop:ld e,(ix) ld c,(ix-14) ld (ix),c ld (ix-14),e inc ix inc hl djnz exg_loop ld de,-28 add ix,de pop bc djnz sort_scores ret ;---------------------- THE MAIN GAME ----------------------- play_level: ld a,1 ld (stop),a game_main_loop: bcall(_cleargbuf) call operate_lasers call Misc_Keys ld hl,GRAPH_MEM+660 ld a,(guard) ld b,12 dbloop: ld (hl),a inc hl djnz dbloop ld a,(speed) ;Slow down a bit or a call nz,waste_time ld hl,(timer) inc hl ld (timer),hl call redraw_solid ;Redraw all blocks xor a ld (aball),a ld hl,x ld b,3 ldb: push hl push bc call ballstuff pop bc pop hl ld de,4 add hl,de djnz ldb ld a,(aball) or a ret z not_hit_right_edge: ld a,$FD ;Exit key = get out! out (1),a in a,(1) bit 6,a jp z,exit_game ld a,%01111110 ;Left arrow = go left! out (1),a in a,(1) rrca rrca push af call nc,go_left pop af rrca call nc,go_right ld a,(p) ; Draw paddle srl a ld d,a ld e,52 ld ix,paddlen ld a,(expand) or a jr z,nw111 ld ix,paddlew nw111: call drw_sprw call bonus_blocks call DISPDELAY ld a,7 out (16),a ld c,17 ld a,$80 ld hl,GRAPH_MEM loop_display: call DISPDELAY out (16),a inc a ld e,a ld a,$20 call DISPDELAY out (16),a ld a,e call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi call DISPDELAY \ outi cp $b8 jr nz,loop_display call update_score ld a,(stop) or a jr nz,stopped ld a,$DF out (1),a in a,(1) bit 7,a ret z ld a,(won) or a jp nz,game_main_loop ret stopped: SUB A ld (stop),a ld de,$2911 ld hl,press_enter call DMX we1: call wait_key lgt_key: cp G_CLEAR ret z cp G_ENTER jr nz,we1 jp game_main_loop Misc_Keys: bcall(_getcsc) lgt42: cp G_MODE jr z,stopped cp G_DOWN ret nz ld hl,saved_flag ld (hl),1 jp exit_game ; -------------- BONUS BRICKS---------------------------------------------- killbb: dec hl dec hl ld (hl),0 ret bonus_blocks: ld hl,bonust ld a,(hl) dec a ret m jr z,b7 dec a jr z,b3 dec a jr z,b2 dec a jr z,b5 dec a jr z,b6 dec a jr z,b4 dec a jr z,b8 ld ix,bonus_4 jr done b2: ld ix,bonus_2 jr done b3: ld ix,bonus_3 jr done b4: ld ix,bonus_1 jr done b5: ld ix,bonus_5 jr done b6: ld ix,bonus_6 jr done b7: ld ix,bonus_7 jr done b8: ld ix,bonus_8 done: inc hl LD D,(hl) srl d inc hl ld e,(HL) call drw_sprw ld hl,bonusy ld a,(timer) and 1 add a,(hl) ld (hl),a ld a,(hl) cp 56 jr z,killbb cp 50 ret m dec hl ld a,(p) neg add a,(hl) add a,20 ret m exp1: sub 52 ret p dec hl ld a,(hl) ld (hl),0 dec a jr z,got7 dec a jr Z,got3 dec a jr z,got2 dec a jr z,got5 dec a jr z,got6 dec a jr z,got4 dec a jp z,got8 got1: ld hl,lives inc (hl) update_lives: ld hl,$207 ld (currow),hl ld a,(lives) ld l,a ld h,0 bcall(_disphl) ret got7: ld hl,bthru inc (hl) inc (hl) jr score25 got4: ld de,100 jr score__ got5: LD A,255 LD (guard),a jr score25 got6: ld hl,catch inc (hl) inc (hl) ret got3: ld a,32 ld (expand),a ld a,84 ld (exp1+1),a ld hl,$3fcb ld (exp2),hl score25: ld de,25 score__: ld hl,(score) add hl,de ld (score),hl ret got2: ld de,4 ;Find first active ball ld hl,x+3 ld a,(hl) or a jr nz,copyball add hl,de ld a,(hl) or a jr nz,copyball add hl,de copyball: ;Exchange that into first ball ld de,x+3 ld b,4 lcopyball: ld a,(hl) ld (hl),0 ld (de),a dec hl dec de djnz lcopyball ld a,(x2+3) ;Test if second ball is used or a jr nz,b1_no ld hl,x ;Split into second ball if it ld de,x2 ld bc,4 ldir ld hl,x2+1 inc (hl) b1_no: ld a,(x3+3) ;Test if third ball is used or a ret nz ld hl,x ;Split into third ball ld de,x3 ld bc,4 ldir ld hl,x3+1 dec (hl) jr score25 got8: ld hl,laserstatus ;Code called when collected ld a,15 add a,(hl) ld (hl),a ld hl,(score) ld de,10 add hl,de ld (score),hl operate_lasers: ld hl,laserstatus ld a,(hl) or a ret z push hl PUSH BC LD A,$fe OUT ($01),A ; Port 1 Keypad NOP \ NOP \ NOP \ NOP IN A,($01) ; Port 1 Keypad LD B,A LD A,$ff IN A,($01) ; Port 1 Keypad LD A,B LD A,$bf OUT ($01),A ; Port 1 Keypad IN A,($01) ; Port 1 Keypad OR $0f AND B POP BC pop hl inc hl bit 5,a jp nz,nof1 ld a,(hl) or a jr nz,doneshooting ld (hl),1 dec hl ld a,(hl) dec A jr z,doneshooting ld (hl),a inc hl inc hl ;Put left bullet ld b,32 shooteml:ld a,(hl) or a jr nz,sactivel ld (hl),52 inc hl ld a,(p) ld (hl),a dec hl ld b,1 sactivel:inc hl inc hl djnz shooteml ld hl,lasercoords ;Put right bullet ld b,32 shootemr:ld a,(hl) or a jr nz,sactiver ld (hl),52 inc hl ld a,(p) ld b,a ld a,(expand) add a,b add a,30 ld (hl),a dec hl ld b,1 sactiver:inc hl inc hl djnz shootemr doneshooting: ld hl,lasercoords ;Handle laser blasts ld b,32 laserloop: push hl ld a,(hl) ;Test if blast active or a jr z,nolaserhere push bc dec (hl) ;Draw blast ld a,63 sub (hl) ld c,a inc hl ld b,(hl) srl b call FIND_PIXEL ld de,GRAPH_MEM add hl,de or (hl) ld (hl),a pop bc pop hl push hl ld a,(hl) bit 5,a jr nz,nolaserhere and 28 add a,a add a,a ld e,a inc hl ld a,(hl) rra rra rra rra and 15 or e ld e,a ld d,0 ld hl,data add hl,de ld a,(hl) or a jr z,nolaserhere cp 3 jr z,nolaserhere dec a ld (hl),a ld hl,(score) inc hl ld (score),hl pop HL ld (hl),0 push hl nolaserhere: pop hl inc hl inc hl djnz laserloop ret nof1: ld (hl),0 jr doneshooting ; ------------------- UTILITY ROUTINES------------------------------------ un_expand: ld a,52 ld (exp1+1),a xor a ld hl,exp2 ld (hl),a inc hl ld (hl),a ld (expand),a ret update_score: ld hl,$b07 ld (currow),hl ld hl,(score) bcall(_disphl) ret init_display: bcall(_clrlcdf) ld de,7 ld (currow),de ld hl,ingame call DTX jp update_lives wait_key:ld a,40 ;Wait for a keypress call waste_time wait_inner: bcall(_getcsc) or a ret nz jr wait_inner go_right: ld a,(expand) neg add a,160 ld d,a ld a,(p) cp d jr z,right_edge inc a ld c,1 in e,(c) bit 3,e jr z,quit_moving cp d jr z,right_edge inc a cp d jr z,right_edge inc a cp d jr z,right_edge inc a cp d jr z,right_edge inc a quit_moving: ld (p),a ret right_edge: ;If paddle is at right edge ld a,d ld (p),a ret go_left: ld a,(p) cp 0 jr z,left_edge dec a jr z,left_edge ld c,1 in e,(c) bit 3,e jr z,quit_moving dec a jr z,left_edge dec a jr z,left_edge dec a jr z,left_edge dec a ld (p),a xor a ret left_edge: ;If paddle is at left edge xor a ld (p),a ret waste_time: or a ret z l: ei halt dec a jr nz,l ret redraw_solid: ;Redraw all bricks ld hl,won ld (hl),0 ld ix,GRAPH_MEM ld hl,data ld b,8 rs_outer:push bc ld b,12 rs_inner:ld a,(hl) dec a jr z,draw_block dec a JR Z,draw_block_tough dec a jr z,draw_block_solid ok: inc hl inc ix djnz rs_inner ld de,36 add ix,de ld de,4 add hl,de pop bc djnz rs_outer ret draw_block: ;Draw a standard block cpl ld (won),a ld (ix+0),255 ld (ix+12),129 ld (ix+24),129 ld (ix+36),255 jr ok draw_block_solid: ;Draw a solid block ld (ix+0),255 ld (ix+12),255 ld (ix+24),255 ld (ix+36),255 jr ok draw_block_tough: ;Draw a tough block cpl ld (won),a ld (ix+0),255 ld (ix+12),195 ld (ix+24),195 ld (ix+36),255 jr ok ; -------------- SRPITE DRAWING ROUTINE------------------------------------ drw_spr: ld a,63 ld b,d sub e ld c,a call FIND_PIXEL ld (smc1+1),a ld de,GRAPH_MEM add hl,de ld d,(ix) ld b,(ix+1) oloop: push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix smc1 ld a,1 ;Load pixel mask iloop: sla c ;Test leftmost pixel jr nc,noplot ;See if a plot is needed ld e,a ;OR pixel with screen or (hl) ld (hl),a ld a,e noplot: rrca jr nc,notedge ;Test if edge of byte reached inc hl ;Go to next byte notedge: djnz iloop pop hl ;Restore address ld bc,12 ;Go to next line add hl,bc pop bc ;Restore data djnz oloop ret drw_sprw: ld a,63 ld b,d sub e ld c,a call FIND_PIXEL ld (wsmc1+1),a ld (wsmc2+1),a ld de,GRAPH_MEM add hl,de ld d,(ix) ld b,(ix+1) woloop: push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix wsmc1 ld a,1 ;Load pixel mask wiloop: sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a ;OR pixel with screen or (hl) ld (hl),a ld a,e wnoplot: rrca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte wnotedge wsmc2: cp 1 jr z,wover_1 djnz wiloop pop hl ;Restore address ld bc,12 ;Go to next line add hl,bc pop bc ;Restore data djnz woloop ret wover_1: ld c,(ix+2) inc ix djnz wiloop dec ix pop hl ld bc,12 add hl,bc pop bc djnz woloop ret ; -------------- SPRITE FOR PADDLE----------------------------------------- paddlen: .db 16,4 .db %01111111,%11111110 .db %10000000,%00000001 .db %10000000,%00000001 .db %01111111,%11111110 paddlew: .db 32,4 .db %01111111,%11111111,%11111111,%11111110 .db %10000000,%00000000,%00000000,%00000001 .db %10000000,%00000000,%00000000,%00000001 .db %01111111,%11111111,%11111111,%11111110 spr_ball:.db 3,3 .db %11100000 .db %11100000 .db %11100000 ; -------------- PROCESS A BALL------------------------------------------- release: ld (hl),50 inc hl ld (hl),-1 dec hl dec hl dec hl ld a,(p) add a,(hl) ld (hl),a jp ballstuff coughtit: dec (hl) pop hl ;HL -> Y inc hl ld (hl),55 dec hl dec hl dec hl ;HL -> X ld a,(p) sub (hl) neg ld (hl),a inc hl inc hl caught_ball: ;HL -> Y ld a,$BF out (1),a ld e,51 in a,(1) bit 5,a jr z,release ld a,(p) dec hl dec hl add a,(hl) srl a Dec a ld d,a dec a ld ix,spr_ball jp drw_spr paddle: push hl dec hl dec hl ld a,(hl) ;HL -> X ld hl,p sub (hl) pop hl ;HL -> Y jp m,doneyb srl a exp2: nop nop ld e,a and 240 jp nz,doneyb push hl inc hl ;HL -> YV ld (hl),-1 ld d,0 ld hl,bounces add hl,de ld a,(hl) pop hl push hl dec hl ;HL -> XV ld (hl),a ld a,15 ld (incr),a ld hl,bthru ld a,(hl) or a jr z,ndbt dec a ld (hl),a ndbt: ld hl,catch ld a,(hl) or a jr nz,coughtit pop hl jr doneyb top2: inc hl ld (hl),1 dec hl jr doneyb bottom: ld a,(guard) or a jr nz,guarded inc hl ld (hl),0 ret guarded: inc hl ld (hl),-1 dec hl rrca ld a,%10101010 ld (guard),a jr c,doneyb xor a ld (guard),a jr doneyb ballstuff: inc hl inc hl inc hl ;HL -> YV ld a,(hl) or a ret z ld (aball),a cp 55 dec hl ;HL -> Y jp z,caught_ball add a,(hl) ld (hl),a dec a jr z,top2 cp 50 jr z,paddle cp 51 jr z,paddle cp 52 jr z,paddle cp 53 jr z,bottom doneyb: ;HL -> Y push hl call test_hit pop hl jr nc,nohit1 ld a,(bthru) or a jr nz,nohit1 inc hl ld a,(hl) neg ld (hl),a dec hl add a,(hl) ld (hl),a ;HL -> Y nohit1: dec hl ;Bounce off left/right sides dec hl ld a,(hl) inc hl rrca rrca and 63 jr z,forceright cp 47 jr z,forceleft dodraw: ld a,(hl) ;Move ball horizontally dec hl add a,(hl) ld (hl),a push hl inc hl inc hl call test_hit pop hl jr nc,nohit2 ld a,(bthru) or a jr nz,nohit2 inc hl ld a,(hl) neg ld (hl),a dec hl add a,(hl) ld (hl),a nohit2: ld d,(hl) inc hl inc hl srl d dec d ld e,(hl) dec e ld ix,spr_ball jp drw_spr forceright: ;Make ball go right ld a,(hl) neg jp m,dodraw ld (hl),a jr dodraw forceleft: ;Make ball go left ld a,(hl) neg jp p,dodraw ld (hl),a jr dodraw ; -------------- TEST IF THE BALL HITS A BRICK ------------------------ test_hit: ld a,(hl) ld e,a bit 5,a jr nz,bottom_half and 28 add a,a add a,a ld b,a dec hl dec hl ld a,(hl) and 240 ld d,a rrca rrca rrca rrca and 15 or b ld c,a ld b,0 ld hl,data add hl,bc ld a,(hl) dec a jr z,hit_1 dec a jr z,hit_2 dec a jr z,hit_3 bottom_half: scf ccf ret hit_1: ld (hl),0 ld hl,(score) ld a,(incr) add a,5 ld (incr),a ld c,a ld b,0 add hl,bc ld (score),hl ld a,r rrca ret c and 7 inc a ld b,a ld a,d rla jr c,abcdef ld hl,bonust ld a,(hl) or a scf ret nz ld (hl),b inc hl ld (hl),d inc hl ld (hl),e scf ret abcdef: ld hl,bonust ld a,(hl) or a scf ret nz ld (hl),b inc hl ld a,d sub 8 ld (hl),a inc hl ld (hl),e scf ret hit_2: ld (hl),1 ld hl,(score) inc hl ld (score),hl hit_3: scf ret ; -------------- DATA ------------------------------------------------- bounces: .db -3 .db -2,-2,-2 .db -1,-1,-1 .db 0,0 .db 1,1,1 .db 2,2,2 .db 3 initial_msg: .db "Orzunoid ION",0 copyright: .db "Version 7.2 Copyright 2000:",0 patstr: .db "Patrick Davidson",0 samstr: .db "Sam Heald",0 control1: .db "Choose Speed(Top Buttons):",0 control11: .db "Y=(Slow) to GRAPH(Fast)",0 ingame: .db "L: S: ",0 ; -------------------- GAME DATA------------------------------------------- saved_flag: .db 0 stop: .db 0 p: .db 0 x: .db 0,0,0,0 x2: .db 0,0,0,0 x3: .db 0,0,0,0 incr: .db 0 level: .db 0 lives: .db 0 won: .db 0,0 score: .db 0,0 inc: .db 0 bonust: .db 0 bonusx: .db 0 bonusy: .db 0 expand: .db 0 timer: .db 0,0 guard: .db 0 catch: .db 0 bthru: .db 0,0 data: .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 laserstatus: .db 0 f1status: .db 0 lasercoords: .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 universe: .ds 120 speed: .db 0 ; ---------------------- BONUS BLOCKS-------------------------------------- bonus_1: .db 11,5 .db %10011000,%11000000 .db %10100101,%00100000 .db %10100101,%00100000 .db %10100101,%00100000 .db %10011000,%11000000 bonus_2: .db 11,3 .db %01000100,%01000000 .db %11101110,%11100000 .db %01000100,%01000000 bonus_3: .db 12,5 .db %00100000,%01000000 .db %01000000,%00100000 .db %11111111,%11110000 .db %01000000,%00100000 .db %00100000,%01000000 bonus_4: .db 11,3 .db %01111111,%11000000 .DB %10000000,%00100000 .db %01111111,%11000000 bonus_5: .db 12,2 .db %11111111,%11110000 .db %11111111,%11110000 bonus_6: .db 12,4 .db %10000000,%00010000 .db %10000000,%00010000 .db %11111111,%11110000 .db %10000000,%00010000 bonus_7: .db 12,5 .db %00100000,%00000000 .db %01000000,%10000000 .db %11111111,%11110000 .db %01000000,%10000000 .db %00100000,%00000000 bonus_8: .db 11,5 .db %10001010,%00100000 .db %01010001,%01000000 .db %00100000,%10000000 .db %01010001,%01000000 .db %10001010,%00100000 ; -------------------- HIGH SCORES----------------------------------------- hi_score_str: .db "--> ORZUNOID <--" .db " You got a " .db " high score! " .db "Enter your name:",0 hstitle: .db "== HIGHSCORES ==",0 hsdata: .dw 10000 .db "ORZUNOID! ",0 .dw 8000 .db "ORZUNOID! ",0 .dw 6000 .db "ORZUNOID! ",0 .dw 4000 .db "ORZUNOID! ",0 .dw 2000 .db "ORZUNOID! ",0 .dw 1000 .db "ORZUNOID! ",0 lowest .dw 500 .db "ORZUNOID! ",0 chartable: .db ":WRMH." .DB "..0VQLG!..ZUPKFC" .DB "..YTOJEBX.>SNIDA" .DB ".12345.." press_enter: .db "Press ENTER to play",0 lost: .db "Game Over!",0 DMX: ld (pencol),de bcall(_vputs) ret DTX2: ld de,0 DTX: ld (currow),de bcall(_puts) ret Instr: .db "Orzunoid 83: Pick A Level Set",0 Bystr: .db "Patrick Davidson/Sam Heald",0 NoLevel: .db "No levels found!",0 DisplayInfo: push bc bcall(_cleargbuf) ld hl,GRAPH_MEM call Invert ld hl,GRAPH_MEM+672 call Invert2 ld de,$0001 set 3,(iy+$05) ld hl,Instr call DMX ld de,$3902 call DMX res 3,(iy+$05) pop bc ret ID: .db 5, 0 LoadLevel: call DisplayInfo xor a ld (LvlNo),a ld hl,(progptr) ; $FE6E SearchLoop: ld ix,ID call ionDetect jr nz,SDone xor a cp (hl) \ jr nz,KeepSearching ld hl,LvlNo inc (hl) KeepSearching: ex de,hl jr SearchLoop SDone: xor a ld (SetD+1),a ld a,(LvlNo) or a jr nz,tt NoLevels: ld de, $0801 ld hl, NoLevel call DMX call fastCopy call OTH_PAUSE res 7,(iy+$14) inc sp inc sp inc sp inc sp scf ret OTH_PAUSE: bcall(_getcsc) cp 9 jr nz,OTH_PAUSE ret ClearMem: ld (hl),0 ld d,h ld e,l inc de ldir ret tt: xor a ld (Top),a ShowLevels: ld hl,$0801 ld (pencol),hl ld hl,GRAPH_MEM+(7*12) ;+112 ld bc,599 ;799 call ClearMem ld b,8 ld a,(LvlNo) cp b jr nc,ShowLevel2 ld b,a ShowLevel2: push bc dec b ld l,b ld h,6 bcall(MUL_HL) ld de, $0801 ld a,l add a,d ld d,a pop bc ShowLevel: ld (pencol),de push de push bc ld a,(Top) add a,b call LoadLevelB ex de,hl inc hl FindLengthLoop: inc hl ld a,(hl) cp 9 jr nc,FindLengthLoop ld b,a DisplayNameLoop: dec hl ld a,(hl) push hl bcall(_vputmap) pop hl djnz DisplayNameLoop pop bc pop de ld a,d sub 6 ld d,a djnz ShowLevel ld hl,Top ld a,(LvlNo) sub (hl) cp 8 jr c,SetMax ld a,8 SetMax: ld e,a dec e SetD: ld d,0 call ShowBar CL_KeyLoop: push de bcall(_getcsc) pop de cp G_DOWN jr z,ScrollDown cp G_UP jr z,ScrollUp cp G_ENTER jr z,AcceptLevel cp G_CLEAR jr nz,CL_KeyLoop scf res 7,(iy+$14) ret ScrollDown: call ShowBar ld a,d cp e jr z,ScrollL_Down inc d jr ShowIt ScrollL_Down: ld (SetD+1),a ld a,(LvlNo) sub 8 jr c,ShowIt ld hl,Top cp (hl) jr z,ShowIt inc (hl) jr Sh ScrollL_Up: ld (SetD+1),a ld a,(Top) or a jr z, ShowIt dec a ld (Top),a Sh: jp ShowLevels ScrollUp: call ShowBar ld a,d or a jr z,ScrollL_Up dec d ShowIt: call ShowBar jr CL_KeyLoop AcceptLevel: ld a,(Top) add a,d inc a call LoadLevelB ld de,universe ld bc,120 ldir ret ; return hl = pointer to the program. LoadLevelB: ld b,a ld de,(progptr) LoadLevelB2: ex de,hl ld ix,ID push bc call iondetect pop bc ld a,(hl) inc hl or a jr nz,LoadLevelB2 ;not an Orzunoid Level djnz LoadLevelB2 ret ShowBar: push de ld l,d ld h,72 bcall(_htimesl) ld de,GRAPH_MEM+(8*12) add hl,de call Invert pop de ret Invert2: ld bc,96 jr InvLoop Invert: ld bc,84 InvLoop: ld a,(hl) cpl ld (hl),a inc hl dec bc ld a,b or c jr nz,InvLoop fastCopy: call ionFastCopy ret ;------------------------------------------------------------------------------- ;FIND_PIXEL Routine, by Patrick Davidson [From Zkart3d 82] ;------------------------------------------------------------------------------- FIND_PIXEL_DATA: .db 128,64,32,16,8,4,2,1 FIND_PIXEL: push bc push de ld a,b and 7 ld hl,FIND_PIXEL_DATA ld e,a ld d,0 add hl,de ld e,(hl) ; E = pixel mask ld a,63 sub c ld c,a add a,a add a,c ; A = 3 * Y ld l,a ld h,0 add hl,hl add hl,hl ; HL = 12 * Y ld a,b ld b,0 rrca rrca rrca and 15 ld c,a add hl,bc ld a,e ; A = pixel mask pop de pop bc ret DISPDELAY: push hl pop hl ret .end