Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *******************************************************************************
- *
- * Total Recall FX Picture
- *
- *******************************************************************************
- clr.l -(a7)
- move.w #32,-(a7)
- trap #1
- addq.l #6,a7
- move.l d0,old_stack
- ;movem.l $ffff8240,d0-d7
- ;movem.l d0-d7,old_palette
- ;bsr initialise ;standard init file
- *******************************************************************************
- *
- * Setup the 2 buffers both and blank and picture onto 256 boundaries
- * and copy them
- *
- *******************************************************************************
- lea save_screenadr,a0 ;Save old screen address
- move.b $ffff8201.w,(a0)+ ;
- move.b $ffff8203.w,(a0)+ ;
- move.b $ffff820d.w,(a0)+ ;
- movem.l $ffff8240.w,d0-d7 ;Save old palette
- movem.l d0-d7,save_pal ;
- move.l #screen+256,d0 ;Align new screen address
- clr.b d0 ;
- lsr.w #8,d0 ;Set new screen address
- move.l d0,$ffff8200.w ;
- move.b $ffff8260.w,save_res ;Save old resolution
- clr.b $ffff8260.w ;Set low resolution
- move.w #$2700,sr ;Stop all interrupts
- move.l $70.w,save_vbl ;Save old VBL
- move.l $68.w,save_hbl ;Save old HBL
- move.l $134.w,save_ta ;Save old Timer A
- move.l $120.w,save_tb ;Save old Timer B
- move.l $114.w,save_tc ;Save old Timer C
- move.l $110.w,save_td ;Save old Timer D
- move.l $118.w,save_acia ;Save old ACIA
- move.l #vbl,$70.w ;Install our own VBL
- move.l #dummy,$68.w ;Install our own HBL (dummy)
- move.l #dummy,$134.w ;Install our own Timer A (dummy)
- move.l #dummy,$120.w ;Install our own Timer B
- move.l #dummy,$114.w ;Install our own Timer C (dummy)
- move.l #dummy,$110.w ;Install our own Timer D (dummy)
- move.l #dummy,$118.w ;Install our own ACIA (dummy)
- move.b $fffffa09.w,save_intb ;Save MFP state for interrupt enable B
- move.b $fffffa15.w,save_intb_mask ;Save MFP state for interrupt mask B
- clr.b $fffffa07.w ;Interrupt enable A (Timer-A & B)
- clr.b $fffffa13.w ;Interrupt mask A (Timer-A & B)
- clr.b $fffffa09.w ;Interrupt enable B (Timer-C & D)
- clr.b $fffffa15.w ;Interrupt mask B (Timer-C & D)
- move.w #$2300,sr ;Interrupts back on
- move.b #$12,$fffffc02.w ;Kill mouse
- movem.l sunset+2,d0-d7 copy palette from pic, jmp res
- movem.l d0-d7,$ffff8240 and put into pal regs
- move.l #buffer,d0 move the location of buffer into d0
- add.l #256,d0 add 256
- clr.b d0 and clear byte to set on 256 boundary
- move.l d0,display display now on 256 boundary
- move.l display,a1 set a1 to display location
- move.l a1,d1 and put the disp loc in d1
- move.l #sunset+34,a3 set a3 to the start of actual pic data (jump res and pal)
- move.l #7999,d0 move 7999 or 32000 bytes into d0
- copy_buffer:
- move.l (a3)+,(a1)+ copy the picture(a3) into the 256 set new position (a1)
- dbra d0,copy_buffer until d0=-1
- movem.l clear_regs,d0-d7 quick clear registers
- move.l #buffer2,d0 move start of buff2 into d0
- add.l #256,d0
- clr.b d0
- move.l d0,display2 standard set onto 256 boundary (non-STE)
- move.l display2,d1 display 2 is blank
- move.l display,d0 move the pointer (d0) to END of picture minus 160bytes
- add.l #31840,d0 by adding 32000-160 to d0
- move.l d0,a1 move the end of picture pointer(d0) into a1
- move.l display2,a3 move the blank screen (display2) into a3
- move.l #40-1,d7 move 40longs into d7 -1 cos dbf/dbra counts to -1 not zero
- move.l #200-1,d6 move startscanline (200) into d6
- move.l #200-1,d4 this is required to set d6 after each scanline run - constant
- move.l #change_screen,d0 move start of buff2 into d0
- add.l #256,d0
- clr.b d0
- move.l d0,change_screen
- *******************************************************************************
- *
- * display the picture
- *
- *******************************************************************************
- bsr disp_it run the base low/med positions by lsr #8
- move.l display2,a4 a2/a4 contain unmoved positions to reset
- move.l display,a2 data from changed addresses a1/a3
- *******************************************************************************
- *
- * Display the picture using scanlines
- *
- *******************************************************************************
- one_scan:
- rept 40
- move.l (a1)+,(a3)+ ;move the scanline at a1 into the display loc at a3
- endr
- ;subq.b #1,d7 ;subtract 1 from d7 (40) for each longword
- ;tst.b d7 ;test for zero?
- ;bne one_scan ;if not done one scanline then repeat
- move.l d0,a1 ;move end display back into a1
- move.l #40,d7 ;explicit move on 40 into d7 to reset "scanlines done" number
- dbf d6,one_scan ;has the whole scanline been done?
- move.w #$700,$ffff8240
- ;bsr v_sync
- move.l d0,-(sp)
- move.l vblcount,d0
- not_changed
- cmp.l vblcount,d0
- beq not_changed
- move.l (sp)+,d0
- move.w #$000,$ffff8240
- move.l a2,d0
- add.l #31840,d0
- addi.w #160,d5 ;add 160 to the amount we are going to subtract from the last picture position
- sub.l d5,d0 ;<--- ;then subtract how many scanlines we've already done
- move.l d0,a1 ;<--- ;and move this into the picture start pos 31840-d0
- move.l a4,a3 ;reset pointers
- move.l d4,d6 ;move 200 into d6
- dbra d4,one_scan ;has the whole picture been copied?
- ;bsr sndh_init
- *******************************************************************************
- *
- * Main loop rountine
- *
- *******************************************************************************
- ;---------------------------------------
- .mainloop: tst.w vblcount ;Wait VBL
- beq.s .mainloop ;
- clr.w vblcount ;
- cmp.b #$39,$fffffc02.w ;Space?
- bne.s .mainloop ;
- ;----------------------------------------
- *******************************************************************************
- *
- * Restore everything back to normal
- *
- *******************************************************************************
- move.w #$2700,sr ;Stop all interrupts
- move.l save_vbl,$70.w ;Restore old VBL
- move.l save_hbl,$68.w ;Restore old HBL
- move.l save_ta,$134.w ;Restore old Timer A
- move.l save_tb,$120.w ;Restore old Timer B
- move.l save_tc,$114.w ;Restore old Timer C
- move.l save_td,$110.w ;Restore old Timer D
- move.l save_acia,$118.w ;Restore old ACIA
- move.b save_intb,$fffffa09.w ;Restore MFP state for interrupt enable B
- move.b save_intb_mask,$fffffa15.w ;Restore MFP state for interrupt mask B
- clr.b $fffffa1b.w ;Timer B control (Stop)
- move.w #$2300,sr ;Interrupts back on
- move.b save_res,$ffff8260.w ;Restore old resolution
- movem.l save_pal,d0-d7 ;Restore old palette
- movem.l d0-d7,$ffff8240.w ;
- lea save_screenadr,a0 ;Restore old screen address
- move.b (a0)+,$ffff8201.w ;
- move.b (a0)+,$ffff8203.w ;
- move.b (a0)+,$ffff820d.w ;
- move.b #$8,$fffffc02.w ;Enable mouse
- move.l save_stack,-(a7)
- move.w #32,-(a7)
- trap #1
- addq.l #6,a7
- clr.l -(a7)
- trap #1
- vbl:
- addq.w #1,vblcount
- move.l d0,-(sp)
- move.l change_screen,d1
- lsr.w #8,d1 ;Set new screen address
- move.l d1,$ffff8200.w
- move.l (sp)+,d1
- rte
- dummy: rte
- *******************************************************************************
- *
- * Display the screen
- *
- *******************************************************************************
- disp_it:
- movem.l d0-d7/a0-a6,-(sp) ;save regs
- bsr v_sync
- ;the following routine destroys nearly everything
- clr.b $ffff820d.w ;clear ste extra bit
- lsr.l #8,d1
- move.b d1,$ffff8203.w
- lsr.w #8,d1
- move.b d1,$ffff8201.w
- movem.l (sp)+,d0-d7/a0-a6 ;restore old regs
- rts
- *******************************************************************************
- *
- * SNDH Routine
- *
- *******************************************************************************
- sndh_init:
- movem.l d0-a6,-(sp)
- move.w #5,d0
- ;move.w #50,d7
- bsr.w player
- movem.l (sp)+,d0-a6
- rts
- sndh_exit:
- movem.l d0-a6,-(sp)
- bsr.w player+4
- movem.l (sp)+,d0-a6
- rts
- sndh_play:
- bsr player+8
- bsr player+8
- bsr player+8
- bsr player+8
- rts
- *******************************************************************************
- *
- * DATA and BSS
- *
- *******************************************************************************
- data
- include 'b:\init.s'
- even
- sunset: incbin 'B:\data\sunset3.pi1'
- player: incbin 'B:\data\dachip.snd'
- even
- bss
- buffer: ds.b 32000
- ds.b 256
- buffer2: ds.b 32000
- ds.b 256
- old_stack: ds.l 1
- old_palette: ds.l 8
- display ds.l 1
- display2 ds.l 1
- clear_regs: ds.l 8
- raster_ofs: ds.w 1
- vblcount: ds.w 1
- screen: ds.b 32000+256
- save_pal: ds.w 16
- save_screenadr: ds.l 1
- save_vbl: ds.l 1
- save_hbl: ds.l 1
- save_ta: ds.l 1
- save_tb: ds.l 1
- save_tc: ds.l 1
- save_td: ds.l 1
- save_acia: ds.l 1
- save_intb: ds.b 1
- save_intb_mask: ds.b 1
- save_res: ds.b 1
- save_stack: ds.l 1
- change_screen ds.l 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement