aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_schasm/main.scm
diff options
context:
space:
mode:
Diffstat (limited to 'atk16_schasm/main.scm')
-rw-r--r--atk16_schasm/main.scm26
1 files changed, 19 insertions, 7 deletions
diff --git a/atk16_schasm/main.scm b/atk16_schasm/main.scm
index 85e7bf2..2810df7 100644
--- a/atk16_schasm/main.scm
+++ b/atk16_schasm/main.scm
@@ -2,20 +2,21 @@
(load "lib.scm")
+;; load asm modules
+(load "bootstrap.scm")
+
;; you can just write a raw word
-(emit #x1234)
+(emit-word #x1234)
;; compile instructions
(ld SP (u16 0))
-;; set the current emit address
-(at-addr #x10)
-
;; set labels
-(def-label 'reset-vector
- (emit #xF800)
- (emit #xF801))
+(def-label 'some-data
+ (emit-word #xF800)
+ (emit-word #xF801))
+;; set the current emit address
(at-addr #x20)
(def-label 'main
(add R1 R2)
@@ -39,5 +40,16 @@
(def-label 'data
(emit-packed-string "hölynpöly"))
+(at-addr #x50)
+
+;; branch based on an ALU flag
+(br flag-carry (label 'branch-true) set: #t)
+(def-label 'branch-false
+ (emit-word 1))
+(def-label 'branch-true
+ (emit-word 2))
+
+;;(print *buffer*)
+
;; compile to a 128KB image file
(write-image-to "out.bin")