aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/README.md b/README.md
index 8b6d5b8..5aff6a7 100644
--- a/README.md
+++ b/README.md
@@ -245,6 +245,28 @@ LDA #01 ; bad!
lda #01 ; good!
```
+One good idea for `.macro` is to use them to define pseudo-instructions, as it's
+done in other assembly languages like RISC-V. For example, on [these scrolling
+examples](https://github.com/mssola/code.nes/tree/main/scroll) there is a macro
+for the pseudo-instruction `JAL`, which makes explicit when a `jmp` has been
+used instead of `jsr` for reducing the stack usage on tail calls. In this
+scenario, you can find code like this:
+
+```assembly
+.proc foo
+ ;; Previous code that might jump/branch to @end.
+
+ lda Some::Variable
+ bne @end
+ JAL prepare_next_column
+@end:
+ rts
+.endproc
+```
+
+Here the casing makes explicit that `JAL` is actually a pseudo-instruction, and
+so that it follows somewhat different rules than the ones by its side.
+
## Use the `@` prefix for named labels which affect the control flow
Named labels which are part of the control flow are to use the `@` symbol as a