v1.s 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. SECTION platform,Code_c
  2. opt c-
  3. incdir "code:platform/"
  4. include "data/system_equates
  5. include "data/system_equates2"
  6. ****compiler directives defines
  7. col_test equ 0
  8. music equ 0
  9. sound_fx equ 0
  10. panel_update equ 0
  11. all_samples equ 0
  12. map_graphics equ 0
  13. squiz_mortal equ 0
  14. show_demo equ 0
  15. *end directives
  16. intreqr equ $01e
  17. TRUE EQU 1
  18. FALSE EQU 0
  19. WINDOW_WIDTH EQU 192
  20. WINDOW_ACTUAL_WIDTH EQU 189
  21. WINDOW_HEIGHT EQU 94
  22. ALIEN_BORDER EQU 48
  23. BYTES_PER_ROW EQU 64
  24. SAFE_OVERSCROLL_AREA EQU 50*BYTES_PER_ROW
  25. HEIGHT EQU 512+ALIEN_BORDER*2
  26. SCROLL_HEIGHT EQU HEIGHT
  27. BACKGROUND_SCROLL_HEIGHT EQU (256+128)
  28. BACKPLANES EQU 4
  29. PANEL_SIZE EQU (16*BYTES_PER_ROW)
  30. WINDOW_SIZE EQU (WINDOW_WIDTH/8)*WINDOW_HEIGHT*4
  31. WINDOW_ALLOC EQU WINDOW_SIZE*2
  32. *-========================================================-
  33. BACKGROUND EQU (BYTES_PER_ROW*HEIGHT)+SAFE_OVERSCROLL_AREA*2
  34. SCENARY EQU (BYTES_PER_ROW*BACKGROUND_SCROLL_HEIGHT*BACKPLANES)+SAFE_OVERSCROLL_AREA
  35. Max_No_Objects EQU 45 ; Maximum 20 (screen drawn) objects
  36. Max_Blit_Width EQU 4 ; Maximum 48 pixels wide + 16 for shift
  37. Max_Blit_Height EQU 48 ; Maximum 48 pixels high
  38. Object_Planes EQU 4 ; 4 planes, 16 colours
  39. SAVEBACK_BUFFER_SIZE EQU Max_Blit_Width*2*Max_Blit_Height*Object_Planes*Max_No_Objects+1
  40. MEMORY_SIZE EQU ((BACKGROUND*BACKPLANES*2)+SCENARY+(PANEL_SIZE*4))+WINDOW_ALLOC+SAVEBACK_BUFFER_SIZE*2
  41. ***********************GAME FLAGS**********************
  42. MAIN_GAME equ 0
  43. LEVEL_SELECTION equ 4
  44. SHOW_TITLE_SCREEN equ 8
  45. QUIT equ 999
  46. FINISHED_ROUTINE equ $ff ;for benifit of rotation routine
  47. *-==========================================================-
  48. ************************************************************
  49. **** SET BALL ROLLING ****
  50. ************************************************************
  51. movem.l d0-d7/a0-a6,-(sp)
  52. * move.w #LEVEL_SELECTION,game_flags
  53. move.w #Show_Title_screen,game_flags
  54. move.b #1,music_flag
  55. *** move.l #tune,mt_data
  56. move.l #tune,a0
  57. ifd music
  58. jsr mt_init
  59. endc
  60. bra set_up_darklites_mega_game ;set up all system
  61. ************************************************************
  62. **** D A R K L I T E I N T E R R U P T ****
  63. ************************************************************
  64. darkint
  65. movem.l d0-d7/a0-a6,-(sp)
  66. ifd music
  67. tst.b music_flag
  68. beq.s dont_play_music
  69. jsr mt_music
  70. endc
  71. dont_play_music
  72. ifd panel_update
  73. tst update_player_status
  74. beq.s dont_update_status
  75. bsr do_timer
  76. bsr do_coins_total
  77. bsr do_score
  78. dont_update_status
  79. endc
  80. move.b $dff014,d2
  81. move.b d2,resistance+1
  82. move.w #$0001,$dff034
  83. movem.l (sp)+,d0-d7/a0-a6
  84. dc.w $4ef9
  85. oldint dc.l 0
  86. music_flag dc.b 0
  87. even
  88. play_colours
  89. dc.b 0
  90. even
  91. two_channel_flag dc.b 0
  92. even
  93. update_player_status
  94. dc.w 0
  95. *-========================================================-
  96. ************************************************************
  97. **** M A I N R O U T I N E ****
  98. ************************************************************
  99. mainroutine
  100. move.w Game_Flags,d0
  101. move.l #routine_jump_table,a0
  102. move.l (A0,d0.w),a0
  103. jsr (a0)
  104. cmp.w #QUIT,Game_Flags
  105. bne.s mainroutine
  106. rts
  107. routine_jump_table
  108. dc.l main_game_routine
  109. dc.l level_select_routine
  110. dc.l show_routine
  111. *************************************************************
  112. **** E N D M A I N R O U T I N E ****
  113. ************************************************************
  114. ************************************************************
  115. **** L E V E L S E L E C T ****
  116. ************************************************************
  117. level_select_routine
  118. bsr Selection_Setup
  119. *BSR draw_paths
  120. level_select_loop
  121. bsr sync
  122. jsr display_sprite
  123. *bsr Password_Entry_Routine
  124. *bsr Create_Password
  125. tst.w transit_flag
  126. bne.s moving_frame
  127. bsr Position_Stage_Player
  128. bsr move_stage_player
  129. cmp.w #-1,d0 ; level selected
  130. beq.s level_selected
  131. bra.s done_frame_code
  132. moving_frame
  133. bsr walk_the_line
  134. bsr walk_the_line
  135. done_frame_code
  136. bra.s level_select_loop
  137. level_selected
  138. move.w #MAIN_GAME,Game_Flags
  139. rts
  140. ************************************************************
  141. **** M A I N G A M E ****
  142. ************************************************************
  143. Set_Level_Number
  144. move.l #Level_Pointers,a0
  145. *move.w player_at_stage,d0
  146. move.w #1,d0
  147. subq.w #1,d0
  148. move.l (a0,d0.w*4),a1
  149. move.l a1,current_game_level
  150. rts
  151. main_game_routine
  152. bsr Set_Level_Number
  153. bsr setup_coin_pointers
  154. bsr set_up_level_details
  155. bsr setup_main_screen_copper
  156. bsr setup_sprite_data
  157. bsr setup_panel_cols
  158. bsr Setup_Enemies
  159. bsr setup_screen_colours
  160. bsr setup_coin_pointers ;done again after setting up map
  161. bsr add_coins_to_screen
  162. bsr display_player ;ensure no sprite crap appears
  163. main_loop
  164. bsr sync
  165. bsr get_stick_readings
  166. bsr draw_player ;pain pain pain pain pain
  167. bsr test_for_collected_coins
  168. bsr swap_buffers
  169. bsr update_scroll
  170. bsr update_background_scroll
  171. bsr add_on_scroll_offsets
  172. bsr check_player_velocitys
  173. bsr replace_savebacks
  174. bsr Clear_Nosaves
  175. bsr draw_coins
  176. bsr Player_Object_Collision
  177. bsr object_collision
  178. bsr add_player_effects ;smoke etc
  179. bsr move_bobs
  180. bsr Move_player_On_Object
  181. bsr draw_blocks_for_front
  182. bsr draw_blocks_for_back
  183. jsr store_nosaves
  184. jsr draw_nosaves
  185. jsr SaveBack_Enemies
  186. jsr Draw_Enemies_in
  187. bsr update_the_player
  188. bsr display_player
  189. bsr get_catch_up_values
  190. bsr process_coins
  191. bsr update_coin_frame
  192. bsr do_screen_effects_routine
  193. bsr player_hit
  194. bsr sound_effects
  195. btst.b #6,$bfe001
  196. bne.s not_hit_btt
  197. move.w #QUIT,Game_Flags
  198. not_hit_btt
  199. cmp.w #MAIN_GAME,Game_Flags
  200. beq main_loop
  201. rts
  202. ************************************************************
  203. *********** UPDATE THE PLAYER *********
  204. ************************************************************
  205. update_the_player
  206. cmp.w #SQUIZ_DYING,player_death_flag
  207. beq.s squiz_death_squirm
  208. bsr update_player
  209. rts
  210. squiz_death_squirm
  211. bsr do_squiz_death
  212. rts
  213. ************************************************************
  214. *********** DO SCREEN EFFECTS ROUTINE *********
  215. ************************************************************
  216. do_screen_effects_routine
  217. dc.w $4ef9
  218. screen_effects_routine
  219. dc.l 0
  220. rts
  221. ***************************************************
  222. ********** SWAP BUFFERS **********
  223. ***************************************************
  224. swap_buffers
  225. move.l plane1,d0
  226. move.l buffered_plane1,plane1
  227. move.l d0,buffered_plane1
  228. * Cripes what a load of lists, Glens a lovely person and i should be lucky to code with him
  229. move.l OLDBOB,d0
  230. move.l OLDBOB_BUFFER,OLDBOB
  231. move.l d0,OLDBOB_BUFFER
  232. move.l FRIENDLY,d0
  233. move.l FRIENDLY_BUFFER,FRIENDLY
  234. move.l d0,FRIENDLY_BUFFER
  235. move.l REPLACE_AREA,d0
  236. move.l REPLACE_AREA_BUFFER,REPLACE_AREA
  237. move.l d0,REPLACE_AREA_BUFFER
  238. move.l CLEAR_AREA,d0
  239. move.l CLEAR_AREA_BUFFER,CLEAR_AREA
  240. move.l d0,CLEAR_AREA_BUFFER
  241. move.l SAVEBACK_AREA,d0
  242. move.l SAVEBACK_BUFFER,SAVEBACK_AREA
  243. move.l d0,SAVEBACK_BUFFER
  244. move.l CLEAR_LIST,D0
  245. move.l CLEAR_LIST_BUFFER,CLEAR_LIST
  246. move.l d0,CLEAR_LIST_BUFFER
  247. rts
  248. ************************************************************
  249. ***** S C R E E N S Y N C **********
  250. ************************************************************
  251. sync
  252. move.w #$0010,intreq(a6)
  253. wait_for_bit
  254. btst.b #4,intreqr+1(a6)
  255. beq.s wait_for_bit
  256. rts
  257. ************************************************************
  258. **** P A U S E ****
  259. ************************************************************
  260. pause
  261. move.w #30000,d4
  262. force_long_wait
  263. dbra d4,force_long_wait
  264. rts
  265. ***********************************************************
  266. ****** REPLACE SYSTEM ****
  267. ***********************************************************
  268. Replace_System
  269. move.l oldint,$6c.w ; replace old interrupt
  270. move.w System_Interrupts,d0
  271. bset.l #15,d0
  272. move.w #$7fff,intena(a6) ;
  273. move.w d0,intena(a6) ; turn on interrupts
  274. MOVE.L EXEC_BASE,A6 ; Exec Base
  275. JSR Permit(A6) ; Re-Permit Tasking
  276. move.l EXEC_BASE,a6 ; get exec location
  277. lea GRAF_NAME,a1 ; library (graphics)
  278. moveq #0,d0 ; version 0
  279. jsr Open_Library(A6) ; open it
  280. tst.l D0 ; open unsuccessfull?
  281. beq No_Lib ; yes then get out
  282. MOVE.L D0,_GFXBASE ; otherwise store addr
  283. MOVE.L _GFXBASE,A4
  284. MOVE.L 38(A4),$DFF000+COP1LC ; Startlist back to copper
  285. CLR.W $DFF000+COPJMP1 ; Trigger copper
  286. MOVE.W #$8020+128,$DFF000+DMACON ; Sprite + Copper ON
  287. move.w #$000f,$dff000+dmacon ; sound off
  288. move.b #$9b,$bfed01 ; keyboard ON
  289. ; 1200 Gay regs
  290. move.w #$2100,$dff1e4
  291. move.w #0,$dff106
  292. move.w #0,$dff10c
  293. move.w #0,$dff1fc
  294. move.l exec,a6
  295. move.l _GFXBASE,a1
  296. jsr -414(a6)
  297. rts
  298. ************************************************************
  299. ******** I N C L U D E S *******
  300. ************************************************************
  301. include "glens_code/player_routines.s"
  302. include "glens_code/player_draw_routines.s"
  303. include "glens_code/joy_routines.s"
  304. include "glens_code/update_scroll.s"
  305. include "glens_code/block_effects.s"
  306. include "glens_code/collision_routines.s"
  307. include "glens_code/colour_routines.s"
  308. include "glens_code/coin_routines.s"
  309. include "glens_code/screen_effects.s"
  310. include "glens_code/setup_routines.s"
  311. include "stus_code/alien_routines.s"
  312. include "stus_code/level_select_routines.s"
  313. include "sound/game_sound.s"
  314. include "glens_code/window_routines.s"
  315. include "glens_code/quick_text_routines.s"
  316. include "glens_code/show_code.s"
  317. include "stus_code/alien_variables.s"
  318. include "stus_code/Character_Animations.s"
  319. include "stus_code/random_routine.s"
  320. include "stus_code/Character_Data.s"
  321. include "data/game_data.s"
  322. include "graphics/fsquizleft5.bin"
  323. include "graphics/fsquizright5.bin"
  324. include "graphics/newsquizrot.s"
  325. jumpleft
  326. include "graphics/squizjumpleft.s"
  327. fallrighttail
  328. include "graphics/squizjumpright.s"
  329. lefttails EQU leftbodys+(SFS/2)
  330. rightbodys EQU righttails+(SFS/2)
  331. tailright EQU spinright+(SFS/2)
  332. jumplefttail EQU jumpleft+(SFS/2)
  333. jumpright EQU fallrighttail+(SFS)+SFS/2
  334. jumprighttail EQU fallrighttail+(SFS)
  335. fallright EQU fallrighttail+SFS/2
  336. fallleft EQU jumpleft+(SFS)
  337. falllefttail EQU jumpleft+(SFS)+SFS/2
  338. ifd sound_fx
  339. include "sound/effects.s"
  340. endc
  341. even
  342. include "sound/replay26.s"
  343. even
  344. tune
  345. ifd music
  346. incbin "scratch:modules/sweetsong"
  347. EVEN
  348. endc
  349. cave_blocks
  350. * incbin "graphics/caveforegraphics"
  351. even
  352. cave_background_blocks
  353. * incbin "graphics/cavebackgraphics"
  354. even
  355. country_blocks
  356. incbin "graphics/dizzyforegroundblocks"
  357. even
  358. country_background_blocks
  359. incbin "graphics/dizzybackblocks"
  360. * incbin "graphics/backblocks"
  361. even
  362. include "data/block_data_information.s"
  363. even
  364. include "glens_code/coin_routine_data.s"
  365. even
  366. textwindowgraphics
  367. incbin "graphics/textwindow.s"
  368. even
  369. include "data/copper_list.s"
  370. Level_Select_Graphics
  371. ifd map_graphics
  372. *incbin "graphics/levelselectmap.bin"
  373. incbin "graphics/showfrigscreen.bin"
  374. endc
  375. even
  376. window_font
  377. include "graphics/font.s"
  378. even
  379. include "glens_code/level_code.s"
  380. include "glens_code/map_data.s"
  381. include "data/colour_maps.s"
  382. level_dpaint_cols
  383. incbin "stus_code/level_select_cols.bin"
  384. even
  385. current_game_level dc.l another_country_level
  386. current_game_level_number dc.w 1
  387. show_stuff
  388. include "glens_code/fireworks.s"
  389. title_screen
  390. incbin "graphics/title.bin"