Advertisement
Guest User

Untitled

a guest
Jul 30th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;loops stored at 0x3000
  2. ;score stored at 0x3001
  3. ;ship texture stored at 0x3002
  4. ;astroid texture stored at 0x3003
  5. ;sleepCounter is stored at 0x3004
  6.  
  7. :start
  8.      set [0x9000], 0
  9.      set a, 0
  10.      set b, 0
  11.      set x, 0
  12.      set y, 0
  13.      set z, 0
  14.      set i, 0
  15.      set j, 0
  16.      set c, 0x80E0
  17.      set [0x3002], 0xF03E
  18.      set [c], [0x3002]
  19.      set [0x3000], 1
  20.      set [0x3001], 0
  21.      set [0x3003], 0xf007
  22.      set [0x3004], 0xffff
  23.      set pc, drawbar
  24.  
  25. :sleep
  26.      sub [0x3004], 1
  27.      set PC, loop_1
  28.  
  29. :loop_1
  30.      ifn [0x3004], 0
  31.          set PC, sleep
  32.      set a, [0x3000]
  33.      add a, 1
  34.      set [0x3000], a
  35.      mod a, 0x04FF ;scoreAddTimeout
  36.      ife a, 0x0000
  37.          set PC, addscore
  38. :loop_1_2
  39.      add [0x3000], 1
  40.      set a, [0x3000]
  41.      mod a, 0x00FF ;movetimeout
  42.      ife a, 1
  43.          set PC, loop_2
  44.      set PC, loop_5
  45. :loop_2
  46.      set x, 31
  47.      add x, 0x8000
  48. :loop_3
  49.      add x, 1
  50.      ife [x], [0x3003]
  51.          set PC, moveAstroid
  52. :loop_4
  53.      ifn x, 0x8200
  54.          set PC, loop_3
  55. :loop_5
  56.      set a, [0x9000]
  57.      set [0x9000], 0x0000
  58.      ife a, 0x0001
  59.          set PC, left
  60.      ife a, 0x0004
  61.          set PC, down
  62.      ife a, 0x0002
  63.          set PC, right
  64.      ife a, 0x0003
  65.          set PC, up
  66. :loop_6
  67.      set a, [0x3000]
  68.      mod a, 0x00FF ;placetimeou
  69.      ife a, 0
  70.          set PC, placeAstroid
  71.      set PC, loop_1
  72.  
  73. :moveAstroid
  74.      set [x], 0x0000
  75.      set y, x
  76.      sub x, 1
  77.      ife [x], [0x3002]
  78.          set PC, crash
  79.      sub y, 0x800
  80.      mod y, 32
  81.      ife y, 0
  82.          set PC, loop_4
  83.      set [x], [0x3003]
  84.      set PC, loop_4
  85.  
  86. :addscore
  87.      add [0x3001], 1
  88.      set PC, drawScore
  89.      set PC, loop_1_2
  90.  
  91. :left
  92.      set x, c
  93.      sub x, 0x800
  94.      mod x, 32
  95.      ife x, 0
  96.          set PC, loop_6
  97.      set [c], 0x0000
  98.      sub c, 1
  99.      ife [c], [0x3003]
  100.          set PC, crash
  101.      set [c], [0x3002]
  102.      set PC, loop_6
  103.  
  104. :right
  105.      set x, c
  106.      sub x, 0x800
  107.      mod x, 32
  108.      ife x, 31
  109.          set PC, loop_6
  110.      set [c], 0x0000
  111.      add c, 1
  112.      ife [c], [0x3003]
  113.          set PC, crash
  114.      set [c], [0x3002]
  115.      set PC, loop_6
  116.  
  117. :up
  118.      ifg 0x8040, c
  119.          set PC, loop_6
  120.      set [c], 0x0000
  121.      sub c, 32
  122.      ife [c], [0x3003]
  123.          set PC, crash
  124.      set [c], [0x3002]
  125.      set PC, loop_6
  126.  
  127. :down
  128.      ifg c, 0x81BF
  129.          set PC, loop_6
  130.      set [c], 0x0000
  131.      add c, 32
  132.      ife [c], [0x3003]
  133.          set PC, crash
  134.      set [c], [0x3002]
  135.      set PC, loop_6
  136.  
  137. :drawbar
  138.      set x, 0x8000
  139.      set y, 0x8000
  140.      add y, 480
  141.      set z, 61
  142.      bor z, 0xf001
  143. :drawbarloop
  144.      set [y], z
  145.      set [x], z
  146.      add x, 1
  147.      add y, 1
  148.      ifn x, 0x8020
  149.          set PC, drawbarloop
  150.      set x, 0
  151.      set y, 0
  152.      set z, 0
  153.      set PC, drawScoreText
  154.  
  155. :placeAstroid
  156.      set a, [seed]
  157.      mul a, 0x1235
  158.      add a, 1
  159.      add a, c
  160.      div a, 4
  161.      set [seed], a
  162.      mul a, 7
  163.      mul a, 17
  164.      add a, 0x72da
  165.      mod a, 14
  166.      add a, 2
  167.      mul a, 32
  168.      add a, 0x8000
  169.      sub a, 1
  170.      add [seed], 0x03FA
  171.      mod [seed], a
  172.      ;div [seed], 2
  173.      set [a], [0x3003]
  174.      set PC, loop_1
  175.  
  176. :seed dat 0x02ba
  177.  
  178. :drawScoreText
  179.     ife (scoreText+a), 0
  180.         set PC, loop_1
  181.     set b, (scoreText+a)
  182.     add a, 0x8000
  183.     bor b, 0xf000
  184.     set [a], b
  185.     sub a, 0x8000
  186.     add a, 1
  187.     set PC, drawScoreText
  188.  
  189. :drawScore
  190.     set b, 0x800c
  191.     set x, [0x3001]
  192. :drawScore2
  193.     set a,x
  194.     and a,15
  195.     ifg a,9
  196.         add a,7
  197.     add a,0x30
  198.     bor a,0xf000
  199.     set [b],a
  200.     sub b,1
  201.     shr x,4
  202.     ifn x,0
  203.         set PC, drawScore2
  204.     set PC, loop_1_2
  205.  
  206. :clear
  207.     set a, 0x8000
  208.     set b, 0
  209.     set c, 0
  210. :clearLoop
  211.     set [a], 0
  212.     add a, 1
  213.     ife a, 0x8200
  214.         set PC, start
  215.     set PC, clearLoop
  216.  
  217. :crash
  218.     set [x], 0xf02a
  219.     set b, 0
  220.     set PC, drawGameOver1
  221.  
  222. :crashloop
  223.     ifn [0x9000], 0
  224.         set PC, clear
  225.     set PC, crashloop
  226.  
  227. :drawGameOver1
  228.     set b, 0x80AA
  229.     set c, 0
  230. :drawGameOverLoop1
  231.     set a, (gameOverText+c)
  232.      ife a, 0
  233.         set PC, drawGameOver2
  234.     bor a, 0xf000
  235.     add c, 1
  236.     set [b], a
  237.     add b, 1
  238.     set PC, drawGameOverLoop1
  239.  
  240. :drawGameOver2
  241.     set b, 0x80CA
  242.     set c, 0
  243. :drawGameOverLoop2
  244.     set a, (YouDiedText+c)
  245.     ife a, 0
  246.         set PC, drawGameOver3
  247.     bor a, 0xf000
  248.     add c, 1
  249.     set [b], a
  250.     add b, 1
  251.     set PC, drawGameOverLoop2
  252.  
  253. :drawGameOver3
  254.     set b, 0x80EA
  255.     set c, 0
  256. :drawGameOverLoop3
  257.     set a, (scoreText+c)
  258.     ife a, 0
  259.         set PC, drawGameOver4
  260.     bor a, 0xf000
  261.     add c, 1
  262.     set [b], a
  263.     add b, 1
  264.     set PC, drawGameOverLoop3
  265.  
  266. :drawGameOver4
  267.     set b, 0x80EA
  268.     add b, 32
  269.     set c, 0
  270. :drawGameOverLoop4
  271.     set a, (PressAnyKeyText+c)
  272.     ife a, 0
  273.         set PC, drawScoreAtGameOver
  274.     bor a, 0xf000
  275.     add c, 1
  276.     set [b], a
  277.     add b, 1
  278.     set PC, drawGameOverLoop4
  279.  
  280. :drawScoreAtGameOver
  281.     set b, 0x80EA
  282.     add b, 12
  283.     set x, [0x3001]
  284.     set [0x9000], 0
  285. :drawScoreAtGameOver2
  286.     set a,x
  287.     and a,15
  288.     ifg a,9
  289.         add a,7
  290.     add a,0x30
  291.     bor a,0xf000
  292.     set [b],a
  293.     sub b,1
  294.     shr x,4
  295.     ifn x,0
  296.         set PC, drawScoreAtGameOver2
  297.     set PC, crashloop
  298.  
  299. :scoreText
  300.     dat "SCORE: 0x0000",0
  301. :gameOverText
  302.     dat "GAME OVER",0
  303. :YouDiedText
  304.     dat "YOU DIED",0
  305. :PressAnyKeyText
  306.     dat "Press any key",0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement