At first the standard code for horizontal scrolling with a sprite 0 split:
Code: Select all
; Set scrolling 0 and name table 0
; for the status bar.
LDA #0
STA PpuScroll
STA PpuScroll
LDA #%10010000
STA PpuCtrl
; Wait for sprite 0.
; (Done as a macro.)
WAIT_FOR_PPU_STATUS %01000000
; Set the scrolling position
; and name table for the level.
LDA scrollingPosition
STA PpuScroll
LDA #0
STA PpuScroll
LDA #%10010000
ORA nameTable
STA PpuCtrl
Now, I changed the scrolling position code to the following:
Code: Select all
LDA scrollingPosition
STA PpuScroll
LDA #64
STA PpuScroll
I.e. if the left image is the regular screen, then one with a vertical scrolling of 64 would be the right image: But the screen still looks like the left image.
It works fine if I set vertical scrolling right away, but when I try to change the scrolling position after the sprite 0 split, i.e. in the middle of the screen, it doesn't work.
Why is that the case? Why can horizontal scrolling be changed in the middle of the screen, but vertical scrolling cannot the way I tried it?