home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 92 / asm / source / fargo-old / dumbadv.asm < prev    next >
Encoding:
Assembly Source File  |  2001-07-01  |  10.1 KB  |  236 lines

  1.         @program        prog_code,prog_name
  2.  
  3.         include macros.h
  4.  
  5. ;************** Start of Fargo program **************
  6.  
  7. prog_code:
  8.         move.b          #0,hassword
  9.         move.w          #10,health
  10.         move.w          #20,draghealth          ;Initialize variables
  11.         move.w          #0,numkills
  12.  
  13. title_screen:
  14.         jsr             flib[clr_scr]           ;Clear the screen
  15.         SetFont         #2                      ;Set font size
  16.         WriteStr        #40,#20,#1,title        ;Print "DUMB Adventure v2.0"
  17.         SetFont         #1                      ;Set font size
  18.         WriteStr        #55,#40,#1,bywho        ;Print "By Daniel Plaisted"
  19.         WriteStr        #60,#50,#1,myaddress    ;Print "dsplaisted@juno.com"
  20.         WriteStr        #45,#70,#1,thanks        ;Print "Thanks to Chris Deer for"
  21.         WriteStr        #45,#80,#1,thanks2       ;Print "lots of programming help."
  22.         jsr             flib[idle_loop]         ;Wait for keypress
  23.  
  24.  
  25. room1:
  26.         jsr             flib[clr_scr]           ;FLIB call to Screen Clear
  27.         cmp.b           #1,hassword
  28.         beq             room2
  29.         SetFont         #1                      ;set the font
  30.         WriteStr        #0,#10,#1,rm1swd        ;Print "There is a sword on the ground."
  31.         WriteStr        #0,#40,#1,rm1chsw       ;Print "2. Pick up the sword."
  32. room2:
  33.         WriteStr        #0,#0,#1,rm1txt         ;Print "You are in a room."
  34.         WriteStr        #0,#30,#1,rm1goout      ;Print "1: Go out the door."
  35. roomtest:
  36.         jsr             flib[idle_loop]
  37.         cmpi.b          #49,d0                  ;check for key '1'
  38.         beq             outside
  39.         cmpi.b          #50,d0                  ;check for key '2'
  40.         beq             skphassd
  41.         cmpi.b          #264,d0                 ;check for ESC
  42.         beq             quit
  43.         bra             roomtest                ;else return
  44.  
  45. skphassd:
  46.         move.b          #1,hassword             ;1->hassword
  47.         bra             room1                   ;goto room1
  48.  
  49. outside:
  50.         jsr             flib[clr_scr]           ;clear screen
  51.         WriteStr        #0,#0,#1,outsidetxt     ;Print "You are outside."
  52.         WriteStr        #0,#10,#1,outsidedrg    ;Print "There is a dragon in the distance."
  53.         WriteStr        #0,#30,#1,outsidech1    ;Print "1. Go back inside."
  54.         WriteStr        #0,#40,#1,outsidech2    ;Print "2. Go towards the Dragon."
  55. outsidetest:
  56.         jsr             flib[idle_loop]
  57.         cmpi.b          #49,d0
  58.         beq             room1
  59.         cmpi.b          #50,d0
  60.         beq             dragonfight
  61.         cmpi.b          #264,d0
  62.         beq             quit
  63.         bra             outsidetest
  64.  
  65. dragonfight:
  66.         cmpi.w          #0,health
  67.         beq             lose                    ;if health = 0 goto lose
  68.         cmpi.w          #0,draghealth
  69.         beq             beatdrag                ;if draghealth = 0 goto beatdrag
  70.         jsr             flib[clr_scr]           ;clear screen
  71.         WriteStr        #0,#0,#1,attack         ;Print "1. Attack"
  72.         WriteStr        #0,#10,#1,runaway       ;Print "2. Run away."
  73.         WriteStr        #0,#30,#1,healthtxt     ;Print "Your health:"
  74.         WriteStr        #0,#40,#1,draghealthtxt ;Print "Dragon's health:"
  75.         clr.l           d0
  76.         clr.l           d1
  77.         move.w          draghealth,d0               ;variable
  78.         moveq           #2,d1                       ;dec. places
  79.         lea             strbuf(pc),a0
  80.         bsr             ConvStr
  81.         WriteStr        #100,#40,#1,strbuf
  82.         move.w          health,d0
  83.         moveq           #2,d1
  84.         lea             strbuf(pc),a0
  85.         bsr             ConvStr
  86.         WriteStr        #78,#30,#1,strbuf
  87. dragonfighttest:
  88.         jsr             flib[idle_loop]         ;keypress->d0
  89.         cmpi.w          #50,d0
  90.         beq             outside                 ;if d0=50 goto outside
  91.         cmpi.w          #264,d0
  92.         beq             quit
  93.         sub.w           #1,draghealth           ;draghealth-1 -> draghealth
  94.         sub.w           #2,health               ;health-2 -> health
  95.         cmp.b           #1,hassword             
  96.         beq             moredam                 ;if hassword=1 goto moredam
  97.         bra             dragonfight             ;(else) goto dragonfight
  98. moredam:
  99.         sub.w           #4,draghealth           ;draghealth-4 -> draghealth
  100.         bra             dragonfight             ;goto dragonfight
  101.  
  102. beatdrag:
  103.         jsr             flib[clr_scr]           ;clear screen
  104.         WriteStr        #0,#0,#1,wintext        ;Print "You kill the dragon with your sword."
  105.         jsr             flib[idle_loop]         ;Wait for keypress
  106.         addi.w          #1,numkills             ;numkills+1 -->numkills
  107.         jsr             flib[clr_scr]           ;clear screen
  108.         WriteStr        #0,#0,#1,beatdragtxt    ;Print "You beat the dragon."
  109.         WriteStr        #0,#10,#1,gotfood       ;Print "You found some food."
  110.         WriteStr        #0,#30,#1,dgoback       ;Print "1. Go back to the building."
  111.         WriteStr        #0,#40,#1,dend          ;Print "2. End this DUMB adventure."
  112.         WriteStr        #10,#71,#1,numkilltxt   ;Print "Kills so far:"
  113.         move.w          numkills,d0
  114.         moveq           #3,d1
  115.         lea             strbuf(pc),a0
  116.         bsr             ConvStr
  117.         WriteStr        #90,#71,#1,strbuf
  118. beatdragtest:
  119.         jsr             flib[idle_loop]
  120.         cmpi.w          #50,d0
  121.         beq             lose1
  122.         cmpi.w          #264,d0
  123.         beq             quit
  124.         cmpi.w          #49,d0
  125.         bne             beatdragtest
  126.         jsr             flib[clr_scr]
  127.         WriteStr        #0,#0,#1,walkback
  128.         jsr             flib[idle_loop]
  129.         WriteStr        #5,#10,#1,newdrag       ;Print "You see another dragon approaching."
  130.         jsr             flib[idle_loop]         ;wait for keypress
  131.         move.w          #10,health              ;restore health- you ate the food
  132.         move.w          #20,draghealth          ;new dragon has full health.
  133.         bra             outside                 ;goto outside
  134.  
  135. lose:
  136.         jsr             flib[clr_scr]           ;clear screen
  137.         WriteStr        #0,#0,#1,losetxt        ;Print "The dragon kills you and eats you."
  138.         jsr             flib[idle_loop]         ;Wait for keypress
  139. lose1:
  140.         move.w          hiscore,d0
  141.         move.w          numkills,d1
  142.         cmp.w           d0,d1
  143.         bge             newhigh                 ;if hiscore<=numkills goto newhigh
  144. rethi:
  145.         jsr             flib[clr_scr]           ;clear screen
  146.         WriteStr        #0,#0,#1,endtext        ;Print "Thank you for playing my DUMB adventure :)"
  147.         WriteStr        #0,#30,#1,whathigh      ;Print "The high score is:"
  148.         clr.l           d0
  149.         move.w          hiscore,d0              ;number to print
  150.         moveq           #4,d1
  151.         lea             strbuf(pc),a0
  152.         bsr             ConvStr
  153.         WriteStr        #120,#30,#1,strbuf
  154.         jsr             flib[idle_loop]         ;Wait for keypress
  155.         bra             quit                    ;end
  156.  
  157. newhigh:
  158.         jsr             flib[clr_scr]           ;clear screen
  159.         WriteStr        #0,#0,#1,gothigh        ;Print "You got the high score!"
  160.         move.w          numkills,hiscore        ;numkills -> hiscore
  161.         jsr             flib[idle_loop]         ;wait for keypress
  162.         bra             rethi                   ;goto rethi
  163.  
  164. quit:
  165.         rts
  166.  
  167. ConvStr:                ;Converts a number to a decimal string
  168.  adda.l  d1,a0          ;I think Jimmy Mardell wrote it, I have no idea
  169.  clr.b   (a0)           ;how it works :(
  170.  subq.b  #1,d1
  171. RepConv:
  172.  divu     #10,d0
  173.  move.l  d0,d2
  174.  lsr.l     #8,d2
  175.  lsr.l     #8,d2
  176.  add.b     #48,d2
  177.  move.b  d2,-(a0)
  178.  and.l     #$FFFF,d0
  179.  dbra     d1,RepConv
  180.  rts
  181.  
  182.  
  183. ;****************************************************
  184.  
  185. prog_name:
  186.                 dc.b    "Dumb adventure by DSPlaisted",0
  187. title           dc.b    "DUMB Adventure v2.0",0
  188. bywho           dc.b    "By Daniel Plaisted",0
  189. myaddress       dc.b    "dsplaisted@juno.com",0
  190. thanks          dc.b    "Thanks to Chris Deer for",0
  191. thanks2         dc.b    "lots of programming help.",0
  192. text            dc.b    "You are in a room.",0
  193. rm1txt          dc.b    "You are in a room.  There is a door",0
  194. rm1swd          dc.b    "There is a sword on the ground.",0
  195. rm1chsw         dc.b    "2: Pick up the sword.",0
  196. rm1goout        dc.b    "1: Go out the door.",0
  197. outsidetxt      dc.b    "You are outside.",0
  198. outsidedrg      dc.b    "There is a dragon in the distance.",0
  199. outsidech1      dc.b    "1: Go back inside.",0
  200. outsidech2      dc.b    "2: Go towards the dragon.",0
  201. losetxt         dc.b   "The dragon kills you and eats you.",0
  202. dofight         dc.b   "1. Attack the dragon.",0
  203. dontfight       dc.b   "2. Run away.",0
  204. healthtxt       dc.b   "Your health:",0
  205. draghealthtxt   dc.b   "Dragon's health:",0
  206. wintext         dc.b    "You kill the dragon with your sword",0
  207. beatdragtxt     dc.b    "You beat the dragon.",0
  208. gotfood         dc.b    "You found some food.",0
  209. walkback        dc.b    "As you are walking back...",0
  210. newdrag         dc.b    "You see another dragon approaching.",0
  211. dgoback         dc.b    "1. Go back to the building.",0
  212. dend            dc.b    "2. End this DUMB adventure.",0
  213. endtext         dc.b    "Thank you for playing my DUMB adventure",0
  214. numkilltxt      dc.b    "Kills so far:",0
  215. whathigh        dc.b    "The high score is:",0
  216. gothigh         dc.b    "You got the high score!",0
  217. hassword        dc.b    0
  218. attack          dc.b    "1. Attack",0
  219. runaway         dc.b    "2. Run away.",0
  220. dragontxt       dc.b    "You meet up with the dragon."
  221.  
  222. strbuf          dc.l    0,0
  223.  
  224. health          dc.w    0
  225. draghealth      dc.w    0
  226. numkills        dc.w    0
  227. hiscore         dc.w    0
  228.  
  229. ;************** End of Fargo program ****************
  230.  
  231.         reloc_open
  232.                 add_library     flib
  233.                 add_library     romlib
  234.         reloc_close
  235.         end
  236.