From 5899f8f02a90a3ba03f7799bcaf87fbb5d2d63f2 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Tue, 4 Mar 2025 22:55:32 +0200 Subject: Add %if and %if-else macros, refactor, add indirection levels --- atk16_schasm/main.scm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'atk16_schasm/main.scm') diff --git a/atk16_schasm/main.scm b/atk16_schasm/main.scm index 2810df7..e6f63ca 100644 --- a/atk16_schasm/main.scm +++ b/atk16_schasm/main.scm @@ -1,6 +1,7 @@ (import (chicken base)) -(load "lib.scm") +(load "core.scm") +(load "macros.scm") ;; load asm modules (load "bootstrap.scm") @@ -33,12 +34,9 @@ (def-label 'forward (hlt)) -;; copy to register -(mov R0 R1) - ;; store string data in memory (def-label 'data - (emit-packed-string "hölynpöly")) + (%packed-string "hölynpöly")) (at-addr #x50) @@ -49,7 +47,14 @@ (def-label 'branch-true (emit-word 2)) -;;(print *buffer*) +;; use macros for convenience +(let ((x #x5678)) + (%if-else (R1 == R2) + (emit-word #x1234) + (emit-word x))) + +(%if (R1 <= (u16 #xFF)) + (emit-word #xbeef)) ;; compile to a 128KB image file (write-image-to "out.bin") -- cgit v1.3