Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Scroll routine for Labyrinth Zone - optimised by MarkeyJester
- ; ---------------------------------------------------------------------------
- Deform_LZ:
- moveq #$07,d0 ; prepare multiplication 100 / 2 for BG scrolling
- move.w ($FFFFF73A).w,d4 ; load horizontal movement distance (Since last frame)
- ext.l d4 ; extend to long-word signed
- asl.l d0,d4 ; align as fixed point 16, but divide by 2 for BG
- move.w ($FFFFF73C).w,d5 ; load vertical movement distance (Since last frame)
- ext.l d5 ; extend to long-word signed
- asl.l d0,d5 ; align as fixed point 16, but divide by 2 for BG
- bsr.w ScrollBlock1 ; adjust BG scroll positions (and set draw code direction flags)
- move.w ($FFFFF70C).w,($FFFFF618).w ; set BG V-scroll position
- lea ($FFFFCC00).w,a1 ; load H-scroll buffer
- move.w ($FFFFF700).w,d0 ; load FG X position
- neg.w d0 ; reverse
- swap d0 ; send to upper word
- move.w ($FFFFF708).w,d0 ; load BG X position
- neg.w d0 ; reverse
- moveq #$00,d3 ; clear d3
- move.b ($FFFFF7D8).w,d3 ; load wave-scroll timer
- addi.w #$0080,($FFFFF7D8).w ; increase wave-scroll timer
- move.w #$00E0,d2 ; prepare water-line count
- move.w ($FFFFF646).w,d1 ; load water line position
- sub.w ($FFFFF704).w,d1 ; minus FG Y position
- bmi.s DLZ_Water ; if the screen is already underwater, branch
- cmp.w d2,d1 ; is the water line below the screen?
- ble.s DLZ_NoWater ; if not, branch
- move.w d2,d1 ; set at maximum
- DLZ_NoWater:
- sub.w d1,d2 ; subtract from water-line count
- add.b d1,d3 ; advance scroll wave timer to correct amount
- subq.b #$01,d1 ; decrease above water count
- bcs.s DLZ_Water ; if finished, branch
- DLZ_Above:
- move.l d0,(a1)+ ; save scroll position to buffer
- dbf d1,DLZ_Above ; repeat for all above water lines
- DLZ_Water:
- subq.b #$01,d2 ; decrease below water count
- bcs.s DLZ_Finish ; if finished, branch
- move.w d0,d1 ; copy BG position back to d1
- swap d0 ; move FG position back to lower word in d0
- move.w d3,d4 ; copy sroll timer for BG use
- add.b ($FFFFF704+$01).w,d3 ; add FG Y position
- add.b ($FFFFF70C+$01).w,d4 ; add BG Y position
- add.w d3,d3 ; multiply by word size (2)
- add.w d4,d4 ; ''
- lea (DLZ_WaveBG).l,a3 ; load beginning of BG wave data
- adda.w d4,a3 ; advance to correct starting point
- move.b (a3),d4 ; get current position byte
- asr.b #$02,d4 ; get only the position bits
- ext.w d4 ; extend to word
- add.w d4,d1 ; adjust BG's current position
- lea DLZ_WaveFG(pc,d3.w),a2 ; load correct starting point of FG wave data
- move.b (a2),d4 ; get current position byte
- asr.b #$02,d4 ; get only the position bits
- ext.w d4 ; extend to word
- add.w d4,d0 ; adjust FG's current position
- DLZ_Below:
- add.w (a2)+,d0 ; alter FG horizontal position
- move.w d0,(a1)+ ; save to scroll buffer
- add.w (a3)+,d1 ; alter BG horizontal position
- move.w d1,(a1)+ ; save to scroll buffer
- dbf d2,DLZ_Below ; repeat for all below water lines
- DLZ_Finish:
- rts ; return
- ; ---------------------------------------------------------------------------
- ; Scroll data for the FG
- ; ---------------------------------------------------------------------------
- DLZ_WaveFG:
- rept $02
- dc.w $0001,$0400,$0401,$0800,$0801,$0C00,$0C00,$0C00,$0FFF,$0800,$0BFF,$0400,$07FF,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $03FF,$FC00,$FFFF,$F800,$FBFF,$F400,$F400,$F400,$F401,$F800,$F801,$FC00,$FC01,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0001,$0400,$0401,$0800,$0801,$0C00,$0C00,$0C00,$0FFF,$0800,$0BFF,$0400,$07FF,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
- endr
- ; ---------------------------------------------------------------------------
- ; Scroll data for the BG
- ; ---------------------------------------------------------------------------
- DLZ_WaveBG: rept $04
- dc.w $FC01,$0000,$0000,$0000,$0000,$0000,$0001,$0400,$0400,$0400,$0400,$0401,$0800,$0800,$0800,$0800
- dc.w $0800,$0800,$0801,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00
- dc.w $0C01,$13FF,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0C00,$0FFF
- dc.w $0800,$0800,$0800,$0800,$0800,$0800,$0BFF,$0400,$0400,$0400,$0400,$07FF,$0000,$0000,$0000,$0000
- dc.w $0000,$03FF,$FC00,$FC00,$FC00,$FC00,$FFFF,$F800,$F800,$F800,$F800,$FBFF,$F400,$F400,$F400,$F400
- dc.w $F400,$F400,$F7FF,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000
- dc.w $F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F000,$F001
- dc.w $F400,$F400,$F400,$F400,$F400,$F400,$F401,$F800,$F800,$F800,$F800,$F801,$FC00,$FC00,$FC00,$FC00
- endr
- ; ===========================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement