3 ms·
This is a really interesting approach. One thing that surprised me from the code snippet: fn play_sound() {$4015}(%100) {$4008}($FF) Are
by Taikonerd 4y ago
This is a really interesting approach. One thing that surprised me from the code snippet:
fn play_sound()
{$4015}(%100)
{$4008}($FF)
Are these hard-coded memory addresses meaningful to NES devs? I'm surprised that they don't have more readable aliases, like $SOUND_ROM_BASE_ADDR or whatever.
- nubinetwork 4y agoYes. https://www.nesdev.org/wiki/APU#Registers https://www.nesdev.org/wiki/APU#Registers https://github.com/cc65/cc65/blob/master/asminc/nes.inc#L44 https://github.com/cc65/cc65/blob/master/asminc/nes.inc#L44
- kristiandupont 4y agoStill seems to me like something there should be "standard library" symbols for? Or is there some cultural reason for this?
- nubinetwork 4y agoYou would think so, but between NIH, old unmaintainable code (like nesasm/magickit), or not knowing other code exists, a lot of times you'll see people reinventing the wheel.
- pubby 4y agoThere's standardized names for the graphics registers. The convention for the sound registers is to use the address itself, as there are lots of sound registers and each does multiple things.
- postalrat 4y agoWould you rather have a many different set of constants for the same addresses or just the addresses themselves? Or do you think all NES developers can agree on the same names?
- Drakim 4y agoSome people prefer localhost, others like 127.0.0.1
- noobermin 4y agoWhen you program in ASM you can choose to use an alias but sometimes it's easier just to use the addresses. If you do NES stuff for a while you just memorize them or at the very least recognize them on sight.
- wk_end 4y agoI can't speak for the NES, but I've done lots of Game Boy asm coding, and personally - although others feel differently - I prefer using the register addresses rather than trying to memorize a bunch of unofficial names. Usually context/the sort of abundant comments asm necessitates indicates well enough what the read/write is doing, and if I want to look up the register to get a better idea of it, well...the names are unofficial, there isn't clear consensus about what these registers should be called, so it's easier to lookup the address in docs, too. Eventually the common ones you memorize, anyway; there's only a handful on these systems.
- karmakaze 4y agoSame. I started on an Atari 8-bit and had most of the i/o memory map memorized in both hex and decimal as well as the ROM i/o routine address/parameters.