Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.02 KB | None | 0 0
  1.  
  2. pal_registers equ $ffff8240
  3.  
  4. *******************************************************************************
  5. *
  6. * Total Recall FX Picture
  7. *
  8. *******************************************************************************
  9. clr.l -(a7)
  10. move.w #32,-(a7)
  11. trap #1
  12. addq.l #6,a7
  13. move.l d0,old_stack
  14.  
  15. movem.l pal_registers,d0-d7
  16. movem.l d0-d7,old_palette
  17.  
  18. bsr initialise ;standard init file
  19.  
  20. *******************************************************************************
  21. *
  22. * Setup the 2 buffers both and blank and picture onto 256 boundaries
  23. * and copy them
  24. *
  25. *******************************************************************************
  26.  
  27. ;copy the pi1 to a 256 boundary
  28.  
  29. movem.l sunset+2,d0-d7 copy palette from pic, jmp res
  30. movem.l d0-d7,pal_registers and put into pal regs
  31.  
  32. move.l #buffer,d0 move the location of buffer into d0
  33. add.l #256,d0 add 256
  34. clr.b d0 and clear byte to set on 256 boundary
  35. move.l d0,display display now on 256 boundary
  36.  
  37.  
  38.  
  39. move.l display,a1 set a1 to display location
  40. move.l a1,d1 and put the disp loc in d1
  41. move.l #sunset+34,a3 set a3 to the start of actual pic data (jump res and pal)
  42. move.l #7999,d0 move 7999 or 32000 bytes into d0
  43.  
  44. copy_buffer:
  45. move.l (a3)+,(a1)+ copy the picture(a3) into the 256 set new position (a1)
  46. dbra d0,copy_buffer until d0=-1
  47.  
  48. **************************************************************************************************
  49. ;and do the second, effectively creating a blank space on a 256 boundary
  50.  
  51. movem.l clear_regs,d0-d7 quick clear registers
  52. move.l #buffer2,d0 move start of buff2 into d0
  53. add.l #256,d0
  54. clr.b d0
  55. move.l d0,display2 standard set onto 256 boundary (non-STE)
  56.  
  57.  
  58. *******************************************************************************************************
  59. *
  60. * Initial values before looping
  61. *
  62. *******************************************************************************************************
  63. move.l display2,d1 display 2 is blank
  64. move.l display,d0 move the pointer (d0) to END of picture minus 160bytes
  65. add.l #32000-160,d0 by adding 32000-160 to d0
  66.  
  67.  
  68. move.l d0,a1 move the end of picture pointer(d0) into a1
  69. move.l display2,a3 move the blank screen (display2) into a3
  70.  
  71. clr.l d7
  72. clr.l d5
  73. move.l #40-1,d7 move 40longs into d7 -1 cos dbf/dbra counts to -1 not zero
  74. move.l #200-1,d6 move startscanline (200) into d6
  75. move.l #200-1,d4 this is required to set d6 after each scanline run - constant
  76.  
  77.  
  78. *******************************************************************************
  79. *
  80. * display the "blank space" onto the video display
  81. * Which will be updated everytime a3 is changed
  82. *
  83. *******************************************************************************
  84. bsr disp_it run the base low/med positions by lsr #8
  85. move.l display2,a4 a2/a4 contain unmoved positions to reset
  86. move.l display,a2 data from changed addresses a1/a3
  87.  
  88. *******************************************************************************
  89. *
  90. * Display the picture using scanlines
  91. *
  92. * Below are initial values of DATA and ADDRESS Registers
  93. *
  94. *******************************************************************************
  95.  
  96. ;a1 = contains start of picture + 31840 (Variable) - display
  97. ;a2 = original start of picture (Constant) - display
  98. ;a3 = the start of the video address that will be changed (Variable) - display2
  99. ;a4 = the start of the video address (Constant) - display 2
  100.  
  101. ;d0 = 31840
  102. ;d1 = display2
  103. ;d2 = unused
  104. ;d3 = unused
  105. ;d4 = 199 Constant
  106. ;d5 = number of scanlines to move up and draw from Variable
  107. ;d6 = test whethr the whole picture has been drawn, does d6=0 (Number of scanlines left)
  108. ;d7 = 40 longwords for copying one scanline
  109.  
  110. ***************************************************************************************************
  111. test_picture_drawn:
  112. test_whole_scanline:
  113. copy_scanline:
  114. move.l (a1)+,(a3)+ ;move the scanline at a1 into the video display at a3
  115. dbra d7,copy_scanline
  116.  
  117. *----------------------------------cut and change for dbra------------------------------------------------------*
  118. ;subq.b #1,d7 ;subtract 1 from d7 (40) for each longword
  119. ;tst.b d7 ;test for zero?
  120. ;bne copy_scanline ;if not done one scanline then repeat
  121. *----------------------------------------------------------------------------------------*
  122.  
  123. move.l d0,a1 ;move end display back into a1
  124. move.l #40,d7 ;explicit move on 40 into d7 to reset "scanlines done" number
  125. dbf d6,test_whole_scanline ;has the whole scanline been done?
  126.  
  127. ** redraw wait vbl routine needed **
  128.  
  129. move.l a2,d0
  130. add.l #31840,d0
  131. addi.w #160,d5 ;add 160 to the amount we are going to subtract from the last picture position
  132. sub.l d5,d0 ;<--- ;then subtract how many scanlines we've already done
  133. move.l d0,a1 ;<--- ;and move this into the picture start pos 31840-d0
  134. move.l a4,a3 ;reset pointers
  135. move.l d4,d6 ;move 200 into d6
  136. dbra d4,test_picture_drawn ;has the whole picture been copied?
  137.  
  138. ;bsr sndh_init
  139.  
  140. *******************************************************************************
  141. *
  142. * Main loop rountine
  143. *
  144. *******************************************************************************
  145.  
  146. main_rout
  147. ;bsr v_sync
  148. ;bsr sndh_play
  149. cmpi.b #$39,$fffffc02 ;standard compare spacebar #$39
  150. bne main_rout ;and loop it until
  151.  
  152.  
  153. *******************************************************************************
  154. *
  155. * Restore everything back to normal
  156. *
  157. *******************************************************************************
  158.  
  159. ;bsr sndh_exit
  160. bsr restore
  161.  
  162. movem.l old_palette,d0-d7
  163. movem.l d0-d7,pal_registers
  164. move.l old_stack,-(a7)
  165. move.w #32,-(a7)
  166. trap #1
  167. addq.l #6,a7
  168. clr.l -(a7)
  169. trap #1
  170.  
  171. *******************************************************************************
  172. *
  173. * Display the screen
  174. *
  175. *******************************************************************************
  176. disp_it:
  177. movem.l d0-d7/a0-a6,-(sp) ;save regs
  178. ;the following routine destroys nearly everything
  179. clr.b $ffff820d.w ;clear ste extra bit
  180. lsr.l #8,d1
  181. move.b d1,$ffff8203.w
  182. lsr.w #8,d1
  183. move.b d1,$ffff8201.w
  184. movem.l (sp)+,d0-d7/a0-a6 ;restore old regs
  185. rts
  186.  
  187. *******************************************************************************
  188. *
  189. * SNDH Routine
  190. *
  191. *******************************************************************************
  192. sndh_init:
  193. movem.l d0-a6,-(sp)
  194. move.w #5,d0
  195. ;move.w #50,d7
  196. bsr.w player
  197. movem.l (sp)+,d0-a6
  198. rts
  199. sndh_exit:
  200. movem.l d0-a6,-(sp)
  201. bsr.w player+4
  202. movem.l (sp)+,d0-a6
  203. rts
  204. sndh_play:
  205. bsr player+8
  206. bsr player+8
  207. bsr player+8
  208. bsr player+8
  209. rts
  210. *******************************************************************************
  211. *
  212. * DATA and BSS
  213. *
  214. *******************************************************************************
  215. data
  216. include 'b:\init.s'
  217. even
  218. sunset: incbin 'B:\data\sunset3.pi1'
  219. player: incbin 'B:\data\dachip.snd'
  220. even
  221.  
  222. bss
  223. buffer: ds.b 32000
  224. ds.b 256
  225. buffer2: ds.b 32000
  226. ds.b 256
  227. old_stack: ds.l 1
  228. old_palette: ds.l 8
  229. display ds.l 1
  230. display2 ds.l 1
  231. clear_regs: ds.l 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement