1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-16 13:31:16 +00:00

Merge pull request #2076 from bbbradsmith/macro-axy-document

Don't use a,x,y in macro parameter example, document why not.
This commit is contained in:
Bob Andrews 2023-05-03 13:10:57 +02:00 committed by GitHub
commit 88f581c796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4262,8 +4262,13 @@ macro actually takes in the definition. You may also leave intermediate
parameters empty. Empty parameters are replaced by empty space (that is,
they are removed when the macro is expanded). If you have a look at our
macro definition above, you will see, that replacing the "addr" parameter
by nothing will lead to wrong code in most lines. To help you, writing
macros with a variable parameter list, there are some control commands:
by nothing will lead to wrong code in most lines.
The names "a", "x" and "y" should be avoided for macro parameters, as these
will usually conflict with the 6502 registers.
For writing macros with a variable parameter list, control commands are
available:
<tt><ref id=".IFBLANK" name=".IFBLANK"></tt> tests the rest of the line and
returns true, if there are any tokens on the remainder of the line. Since
@ -4274,15 +4279,15 @@ opposite.
Look at this example:
<tscreen><verb>
.macro ldaxy a, x, y
.ifnblank a
lda #a
.macro ldaxy i, j, k
.ifnblank i
lda #i
.endif
.ifnblank x
ldx #x
.ifnblank j
ldx #j
.endif
.ifnblank y
ldy #y
.ifnblank k
ldy #k
.endif
.endmacro
</verb></tscreen>