How do some games change vertical scroll at IRQ?
Moderator: Moderators
-
- Posts: 2
- Joined: Wed Jun 16, 2021 3:48 pm
How do some games change vertical scroll at IRQ?
To quote the wiki, "Changes made to the vertical scroll during rendering will only take effect on the next frame." But taking a look at Super Mario Bros. 3, the HUD clearly adjusts vertical position during the IRQ's interrupt. Looking through SMB3's disassembly, all it seems to do is write to the shift register like normal, but shouldn't the Y value only make changes on scanline -1?
-
- Posts: 2
- Joined: Wed Jun 16, 2021 3:48 pm
Re: How do some games change vertical scroll at IRQ?
The "normal" way of setting the vertical scroll (i.e. via $2000 and $2005) does not work mid-frame. Using $2006 you can partially modify the vertical scroll mid-frame (the fine Y scroll can't be > 3). Using combined $2005 and $2006 writes you can set the scroll to whatever you want.
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
Re: How do some games change vertical scroll at IRQ?
The trick is, and what took me a while to understand admittedly, is you have to load the top left of the nametable address into PPU_ADDR ($2006). It's not just a matter of setting the coordinates with PPU_SCROLL ($2005) as one might assume.