dev.s 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. section test,code_c
  2. incdir "dh1:game/platform/"
  3. exec equ 4 ; amiga executive o/s base
  4. SERPER equ $032 ; serial port period and control
  5. SERDATR equ $018 ; serial port data and status read
  6. SERDAT equ $030
  7. INTREQ equ $09c ; interrupt request bits
  8. INTENA equ $09a ; interrupt enable bits
  9. CUSTOM EQU $DFF000 ; start of amigas hardware
  10. BPLCONO EQU $100
  11. BPLCON1 EQU $102
  12. BPLCON2 EQU $104
  13. BPL1MOD EQU $108
  14. BPL2MOD EQU $10a
  15. DDFSTRT EQU $092
  16. DDFSTOP EQU $094
  17. DIWSTRT EQU $08E
  18. DIWSTOP EQU $090
  19. VPSOR EQU $004
  20. COLOUR0 EQU $180
  21. COLOUR1 EQU $182
  22. COLOUR2 EQU $184
  23. COLOUR3 EQU $186
  24. DMACON EQU $096
  25. COP1LCH EQU $080
  26. COPJMP1 EQU $088
  27. DMAF_BLITTER EQU $0040
  28. DMAF_BLTDONE EQU $4000
  29. DMAF_BLTNZERO EQU $2000
  30. DMAB_BLTDONE EQU 14
  31. bltddat EQU $000
  32. dmaconr EQU $002
  33. vposr EQU $004
  34. vhposr EQU $006
  35. dskdatr EQU $008
  36. joy0dat EQU $00A
  37. joy1dat EQU $00C
  38. clxdat EQU $00E
  39. bltcon0 EQU $040
  40. bltcon1 EQU $042
  41. bltafwm EQU $044
  42. bltalwm EQU $046
  43. bltcpt EQU $048
  44. bltbpt EQU $04C
  45. bltapt EQU $050
  46. bltdpt EQU $054
  47. bltsize EQU $058
  48. bltcmod EQU $060
  49. bltbmod EQU $062
  50. bltamod EQU $064
  51. bltdmod EQU $066
  52. bltcdat EQU $070
  53. bltbdat EQU $072
  54. bltadat EQU $074
  55. dsksync EQU $07E
  56. cop1lc EQU $080
  57. cop2lc EQU $084
  58. bpldat EQU $110
  59. MODE_OLDFILE EQU 1005
  60. MODE_NEWFILE EQU 1006
  61. STARTOFMAINCODE
  62. bsr setup
  63. cmp.w #0,error_flag
  64. beq aok
  65. rts
  66. aok
  67. move.l #colours,a1
  68. bsr setup_screen_colours
  69. move.l backscr1,a0
  70. add.l #(128+20)*40,a0
  71. move.w #40-1,d0
  72. fill_plat
  73. move.l #$ffffffff,(a0)+
  74. dbra d0,fill_plat
  75. bsr mainroutine
  76. bsr winddown
  77. rts
  78. mainroutine
  79. bsr sync
  80. move.w #$f00,$dff180
  81. bsr get_stick_readings
  82. bsr update_player
  83. bsr display_player
  84. move.w #$0,$dff180
  85. bsr pause
  86. btst #6,$bfe001
  87. bne mainroutine
  88. rts
  89. pause
  90. move.w #10000,d0
  91. wait_p
  92. dbra d0,wait_p
  93. rts
  94. sync
  95. move.w $dff006,d0
  96. andi.w #$ff00,d0
  97. bne.s sync
  98. rts
  99. *****************************************************************
  100. *Module Name :setup *
  101. *Function :sets up screen,allocates mem *
  102. *****************************************************************
  103. setup
  104. move.l 4,a6 ; exec
  105. move.l #(40*256)*3,d0 ; mem to allocate 3 planes 258*336 wide two screens for swiching
  106. move.l #1<<1+1<<16,d1 ; chip and clear
  107. jsr -198(a6) ; try
  108. tst.l d0
  109. bne allocated_mem
  110. move.w #1,error_flag
  111. rts ; otherwise quit
  112. allocated_mem
  113. move.l d0,backscr1
  114. add.l #40*256,d0
  115. move.l d0,backscr2
  116. add.l #40*256,d0
  117. move.l d0,backscr3
  118. LEA CUSTOM,A0
  119. MOVE.W #$3200,BPLCONO(A0) ;set up 6 planes dual-playfield
  120. MOVE.W #0,BPLCON1(A0)
  121. MOVE.W #0,BPL1MOD(A0) ; for 320 wide screen
  122. MOVE.W #0,BPL2MOD(A0)
  123. MOVE.W #$0038,DDFSTRT(A0)
  124. MOVE.W #$00D0,DDFSTOP(A0)
  125. MOVE.W #$2C81,DIWSTRT(A0)
  126. MOVE.W #$2CC1,DIWSTOP(A0)
  127. MOVE.L #COPPERL,COP1LCH(A0)
  128. MOVE.W COPJMP1(A0),D0
  129. MOVE.W #$8380,DMACON(A0)
  130. move.w #$8020,DMACON(a0) ;sprites on
  131. move.l backscr1,d0
  132. MOVE.W D0,PLANELOW
  133. SWAP D0
  134. MOVE.W D0,PLANEHIGH
  135. move.l backscr2,d0
  136. MOVE.W D0,PLANE2LOW
  137. SWAP D0
  138. MOVE.W D0,PLANE2HIGH
  139. move.l backscr3,d0
  140. MOVE.W D0,PLANE3LOW
  141. SWAP D0
  142. MOVE.W D0,PLANE3HIGH
  143. move.l exec,a6 ; use our label
  144. jsr -120(a6) ; disable system tasking
  145. rts
  146. *****************************************************************
  147. *Module Name :winddown *
  148. *Function :deallocates mem, exits to system *
  149. *****************************************************************
  150. winddown
  151. move.l 4,a6 ; deallocate mem
  152. move.l #(40*256)*3,d0
  153. move.l backscr1,a1
  154. jsr -210(a6)
  155. MOVE.L #graf_name,A1
  156. MOVEQ #0,D0
  157. JSR -552(A6) ; OPEN GRAPHICS LIBRARY
  158. MOVE.L D0,a4
  159. MOVE.L #$DFF000,A6
  160. MOVE.L 38(A4),COP1LCH(A6) ; GET SYSTEM COPPER
  161. CLR.W COPJMP1(A6)
  162. MOVE.W #$8030,$DFF096 ; ENABLE SPRITES
  163. move.l exec,a6 ; use our label
  164. jsr -126(a6) ; enable system tasking
  165. RTS
  166. COPPERL
  167. DC.W $00E0
  168. PLANEHIGH DC.W 0
  169. DC.W $00E2
  170. PLANELOW DC.W 0
  171. DC.W $00E4
  172. PLANE2HIGH DC.W 0
  173. DC.W $00E6
  174. PLANE2LOW DC.W 0
  175. DC.W $00E8
  176. PLANE3HIGH DC.W 0
  177. DC.W $00Ea
  178. PLANE3LOW DC.W 0
  179. dc.w $120 ;all sprite stuff
  180. sprite0h dc.w $0
  181. dc.w $122
  182. sprite0l dc.w 0
  183. dc.w $124
  184. sprite1h dc.w $0
  185. dc.w $126
  186. sprite1l dc.w 0
  187. dc.w $128
  188. sprite2h dc.w $0
  189. dc.w $12a
  190. sprite2l dc.w 0
  191. dc.w $12c
  192. sprite3h dc.w $0
  193. dc.w $12e
  194. sprite3l dc.w 0
  195. dc.w $130
  196. sprite4h dc.w $0
  197. dc.w $132
  198. sprite4l dc.w 0
  199. dc.w $134
  200. sprite5h dc.w $0
  201. dc.w $136
  202. sprite5l dc.w 0
  203. dc.w $138
  204. sprite6h dc.w $0
  205. dc.w $13a
  206. sprite6l dc.w 0
  207. dc.w $13c
  208. sprite7h dc.w $0
  209. dc.w $13e
  210. sprite7l dc.w 0
  211. main_screen_colours
  212. dc.w $180
  213. dc.w 0
  214. dc.w $182
  215. dc.w 0
  216. dc.w $184
  217. dc.w 0
  218. dc.w $186
  219. dc.w 0
  220. dc.w $188
  221. dc.w 0
  222. dc.w $18a
  223. dc.w 0
  224. dc.w $18c
  225. dc.w 0
  226. dc.w $18e
  227. dc.w 0
  228. dc.w $190
  229. dc.w 0
  230. dc.w $192
  231. dc.w 0
  232. dc.w $194
  233. dc.w 0
  234. dc.w $196
  235. dc.w 0
  236. dc.w $198
  237. dc.w 0
  238. dc.w $19a
  239. dc.w 0
  240. dc.w $19c
  241. dc.w 0
  242. dc.w $19e
  243. dc.w 0
  244. other_colours
  245. dc.w $1a0
  246. dc.w 0
  247. dc.w $1a2
  248. dc.w 0
  249. dc.w $1a4
  250. dc.w 0
  251. dc.w $1a6
  252. dc.w 0
  253. dc.w $1a8
  254. dc.w 0
  255. dc.w $1aa
  256. dc.w 0
  257. dc.w $1ac
  258. dc.w 0
  259. dc.w $1ae
  260. dc.w 0
  261. dc.w $1b0
  262. dc.w 0
  263. dc.w $1b2
  264. dc.w 0
  265. dc.w $1b4
  266. dc.w 0
  267. dc.w $1b6
  268. dc.w 0
  269. dc.w $1b8
  270. dc.w 0
  271. dc.w $1ba
  272. dc.w 0
  273. dc.w $1bc
  274. dc.w 0
  275. dc.w $1be
  276. dc.w 0
  277. DC.W $ffFF,$FFFE
  278. graf_name dc.b "graphics.library",0
  279. EVEN
  280. error_flag dc.w 0
  281. backscr1 Dc.l 0
  282. backscr2 Dc.l 0
  283. backscr3 Dc.l 0
  284. **********************************
  285. *** SETUP_SCREEN_COLOURS ****
  286. **********************************
  287. setup_screen_colours
  288. ***send colour map in a1
  289. move.l #main_screen_colours+2,a3
  290. move.w #32-1,d0
  291. fill_scr_colours
  292. move.w (a1)+,(a3)
  293. add.l #4,a3
  294. dbra d0,fill_scr_colours
  295. rts
  296. colours
  297. dc.w $bbb,$960,$fff,$fff,$fff,$fff,$fff,$fff
  298. dc.w 0,$fff,$fff,$fff,$fff,$fff,$fff,$fff
  299. dc.w 0,$e35,$f00,$b00,$f78,$d56,$fff,$0cc
  300. dc.w $000,$c70,$ff2,$33d,$56f
  301. dc.w 0,$fff,$fff,$fff,$fff,$fff,$fff,$fff
  302. include "glens_code/joy_routines.s"
  303. include "graphics/player_graphics.s"
  304. incdir "dh1:game/platform/develop/"
  305. include "glens_code/player_routines.s"