aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-03-01 12:19:36 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-03-01 12:19:36 +0200
commit4408fe1ee76dd96c031cbbf7b385f78635b256d5 (patch)
tree5eced1669529765c2e0f979e58a75d4eaa4284f9
parent5aaa0ffcc4e85af1d0f22e3728b2f73d750dd895 (diff)
Improvements
-rw-r--r--atk16_schasm/lib.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/atk16_schasm/lib.scm b/atk16_schasm/lib.scm
index 4e316d0..5a1c540 100644
--- a/atk16_schasm/lib.scm
+++ b/atk16_schasm/lib.scm
@@ -300,8 +300,9 @@
(emit sl)
;; compute packed words
- (define words (pack-bytes-to-words (string->ascii-list s)))
+ (emit-bytes (string->ascii-list s)))
+(define (emit-words words)
(let loop ((ws words))
(if (null? ws)
;; if done, return total number of words emitted
@@ -310,6 +311,16 @@
(begin (emit (car ws))
(loop (cdr ws))))))
+(define (emit-bytes bytes)
+ (emit-words (pack-bytes-to-words bytes)))
+
+;; TODO: figure out a system for jumping to a non-declared label 'program here
+
+(define-syntax defer
+ (syntax-rules ()
+ ((_ exp exp* ...)
+ (emit (lambda () (exp exp* ...))))))
+
;; Utils
(define (type-of v)
@@ -356,6 +367,5 @@
(error "packing of one byte produced an invalid 16 bit word" word))
(list word)))
-
((= (length bytes) 0)
'())))