I'd like to clear up some things in the Nerdy Nights tutorial that I didn't understand.
As an example, I use the code in this file:
www.nespowerpak.com/nesasm/background2.zip
1. There is vblankwait1 to make sure that the PPU is ready. But in the next step, all he does is resetting the RAM values. Before he actually accesses the PPU, he does a second vblankwait. So, is the first one even necessary? And if yes, why?
1.1. The guy who converted the source code to CC65 even included a third vblankwait between the end of LoadPalettes and the start of LoadSprites. Is that necessary?
2. In clrmem, when the sprites are put outside the screen, why are the sprite data ($0200-$02FF) set to value #$FE instead of #$FF?
3. In the initialization, right before the Forever loop, the following line is written:
But later, in the PPU clean up section, this is done anyway. So, why is it done right before the infinite loop? Manipulating the values there (like disabling sprites) doesn't seem to have any influence on the program anyway. The only time the manipulation of these values shows any effect is in the PPU cleanup section.
4. In one of the first chapters he said that the initialization is not enough for a real NES, but good enough for an emulator. Does that still apply to this chapter or is the initialization complete now?
5. As far as I see it, the first color in the sprite palette (which is rendered transparent for the sprite anyway) will be the global background color of the screen, is this correct? Why did they choose to do it like that? Why not the first color of the background palette?
As an example, I use the code in this file:
www.nespowerpak.com/nesasm/background2.zip
1. There is vblankwait1 to make sure that the PPU is ready. But in the next step, all he does is resetting the RAM values. Before he actually accesses the PPU, he does a second vblankwait. So, is the first one even necessary? And if yes, why?
1.1. The guy who converted the source code to CC65 even included a third vblankwait between the end of LoadPalettes and the start of LoadSprites. Is that necessary?
2. In clrmem, when the sprites are put outside the screen, why are the sprite data ($0200-$02FF) set to value #$FE instead of #$FF?
3. In the initialization, right before the Forever loop, the following line is written:
Code:
LDA #%00011110 ; enable sprites, enable background, no clipping on left side
STA $2001
STA $2001
But later, in the PPU clean up section, this is done anyway. So, why is it done right before the infinite loop? Manipulating the values there (like disabling sprites) doesn't seem to have any influence on the program anyway. The only time the manipulation of these values shows any effect is in the PPU cleanup section.
4. In one of the first chapters he said that the initialization is not enough for a real NES, but good enough for an emulator. Does that still apply to this chapter or is the initialization complete now?
5. As far as I see it, the first color in the sprite palette (which is rendered transparent for the sprite anyway) will be the global background color of the screen, is this correct? Why did they choose to do it like that? Why not the first color of the background palette?