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

  1.     include    "tios.h"
  2.     include    "flib.h"
  3.     xdef    _main
  4.     xdef    _comment
  5.  
  6. ;*****************************************************
  7.  
  8. _main:
  9.     jsr    flib::clr_scr
  10.  
  11.     move.w    #120,d3
  12.     move.w    #064,d4
  13.     move.w    #2,d5
  14.     clr.w    d6
  15.  
  16. main_loop:
  17.     tst.w    tios::kb_globals+$1C
  18.     beq    no_key
  19.     clr.w    tios::kb_globals+$1C
  20.     move.w    tios::kb_globals+$1E,d0
  21.  
  22. try_key_exit:
  23.     cmp.w    #$0108,d0        ; [ESC] to quit
  24.     beq    exit
  25. not_key_exit:
  26. try_key_r:
  27.     cmp.w    #$0072,d0        ; [R] to reverse time
  28.     bne    not_key_r
  29.     not.w    d6
  30. not_key_r:
  31.  
  32. no_key:
  33.     tst.w    d6
  34.     bne    time_reverse
  35.  
  36.     bsr    do_direction
  37. do_langston:
  38.     move.w    d4,-(a7)
  39.     move.w    d3,-(a7)
  40.     jsr    flib::find_pixel
  41.     add.l    #4,a7
  42.     bchg.b    d0,(a0)
  43.     bne    pixel_1
  44. pixel_0:
  45.     add.w    #3,d5
  46.     and.w    #3,d5
  47.     bra    main_loop
  48. pixel_1:
  49.     add.w    #1,d5
  50.     and.w    #3,d5
  51.     bra    main_loop
  52.  
  53. time_reverse:
  54.  
  55.     move.w    d4,-(a7)
  56.     move.w    d3,-(a7)
  57.     jsr    flib::find_pixel
  58.     add.l    #4,a7
  59.     bchg.b    d0,(a0)
  60.     bne    r_pixel_1
  61. r_pixel_0:
  62.     add.w    #3,d5
  63.     and.w    #3,d5
  64.     bra    r_do_direction
  65. r_pixel_1:
  66.     add.w    #1,d5
  67.     and.w    #3,d5
  68.     bra    r_do_direction
  69. r_do_direction:
  70.     bchg.w    #1,d5
  71.     bsr    do_direction
  72.     bchg.w    #1,d5
  73.     bra    main_loop
  74.  
  75. exit:
  76.     rts
  77.  
  78. ;*****************************************************
  79. do_direction:
  80.  
  81. d_0:
  82.     tst.w    d5
  83.     bne    d_1
  84.     add.w    #1,d3
  85.     cmp.w    #240,d3
  86.     bne    dir_done
  87.     clr.w    d3
  88.     rts
  89. d_1:
  90.     cmp.w    #1,d5
  91.     bne    d_2
  92.     add.w    #1,d4
  93.     cmp.w    #121,d4
  94.     bne    dir_done
  95.     clr.w    d4
  96.     rts
  97. d_2:
  98.     cmp.w    #2,d5
  99.     bne    d_3
  100.     sub.w    #1,d3
  101.     bcc    dir_done
  102.     move.w    #239,d3
  103.     rts
  104. d_3:
  105.     sub.w    #1,d4
  106.     bcc    dir_done
  107.     move.w    #120,d4
  108. dir_done:
  109.     rts
  110.  
  111. ;*****************************************************
  112.  
  113. _comment    dc.b    "Langston's Ant",0
  114.  
  115. ;*****************************************************
  116.  
  117.     end
  118.