Memblers wrote:
Doing indirect writes to the sound registers is another little thing that can be annoying.
Something like STA $4003,X is annoying, but not evil. I do just that in Pently so that I can reuse the same pitch code for channels 1, 2, and 3, and the same envelope code for channels 1, 2, and 4. If the program is accessing sound registers through STA ($24),y, data breakpoints can still start to tease those out.
Streaming music data from CHR ROM, now that's evil. This goes double if the CHR gets XOR'd with graphics from another CHR bank before being played.
But some games do one thing that could be considered more evil than that. They generate the music in real time based on what's happening elsewhere in the game engine:
- Super Mario 64 water levels turn strings on and off depending on the player's position.
- Tetris Advance (J) for GBA turns channels on one-by-one depending on which section the player is in, and section 5 sounds almost exactly like the Starman music from the Mario series.
- Lumines for PSP turns channels on and off depending on how many squares got swept in the previous pass.
- Super Mario Galaxy takes Super Mario 64's methods to the next level.
blargg said require an obscure mapper. You could design a sound chip that generates DPCM samples at $FFC0, which the NES can easily stream. Or one that generates raw samples to be played with code like this:
Code:
irq:
pha
lda $4111
sta $4011
pla
rti
EDIT (2018-10-28): The audio driver has a name