Skip to content

Macros for use in expressions #21

@Xkeeper0

Description

@Xkeeper0

In cases of stupid addressing like the PPU, addresses are usually written as .db $20, $00, as opposed to the usual way, due to having to write the high byte to PPUADDR first.

I wanted to do something like this:

MACRO vram addr
      .byte >addr, <addr
ENDM

SampleLabel:
;      .BYTE $20, $00, $60, $FD
      .BYTE vram($2000),  $60, $FD

However, this gives me a warning that macros aren't allowed to be used as expressions.

I got around it right now by removing the .byte:

SampleLabel:
      vram($2000), $60, $FD

...but that will only work if it's the first entry on a 'line', and feels pretty hokey.

This is probably a lot tougher than it sounds, but I at least have a workaround for it right now, so it isn't a huuuuuge issue.

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