Codemain: LDA $9D
ORA $13D4|!addr
BNE .end
LDA $14
LSR
LSR
BCC .end
LDX $1444|!addr
LDA.l otherbank1F_data,x
INX
STX $1444|!addr
CMP #$01
BEQ .up
CMP #$02
BEQ .down
.end
RTL
.up
STZ $55 ; Make sure that new tiles are uploaded from the top of the screen
REP #$30 ; 16-bit (accumulator).
DEC $1464|!addr ; Make the screen scroll upwards automatically.
SEP #$30 ; 8-bit (accumulator).
RTL
.down
LDA #$02 ;\ Make sure that new tiles are uploaded from the bottom of the screen
STA $55 ;/
REP #$20 ; 16-bit (accumulator).
INC $1464|!addr ; Make the screen scroll downwards automatically.
SEP #$20 ; 8-bit (accumulator).
RTL
otherbank1F:
.data
db $00,$00,$00,$00,$00,$00,$00,$01,$00,$00,$00,$00,$00,$01,$00,$00,$00,$00,$01,$00,$00,$00,$01,$00,$00,$01,$00,$01,$00,$01,$00,$01
db $00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01
db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01
db $00,$01,$00,$01,$00,$01,$00,$00,$01,$00,$00,$00,$01,$00,$00,$00,$00,$01,$00,$00,$00,$00,$00,$01,$00,$00,$00,$00,$00,$00,$00,$01
db $00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$02,$00,$00,$00,$02,$00,$00,$02,$00,$02,$00,$02,$00,$02
db $00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02
db $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02,$00,$02
db $00,$02,$00,$02,$00,$02,$00,$00,$02,$00,$00,$00,$02,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00,$02
If you want to customize the scrolling, you need to understand the '.data' table. The first four lines of the table are responsible for moving the camera
. This is dictated by the following three values:
The last four lines should have the same pattern as the first four lines, but with the $01's replaced with $02's, of course. Editing the table may be quite trial-and-error, but eventually you will get used to it.
One benefit of this code is that stationary sprites like piranha plants and shooters will follow layer 1 normally since the camera is being moved, not any layers. The other benefit is that it works fine with the vanilla auto-scrollers (though I don't recommend you to use the special auto-scrollers).
. The layer 2 auto-scroll UberASM you linked should theoretically work fine, but I didn't try it myself.
Hope this helps! If you have any more questions, I'll clarify them.