aboutsummaryrefslogtreecommitdiff
path: root/include/asm.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-03-13 22:52:49 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-03-13 22:52:49 +0100
commit9ff2033e936689135210989a5fee057a4a13527e (patch)
treedd41ffd78f451d28a554f105ff40017ed31106a2 /include/asm.s
parent2627b459d9a19ce7f1b7f3a359dca3b30b66b34e (diff)
downloadjetpac.nes-9ff2033e936689135210989a5fee057a4a13527e.tar.gz
jetpac.nes-9ff2033e936689135210989a5fee057a4a13527e.zip
Add a title and a main screens
This commit adds the skeleton for having a title and a main screen. For now the title menu doesn't do much, as the selection is simply ignored, but at least it already knows how to cycle between these two states. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'include/asm.s')
-rw-r--r--include/asm.s22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/asm.s b/include/asm.s
new file mode 100644
index 0000000..67b195c
--- /dev/null
+++ b/include/asm.s
@@ -0,0 +1,22 @@
+;; Jump And Link: jump to subroutine but use the return address that the caller
+;; had whenever the given subroutine runs `rts`. In other words, "link" the
+;; return address from the caller to the callee.
+;;
+;; This is in practice the same as using `jmp` but it bears the semantic
+;; connotation of the `jsr` one. That is, instead of this:
+;;
+;; jsr subroutine
+;; rts
+;;
+;; It's more adviseable to do the following for better stack management:
+;;
+;; jmp subroutine
+;;
+;; That being said, the `jmp` instruction is also used in many other contexts,
+;; and so sometimes it's needed to clarify that: "no, I have not messed up,
+;; using `jmp` here instead of `jsr` is deliberate". Hence, instead of adding a
+;; comment every time this small optimization is being done, use this
+;; pseudo-instruction.
+.macro JAL ADDR
+ jmp ADDR
+.endmacro