dev.s 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. section test,code_c
  2. incdir "dh0:game/platform/develop/"
  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. bsr mainroutine
  70. bsr winddown
  71. rts
  72. mainroutine
  73. bsr sync
  74. bsr get_stick_readings
  75. bsr update_player
  76. bsr display_player
  77. bsr pause
  78. btst #6,$bfe001
  79. bne mainroutine
  80. rts
  81. pause
  82. move.w #10000,d0
  83. wait_p
  84. dbra d0,wait_p
  85. rts
  86. sync
  87. move.w $dff006,d0
  88. andi.w #$ff00,d0
  89. bne.s sync
  90. rts
  91. *****************************************************************
  92. *Module Name :setup *
  93. *Function :sets up screen,allocates mem *
  94. *****************************************************************
  95. setup
  96. move.l 4,a6 ; exec
  97. move.l #(40*256)*3,d0 ; mem to allocate 3 planes 258*336 wide two screens for swiching
  98. move.l #1<<1+1<<16,d1 ; chip and clear
  99. jsr -198(a6) ; try
  100. tst.l d0
  101. bne allocated_mem
  102. move.w #1,error_flag
  103. rts ; otherwise quit
  104. allocated_mem
  105. move.l d0,backscr1
  106. add.l #40*256,d0
  107. move.l d0,backscr2
  108. add.l #40*256,d0
  109. move.l d0,backscr3
  110. LEA CUSTOM,A0
  111. MOVE.W #$3200,BPLCONO(A0) ;set up 6 planes dual-playfield
  112. MOVE.W #0,BPLCON1(A0)
  113. MOVE.W #0,BPL1MOD(A0) ; for 320 wide screen
  114. MOVE.W #0,BPL2MOD(A0)
  115. MOVE.W #$0038,DDFSTRT(A0)
  116. MOVE.W #$00D0,DDFSTOP(A0)
  117. MOVE.W #$2C81,DIWSTRT(A0)
  118. MOVE.W #$2CC1,DIWSTOP(A0)
  119. MOVE.L #COPPERL,COP1LCH(A0)
  120. MOVE.W COPJMP1(A0),D0
  121. MOVE.W #$8380,DMACON(A0)
  122. move.w #$8020,DMACON(a0) ;sprites on
  123. move.l backscr1,d0
  124. MOVE.W D0,PLANELOW
  125. SWAP D0
  126. MOVE.W D0,PLANEHIGH
  127. move.l backscr2,d0
  128. MOVE.W D0,PLANE2LOW
  129. SWAP D0
  130. MOVE.W D0,PLANE2HIGH
  131. move.l backscr3,d0
  132. MOVE.W D0,PLANE3LOW
  133. SWAP D0
  134. MOVE.W D0,PLANE3HIGH
  135. move.l exec,a6 ; use our label
  136. jsr -120(a6) ; disable system tasking
  137. rts
  138. *****************************************************************
  139. *Module Name :winddown *
  140. *Function :deallocates mem, exits to system *
  141. *****************************************************************
  142. winddown
  143. move.l 4,a6 ; deallocate mem
  144. move.l #(40*256)*3,d0
  145. move.l backscr1,a1
  146. jsr -210(a6)
  147. MOVE.L #graf_name,A1
  148. MOVEQ #0,D0
  149. JSR -552(A6) ; OPEN GRAPHICS LIBRARY
  150. MOVE.L D0,a4
  151. MOVE.L #$DFF000,A6
  152. MOVE.L 38(A4),COP1LCH(A6) ; GET SYSTEM COPPER
  153. CLR.W COPJMP1(A6)
  154. MOVE.W #$8030,$DFF096 ; ENABLE SPRITES
  155. move.l exec,a6 ; use our label
  156. jsr -126(a6) ; enable system tasking
  157. RTS
  158. COPPERL
  159. DC.W $00E0
  160. PLANEHIGH DC.W 0
  161. DC.W $00E2
  162. PLANELOW DC.W 0
  163. DC.W $00E4
  164. PLANE2HIGH DC.W 0
  165. DC.W $00E6
  166. PLANE2LOW DC.W 0
  167. DC.W $00E8
  168. PLANE3HIGH DC.W 0
  169. DC.W $00Ea
  170. PLANE3LOW DC.W 0
  171. dc.w $120 ;all sprite stuff
  172. sprite0h dc.w $0
  173. dc.w $122
  174. sprite0l dc.w 0
  175. dc.w $124
  176. sprite1h dc.w $0
  177. dc.w $126
  178. sprite1l dc.w 0
  179. dc.w $128
  180. sprite2h dc.w $0
  181. dc.w $12a
  182. sprite2l dc.w 0
  183. dc.w $12c
  184. sprite3h dc.w $0
  185. dc.w $12e
  186. sprite3l dc.w 0
  187. dc.w $130
  188. sprite4h dc.w $0
  189. dc.w $132
  190. sprite4l dc.w 0
  191. dc.w $134
  192. sprite5h dc.w $0
  193. dc.w $136
  194. sprite5l dc.w 0
  195. dc.w $138
  196. sprite6h dc.w $0
  197. dc.w $13a
  198. sprite6l dc.w 0
  199. dc.w $13c
  200. sprite7h dc.w $0
  201. dc.w $13e
  202. sprite7l dc.w 0
  203. main_screen_colours
  204. dc.w $180
  205. dc.w 0
  206. dc.w $182
  207. dc.w 0
  208. dc.w $184
  209. dc.w 0
  210. dc.w $186
  211. dc.w 0
  212. dc.w $188
  213. dc.w 0
  214. dc.w $18a
  215. dc.w 0
  216. dc.w $18c
  217. dc.w 0
  218. dc.w $18e
  219. dc.w 0
  220. dc.w $190
  221. dc.w 0
  222. dc.w $192
  223. dc.w 0
  224. dc.w $194
  225. dc.w 0
  226. dc.w $196
  227. dc.w 0
  228. dc.w $198
  229. dc.w 0
  230. dc.w $19a
  231. dc.w 0
  232. dc.w $19c
  233. dc.w 0
  234. dc.w $19e
  235. dc.w 0
  236. other_colours
  237. dc.w $1a0
  238. dc.w 0
  239. dc.w $1a2
  240. dc.w 0
  241. dc.w $1a4
  242. dc.w 0
  243. dc.w $1a6
  244. dc.w 0
  245. dc.w $1a8
  246. dc.w 0
  247. dc.w $1aa
  248. dc.w 0
  249. dc.w $1ac
  250. dc.w 0
  251. dc.w $1ae
  252. dc.w 0
  253. dc.w $1b0
  254. dc.w 0
  255. dc.w $1b2
  256. dc.w 0
  257. dc.w $1b4
  258. dc.w 0
  259. dc.w $1b6
  260. dc.w 0
  261. dc.w $1b8
  262. dc.w 0
  263. dc.w $1ba
  264. dc.w 0
  265. dc.w $1bc
  266. dc.w 0
  267. dc.w $1be
  268. dc.w 0
  269. DC.W $ffFF,$FFFE
  270. graf_name dc.b "graphics.library",0
  271. EVEN
  272. error_flag dc.w 0
  273. backscr1 Dc.l 0
  274. backscr2 Dc.l 0
  275. backscr3 Dc.l 0
  276. **********************************
  277. *** SETUP_SCREEN_COLOURS ****
  278. **********************************
  279. setup_screen_colours
  280. ***send colour map in a1
  281. move.l #main_screen_colours+2,a3
  282. move.w #32-1,d0
  283. fill_scr_colours
  284. move.w (a1)+,(a3)
  285. add.l #4,a3
  286. dbra d0,fill_scr_colours
  287. rts
  288. colours
  289. dc.w $080,$fff,$fff,$fff,$fff,$fff,$fff,$fff
  290. dc.w 0,$fff,$fff,$fff,$fff,$fff,$fff,$fff
  291. dc.w 0,$e35,$f00,$b00,$f78,$d56,$fff,$0cc
  292. dc.w $000,$c70,$ff2,$33d,$56f
  293. dc.w 0,$fff,$fff,$fff,$fff,$fff,$fff,$fff
  294. include "glens_code/joy_routines.s"
  295. include "glens_code/player_routines1.s"
  296. incdir "dh0:game/platform/"
  297. include "graphics/player_graphics.s"