layer2control
by ixitxachitl
Game:
Description:
;======================== ;uberASM ;======================== ;Version 1.3 ;======================== ;This ASM scrolls layer 2 ;up and down depending on ;the button you pressed. ;======================== ;It was completely ;built from scratch. ;======================== ;Created by badummzi ;======================== ;Customizable !freeram = $13E6 ;1-Byte. Only used, when SpeedType = $00 !Direction = $1468 ;Which 'direction' layer two should scroll ($1466 = left/right, $1468 = up/down) !U = #%10000000 ;Which button causes layer 2 to scroll up/left (Format: axlr---- (Only when adress is $17. For other formats, please refer to the SMWC Ram-Map) !D = #%10000000 ;Which button causes layer 2 to scroll down/right !UAddr = $15 ;Ram-Adress of the button that makes layer 2 scroll up/left !DAddr = $16 ;Ram-Adress of the button that makes layer 2 scroll down/right !ULock = #$00FF ;How much layer 2 can scroll up/left (16-Bit/Little-Endian!) !DLock = #$0000 ;How much layer 2 can scroll down/right (16-Bit/Little-Endian!) !SpeedType = $01 ;How fast the speed-values below are. ($01 = Default / Gets faster the higher the value, $00 = Slower than default (uses the freeram adress) / gets slower, the higher the value) ; > If set to $FF, when SpeedType = $01/$00, the layer won't move in the certain direction. !SpeedUp = $01 ;What speed the layer scrolls up/left !SpeedDown = $01 ;What speed the layer scrolls down/right ;End of defines ;===Code begins below=== main: ;STZ $1411 ; Remove the ; , if you're in a vertical level and want to disable the horizontal scroll (also makes layer 2 not move with the player (in vertical levels)) ;) LDA #!SpeedType BNE .check LDA !freeram BNE .SpeedSlow JSL .check RTL .SpeedSlow: DEC !freeram RTL .check: LDA $1493 ;Just comment this out by adding a ; before it, if you want the player to still be able to scroll, after he hit the goaltape/ orb, etc. BNE .end ;/ LDA $9D BNE .end LDA !UAddr AND !U if !SpeedType == $00 BNE .upSlow else BNE .up endif LDA !DAddr AND !D if !SpeedType == $00 BNE .downSlow else BNE .down endif RTL .up: if !SpeedUp != $FF REP #$20 LDX #!SpeedUp .increase LDA !Direction CMP !ULock BEQ .end INC !Direction DEX BPL .increase SEP #$20 endif RTL .down: if !SpeedDown != $FF REP #$20 LDX #!SpeedDown .decrease LDA !Direction CMP !DLock BEQ .end DEC !Direction DEX BPL .decrease SEP #$20 endif RTL .end: SEP #$20 RTL .upSlow: if !SpeedUp != $FF LDA #!SpeedUp STA !freeram REP #$20 LDA !Direction CMP !ULock BEQ .end INC !Direction SEP #$20 endif RTL .downSlow: if !SpeedDown != $FF LDA #!SpeedDown STA !freeram REP #$20 LDA !Direction CMP !DLock BEQ .end DEC !Direction SEP #$20 endif RTLback to listings