aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2023-11-03 20:02:03 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2023-11-03 20:02:03 +0200
commit4fbe8d2d27dd8873c1f309e15b116f8800a5e605 (patch)
tree709d25abaa5c0a7d1ea7484750cb54765d33cd59 /asm
parentabf6cbdecc8eb006a859205dee7500c2b70c0998 (diff)
Improve string I/O helper macros
Diffstat (limited to 'asm')
-rw-r--r--asm/ext_string_io.py2
-rw-r--r--asm/text_mode.atk168
2 files changed, 5 insertions, 5 deletions
diff --git a/asm/ext_string_io.py b/asm/ext_string_io.py
index cf7d598..7b026ba 100644
--- a/asm/ext_string_io.py
+++ b/asm/ext_string_io.py
@@ -13,6 +13,7 @@ def get_unique_name(prefix: str):
return ret
def expand_put_char(cursor_reg: str, scratch_reg: str, c: str) -> ExpandResult:
+ c = c.strip("\"")
return [
["ldi", str(to_char_code(c)), scratch_reg],
["str", scratch_reg, cursor_reg],
@@ -21,6 +22,7 @@ def expand_put_char(cursor_reg: str, scratch_reg: str, c: str) -> ExpandResult:
def expand_put_string(cursor_reg: str, scratch_reg: str, *rest: str) -> ExpandResult:
string = " ".join(rest)
+ string = string.strip("\"")
result: ExpandResult = []
for c in string:
result += expand_put_char(cursor_reg, scratch_reg, c)
diff --git a/asm/text_mode.atk16 b/asm/text_mode.atk16
index f4d84ae..f33120d 100644
--- a/asm/text_mode.atk16
+++ b/asm/text_mode.atk16
@@ -9,11 +9,9 @@
@label main
cursor_to_line RA 1
- put_char RA RB %SPACE
- put_string RA RB HELLO CORECAMP
- cursor_to_line RA 3
- put_char RA RB %SPACE
- put_string RA RB BY JAN
+ put_string RA RB " HELLO CORECAMP"
+ cursor_to_line RA 2
+ put_string RA RB " BY JAN"
; set graphics mode to sprite mode
; set_graphics_mode gr_sprite_mode