init.s 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. ********************************************************************************
  2. * oo oo *
  3. * \( )/ Bullfrog Programming Demo \( )/ *
  4. * ^ ^^ ^ ^ ^^ ^ *
  5. ********************************************************************************
  6. _init
  7. tst.w delay
  8. beq.s .let_do_init
  9. sub.w #1,delay
  10. bra .not_init
  11. .let_do_init
  12. cmp.w #NO_LIVES,game_over
  13. bge.s .not_alive
  14. tst.w to_collect
  15. bne.s .not_init
  16. move.w #0,fallen
  17. bsr _clear_objects
  18. bsr _clear_bad_guys
  19. move.w current_level,d0
  20. bge.s .on_last_level
  21. move.w #MAX_LEVELS-1,d0
  22. .on_last_level
  23. asl.w #TWO,d0
  24. add.w #1,current_level
  25. add.w #1,total_levels
  26. cmp.w #MAX_LEVELS,current_level
  27. bne.s .ok
  28. move.w #0,current_level
  29. .ok
  30. move.w #0,man_vx
  31. move.w #150*4,man_y
  32. move.w #0,man_x
  33. move.w .init_table(pc,d0.w),d0
  34. jmp .init_table(pc,d0.w)
  35. even
  36. .init_table dc.w lev0-.init_table
  37. dc.w lev1-.init_table
  38. dc.w lev2-.init_table
  39. dc.w lev3-.init_table
  40. *insert extra level labels into jump table here
  41. dc.w .not_init-.init_table
  42. .not_alive
  43. move.w #1,died
  44. .not_init
  45. rts
  46. lev0
  47. lea _map0,a0
  48. move.l a0,map_pointer
  49. lea _objects,a0
  50. move.w #1,OBJ_ON(a0)
  51. lea OBJ_SIZE(a0),a0
  52. move.w #1,OBJ_ON(a0)
  53. move.w #304,OBJ_X(a0)
  54. lea OBJ_SIZE(a0),a0
  55. move.w #1,OBJ_ON(a0)
  56. move.w #96,OBJ_X(a0)
  57. lea OBJ_SIZE(a0),a0
  58. move.w #1,OBJ_ON(a0)
  59. move.w #304,OBJ_X(a0)
  60. move.w #50,OBJ_Y(a0)
  61. lea OBJ_SIZE(a0),a0
  62. move.w #1,OBJ_ON(a0)
  63. move.w #192,OBJ_X(a0)
  64. move.w #4,to_collect
  65. lea _bad_guys,a0
  66. move.w #BAD_STATE_LEFT,BAD_ON(a0)
  67. move.w #160,BAD_X(a0)
  68. move.w #160,BAD_Y(a0)
  69. move.w #BAD_LEFT_START,BAD_FRAME(a0)
  70. lea BAD_SIZE(a0),a0
  71. move.w #BAD_STATE_RIGHT,BAD_ON(a0)
  72. move.w #176,BAD_X(a0)
  73. move.w #160,BAD_Y(a0)
  74. move.w #BAD_RIGHT_START,BAD_FRAME(a0)
  75. lea BAD_SIZE(a0),a0
  76. move.w #BAD_STATE_RIGHT,BAD_ON(a0)
  77. move.w #176,BAD_X(a0)
  78. move.w #0,BAD_Y(a0)
  79. move.w #BAD_RIGHT_START,BAD_FRAME(a0)
  80. rts
  81. lev1
  82. lea _map1,a0
  83. move.l a0,map_pointer
  84. lea _objects,a0
  85. move.w #1,OBJ_ON(a0)
  86. move.w #112,OBJ_X(a0)
  87. lea OBJ_SIZE(a0),a0
  88. move.w #1,OBJ_ON(a0)
  89. move.w #128,OBJ_X(a0)
  90. lea OBJ_SIZE(a0),a0
  91. move.w #1,OBJ_ON(a0)
  92. move.w #144,OBJ_X(a0)
  93. lea OBJ_SIZE(a0),a0
  94. move.w #1,OBJ_ON(a0)
  95. move.w #160,OBJ_X(a0)
  96. lea OBJ_SIZE(a0),a0
  97. move.w #1,OBJ_ON(a0)
  98. move.w #176,OBJ_X(a0)
  99. lea OBJ_SIZE(a0),a0
  100. move.w #1,OBJ_ON(a0)
  101. move.w #192,OBJ_X(a0)
  102. lea OBJ_SIZE(a0),a0
  103. move.w #1,OBJ_ON(a0)
  104. move.w #64,OBJ_X(a0)
  105. move.w #48,OBJ_Y(a0)
  106. lea OBJ_SIZE(a0),a0
  107. move.w #1,OBJ_ON(a0)
  108. move.w #240,OBJ_X(a0)
  109. move.w #48,OBJ_Y(a0)
  110. move.w #8,to_collect
  111. lea _bad_guys,a0
  112. move.w #1,BAD_ON(a0)
  113. move.w #80,BAD_X(a0)
  114. move.w #96,BAD_Y(a0)
  115. lea BAD_SIZE(a0),a0
  116. move.w #1,BAD_ON(a0)
  117. move.w #112,BAD_X(a0)
  118. move.w #16,BAD_Y(a0)
  119. rts
  120. lev2
  121. lea _map2,a0
  122. move.l a0,map_pointer
  123. lea _objects,a0
  124. move.w #1,OBJ_ON(a0)
  125. lea OBJ_SIZE(a0),a0
  126. move.w #1,OBJ_ON(a0)
  127. move.w #304,OBJ_X(a0)
  128. move.w #2,to_collect
  129. lea _bad_guys,a0
  130. move.w #BAD_STATE_LEFT,BAD_ON(a0)
  131. move.w #32,BAD_X(a0)
  132. move.w #48,BAD_Y(a0)
  133. move.w #BAD_LEFT_START,BAD_FRAME(a0)
  134. lea BAD_SIZE(a0),a0
  135. move.w #BAD_STATE_RIGHT,BAD_ON(a0)
  136. move.w #160,BAD_X(a0)
  137. move.w #80,BAD_Y(a0)
  138. move.w #BAD_RIGHT_START,BAD_FRAME(a0)
  139. rts
  140. lev3
  141. lea _map3,a0
  142. move.l a0,map_pointer
  143. lea _objects,a0
  144. move.w #1,OBJ_ON(a0)
  145. lea OBJ_SIZE(a0),a0
  146. move.w #1,OBJ_ON(a0)
  147. move.w #304,OBJ_X(a0)
  148. move.w #2,to_collect
  149. lea _bad_guys,a0
  150. move.w #BAD_STATE_LEFT,BAD_ON(a0)
  151. move.w #160,BAD_X(a0)
  152. move.w #160,BAD_Y(a0)
  153. move.w #BAD_LEFT_START,BAD_FRAME(a0)
  154. lea BAD_SIZE(a0),a0
  155. move.w #BAD_STATE_RIGHT,BAD_ON(a0)
  156. move.w #0,BAD_X(a0)
  157. move.w #48,BAD_Y(a0)
  158. move.w #BAD_RIGHT_START,BAD_FRAME(a0)
  159. rts
  160. ********************************************************************************
  161. _clear_objects
  162. lea _objects,a0
  163. move.w #MAX_OBJECTS-1,d0
  164. .loop
  165. move.w #0,OBJ_ON(a0)
  166. move.w #0,OBJ_X(a0)
  167. move.w #0,OBJ_Y(a0)
  168. move.w #0,OBJ_FRAME(a0)
  169. lea OBJ_SIZE(a0),a0
  170. dbra d0,.loop
  171. rts
  172. ********************************************************************************
  173. _clear_bad_guys
  174. lea _bad_guys,a0
  175. move.w #MAX_BADDIES-1,d0
  176. .loop
  177. move.w #0,BAD_ON(a0)
  178. move.w #0,BAD_X(a0)
  179. move.w #0,BAD_Y(a0)
  180. move.w #0,BAD_FRAME(a0)
  181. move.w #BAD_FRAME_DELAY,BAD_DELAY(a0)
  182. lea BAD_SIZE(a0),a0
  183. dbra d0,.loop
  184. rts
  185. ********************************************************************************