Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HInt3:
- tst.w HInt_Flag.w ; branch if h-ints were not enabled
- beq.s .rte ; (makes sure this does not again after we're done)
- move.w #0,HInt_Flag.w ; disable the flag...
- movem.l d0-d1/a0-a2,-(sp) ; push some regs out of the way
- lea VDP_data_port,a1
- move.w #$8AFF,4(a1) ; reset H-int counter
- stopZ80 ; might be a good idea in order to stop Z80 from stealing the 68k bus and breaking timing!
- movea.l HInt_Water_Data.w,a2 ; get water data in a2
- moveq #13-1,d0 ; number of loops to do in place to delay for next h-int (NSTC)
- ; moveq #28-1,d0 ; number of loops to do in place to delay for next h-int (PAL)
- dbf d0,offset(*) ; wait a little here
- move.w (a2)+,d1 ; total number of color groups to write
- move.b Hint_Counter_Reserve+1.w,d0; get the vertical line we are on
- subi.b #200,d0
- bcs.s .moveColors ; if scanlines is less than 200, we are OK here
- sub.b d0,d1 ; sub the remaining number of scanlines from color group count
- bcs.s .skiptransfer ; if remaining line count would be negative, skip
- ; this code seems to start clipping the amount of transfer we do a little bit too early unless the color group count is exactly 24
- ; For the record the number of color groups is 16-20, so it should not be all that noticeable.
- .moveColors move.w (a2)+,d0 ; get offset of colour
- lea Water_Pal.w,a0 ; get water palette
- adda.w d0,a0 ; add to water palette off
- addi.w #$C000,d0 ; set CRAM write mode
- swap d0 ; swap words
- move.l d0,4(a1) ; DMA to VDP
- move.l (a0)+,(a1)
- move.w (a0)+,(a1) ; move all of the 3 colors in one group
- nop
- nop ; only one nop in PAL
- ; moveq #52-1,d0 ; number of loops to do in place to delay for next h-int (PAL)
- moveq #37-1,d0 ; number of loops to do in place to delay for next h-int (NSTC)
- dbf d0,offset(*) ; delay a little
- dbf d1,.moveColors ; loop for all groups
- .skiptransfer startZ80 ; start z80
- movem.l (sp)+,d0-d1/a0-a2 ; pop stack contents
- tst.b Water_Fullscrn_Flag+1.w ; seems to be same in princible as $F64F in Sonic 1, but not update sound driver
- bne.s .doUpdates ; if we want to do updates, branch
- .rte rte
- .doUpdates clr.b Water_Fullscrn_Flag+1.w ; disable flag
- movem.l d0-a6,-(sp) ; push
- jsr VInt_UpdateHUD ; update HUD
- movem.l (sp)+,d0-a6 ; pop
- rte
- ; ---------------------------------------------------------------------------
- ; example Hint_Water_Data
- word_74E0: dc.w 16-1
- dc.w 2, $68, $62, $42
- dc.w $48, $4E, $54, 8
- dc.w $E, $14, $1A, $34
- dc.w $22, $3A, $2E, $28
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement