Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ===========================================================================
- ; Scrolling BG from the Aero the Acro-Bat 2.
- ; Ripped by TheBlad768.
- ; The code in the Aero the Acro-Bat is the same.
- ; ===========================================================================
- ; RAM Address
- long_464A: = RAM+$00 ; 4 bytes
- long_464E: = RAM+$04 ; 4 bytes
- word_4652: = RAM+$08 ; 2 bytes
- word_4654: = RAM+$0A ; 2 bytes
- word_4656: = RAM+$0C ; 2 bytes
- word_4658: = RAM+$0E ; 2 bytes
- ; =============== S U B R O U T I N E =======================================
- Scrolling_BG_Init:
- move.w #1,(word_4656).w ; set X move
- move.w #1,(word_4658).w ; set Y move
- clr.w (word_4652).w
- clr.w (word_4654).w
- rts
- ; End of function Scrolling_BG_Init
- ; =============== S U B R O U T I N E =======================================
- Scrolling_BG:
- tst.w (word_4652).w
- bmi.s loc_2FD6
- cmpi.w #512,(word_4652).w
- bhi.s loc_2FE6
- bra.s loc_3014
- ; ---------------------------------------------------------------------------
- loc_2FD6:
- cmpi.w #-512,(word_4652).w
- blt.s loc_2FE6
- bra.s loc_3014
- ; ---------------------------------------------------------------------------
- loc_2FE6:
- neg.w (word_4656).w
- move.w (word_4656).w,d0
- add.w d0,(word_4652).w
- bsr.w Random_Number
- andi.w #7,d0
- addq.w #1,d0
- tst.w (word_4656).w
- bpl.s +
- neg.w d0
- + move.w d0,(word_4656).w
- loc_3014:
- move.w (word_4656).w,d0
- add.w d0,(word_4652).w
- move.w (word_4652).w,d0
- ext.l d0
- lsl.l #8,d0
- add.l d0,(long_464A).w
- tst.w (word_4654).w
- bmi.s loc_304A
- cmpi.w #512,(word_4654).w
- bhi.s loc_305A
- bra.s loc_3088
- ; ---------------------------------------------------------------------------
- loc_304A:
- cmpi.w #-512,(word_4654).w
- blt.s loc_305A
- bra.s loc_3088
- ; ---------------------------------------------------------------------------
- loc_305A:
- neg.w (word_4658).w
- move.w (word_4658).w,d0
- add.w d0,(word_4654).w
- bsr.s Random_Number
- andi.w #7,d0
- addq.w #1,d0
- tst.w (word_4658).w
- bpl.s +
- neg.w d0
- + move.w d0,(word_4658).w
- loc_3088:
- move.w (word_4658).w,d0
- add.w d0,(word_4654).w
- move.w (word_4654).w,d0
- ext.l d0
- lsl.l #8,d0
- add.l d0,(long_464E).w
- move.w (long_464A).w,(H_scroll_buffer+2).w
- move.w (long_464E).w,(V_scroll_value+2).w
- rts
- ; End of function Scrolling_BG
- ; ---------------------------------------------------------------------------
- ; Generates a pseudo-random number in d0
- ; ---------------------------------------------------------------------------
- byte_CE54: = RAM+$10 ; 1 byte
- byte_CE55: = RAM+$11 ; 1 byte
- ; =============== S U B R O U T I N E =======================================
- Random_Number:
- movem.l d1-d2/a0,-(sp)
- move.w (V_int_run_count).w,d2
- move.w d2,d1
- andi.w #$FF,d2
- lsr.w #8,d1
- move.b (byte_CE55).w,d0
- eor.b d0,d2
- move.b (byte_CE54).w,d0
- eor.b d0,d1
- moveq #0,d0
- move.w d1,d0
- lsl.w #8,d0
- or.b d2,d0
- add.l d0,d0
- movea.l d0,a0
- moveq #0,d0
- move.w (a0),d0
- sub.w d0,d2
- sub.w d0,d1
- ror.b #1,d2
- rol.b #1,d1
- add.b d1,(byte_CE55).w
- add.b d2,(byte_CE54).w
- eor.b d2,d0
- lsl.w #8,d1
- eor.b d1,d0
- movem.l (sp)+,d1-d2/a0
- rts
- ; End of function Random_Number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement