summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormRnea <[email protected]>2024-07-30 20:17:43 +0300
committermRnea <[email protected]>2024-07-30 20:17:43 +0300
commit7562c4b30ba918928308da23487bffc92d4de37b (patch)
treea5bb5fcee5936edf97c40ca0f7cc4ce53408fb21
parent4091b0e81f30e4aba04f81fd0c6ae661f0b72603 (diff)
Found a cool idea for DEFOP
-rw-r--r--assembly.lisp10
1 files changed, 10 insertions, 0 deletions
diff --git a/assembly.lisp b/assembly.lisp
index 81b0ca1..1ddd326 100644
--- a/assembly.lisp
+++ b/assembly.lisp
@@ -34,15 +34,23 @@
,(normalize-op-list body))
(replace-write out-stream indent (car body))))))))
+;;; TODO: Turn stack operation comments to DEFOP option,
+;;; which then can be used by the user as a documentation
+;;; TODO: Better yet, generate the asm code directly from
+;;; the stack op documentation (this seems easily doable)
+
+;; ( -- a)
(defop (push a) ()
("push ~d" a))
+;; (rbx rax -- (rbx + rax))
(defop + ()
"pop rax"
"pop rbx"
"add rax, rbx"
"push rax")
+;; (rbx rax -- (rbx - rax))
(defop - ()
"pop rax"
"pop rbx"
@@ -82,11 +90,13 @@
(:write (" jmp et_~a" döngü-num)
("et_~a:" label-num))))
+;; (rax -- rax rax)
(defop eş ()
"pop rax"
"push rax"
"push rax")
+;; (rax -- )
(defop düş ()
"pop rax")