Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.77 KB | None | 0 0
  1.  
  2. *******************************************************************************
  3. *
  4. * Total Recall FX Picture
  5. *
  6. *******************************************************************************
  7. clr.l -(a7)
  8. move.w #32,-(a7)
  9. trap #1
  10. addq.l #6,a7
  11. move.l d0,old_stack
  12. ;movem.l $ffff8240,d0-d7
  13. ;movem.l d0-d7,old_palette
  14. ;bsr initialise ;standard init file
  15.  
  16. *******************************************************************************
  17. *
  18. * Setup the 2 buffers both and blank and picture onto 256 boundaries
  19. * and copy them
  20. *
  21. *******************************************************************************
  22.  
  23.  
  24. lea save_screenadr,a0 ;Save old screen address
  25. move.b $ffff8201.w,(a0)+ ;
  26. move.b $ffff8203.w,(a0)+ ;
  27. move.b $ffff820d.w,(a0)+ ;
  28.  
  29. movem.l $ffff8240.w,d0-d7 ;Save old palette
  30. movem.l d0-d7,save_pal ;
  31.  
  32. move.l #screen+256,d0 ;Align new screen address
  33. clr.b d0 ;
  34.  
  35. lsr.w #8,d0 ;Set new screen address
  36. move.l d0,$ffff8200.w ;
  37.  
  38. move.b $ffff8260.w,save_res ;Save old resolution
  39. clr.b $ffff8260.w ;Set low resolution
  40.  
  41. move.w #$2700,sr ;Stop all interrupts
  42. move.l $70.w,save_vbl ;Save old VBL
  43. move.l $68.w,save_hbl ;Save old HBL
  44. move.l $134.w,save_ta ;Save old Timer A
  45. move.l $120.w,save_tb ;Save old Timer B
  46. move.l $114.w,save_tc ;Save old Timer C
  47. move.l $110.w,save_td ;Save old Timer D
  48. move.l $118.w,save_acia ;Save old ACIA
  49. move.l #vbl,$70.w ;Install our own VBL
  50. move.l #dummy,$68.w ;Install our own HBL (dummy)
  51. move.l #dummy,$134.w ;Install our own Timer A (dummy)
  52. move.l #dummy,$120.w ;Install our own Timer B
  53. move.l #dummy,$114.w ;Install our own Timer C (dummy)
  54. move.l #dummy,$110.w ;Install our own Timer D (dummy)
  55. move.l #dummy,$118.w ;Install our own ACIA (dummy)
  56. move.b $fffffa09.w,save_intb ;Save MFP state for interrupt enable B
  57. move.b $fffffa15.w,save_intb_mask ;Save MFP state for interrupt mask B
  58. clr.b $fffffa07.w ;Interrupt enable A (Timer-A & B)
  59. clr.b $fffffa13.w ;Interrupt mask A (Timer-A & B)
  60. clr.b $fffffa09.w ;Interrupt enable B (Timer-C & D)
  61. clr.b $fffffa15.w ;Interrupt mask B (Timer-C & D)
  62. move.w #$2300,sr ;Interrupts back on
  63.  
  64. move.b #$12,$fffffc02.w ;Kill mouse
  65.  
  66.  
  67. movem.l sunset+2,d0-d7 copy palette from pic, jmp res
  68. movem.l d0-d7,$ffff8240 and put into pal regs
  69. move.l #buffer,d0 move the location of buffer into d0
  70. add.l #256,d0 add 256
  71. clr.b d0 and clear byte to set on 256 boundary
  72. move.l d0,display display now on 256 boundary
  73. move.l display,a1 set a1 to display location
  74. move.l a1,d1 and put the disp loc in d1
  75. move.l #sunset+34,a3 set a3 to the start of actual pic data (jump res and pal)
  76. move.l #7999,d0 move 7999 or 32000 bytes into d0
  77. copy_buffer:
  78. move.l (a3)+,(a1)+ copy the picture(a3) into the 256 set new position (a1)
  79. dbra d0,copy_buffer until d0=-1
  80. movem.l clear_regs,d0-d7 quick clear registers
  81. move.l #buffer2,d0 move start of buff2 into d0
  82. add.l #256,d0
  83. clr.b d0
  84. move.l d0,display2 standard set onto 256 boundary (non-STE)
  85. move.l display2,d1 display 2 is blank
  86. move.l display,d0 move the pointer (d0) to END of picture minus 160bytes
  87. add.l #31840,d0 by adding 32000-160 to d0
  88. move.l d0,a1 move the end of picture pointer(d0) into a1
  89. move.l display2,a3 move the blank screen (display2) into a3
  90. move.l #40-1,d7 move 40longs into d7 -1 cos dbf/dbra counts to -1 not zero
  91. move.l #200-1,d6 move startscanline (200) into d6
  92. move.l #200-1,d4 this is required to set d6 after each scanline run - constant
  93.  
  94.  
  95.  
  96. move.l #change_screen,d0 move start of buff2 into d0
  97. add.l #256,d0
  98. clr.b d0
  99. move.l d0,change_screen
  100. *******************************************************************************
  101. *
  102. * display the picture
  103. *
  104. *******************************************************************************
  105. bsr disp_it run the base low/med positions by lsr #8
  106. move.l display2,a4 a2/a4 contain unmoved positions to reset
  107. move.l display,a2 data from changed addresses a1/a3
  108.  
  109. *******************************************************************************
  110. *
  111. * Display the picture using scanlines
  112. *
  113. *******************************************************************************
  114.  
  115. one_scan:
  116. rept 40
  117. move.l (a1)+,(a3)+ ;move the scanline at a1 into the display loc at a3
  118. endr
  119.  
  120. ;subq.b #1,d7 ;subtract 1 from d7 (40) for each longword
  121. ;tst.b d7 ;test for zero?
  122.  
  123. ;bne one_scan ;if not done one scanline then repeat
  124.  
  125.  
  126. move.l d0,a1 ;move end display back into a1
  127. move.l #40,d7 ;explicit move on 40 into d7 to reset "scanlines done" number
  128. dbf d6,one_scan ;has the whole scanline been done?
  129.  
  130.  
  131. move.w #$700,$ffff8240
  132. ;bsr v_sync
  133.  
  134. move.l d0,-(sp)
  135. move.l vblcount,d0
  136. not_changed
  137. cmp.l vblcount,d0
  138. beq not_changed
  139. move.l (sp)+,d0
  140.  
  141.  
  142. move.w #$000,$ffff8240
  143. move.l a2,d0
  144. add.l #31840,d0
  145. addi.w #160,d5 ;add 160 to the amount we are going to subtract from the last picture position
  146. sub.l d5,d0 ;<--- ;then subtract how many scanlines we've already done
  147. move.l d0,a1 ;<--- ;and move this into the picture start pos 31840-d0
  148. move.l a4,a3 ;reset pointers
  149. move.l d4,d6 ;move 200 into d6
  150. dbra d4,one_scan ;has the whole picture been copied?
  151.  
  152. ;bsr sndh_init
  153.  
  154. *******************************************************************************
  155. *
  156. * Main loop rountine
  157. *
  158. *******************************************************************************
  159.  
  160. ;---------------------------------------
  161. .mainloop: tst.w vblcount ;Wait VBL
  162. beq.s .mainloop ;
  163. clr.w vblcount ;
  164.  
  165. cmp.b #$39,$fffffc02.w ;Space?
  166. bne.s .mainloop ;
  167. ;----------------------------------------
  168.  
  169. *******************************************************************************
  170. *
  171. * Restore everything back to normal
  172. *
  173. *******************************************************************************
  174.  
  175.  
  176. move.w #$2700,sr ;Stop all interrupts
  177. move.l save_vbl,$70.w ;Restore old VBL
  178. move.l save_hbl,$68.w ;Restore old HBL
  179. move.l save_ta,$134.w ;Restore old Timer A
  180. move.l save_tb,$120.w ;Restore old Timer B
  181. move.l save_tc,$114.w ;Restore old Timer C
  182. move.l save_td,$110.w ;Restore old Timer D
  183. move.l save_acia,$118.w ;Restore old ACIA
  184. move.b save_intb,$fffffa09.w ;Restore MFP state for interrupt enable B
  185. move.b save_intb_mask,$fffffa15.w ;Restore MFP state for interrupt mask B
  186. clr.b $fffffa1b.w ;Timer B control (Stop)
  187. move.w #$2300,sr ;Interrupts back on
  188.  
  189. move.b save_res,$ffff8260.w ;Restore old resolution
  190.  
  191. movem.l save_pal,d0-d7 ;Restore old palette
  192. movem.l d0-d7,$ffff8240.w ;
  193.  
  194. lea save_screenadr,a0 ;Restore old screen address
  195. move.b (a0)+,$ffff8201.w ;
  196. move.b (a0)+,$ffff8203.w ;
  197. move.b (a0)+,$ffff820d.w ;
  198.  
  199. move.b #$8,$fffffc02.w ;Enable mouse
  200.  
  201. move.l save_stack,-(a7)
  202. move.w #32,-(a7)
  203. trap #1
  204. addq.l #6,a7
  205.  
  206. clr.l -(a7)
  207. trap #1
  208.  
  209.  
  210. vbl:
  211.  
  212. addq.w #1,vblcount
  213.  
  214. move.l d0,-(sp)
  215. move.l change_screen,d1
  216. lsr.w #8,d1 ;Set new screen address
  217. move.l d1,$ffff8200.w
  218. move.l (sp)+,d1
  219.  
  220.  
  221.  
  222. rte
  223.  
  224. dummy: rte
  225.  
  226. *******************************************************************************
  227. *
  228. * Display the screen
  229. *
  230. *******************************************************************************
  231. disp_it:
  232. movem.l d0-d7/a0-a6,-(sp) ;save regs
  233. bsr v_sync
  234. ;the following routine destroys nearly everything
  235. clr.b $ffff820d.w ;clear ste extra bit
  236. lsr.l #8,d1
  237. move.b d1,$ffff8203.w
  238. lsr.w #8,d1
  239. move.b d1,$ffff8201.w
  240. movem.l (sp)+,d0-d7/a0-a6 ;restore old regs
  241.  
  242. rts
  243.  
  244. *******************************************************************************
  245. *
  246. * SNDH Routine
  247. *
  248. *******************************************************************************
  249. sndh_init:
  250. movem.l d0-a6,-(sp)
  251. move.w #5,d0
  252. ;move.w #50,d7
  253. bsr.w player
  254. movem.l (sp)+,d0-a6
  255. rts
  256. sndh_exit:
  257. movem.l d0-a6,-(sp)
  258. bsr.w player+4
  259. movem.l (sp)+,d0-a6
  260. rts
  261. sndh_play:
  262. bsr player+8
  263. bsr player+8
  264. bsr player+8
  265. bsr player+8
  266. rts
  267. *******************************************************************************
  268. *
  269. * DATA and BSS
  270. *
  271. *******************************************************************************
  272. data
  273. include 'b:\init.s'
  274. even
  275. sunset: incbin 'B:\data\sunset3.pi1'
  276. player: incbin 'B:\data\dachip.snd'
  277. even
  278.  
  279. bss
  280. buffer: ds.b 32000
  281. ds.b 256
  282. buffer2: ds.b 32000
  283. ds.b 256
  284. old_stack: ds.l 1
  285. old_palette: ds.l 8
  286. display ds.l 1
  287. display2 ds.l 1
  288. clear_regs: ds.l 8
  289. raster_ofs: ds.w 1
  290. vblcount: ds.w 1
  291. screen: ds.b 32000+256
  292. save_pal: ds.w 16
  293. save_screenadr: ds.l 1
  294. save_vbl: ds.l 1
  295. save_hbl: ds.l 1
  296. save_ta: ds.l 1
  297. save_tb: ds.l 1
  298. save_tc: ds.l 1
  299. save_td: ds.l 1
  300. save_acia: ds.l 1
  301. save_intb: ds.b 1
  302. save_intb_mask: ds.b 1
  303. save_res: ds.b 1
  304. save_stack: ds.l 1
  305. change_screen ds.l 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement