@program prog_code,prog_name include macros.h ;************** Start of Fargo program ************** prog_code: move.b #0,hassword move.w #10,health move.w #20,draghealth ;Initialize variables move.w #0,numkills title_screen: jsr flib[clr_scr] ;Clear the screen SetFont #2 ;Set font size WriteStr #40,#20,#1,title ;Print "DUMB Adventure v2.0" SetFont #1 ;Set font size WriteStr #55,#40,#1,bywho ;Print "By Daniel Plaisted" WriteStr #60,#50,#1,myaddress ;Print "dsplaisted@juno.com" WriteStr #45,#70,#1,thanks ;Print "Thanks to Chris Deer for" WriteStr #45,#80,#1,thanks2 ;Print "lots of programming help." jsr flib[idle_loop] ;Wait for keypress room1: jsr flib[clr_scr] ;FLIB call to Screen Clear cmp.b #1,hassword beq room2 SetFont #1 ;set the font WriteStr #0,#10,#1,rm1swd ;Print "There is a sword on the ground." WriteStr #0,#40,#1,rm1chsw ;Print "2. Pick up the sword." room2: WriteStr #0,#0,#1,rm1txt ;Print "You are in a room." WriteStr #0,#30,#1,rm1goout ;Print "1: Go out the door." roomtest: jsr flib[idle_loop] cmpi.b #49,d0 ;check for key '1' beq outside cmpi.b #50,d0 ;check for key '2' beq skphassd cmpi.b #264,d0 ;check for ESC beq quit bra roomtest ;else return skphassd: move.b #1,hassword ;1->hassword bra room1 ;goto room1 outside: jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,outsidetxt ;Print "You are outside." WriteStr #0,#10,#1,outsidedrg ;Print "There is a dragon in the distance." WriteStr #0,#30,#1,outsidech1 ;Print "1. Go back inside." WriteStr #0,#40,#1,outsidech2 ;Print "2. Go towards the Dragon." outsidetest: jsr flib[idle_loop] cmpi.b #49,d0 beq room1 cmpi.b #50,d0 beq dragonfight cmpi.b #264,d0 beq quit bra outsidetest dragonfight: cmpi.w #0,health beq lose ;if health = 0 goto lose cmpi.w #0,draghealth beq beatdrag ;if draghealth = 0 goto beatdrag jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,attack ;Print "1. Attack" WriteStr #0,#10,#1,runaway ;Print "2. Run away." WriteStr #0,#30,#1,healthtxt ;Print "Your health:" WriteStr #0,#40,#1,draghealthtxt ;Print "Dragon's health:" clr.l d0 clr.l d1 move.w draghealth,d0 ;variable moveq #2,d1 ;dec. places lea strbuf(pc),a0 bsr ConvStr WriteStr #100,#40,#1,strbuf move.w health,d0 moveq #2,d1 lea strbuf(pc),a0 bsr ConvStr WriteStr #78,#30,#1,strbuf dragonfighttest: jsr flib[idle_loop] ;keypress->d0 cmpi.w #50,d0 beq outside ;if d0=50 goto outside cmpi.w #264,d0 beq quit sub.w #1,draghealth ;draghealth-1 -> draghealth sub.w #2,health ;health-2 -> health cmp.b #1,hassword beq moredam ;if hassword=1 goto moredam bra dragonfight ;(else) goto dragonfight moredam: sub.w #4,draghealth ;draghealth-4 -> draghealth bra dragonfight ;goto dragonfight beatdrag: jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,wintext ;Print "You kill the dragon with your sword." jsr flib[idle_loop] ;Wait for keypress addi.w #1,numkills ;numkills+1 -->numkills jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,beatdragtxt ;Print "You beat the dragon." WriteStr #0,#10,#1,gotfood ;Print "You found some food." WriteStr #0,#30,#1,dgoback ;Print "1. Go back to the building." WriteStr #0,#40,#1,dend ;Print "2. End this DUMB adventure." WriteStr #10,#71,#1,numkilltxt ;Print "Kills so far:" move.w numkills,d0 moveq #3,d1 lea strbuf(pc),a0 bsr ConvStr WriteStr #90,#71,#1,strbuf beatdragtest: jsr flib[idle_loop] cmpi.w #50,d0 beq lose1 cmpi.w #264,d0 beq quit cmpi.w #49,d0 bne beatdragtest jsr flib[clr_scr] WriteStr #0,#0,#1,walkback jsr flib[idle_loop] WriteStr #5,#10,#1,newdrag ;Print "You see another dragon approaching." jsr flib[idle_loop] ;wait for keypress move.w #10,health ;restore health- you ate the food move.w #20,draghealth ;new dragon has full health. bra outside ;goto outside lose: jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,losetxt ;Print "The dragon kills you and eats you." jsr flib[idle_loop] ;Wait for keypress lose1: move.w hiscore,d0 move.w numkills,d1 cmp.w d0,d1 bge newhigh ;if hiscore<=numkills goto newhigh rethi: jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,endtext ;Print "Thank you for playing my DUMB adventure :)" WriteStr #0,#30,#1,whathigh ;Print "The high score is:" clr.l d0 move.w hiscore,d0 ;number to print moveq #4,d1 lea strbuf(pc),a0 bsr ConvStr WriteStr #120,#30,#1,strbuf jsr flib[idle_loop] ;Wait for keypress bra quit ;end newhigh: jsr flib[clr_scr] ;clear screen WriteStr #0,#0,#1,gothigh ;Print "You got the high score!" move.w numkills,hiscore ;numkills -> hiscore jsr flib[idle_loop] ;wait for keypress bra rethi ;goto rethi quit: rts ConvStr: ;Converts a number to a decimal string adda.l d1,a0 ;I think Jimmy Mardell wrote it, I have no idea clr.b (a0) ;how it works :( subq.b #1,d1 RepConv: 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,RepConv rts ;**************************************************** prog_name: dc.b "Dumb adventure by DSPlaisted",0 title dc.b "DUMB Adventure v2.0",0 bywho dc.b "By Daniel Plaisted",0 myaddress dc.b "dsplaisted@juno.com",0 thanks dc.b "Thanks to Chris Deer for",0 thanks2 dc.b "lots of programming help.",0 text dc.b "You are in a room.",0 rm1txt dc.b "You are in a room. There is a door",0 rm1swd dc.b "There is a sword on the ground.",0 rm1chsw dc.b "2: Pick up the sword.",0 rm1goout dc.b "1: Go out the door.",0 outsidetxt dc.b "You are outside.",0 outsidedrg dc.b "There is a dragon in the distance.",0 outsidech1 dc.b "1: Go back inside.",0 outsidech2 dc.b "2: Go towards the dragon.",0 losetxt dc.b "The dragon kills you and eats you.",0 dofight dc.b "1. Attack the dragon.",0 dontfight dc.b "2. Run away.",0 healthtxt dc.b "Your health:",0 draghealthtxt dc.b "Dragon's health:",0 wintext dc.b "You kill the dragon with your sword",0 beatdragtxt dc.b "You beat the dragon.",0 gotfood dc.b "You found some food.",0 walkback dc.b "As you are walking back...",0 newdrag dc.b "You see another dragon approaching.",0 dgoback dc.b "1. Go back to the building.",0 dend dc.b "2. End this DUMB adventure.",0 endtext dc.b "Thank you for playing my DUMB adventure",0 numkilltxt dc.b "Kills so far:",0 whathigh dc.b "The high score is:",0 gothigh dc.b "You got the high score!",0 hassword dc.b 0 attack dc.b "1. Attack",0 runaway dc.b "2. Run away.",0 dragontxt dc.b "You meet up with the dragon." strbuf dc.l 0,0 health dc.w 0 draghealth dc.w 0 numkills dc.w 0 hiscore dc.w 0 ;************** End of Fargo program **************** reloc_open add_library flib add_library romlib reloc_close end