; Tunnel for Doorsos 0.91Beta ; by Alban Gervaise ; last release 12/12/98 include "doorsos.h include "userlib.h" include "graphlib.h" xdef _main xdef _comment xdef _ti89 Take_str MACRO move.w \1,d5 move.w \2,d6 move.w \3-1,d7 move.w d7,d4 bsr take_string ENDM print_d0 MACRO bsr print_value move.w \3,-(a7) move.l a0,-(a7) move.w \2,-(a7) move.w \1,-(a7) jsr doorsos::DrawStrXY lea 10(a7),a7 ENDM mask0 equ %11111110 ;(up\2nd\donw...) mask1 equ %11111101 ;(Enter\clear...) mask2 equ %11111011 ;( <- ) mask3 equ %11110111 ;(catalog...) mask4 equ %11101111 ;(Mode...) mask5 equ %11011111 ;(Home...) mask6 equ %10111111 ;(ESC...) _main: bsr print_high bra print_selection print_high: jsr graphlib::clr_scr clr.w -(a7) jsr doorsos::ST_busy lea 2(a7),a7 SetFont #2 WriteStr #50,#0,#1,titre SetFont #0 WriteStr #59,#15,#1,auteur WriteStr #45,#21,#4,real_name SetFont #1 WriteStr #0,#60,#1,easy_str WriteStr #0,#70,#1,medium_str WriteStr #0,#80,#1,hard_str WriteStr #50,#60,#1,easy WriteStr #50,#70,#1,medium WriteStr #50,#80,#1,hard move.w #2,d6 move.l #easy+13,a5 move.w #60,d7 \loops move.w (a5),d0 print_d0 #130,d7,#4 add.w #10,d7 lea 16(a5),a5 dbra d6,\loops rts select_loop: pea email(pc) jsr doorsos::ST_showHelp ; lea 4(a7),a7 ; jsr userlib::idle_loop cmp.w #13,d0 beq start cmp.w #264,d0 beq exit cmp.w #277,d0 beq exit cmp.w #$152,d0 beq moins cmp.w #$158,d0 beq plus bra select_loop moins tst.w sel beq print_selection sub.w #1,sel bra print_selection plus cmp.w #2,sel beq print_selection add.w #1,sel print_selection: WriteStr #30,#35,#4,choose WriteStr #50,#45,#4,fleche move.w sel,d0 tst.w sel beq easy_print cmp.w #1,sel beq print_medium WriteStr #60,#45,#1,hard_str move.w table+8,level move.w table+10,level+2 bra select_loop easy_print: move.w table,level move.w table+2,level+2 WriteStr #60,#45,#1,easy_str bra select_loop print_medium: move.w table+4,level move.w table+6,level+2 WriteStr #60,#45,#1,medium_str bra select_loop start move.w #80,x clr.w score move.w #60,bord move.w #110,bord+2 clr.w timer clr.w score_t clr.w -(a7) jsr doorsos::ST_busy lea 2(a7),a7 bsr ini_screen bsr int_on main_loop add.w #1,timer move.w level,d0 cmp.w timer,d0 beq scroll move.w #mask5,d0 bsr get_key btst.b #6,d0 beq int_off move.w #mask6,d0 bsr get_key btst.b #0,d0 beq menu tst.w block beq dir sub.w #1,block bra check dir move.w #mask0,d0 bsr get_key btst.b #3,d0 beq droite btst.b #1,d0 bne check gauche bsr cur_off sub.w #1,x bsr dispcur move.w level+2,block bra check droite bsr cur_off add.w #1,x bsr dispcur move.w level+2,block bra check scroll clr.w timer add.w #1,score_t bsr up_date move.l #LCD_MEM,a0 move.w #4,d0 \sloop clr.l (a0)+ dbra d0,\sloop clr.l d0 move.w #7,d0 jsr userlib::random sub.w #3,d0 add.w d0,bord cmp.w #5,bord ble ajuste add.w d0,bord+2 cmp.w #155,bord+2 bge ajuste2 retour clr.w d0 clr.w d1 move.w bord,d2 move.w #1,d3 move.l #LCD_MEM,a0 jsr graphlib::line move.w bord+2,d0 clr.w d1 move.w #160,d2 move.w #1,d3 move.l #LCD_MEM,a0 jsr graphlib::line bsr dispcur move.w score_t,d0 divu #10,d0 swap d0 tst.w d0 bne check add.w #1,score clr.l d0 move.w score,d0 print_d0 #25,#95,#4 bra check ajuste move.w #6,bord move.w #56,bord+2 bra retour ajuste2 move.w #154,bord+2 move.w #104,bord bra retour get_key move.w d0,$600018 move.w #50,d0 delay_c dbra d0,delay_c move.b $60001b,d0 exit rts menu bsr int_off move.w #100,d0 move.w #1000,d0 \loopa move.w #100,d1 \loopc dbra d1,\loopc dbra d0,\loopa bra _main check clr.l d0 clr.l d1 move.w x,d1 sub.w #2,d1 move.w #92,d0 bsr pixel btst.l d4,(a4) bne touche add.w #11,d1 bsr pixel btst.l d4,(a4) bne touche bra main_loop pixel movem.l d0-d1/a0,-(a7) lea $4c00,a0 cmp.w #99,d0 bcc pasbon lsl.w #1,d0 move.w d0,d3 lsl.w #4,d0 sub.w d3,d0 lea 0(a0,d0.w),a0 cmp.w #159,d1 bcc pasbon move.w d1,d3 lsr.w #3,d1 lea 0(a0,d1.w),a4 not.w d3 and.w #7,d3 move.w d3,d4 bra pasbon sub.l a4,a4 pasbon movem.l (a7)+,d0-d1/a0 rts touche move.l #dialog,a6 jsr graphlib::show_dialog \loop move.w #mask6,d0 bsr get_key btst.b #0,d0 beq apres move.w #mask1,d0 bsr get_key btst.b #0,d0 beq apres bra \loop apres bsr int_off clr.l d0 move.w sel,d0 mulu #16,d0 move.l #easy+13,a0 add.l d0,a0 move.w (a0),d0 cmp.w score,d0 bge _main move.w score,(a0) sub.l #13,a0 move.l a0,-(a7) bsr print_high move.l (a7)+,a5 move.w sel,d1 mulu #10,d1 add.w #60,d1 move.w #50,d0 move.w #70,d2 move.w #10,d3 move.w #1,d4 jsr graphlib::fill WriteStr #40,#40,#4,new_high move.w sel,d0 mulu #10,d0 add.w #60,d0 Take_str #50,d0,#12 bra _main ini_screen: jsr graphlib::clr_scr2 move.l #$4c00,a0 move.l #$FFFFFFFF,(a0) move.l #$FFFFFFFF,4(a0) move.l #$00000000,8(a0) move.w #$00000,10(a0) move.l #$FFFFFFFF,12(a0) move.l #$FFFFFFFF,16(a0) lea LCD_MEM,a0 lea LCD_MEM+30,a1 move.w #750-62,d0 \iloop move.l (a0)+,(a1)+ dbra d0,\iloop bsr dispcur clr.w -(a7) jsr doorsos::ST_busy clr.w -(a7) jsr doorsos::FontSetSys lea 4(a7),a7 WriteStr #0,#95,#4,score_str WriteStr #100,#95,#1,_comment rts dispcur move.w x,d0 move.w #86,d1 clr.b d3 move.l #sprite,a0 jsr graphlib::put_sprite_mask rts cur_off move.w x,d0 move.w #86,d1 move.b #$FF,d3 move.l #sprite+10,a0 jsr graphlib::put_sprite_mask rts up_date lea LCD_MEM+3000-30*8,a0 move.w #750,d0 \loop move.l -(a0),30(a0) dbra d0,\loop rts take_string: jsr userlib::idle_loop cmp.w #257,d0 beq undo cmp.w #264,d0 beq \bon cmp.w #13,d0 beq \bon move.b d0,(a5)+ move.w #2,-(a7) move.w d6,-(a7) move.w d5,-(a7) move.w d0,-(a7) jsr userlib::DrawCharXY lea 8(a7),a7 add.w #6,d5 dbra d7,take_string \bon cmp.w d4,d7 beq take_string clr.b (a5) rts undo cmp.w d4,d7 beq take_string add.w #1,d7 clr.b -(a5) sub.w #6,d5 move.w #4,-(a7) move.w d6,-(a7) move.w d5,-(a7) move.w #32,-(a7) jsr userlib::DrawCharXY lea 8(a7),a7 bra take_string print_value: move.l #str+8,a0 clr.b (a0) clr.l d1 print_loop: add.l #1,d1 divu #10,d0 swap d0 add.b #48,d0 move.b d0,-(a0) clr.w d0 swap d0 tst.w d0 bne print_loop rts int_on clr.l d0 move.w #$0700,d0 trap #1 bclr.b #2,($600001) move.l ($64),old_int1 move.l #new_int,($64) bset.b #2,($600001) trap #1 rts int_off clr.l d0 move.w #$0700,d0 trap #1 bclr.b #2,($600001) move.l old_int1,($64) bset.b #2,($600001) trap #1 rts new_int rte sprite dc.w 6 dc.w 1 dc.b %00011000 dc.b %00111100 dc.b %00100100 dc.b %01100110 dc.b %01011010 dc.b %11111111 dc.w 6 dc.w 1 dc.b 0,0,0,0,0,0 score_str dc.b "score:",0 crash_str dc.b "CRASH!",0 new_high dc.b "NEW HIGH SCORE!",0 titre dc.b "TUNNEL",0 auteur dc.b "by Endive",0 real_name dc.b "-Alban Gervaise-",0 choose dc.b "choose your level",0 email dc.b "e-mail: GefunS@I-France.com",0 easy_str dc.b " easy ",0 medium_str dc.b "medium",0 hard_str dc.b " hard ",0 easy dc.b "alban gervai",0,0,0,0 medium dc.b "alban gervai",0,0,0,0 hard dc.b "alban gervai",0,0,0,0 fleche dc.b 17," ",18,0 table dc.w 20,30,10,20,3,5 dialog dC.w 40,30,120,50,18,6 dc.l crash_str _comment dc.b "Tunnel by Endive",0 x ds.w 1 bord ds.w 2 block ds.w 1 score ds.w 1 str ds.b 9 score_t ds.w 1 old_int1 ds.l 1 sel ds.b 1 timer ds.w 1 level ds.w 2 end ;by Alban Gervaise