From 97bf5a802262bb47675fb6f4cd9d1e1522eaef5d Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 4 Nov 2023 10:40:11 +0200 Subject: Add new_line macro --- asm/ext_string_io.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'asm/ext_string_io.py') diff --git a/asm/ext_string_io.py b/asm/ext_string_io.py index dd17123..519077d 100644 --- a/asm/ext_string_io.py +++ b/asm/ext_string_io.py @@ -1,5 +1,5 @@ from asm_ops import * -from ext_std import expand_addi +from ext_std import * def to_char_code(c: str): return ord(c) @@ -41,8 +41,16 @@ def expand_cursor_to_line(cursor_reg: str, line: int) -> ExpandResult: ["ldr", cursor_reg, cursor_reg], ] +def expand_new_line(cursor_reg: str) -> ExpandResult: + return [ + *expand_slri(cursor_reg, "6", cursor_reg), + *expand_addi(cursor_reg, "1", cursor_reg), + *expand_slli(cursor_reg, "6", cursor_reg), + ] + expansions: OpExpansionDict = { "put_char": expand_put_char, "cursor_to_line": expand_cursor_to_line, "put_string": expand_put_string, -} \ No newline at end of file + "new_line": expand_new_line, +} -- cgit v1.3