Automatic scrolling

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

I usually read $2002 on the start of my NMI routine to set the $2005/6 latch to a know state and clear the NMI flag all at once. Then, since I always write to $2006 in pairs during VBlank updates, and then to $2005 in pair too, it's useless to read $2002 again.
Reading $2002 is still needed for exemple if you write timed code during the frame to have a wavy effect, only $2005.1 writes are needed, so instead of writing twice to $2005 you can rather read $2002, and then write once your HScroll to $2005, and this several times.
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Oh, I see. So if you want to not have to keep a variable of the vertical scroll for doing the wavy effect, you can just read from $2002 to have it ignore the second write. I didn't know about this. It's good to know if I ever want to do some cool scrolling tricks.
Post Reply