1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Don't use a,x,y in macro parameter example, document why not.

#392
This commit is contained in:
bbbradsmith 2023-05-03 03:05:14 -04:00
parent 805e98a7aa
commit 4d698bf18c

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>