summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-11 00:54:01 -0400
committerbd <bdunahu@operationnull.com>2025-04-11 00:54:01 -0400
commit1161354f5dbb9648f90edb3ffb16dc9daad7d966 (patch)
tree40b1a0016cc7db1eb3ebd4e9c19ff5abc2a4c38d /src
parent5d63924222856e9decd4f8981869141ac5a5b430 (diff)
Automatically add a halt to the end of every program
Diffstat (limited to 'src')
-rw-r--r--src/emit.lisp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/emit.lisp b/src/emit.lisp
index 48ebebe..a6e4bbb 100644
--- a/src/emit.lisp
+++ b/src/emit.lisp
@@ -31,7 +31,9 @@ concatenated with TYPE."
(mapcar (lambda (x) (util:format-as-binary x 32)) lst))
(defun x (&rest lst)
- lst)
+ (append lst
+ ;; add a halt to the end of the instructions list
+ (list (r "QUOT" (rr 0) (rr 0) (rr 0)))))
(defun r (mnemonic s1 s2 d)
(concatenate
@@ -58,7 +60,7 @@ concatenated with TYPE."
(defun var (s)
(let ((pos (util:get-variable s)))
- (+ pos parse:line-number)))
+ (+ pos parse:line-number 1)))
(defun emit (p)
(eval p))