Yes using RAM page 2 ($0200-$02FF) as an OAM buffer is a convention used by most licensed NES games, and Nerdy Nights follows this convention as well. Technically you could use any RAM page for the OAM buffer, but there is no point in not following the convention. The page used as the OAM buffer is determined by what value you write to $4014 each vblank (writing $02 means page 2).
It's only the the Y-position that needs to be $FE to hide the sprites, the other bytes can be 0 if you want (though that requires some extra code). The value $FE seems arbitrary though, so I'm not sure why Nerdy Nights choose this particular odd value, as any Y-value between $EF-$FF will hide the sprite according to the
wiki).
Note that Nerdy Nights makes a mistake in it's commenting which confused me back when I learned from it:
Code: Select all
LDA #$00
STA $2003 ; set the low byte (00) of the RAM address
LDA #$02
STA $4014 ; set the high byte (02) of the RAM address, start the transfer
This sounds like you set the RAM address of your OAM buffer to $2003 and $4014 (which is a very odd choice of registers considering $2xxx registers are PPU related and $4xxx registers are CPU/APU related), but that is wrong. Only $4014 affects the OAM buffer's address, and it assigns the whole RAM page (256 byte) in a single byte write. You write to $2003 only to set the OAM write address (used by both manual OAM writes and writes done by OAM-DMA) to $00 to make sure the OAM-DMA starts writing from the beginning of OAM. Since OAM is only 256 byte large, you only need a single byte to set the OAM write address (so there is no need for a high and low byte here). The DMA is performed by hardware inside the CPU chip, which explains why a $4xxx register is used to set and start the DMA process.
This is an infamous misconception that I believe comes from an older tutorial by GBAGuy.
The comments should therefore look like this:
Code: Select all
LDA #$00
STA $2003 ; set the destination OAM address to $00
LDA #$02
STA $4014 ; set the source RAM page (2), start the transfer
The code is correct though, so no need to change anything but the comments.