diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-03-02 18:16:52 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-03-02 18:16:52 +0200 |
| commit | 861bbf2ddae539e2adb466ba7ced30a3676cca8d (patch) | |
| tree | a4bf288665900ae05ffc3877aebf09ef0a946268 /atk16_schasm/main.scm | |
| parent | 19ee6d36222bb288340d3d66f8773e259c49db2c (diff) | |
Refactor emit functions, add bootstrap.scm
Diffstat (limited to 'atk16_schasm/main.scm')
| -rw-r--r-- | atk16_schasm/main.scm | 26 |
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") |
