So, I've been reading BunnyBoy's "Nerdy Nights" tutorials, to learn the basics of 6502 NES Assembly. Everything, featured in the tutorials works great, when I compile the code. However, when I try to experiment, things don't work out at all, for the most part. So, I hope I can get some answers.
(Note: I'm on a different computer right now, so unfortunately I can't show any of the code I've written by now. I hope I can explain the problems well. )
1. Do all the graphic updates have to happen in the NMI section?
So, in his example code, BunnyBoy adds these two Vblankwait loops. From what I understand, every time the screen is being drawn, these loops check if that is happening, and if it is, they keep looping until there's a VBlank (or VBI). Then the rest of the code executed. I wonder, when the RTI function is executed, does the CPU go back to the Vblankwait loops? If that's so, then judging by the code, the CPU's RAM would get wiped every frame and it would establish the same colors and sprite positions every single time. But if that was so, how would the sprites be able to move? Is the code executed only once? That would explain why when I try to establish new positions for three other sprites, based on sprite 0's position, it doesn't work in the regular sections, yet it does only in the NMI section. But why? Where does the RTI function lead to? What is the chronological path of this code and why does it work differently than in any other languages, I've used? (They are high-level, but I don't think it should make that big a difference) None of this stuff is explained in the tutorials, so I hope someone can give me a straight-forward explanation.
2. When writing values to the palettes, do you have to write all the values?
Let's say I just want change one color from the background palette. I write down all the code, telling the CPU to write values to the PPU. Once I start putting in color values, do I have to write every single color for both palettes, or can I just write the value for the first color and then start doing something else?
There may be more questions in the future. Sorry if they sounded (or looked) like ramblings. Right now, I hope I can get these answered, since they're vital. What BunnyBoy explains in his tutorials, he explains well. What he doesn't explain... he doesn't explain. This can create some knowledge holes, that will bite a future NES programmer in the ass one day.
(Note: I'm on a different computer right now, so unfortunately I can't show any of the code I've written by now. I hope I can explain the problems well. )
1. Do all the graphic updates have to happen in the NMI section?
So, in his example code, BunnyBoy adds these two Vblankwait loops. From what I understand, every time the screen is being drawn, these loops check if that is happening, and if it is, they keep looping until there's a VBlank (or VBI). Then the rest of the code executed. I wonder, when the RTI function is executed, does the CPU go back to the Vblankwait loops? If that's so, then judging by the code, the CPU's RAM would get wiped every frame and it would establish the same colors and sprite positions every single time. But if that was so, how would the sprites be able to move? Is the code executed only once? That would explain why when I try to establish new positions for three other sprites, based on sprite 0's position, it doesn't work in the regular sections, yet it does only in the NMI section. But why? Where does the RTI function lead to? What is the chronological path of this code and why does it work differently than in any other languages, I've used? (They are high-level, but I don't think it should make that big a difference) None of this stuff is explained in the tutorials, so I hope someone can give me a straight-forward explanation.
2. When writing values to the palettes, do you have to write all the values?
Let's say I just want change one color from the background palette. I write down all the code, telling the CPU to write values to the PPU. Once I start putting in color values, do I have to write every single color for both palettes, or can I just write the value for the first color and then start doing something else?
There may be more questions in the future. Sorry if they sounded (or looked) like ramblings. Right now, I hope I can get these answered, since they're vital. What BunnyBoy explains in his tutorials, he explains well. What he doesn't explain... he doesn't explain. This can create some knowledge holes, that will bite a future NES programmer in the ass one day.