Airshipcamera
by zuccati
Game: Super Mario World
Description:
;=================================================== ; Airship-like Camera (Up and Down Swaying Camera) ; by KevinM ;=================================================== ; Max speed to move the camera in each phase (going up, going down) ; measured in 1/$100 pixels/frame ; The movement will switch direction when reaching this value ; The two values should be equal (but opposite) or the camera will ; drift away after enough cycles. speed: dw -$0060,$0060 ; How fast the speed increases in each phase (going up, going down) ; The two values should be equal (but opposite) or the camera will ; drift away after enough cycles. acceleration: dw -$0001,$0001 ; Addresses defines !phase_addr = $1443|!addr !position_addr = $1464|!addr !speed_addr = $1448|!addr !fraction_addr = $1450|!addr init: stz $1412|!addr rep #$20 stz !phase_addr stz !speed_addr stz !fraction_addr sep #$20 rtl main: LDA #$00 STA $1412 lda $9D : ora $13D4|!addr : bne .return lda $71 : cmp #$0A : beq .return .run: lda !phase_addr : and #$01 : asl : tax rep #$20 lda !speed_addr : clc : adc acceleration,x : sta !speed_addr sec : sbc speed,x : eor speed,x : bmi + lda speed,x : sta !speed_addr inc !phase_addr stz !fraction_addr + lda !fraction_addr : and #$00FF clc : adc !speed_addr : sta !fraction_addr and #$FF00 bpl + ora #$00FF + xba clc : adc !position_addr : sta !position_addr sep #$20 .return: rtlback to listings