Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix driver-internal constants and labels #43

Open
3 tasks done
pinobatch opened this issue Jul 22, 2019 · 0 comments
Open
3 tasks done

Prefix driver-internal constants and labels #43

pinobatch opened this issue Jul 22, 2019 · 0 comments
Labels

Comments

@pinobatch
Copy link
Owner

pinobatch commented Jul 22, 2019

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 invincibility
  • attackPitch 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 with pentlyi_
pinobatch added a commit that referenced this issue Jul 22, 2019
Handle aspects of #43 related to sound effects and hardware access
pinobatch added a commit that referenced this issue Jul 22, 2019
pinobatch added a commit that referenced this issue Jul 22, 2019
This should take care of most of #43, but I need to sleep on it
before auditing the rest for namespace pollution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant