Skip to content

Symbol to fetch the output address of a label #15

@DevRubicate

Description

@DevRubicate

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions