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

REQUEST: Constants defined with const keyword are unusable inside ASM and BuildTable #873

Open
onceuponabyte opened this issue Feb 8, 2025 · 1 comment

Comments

@onceuponabyte
Copy link

As I understood, constants defined with const keyword are replaced directly by their value inside ASM, there is no labeled value used. This then means that they cannot be used inside ASM("...") nor inside BuildTable statements.

On the other hand, preprocessor defines (made with @define) can be used in both, but they do not offer computation, e.g.

@define FOO 1
@define BAR 42
@define BAZ (FOO+BAR) // generates an error

So, my request would be, if possible, to define real ASM constants for anything defined with const keyword, in the same way as with variables. That would enable the usage of those constants inside ASM and BuildTable statements, e.g.:

const FOO: byte = 1;
const BAR: byte = 42;
const BAZ: byte = FOO+BAR;

something: array[25] of byte = BuildTable("(BAZ + (i*40)) & 0xFF");
ASM("
lda #BAZ
");

If inside unit, the same rules could apply as for variables, e.g. UnitName_ConstName.

@zzarko
Copy link
Collaborator

zzarko commented Feb 8, 2025

Ha, I just realized that I made the request with my other github account... :)

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