home *** CD-ROM | disk | FTP | other *** search
- include "tios.h"
- include "flib.h"
- xdef _main
- xdef _comment
-
- on macro ;do black pixels
- move.w \1,-(a7)
- move.w \2,-(a7)
- jsr flib::pixel_on
- lea 4(a7),a7
- move.w \1,-(a7)
- move.w \2,-(a7)
- add.w #1,\1
- add.w #1,\2
- move.w \1,-(a7)
- move.w \2,-(a7)
- sub.w #2,\1
- sub.w #2,\2
- move.w \1,-(a7)
- move.w \2,-(a7)
- jsr flib::frame_rect
- lea 12(a7),a7
- add.w #1,\1
- add.w #1,\2
- endm
-
- fonts macro ;print text
- move.w \1,-(a7)
- jsr tios::FontSetSys
- lea 2(a7),a7
- move.w \2,-(a7)
- pea \5(PC)
- move.w \4,-(a7)
- move.w \3,-(a7)
- jsr tios::DrawStrXY
- lea 10(a7),a7
- endm
-
- shownum:moveq #2,d1
- lea strbuf(PC),a0
- adda.l d1,a0
- clr.b (a0)
- subq.b #1,d1
- num_loop:
- divu #10,d0
- move.l d0,d2
- lsr.l #8,d2
- lsr.l #8,d2
- add.b #48,d2
- move.b d2,-(a0)
- and.l #$FFFF,d0
- dbra d1,num_loop
- rts
-
- _main: move.w 0,sco ;P1
- move.w 0,scor ;P2
- jsr flib::zap_screen
- fonts #1,#2,#1,#1,z1
- fonts #1,#2,#20,#12,z2
- fonts #1,#2,#20,#22,z3
- fonts #2,#0,#0,#50,z4
- fonts #2,#0,#0,#60,z5
- fonts #1,#1,#60,#80,z6
- fonts #1,#1,#60,#90,z7
- fonts #1,#1,#60,#100,z8
- jsr flib::idle_loop
- cmp.b #13,d0
- beq main
- cmp.b #264,d0
- beq fin
- cmp.w #$10C,d0
- beq option
- jmp _main
-
- main: clr.b fla
- clr.b fl
- clr.b tes
-
- jsr flib::zap_screen
- move.w #119,-(a7)
- move.w #239,-(a7)
- move.w #1,-(a7)
- move.w #16,-(a7)
- jsr flib::frame_rect
- lea 8(a7),a7
- pea _comment(pc)
- jsr tios::ST_showHelp
- lea 4(a7),a7
-
- move.b #2,(dir)
- move.b #1,(zdir)
-
- fonts #2,#0,#0,#0,p1
- fonts #2,#0,#0,#22,p2
- fonts #2,#0,#0,#44,nb
- fonts #2,#0,#0,#66,rd
- fonts #2,#0,#0,#88,sp
- move.w sco,d0
- move.w #11,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
- move.w scor,d0
- move.w #33,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
-
- move.w tspee,d0
- move.w #77,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
- move.w tspeed,d0
- move.w #99,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
-
- move.w #63,d3
- move.w #60,d4
- move.w #57,d5
- move.w #195,d6
- main_loop:
- clr.b te
- tst.w tios::kb_globals+$1C
- beq touche ;no end
- clr.w tios::kb_globals+$1C
- move.w tios::kb_globals+$1E,d0
- cmp.w #264,d0 ;end
- beq _main
-
- touche: move.w d3,-(a7) ;tests the pixel P1
- move.w d4,-(a7)
- jsr flib::find_pixel
- lea 4(a7),a7 ;reset stack ptr
- btst d0,(a0)
- bne gagne1
-
- chance: cmp.b #1,te
- beq chance2
- move.w d5,-(a7) ;tests the pixel P2
- move.w d6,-(a7)
- jsr flib::find_pixel
- lea 4(a7),a7 ;reset stack ptr
- btst d0,(a0)
- bne gagne2
-
- cmp.b #1,tes
- beq chance2
-
- on d3,d4 ;player1 d3=x d4=y
- on d5,d6 ;player2 d5=x d6=y
-
- move.w d3,d7
- cmp.b #9,fl
- bne suite
- add.b #1,fla
- clr.b fl
- jmp suite1
-
- suite: add.b #1,fl
-
- suite1: move.b fla,d0
- move.w #55,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
- move.w d7,d3
-
- move.w #0,(bou)
- move.w tspe,d0
- mulu.w #200,d0
-
- delay: add.w #1,bou ;loop for wait
- cmp.w bou,d0 ;change delay default=10000
- bne delay
-
- move.w #$FFFD,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #32,d0
- cmpi.b #32,d0
- bne touche3
- move.b #1,(zdir)
-
- touche3:
- move.w #$FFFD,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #128,d0
- cmpi.b #128,d0
- bne touche_cos
- move.b #2,(zdir)
-
- touche_cos:
- move.w #$FFF7,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #64,d0
- cmpi.b #64,d0
- bne touche8
- move.b #4,(zdir)
-
- touche8:
- move.w #$FFDF,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #64,d0
- cmpi.b #64,d0
- bne touche_f2
- move.b #3,(zdir)
-
- touche_f2:
- move.w #$FFEF,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #16,d0
- cmpi.b #16,d0
- bne touche_f6
- move.b #1,(dir)
-
- touche_f6:
- move.w #$FFDF,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #16,d0
- cmpi.b #16,d0
- bne touchez
- move.b #2,(dir)
-
- touchez:
- move.w #$FFFD,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #2,d0
- cmpi.b #2,d0
- bne touchew
- move.b #4,(dir)
-
- touchew:
- move.w #$FFFD,($600018)
- nop
- nop
- nop
- nop
- move.b ($60001B),d0
- not.b d0
- and.b #8,d0
- cmpi.b #8,d0
- bne continu
- move.b #3,(dir)
-
- continu:
- move.b #1,te
- cmp.b #1,(dir)
- beq dir1
- cmp.b #2,(dir)
- beq dir2
- cmp.b #3,(dir)
- beq dir3
- cmp.w #$75,d3
- beq gagne1
- add.b #3,d3
- jmp chance2
-
- dir1: cmp.w #$12,d4
- beq gagne1
- sub.b #3,d4 ;substracte y of p1
- jmp chance2
-
- dir2: cmp.w #$ED,d4
- beq gagne1
- add.b #3,d4
- jmp chance2
-
- dir3: cmp.w #03,d3
- beq gagne1
- sub.b #3,d3 ;substracte x of p1
-
- chance2:
- cmp.b #1,(zdir)
- beq zdir1
- cmp.b #2,(zdir)
- beq zdir2
- cmp.b #3,(zdir)
- beq zdir3
- cmp.w #$75,d5
- beq gagne2
- add.b #3,d5
- jmp retour
-
- zdir1: cmp.w #$12,d6
- beq gagne2
- sub.b #3,d6 ;substracte y of p2
- jmp retour
-
- zdir2: cmp.w #$ED,d6
- beq gagne2
- add.b #3,d6
- jmp retour
-
- zdir3: cmp.w #03,d5
- beq gagne2
- sub.b #3,d5 ;substracte x of p2
-
- retour: cmp.b #1,tes
- beq stope
- jmp main_loop
-
- gagne1: move.w tspee,d7 ;+1 α P2
- cmp.w scor,d7
- beq win1 ;end and winner P1
- add.w #1,scor
- move.b #1,tes
- fonts #0,#0,#27,#122,z18
- jmp chance
-
- gagne2: move.w tspee,d7 ;+1 α P1
- cmp.w sco,d7
- beq win2 ;end and winner P2
- add.w #1,sco
- fonts #0,#0,#185,#122,z19
- jmp stope
-
- stope: move.w sco,d0
- move.w #11,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
- move.w scor,d0
- move.w #33,d3
- bsr shownum
- fonts #2,#4,0,d3,strbuf
- jsr flib::idle_loop
- cmp.w #13,d0
- beq main
- cmp.w #261,d0
- beq pla
- cmp.w #264,d0
- beq _main
- jmp stope
-
- win2: jsr flib::zap_screen ;P1
- fonts #2,#0,#30,#50,z15
- fonts #1,#2,#50,#90,z14
- jsr flib::idle_loop
- cmp.b #13,d0
- beq enter3
- jmp win2
-
- win1: move.w sco,d1
- cmp.w tspee,d1
- beq win3
- jsr flib::zap_screen
- fonts #2,#0,#30,#50,z16 ;P2
- fonts #1,#2,#50,#90,z14
- jsr flib::idle_loop
- cmp.b #13,d0
- beq enter3
- jmp win1
-
- win3: jsr flib::zap_screen
- fonts #2,#0,#30,#50,z17 ;P1&P2
- fonts #1,#2,#50,#90,z14
- jsr flib::idle_loop
- cmp.b #13,d0
- beq enter3
- jmp win3
-
- pla: add.w #1,scor
- jmp stope
-
- enter3: jmp _main
-
- option: jsr flib::zap_screen
- fonts #1,#2,#10,#10,z9
- fonts #1,#2,#10,#30,z10
- fonts #1,#2,#10,#40,z11
- fonts #1,#2,#10,#50,z12
- fonts #1,#2,#10,#60,z13
- fonts #1,#2,#60,#110,z14
- fonts #2,#4,#10,#80,opt
- fonts #2,#4,#10,#90,opt2
-
- bm: move.w tspee,d0
- move.w #80,d3
- bsr shownum
- fonts #2,#4,#67,d3,strbuf
- jsr flib::idle_loop
- cmp.w #$154,d0
- bne bm2
- add.w #1,(tspee)
-
- bm2: cmp.w #$151,d0
- bne bm3
- sub.w #1,(tspee)
-
- bm3: cmp.w #$D,d0
- beq am
- bra bm
-
- am: move.w tspeed,d0
- move.w #90,d3
- bsr shownum
- fonts #2,#4,#67,d3,strbuf
- jsr flib::idle_loop
- cmp.w #$154,d0
- bne am2
- add.w #1,(tspeed)
-
- am2: cmp.w #$151,d0
- bne am3
- sub.w #1,(tspeed)
-
- am3: cmp.w #$D,d0
- beq finam
- bra am
-
- finam: move.w #100,d7
- sub.w tspeed,d7
- move.w d7,tspe
- bra _main
-
- fin: rts
-
- dir dc.b 2
- zdir dc.b 1
- bou dc.w 0
- z4 dc.b 16,"Bienvenue dans le monde TRON",16,0
- z5 dc.b 16," Welcome in the world TRON ",16,0
- z6 dc.b "<ENTER> - Play TRON",0
- z1 dc.b "David H√",0
- z2 dc.b "((((alfred02@club-internet.fr))))",0
- z3 dc.b " ))))ICQ-----10872061----ICQ((((",0
- z7 dc.b "<F1> - Help and Option",0
- z8 dc.b "<ESC> - Exit",0
- p1 dc.b "P1",0
- p2 dc.b "P2",0
- nb dc.b "NB",0
- sp dc.b "SP",0
- rd dc.b "RD",0
- z9 dc.b " PLAYER 1 PLAYER2",0
- z10 dc.b "UP : <F6> <1>",0
- z11 dc.b "DOWN : <F2> <3>",0
- z12 dc.b "LEFT : <W> <8>",0
- z13 dc.b "RIGHT : <Z> <COS>",0
- z14 dc.b "<ENTER> - Main Menu",0
- z15 dc.b " WINNER : PLAYER 1 ",0
- z16 dc.b " WINNER : PLAYER 2 ",0
- z17 dc.b " DRAW !!!! ",0
- z18 dc.b "PLAYER 1",0
- z19 dc.b "PLAYER 2",0
- scor dc.w 0
- sco dc.w 0
- strbuf dc.l 0
- opt dc.b "Round ",17," ",18,0
- opt2 dc.b "Speed ",17," ",18,0
- tspee dc.w 9
- tspeed dc.w 50
- tspe dc.w 50
- fla dc.b 0
- fl dc.b 0
- tes dc.b 0
- te dc.b 0
-
- _comment:
- dc.b " Tron by David H√ 1998",0
-
- end