aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_ast_walking_compiler/sample_py/test_py_src.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-26 15:40:14 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-26 15:40:14 +0300
commit7ca56c1a730fcecd0fe3af5e6b652fa09514a18b (patch)
treee2ef6a4d28fa26adf11e00d138ef21b8316497f6 /atk16_ast_walking_compiler/sample_py/test_py_src.py
parent2b18b320e97260f1d27143a37fe14953cf62e56d (diff)
Refactor project structure, add README and LICENSE
Diffstat (limited to 'atk16_ast_walking_compiler/sample_py/test_py_src.py')
-rw-r--r--atk16_ast_walking_compiler/sample_py/test_py_src.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/atk16_ast_walking_compiler/sample_py/test_py_src.py b/atk16_ast_walking_compiler/sample_py/test_py_src.py
new file mode 100644
index 0000000..619d22e
--- /dev/null
+++ b/atk16_ast_walking_compiler/sample_py/test_py_src.py
@@ -0,0 +1,36 @@
+# TODO: actual imports, not just `import atk16`
+from atk16 import *
+
+GRAPHICS_NO_MODE: ConstWord16 = 0
+GRAPHICS_TEXT_MODE: ConstWord16 = 1
+GRAPHICS_SPRITE_MODE: ConstWord16 = 2
+
+GRAPHICS_MODE_PP: ConstWord16 = 0x17
+TEXT_MEM_PP: ConstWord16 = 0x19
+
+TEXT_MEM_PP: ConstWord16 = 0x19
+
+# asm(
+# "@label keyboard_isr"
+# " spu RA"
+
+# " spo RA"
+# )
+
+# set_isr(0, "keyboard_isr")
+
+graphics_mode_p = load(GRAPHICS_MODE_PP)
+text_mem_p = load(TEXT_MEM_PP)
+
+store(graphics_mode_p, GRAPHICS_TEXT_MODE)
+
+def nth_letter(n: int) -> int:
+ return ord('A') + n
+
+i = 0
+while i < 26:
+ store(text_mem_p + i, nth_letter(i))
+ i += 1
+
+while True:
+ pass