puppydrum64
Active member
Ok, I understand that this was a feature removed from NES Maker because it was considered too complicated for the average user to understand. I get that. But I really want to use it for my game and I just can't seem to get it to work. This is what I understand so far:
* The NES checks each pixel of the screen in an endless loop.
* In address $2002, the 6th bit is set at the first moment during the loop that a non-transparent sprite is touching a non-transparent background tile, and the above loop happens to be on that pixel.
* Super Mario Bros. uses this fact to partition the HUD from the rest of the screen, having it stay in place while the game scrolls.
I have read both this article on NESdev wiki and this explanation on stack exchange and I mostly get it.
Now with all that being said, I'm not sure about the implementation of splitting the screen. Using breakpoints in the Mesen debugger I can see just when sprite zero detection occurs, and it occurs mostly when I expect it to (except at the very beginning to lock the background HUD in place.)
My first attempt to make the screen split involved changing the NMI script. Originally, it looked like this:
Understanding that $2005 controls scrolling, my original plan was to do the following:
I was thinking I could gate the scroll reset behind sprite zero detection but all this did was make the camera halfway off to the right and messed everything up.
I'm hoping someone more experienced than me can explain how to code this sort of thing, I feel so close to getting it but I'm just not quite there and can't find a good tutorial that explains it (I've searched all over the internet but so far no luck)
* The NES checks each pixel of the screen in an endless loop.
* In address $2002, the 6th bit is set at the first moment during the loop that a non-transparent sprite is touching a non-transparent background tile, and the above loop happens to be on that pixel.
* Super Mario Bros. uses this fact to partition the HUD from the rest of the screen, having it stay in place while the game scrolls.
I have read both this article on NESdev wiki and this explanation on stack exchange and I mostly get it.
Now with all that being said, I'm not sure about the implementation of splitting the screen. Using breakpoints in the Mesen debugger I can see just when sprite zero detection occurs, and it occurs mostly when I expect it to (except at the very beginning to lock the background HUD in place.)
My first attempt to make the screen split involved changing the NMI script. Originally, it looked like this:
Code:
LDA camX
STA $2005 ;reset scroll values to zero
LDA camY
STA $2005 ;reset scroll values to zero
Understanding that $2005 controls scrolling, my original plan was to do the following:
Code:
LDA $2002
AND $40
BEQ SpriteZeroWait
JMP skipNMIstuff
SpriteZeroWait:
LDA camX
STA $2005 ;reset scroll values to zero
LDA camY
STA $2005 ;reset scroll values to zero
skipNMIstuff:
I was thinking I could gate the scroll reset behind sprite zero detection but all this did was make the camera halfway off to the right and messed everything up.
I'm hoping someone more experienced than me can explain how to code this sort of thing, I feel so close to getting it but I'm just not quite there and can't find a good tutorial that explains it (I've searched all over the internet but so far no luck)