Quantcast
Channel: nesdev.org
Viewing all articles
Browse latest Browse all 785

CA65 macros: using parameter as prefix for labels?

$
0
0
This isn't really a question about the NES, rather CA65. Is there a way to use the parameter passed to a macro as a label prefix? For example, here is my CHR loading macro:

Code:

.MACRO  LCHR      chr, addr, rows, bank.IFNBLANK bank        LDA #bank        JSR Bankswap.ENDIF        LDA #<chr        STA pointer        LDA #>chr        STA pointer+1        LDA #>addr        STA >address        LDA #<addr        STA <address        LDX #rows        JSR Load_CHR.ENDMACRO        LCHR TITLE_CHR, TITLE_CHR_START, TITLE_CHR_TILES
This works fine, and is obviously less verbose than typing all of that out every time, but it would be really nice if I could just pass a single "TITLE" parameter and it would automatically append _CHR, _CHR_START, CHR_ROWS, and CHR_BANK where needed.

Statistics: Posted by dragonsbrethren — Sun Sep 01, 2024 11:19 am — Replies 0 — Views 27



Viewing all articles
Browse latest Browse all 785

Trending Articles