Prefix driver-internal constants and labels
Opened this issue · 0 comments
As described in the ASM6 manual, ASM6's excuse for a linker is include
, which behaves the same way as the C language preprocessor's #include
. Because ASM6 lacks file-local symbols, functions and variables within the driver, such as update_channel_hw
, graceTime
, and attackPitch
, escape the context of the audio driver and may collide with labels used by the main program. Some contrived examples follow:
update_channel_hw
means what, DMA channels?graceTime
sounds like it might be used by mercy invincibilityattackPitch
sounds like pointing the nose of an aircraft up or down
The solution suggested in "Namespacing symbols used by an ASM6 library" on NESdev BBS is to prefix everything. The first half was #42, adding a PENTLY_
prefix to constants and macros in music data. This, the second half, is about RAM and ROM addresses and constants not related to music data.
Most symbols declared outside a scope should contain pently
, case insensitive. Some categories are done:
- Public labels begin with
pently_
- C-callable aliases for public labels begin with
_pently_
- Configuration flags begin with
PENTLY_USE_
With new guidelines to follow:
- Like music data constants, driver-internal constants begin with
PENTLY_
- Internal ROM labels begin with
pentlyi_
to preserve separation of the defined API from the internals - Internal RAM labels, such as those allocated by
pentlybss.py
, also begin withpentlyi_