setup_routines.s 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. SINGLE_PLANE EQU ((OVERSCROLL_OFFSET+SCROLL_HEIGHT)*BPR) ;did have *2 on overscroll offset
  2. PLANE_INC EQU SINGLE_PLANE
  3. SCROLL_MEMORY EQU SINGLE_PLANE*12
  4. MAP_MEMORY EQU BIGGEST_MAP_X*BIGGEST_MAP_Y*3 ;main map word, alien map byte
  5. GAME_MEMORY EQU SCROLL_MEMORY+OVERSCROLL_OFFSET*BPR ; allow for scroll into memory
  6. COPY_STORE EQU SINGLE_PLANE
  7. NUMBER_OF_BLOCKS EQU 1180
  8. BLOCKS_MEMORY EQU (2*16*4)*NUMBER_OF_BLOCKS
  9. LOADER_PIC_SIZE EQU 8116 ;bytes
  10. FAST_MEM_MEMORY EQU MAP_MEMORY+COPY_STORE+BLOCKS_MEMORY+LOADER_PIC_SIZE
  11. MEM_CHIP EQU $02
  12. MEM_FAST EQU $04
  13. MEM_PUBLIC EQU $01 ;Chooses fast first, chip second
  14. MEM_CLEAR EQU $10000
  15. BIT_PLANE_DMA EQU $0100
  16. SPRITE_DMA EQU $0020
  17. BLITTER_NASTY EQU $0400
  18. ******************************************
  19. ***** BLANK OUT WORKBENCH *****
  20. ******************************************
  21. Blank_Out_Workbench
  22. *Display shareware message
  23. **set up pointers and variables so decompression is super quick
  24. move.l #blank_data,d0
  25. move.w d0,swsprite0l
  26. move.w d0,swsprite1l
  27. move.w d0,swsprite2l
  28. move.w d0,swsprite3l
  29. move.w d0,swsprite4l
  30. move.w d0,swsprite5l
  31. move.w d0,swsprite6l
  32. move.w d0,swsprite7l
  33. swap d0
  34. move.w d0,swsprite0h
  35. move.w d0,swsprite1h
  36. move.w d0,swsprite2h
  37. move.w d0,swsprite3h
  38. move.w d0,swsprite4h
  39. move.w d0,swsprite5h
  40. move.w d0,swsprite6h
  41. move.w d0,swsprite7h
  42. move.l #plane_positions,a2
  43. move.l memory_base,d0
  44. move.w d0,SHPLane1_Lo
  45. swap d0
  46. move.w d0,SHPlane1_hi
  47. swap d0
  48. move.l d0,(a2)
  49. add.l #80*256,d0
  50. move.w d0,SHPLane2_Lo
  51. swap d0
  52. move.w d0,SHPlane2_hi
  53. swap d0
  54. move.l d0,4(a2)
  55. add.l #80*256,d0
  56. move.l d0,8(a2)
  57. move.w d0,SHPLane3_Lo
  58. swap d0
  59. move.w d0,SHPlane3_hi
  60. move.l #$dff000,a6
  61. move.l #shareware_screen_copper,cop1lch(a6)
  62. clr.w copjmp1(a6)
  63. move.w #BIT_PLANE_DMA+$8000,dmacon(a6)
  64. move.w #SPRITE_DMA,dmacon(a6)
  65. moveq #0,d3 ;index into plane table
  66. move.w #640,d4 ;screen x size
  67. move.w #3*4,d7 ;number of planes ( *4 cos compare d3 with it - will inc by 4)
  68. move.w #640,d6 ; pixel count ( count down )
  69. move.w #640,d5 ; image loaded size
  70. move.l (a2,d3),a4 ;get first plane
  71. move.l #shareware_pic+4,a1
  72. move.w iff_cols(a1),num_of_cols
  73. move.l a1,colour_map_ptr
  74. add.l #size_of_iff_header,colour_map_ptr
  75. move.w iff_cols(a1),d0
  76. move.l pic_data_size(a1),size_of_pic
  77. ext.l d0
  78. asl d0
  79. add.l #size_of_iff_header,a1
  80. add.l d0,a1
  81. move.l a1,picture_data
  82. moveq #0,d0 ;clear
  83. move.l size_of_pic,d2
  84. jsr compressed_data ;Display pic
  85. move.w #80,text_bpr
  86. * bsr Display_System_Setup
  87. bsr Sync
  88. move.l colour_map_ptr,a0
  89. move.l #game_list,a1
  90. move.w #16-1,d0
  91. copy_share_cols
  92. move.w (a0)+,(a1)+
  93. dbra d0,copy_share_cols
  94. move.l #black_list,a0
  95. move.l #game_list,a1
  96. move.l #share_cols+2,a2
  97. move.w #16-1,d7
  98. move.l #store_text_nums,a3
  99. move.w #3,fade_speed
  100. jsr Fade_List_To_List
  101. *clear black list for later
  102. move.w #16-1,d0
  103. jsr Clear_Black_Colours
  104. rts
  105. FadeAfterLoading
  106. dc.w 0
  107. ******************************************
  108. ***** DISPLAY_SYSTEM_SETUP *****
  109. ******************************************
  110. Display_System_Setup
  111. move.l memory_base,a3
  112. move.w #1,default_colour
  113. tst.w chip_type
  114. beq.s bog_standard
  115. move.l #chip_type_string2,a4
  116. bra.s display_chip_string
  117. bog_standard
  118. move.l #chip_type_string1,a4
  119. display_chip_string
  120. move.w #230,d0
  121. move.w #80,d1
  122. jsr Display_Small_String_Skip
  123. move.l memory_base,a3
  124. cmp.w #ON,xtra_fx
  125. bne.s bog_standard_fx
  126. move.l #xfx_string2,a4
  127. bra.s display_fx_string
  128. bog_standard_fx
  129. move.l #xfx_string1,a4
  130. display_fx_string
  131. move.w #230,d0
  132. move.w #80+9,d1
  133. jsr Display_Small_String_Skip
  134. move.l memory_base,a3
  135. cmp.w #ON,xtra_music
  136. bne.s bog_standard_music
  137. move.l #music_string1,a4
  138. bra.s display_music_string
  139. bog_standard_music
  140. move.l #music_string2,a4
  141. display_music_string
  142. move.w #230,d0
  143. move.w #80+18,d1
  144. jsr Display_Small_String_Skip
  145. *find out fast and chip for interest
  146. move.l EXEC,a6
  147. move.l #MEM_CHIP,d1 ;chip
  148. jsr -$d8(a6) ;avail mem
  149. move.l d0,chip_free
  150. move.l EXEC,a6
  151. move.l #MEM_FAST,d1 ;chip
  152. jsr -$d8(a6) ;avail mem
  153. move.l d0,fast_free
  154. move.l #$dff000,a6 ;reset
  155. *hehe ready for some tacky code...
  156. clr.w d7
  157. move.l chip_free,score
  158. move.l #free_mem_string+25,a5
  159. jsr Convert_Score_To_String
  160. move.l fast_free,score
  161. move.l #free_mem_string+8,a5
  162. jsr Convert_Score_To_String
  163. move.l memory_base,a3
  164. move.l #free_mem_string,a4
  165. move.w #230,d0
  166. move.w #80+27,d1
  167. jsr Display_Small_String_Skip
  168. rts
  169. chip_free dc.l 0
  170. fast_free dc.l 0
  171. chip_type dc.w 0
  172. free_mem_string
  173. dc.b "FAST : 00000000 CHIP : 00000000",0
  174. even
  175. chip_type_string1
  176. dc.b "SYSTEM TYPE : 1000, 500, 500+ or 600",0
  177. even
  178. chip_type_string2
  179. dc.b "SYSTEM TYPE : 1200 OR BETTER",0
  180. even
  181. music_string1
  182. dc.b "IN GAME MUSIC : OPTIONAL ( DEFAULT ON )",0
  183. even
  184. music_string2
  185. dc.b "IN GAME MUSIC : NONE",0
  186. even
  187. xfx_string1
  188. dc.b "EXTRA SOUND FX : NO",0
  189. even
  190. xfx_string2
  191. dc.b "EXTRA SOUND FX : YES",0
  192. even
  193. ******************************************
  194. ***** STOP_SYSTEM *****
  195. ******************************************
  196. Stop_System
  197. movem.l a0-a6/d0-d7,-(sp)
  198. Ensure_Blit_Fin
  199. btst #14,dmaconr+$dff000
  200. bne.s Ensure_Blit_Fin
  201. move.l EXEC,a6
  202. jsr -132(A6) ;DISABLE tasking
  203. movem.l (sp)+,a0-a6/d0-d7
  204. rts
  205. ******************************************
  206. ***** ALLOCATE_GAME_MEMORY *****
  207. ******************************************
  208. Allocate_Game_Memory
  209. move.l EXEC,a6
  210. move.l #GAME_MEMORY,d0
  211. move.l #MEM_CHIP+MEM_CLEAR,d1 ;chip and clear
  212. jsr -198(a6) ;try
  213. tst.l d0
  214. bne allocated_mem
  215. rts ;otherwise quit
  216. allocated_mem
  217. move.l d0,Memory_Base
  218. add.l #OVERSCROLL_OFFSET*BPR,d0
  219. move.l d0,Plane1
  220. move.l d0,resetp1
  221. move.l d0,scroll_area
  222. add.l #SINGLE_PLANE*4,d0
  223. move.l d0,scroll_buff_area
  224. move.l d0,buff_plane1
  225. move.l d0,resetp2
  226. add.l #SINGLE_PLANE*4,d0
  227. move.l d0,copyback_area
  228. move.l EXEC,a6
  229. move.l #FAST_MEM_MEMORY,d0
  230. move.l #MEM_PUBLIC+MEM_CLEAR,d1 ;chip and clear
  231. jsr -198(a6) ;try
  232. tst.l d0
  233. bne allocated_fast_mem
  234. rts ;otherwise quit
  235. allocated_fast_mem
  236. move.l d0,Fast_Memory_Base
  237. move.l d0,buffer_map_memory
  238. add.l #(BIGGEST_MAP_X*BIGGEST_MAP_Y)*MAP_BLOCK_SIZE,d0
  239. move.l d0,buffer_alien_memory
  240. add.l #(BIGGEST_MAP_X*BIGGEST_MAP_Y),d0
  241. move.l d0,copy_store_area
  242. add.l #COPY_STORE,d0
  243. move.l d0,background_block_graphics
  244. add.l #BLOCKS_MEMORY,d0
  245. move.l d0,loader_pic_data
  246. rts
  247. ******************************************
  248. ***** SETUP_SYSTEM *****
  249. ******************************************
  250. Setup_System
  251. LEA CUSTOM,A6
  252. bsr Sync
  253. MOVE.W #0,BPLCON1(A6)
  254. move.w #$83a0,DMACON(a6)
  255. move.w #$000f,DMACON(a6)
  256. MOVE.L #COPPERL,COP1LCH(A6)
  257. MOVE.W COPJMP1(A6),D0
  258. rts
  259. ******************************************
  260. ***** SETUP_INT *****
  261. ******************************************
  262. Setup_Int
  263. move.l $6c,oldint
  264. move.l #darkint,$6c
  265. rts
  266. *********************************************
  267. ***** RELEASE_SYSTEM *****
  268. *********************************************
  269. Release_System
  270. movem.l a0-a6/d0-d7,-(sp)
  271. Ensure_Release_Blit_Fin
  272. btst #14,dmaconr+$dff000
  273. bne.s Ensure_Release_Blit_Fin
  274. MOVE.L EXEC,A6
  275. JSR -138(A6) ;ENABLE tasking
  276. movem.l (sp)+,a0-a6/d0-d7
  277. rts
  278. Fast_Memory_Base
  279. dc.l 0
  280. *********************************************
  281. ***** Replace_System *****
  282. *********************************************
  283. Replace_System
  284. move.l oldint,$6c
  285. move.w #$000f,dmacon(a6)
  286. move.w #$8000+BIT_PLANE_DMA,dmacon(a6)
  287. move.l EXEC,a6
  288. move.l #GAME_MEMORY,d0
  289. move.l Memory_Base,a1
  290. jsr -210(a6)
  291. move.l EXEC,a6
  292. move.l #FAST_MEM_MEMORY,d0
  293. move.l Fast_Memory_Base,a1
  294. jsr -210(a6)
  295. tst.l in_game_music
  296. beq.s no_music_mem_allocated
  297. move.l EXEC,a6
  298. move.l #IN_GAME_MUSIC_BUFFER,d0
  299. move.l in_game_music,a1
  300. jsr -210(a6) ; free only if allocated
  301. no_music_mem_allocated
  302. move.l EXEC,a6
  303. move.l Sound_Fx_Buffer_Size,d0
  304. move.l sfx_mem,a1
  305. jsr -210(a6) ; free only if allocated
  306. no_xtra_fx_allocated
  307. MOVE.L #graf_NAME,A1
  308. MOVEQ #0,D0
  309. JSR -552(A6) ;OPEN GRAPHICS LIBRARY
  310. MOVE.L D0,a4
  311. MOVE.W #$8020,DMACON+$dff000 ; sprites back
  312. move.l 38(a4),$dff080
  313. clr.w $dff088
  314. move.b #$9b,$bfed01
  315. rts
  316. graf_NAME dc.b "graphics.library",0
  317. even
  318. ******************************************
  319. ***** SETUP_COLOURS *****
  320. ******************************************
  321. setup_colours
  322. rts
  323. ******************************************
  324. ***** INSERT_COLOURS *****
  325. ******************************************
  326. Insert_Colours
  327. move.w #$180,d0
  328. move.w #16-1,d1
  329. col_loop
  330. move.w d0,(a0)+
  331. move.w (a1)+,(a0)+
  332. add.w #$2,d0
  333. dbra d1,col_loop
  334. rts
  335. ******************************************
  336. ***** INSERT_32COLOURS *****
  337. ******************************************
  338. Insert_32Colours
  339. move.w #$180,d0
  340. move.w #32-1,d1
  341. col_loop32
  342. move.w d0,(a0)+
  343. move.w (a1)+,(a0)+
  344. add.w #$2,d0
  345. dbra d1,col_loop32
  346. rts
  347. ******************************************
  348. ***** INSERT_SPRITE_COLOURS *****
  349. ******************************************
  350. Insert_Sprite_Colours
  351. move.w #$1A0,d0
  352. move.w #16-1,d1
  353. sp_col_loop
  354. move.w d0,(a0)+
  355. move.w (a1)+,(a0)+
  356. add.w #$2,d0
  357. dbra d1,sp_col_loop
  358. rts
  359. ******************************************
  360. ***** LOAD GAME BASICS *****
  361. ******************************************
  362. Load_Game_Basics
  363. bsr release_system
  364. jsr Construct_Map_Pages
  365. jsr Load_Loader_Pic
  366. jsr Load_Sound_Effects
  367. move.w #1,FadeAfterLoading
  368. bsr stop_system
  369. rts
  370. background_block_graphics dc.l 0