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

Symbol to fetch the output address of a label #15

Open
Drakim opened this issue Nov 7, 2017 · 1 comment
Open

Symbol to fetch the output address of a label #15

Drakim opened this issue Nov 7, 2017 · 1 comment

Comments

@Drakim
Copy link

Drakim commented Nov 7, 2017

NESASM has a built-in function called BANK() which returns an integer indicating what bank a certain label belongs to. This can be quite the useful piece of functionality as you can create a primitive type of pointer, or simply make your code truly relocatable, or allow for data sets that expand over more than one bank and automatically adapts.

It's perhaps the only piece of functionality I truly miss when moving from NESASM to asm6f, as I now have to manually hard-code the bank integers and hope I remember to change it by hand later if need be.

asm6f doesn't have the concept of banks so the same functionality is impossible at first glance, but, if there was a way to fetch out the real address of a label (the actual offset into the output file as opposed to the virtual address often changed by .base directives) then the programmer could easily calculate what bank a label belongs to.

My suggestion is to add some symbol you can put before a label to indicate that you want it's output address, something like ?MyLabel.

@nicklausw
Copy link
Collaborator

Fetching a bank in WLA is done by preceding a label with a colon (lda #:myLabel), but this doesn't work well with asm6's parser which considers a colon to be white space. Maybe that could be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants