diff options
Diffstat (limited to 'atk16_schasm/lib.scm')
| -rw-r--r-- | atk16_schasm/lib.scm | 14 |
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) '()))) |
