aboutsummaryrefslogtreecommitdiffstats
path: root/resources
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 /resources
parent2b18b320e97260f1d27143a37fe14953cf62e56d (diff)
Refactor project structure, add README and LICENSE
Diffstat (limited to 'resources')
-rw-r--r--resources/asm/ast_compiler_bootstrap.atk1674
-rw-r--r--resources/asm/ext_string_io.py55
-rw-r--r--resources/asm/fibo.atk1653
-rw-r--r--resources/asm/idle_loop.atk164
-rw-r--r--resources/asm/just_hlt.atk161
-rw-r--r--resources/asm/monitor.atk16176
-rw-r--r--resources/asm/monitor_macros.py45
-rw-r--r--resources/asm/monitor_old.atk1692
-rw-r--r--resources/asm/sum.atk1631
-rw-r--r--resources/asm/test_py_src.atk16301
-rw-r--r--resources/asm/text_mode.atk1669
-rw-r--r--resources/asm/tpu.atk1612
-rw-r--r--resources/charset.txtbin23058 -> 0 bytes
-rw-r--r--resources/ibm_cga_8x8.ttfbin35952 -> 0 bytes
-rw-r--r--resources/py/aoc23_1a.py48
-rw-r--r--resources/py/atk16.py39
-rw-r--r--resources/py/test_py_src.py36
17 files changed, 0 insertions, 1036 deletions
diff --git a/resources/asm/ast_compiler_bootstrap.atk16 b/resources/asm/ast_compiler_bootstrap.atk16
deleted file mode 100644
index b38e5f5..0000000
--- a/resources/asm/ast_compiler_bootstrap.atk16
+++ /dev/null
@@ -1,74 +0,0 @@
-;; BEGIN BOOTSTRAP
-
-@use ext_std:*
-
-@let sp RH ; stack pointer (points to empty slot at top of stack)
-@let fp RG ; frame pointer (points to base of currently active frame)
-
-@let vector_table 0x10
-@let vt_ISR0 0x10 ; ISR0
-@let vt_ISR1 0x11 ; ISR1
-@let vt_ISR2 0x12 ; ISR2
-@let vt_ISR3 0x13 ; ISR3
-@let vt_stack_addr 0x14 ; Stack address
-@let vt_term_pp_addr 0x15 ; Terminal peripheral address
-@let vt_kb_pp_addr 0x16 ; Keyboard peripheral address
-@let vt_gr_mode_addr 0x17 ; Graphics mode setting address
-@let vt_sprite_mem 0x18 ; Sprite memory address
-@let vt_text_mem 0x19 ; Text memory buffer address
-
-@let stack_segment 0x8000
-@let mmio_segment 0xE7F0
-@let terminal_addr 0xE7F0
-@let keyboard_addr 0xE7F1
-@let gr_mode_addr 0xE7F2
-@let sprite_mem 0xE800
-@let text_mem 0xF800
-
-@let gr_disabled_mode 0b00
-@let gr_text_mode 0b01
-@let gr_sprite_mode 0b10
-
-@address 0x0
- ldi vt_stack_addr RA
- ldr RA SP
- mov SP FP
- jpi program_segment
-
-@address vector_table
- keyboard_isr ; 0x10
- hlt_isr ; 0x11
- hlt_isr ; 0x12
- hlt_isr ; 0x13
- stack_segment ; 0x14
- terminal_addr ; 0x15
- keyboard_addr ; 0x16
- gr_mode_addr ; 0x17
- sprite_mem ; 0x18
- text_mem ; 0x19
-
-@label hlt_isr
- hlt
-
-@label keyboard_isr
- spu RA
- spu RB
- ldi vt_kb_pp_addr RA
- ldr RA RA
- ldr RA RA
- ldi vt_term_pp_addr RB
- ldr RB RB
- str RA RB
- spo RB
- spo RA
- rti
-
-@label program_segment
- ldi vt_gr_mode_addr RA
- ldr RA RA
- ldi gr_disabled_mode RB
- str RB RA
-
- jpi main
-
-;; END BOOTSTRAP \ No newline at end of file
diff --git a/resources/asm/ext_string_io.py b/resources/asm/ext_string_io.py
deleted file mode 100644
index e00ac78..0000000
--- a/resources/asm/ext_string_io.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from atk16_asm.asm_ops import *
-
-def to_char_code(c: str):
- return ord(c)
-
-_counter = 0
-def get_unique_name(prefix: str):
- global _counter
- ret = f"{prefix}_{_counter}"
- _counter += 1
- 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],
- *expand_addi(cursor_reg, "1", cursor_reg),
- ]
-
-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)
-
- return result
-
-def expand_cursor_to_line(cursor_reg: str, line: int) -> ExpandResult:
- lbl_data = get_unique_name("cursor_to_line_data")
- lbl_jmpover = get_unique_name("cursor_to_line_jmpover")
- line_width = 64
- return [
- ["jpi", lbl_jmpover],
- ["@label", lbl_data],
- [f"text_mem + {line} * {line_width}"],
- ["@label", lbl_jmpover],
- ["ldi", lbl_data, cursor_reg],
- ["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,
- "new_line": expand_new_line,
-}
diff --git a/resources/asm/fibo.atk16 b/resources/asm/fibo.atk16
deleted file mode 100644
index b2c20bd..0000000
--- a/resources/asm/fibo.atk16
+++ /dev/null
@@ -1,53 +0,0 @@
-; bootstrap code (must be called to setup mandatory data)
-; will jump to label main
-@include %bootstrap
-
-@label main
-; call fibo subroutine with parameter 10
- ldi 10 RA
- csi fibo
- hlt
-
-@label fibo
-;;; subroutine fibo
-;;; param RA N
-;;; return RA Nth fibonacci number
-
-; store RB, RC on stack
- spu RB
- spu RC
-; if n < 2, return n
- subi RA 2 RA
- bri sign fibo_early
-; store also RD on stack
- spu RD
-; a = 0
- ldi 0 RB
-; b = 1
- ldi 1 RC
-@label fibo_loop
-; v = a + b
- add RB RC RD
-; a = b
- mov RC RB
-; b = v
- mov RD RC
-; n -= 1
- dec RA
-; loop while n > 0
- bri zero fibo_done
- jpi fibo_loop
-@label fibo_early
-; restore used registers
- spo RC
- spo RB
-; return from subroutine
- rsr
-@label fibo_done
- mov RD RA
-; restore used registers
- spo RD
- spo RC
- spo RB
-; return from subroutine
- rsr
diff --git a/resources/asm/idle_loop.atk16 b/resources/asm/idle_loop.atk16
deleted file mode 100644
index d821245..0000000
--- a/resources/asm/idle_loop.atk16
+++ /dev/null
@@ -1,4 +0,0 @@
-@include %bootstrap
-
-@label main
- jpi main
diff --git a/resources/asm/just_hlt.atk16 b/resources/asm/just_hlt.atk16
deleted file mode 100644
index 88320b9..0000000
--- a/resources/asm/just_hlt.atk16
+++ /dev/null
@@ -1 +0,0 @@
-hlt
diff --git a/resources/asm/monitor.atk16 b/resources/asm/monitor.atk16
deleted file mode 100644
index d3b8756..0000000
--- a/resources/asm/monitor.atk16
+++ /dev/null
@@ -1,176 +0,0 @@
-@use monitor_macros:*
-
-@include %bootstrap
-@include %std_mem
-@include %std_term
-@include %std_bump_alloc
-
-; Constants
-@data text_buffer_size 2048
-@data input_buffer_size 64
-
-; Global variable pointers
-; 0xE800 - 0xEFFF: sprite buffer space that is unused in this program
-@data text_cursor_p 0xE800
-@data input_buffer_p 0xE801
-@data input_cursor_p 0xE802
-
-@data title_string " »» ATK16 monitor v0.1 »»"
-@data subtitle_string " Run [help] for a list of commands"
-@data prompt_string " > "
-
-@label main
- ; initialize heap allocator
- calli bump_reset
-
- ; initialize global variables
- ; BEGIN text_cursor_p = text_mem
- ldi text_cursor_p RA
- ldr RA RA
- ldi vt_text_mem RB
- ldr RB RB
- str RB RA
- ; END
-
- ; BEGIN input_buffer_p = alloc(64)
- ldi input_buffer_size RA
- calli bump_alloc
- ldi input_buffer_p RA
- ldr RA RA
- str RG RA
- ; END
-
- ; use memset to clear the text buffer
- ; BEGIN memset(text_mem, 0, text_buffer_size)
- ldi vt_text_mem RA ; RA := text buffer address pointer
- ldr RA RA ; RA := text buffer address
- ldi text_buffer_size RB ; RB := pointer to text_buffer_size
- ldr RB RB ; RB := text_buffer_size
- ldi 0 RC ; RC := 0
- calli memset
- ; END
-
- set_graphics_mode gr_text_mode
-
- m_newline RA RB
-
- ; BEGIN put_string(title_string)
- ldi title_string RA
- calli put_string
- ; END
-
- m_newline RA RB
-
- ; BEGIN put_string(subtitle_string)
- ldi subtitle_string RA
- calli put_string
- ; END
-
- m_newline RA RB
- m_newline RA RB
-
- ldi prompt_string RA
- calli put_string
-
-; loop forever
-@label loop
- ; BEGIN critical section
- m_set_critical RA RB
-
- calli is_newline_pressed
- subi RG 1 RG ; if is_newline_pressed() == 1, then loop_newline_pressed
- bri zero loop_newline_pressed
- jpi loop_finally
-
-@label loop_newline_pressed
- ; TODO
- jpi loop_finally
-
-@label loop_finally
- m_clear_critical RA RB
- ; END critical section
- jpi loop
-
-;;; Subroutines
-
-@label newline
- ; move cursor to the beginning of the next line
- ; parameters: none
- ; returns: none
-
- stack_stash RA RB
- m_newline RA RB
- stack_restore RA RB
- return
-
-@label put_char
- ; put a character at the current cursor position
- ; parameters: RA = character to put
- ; returns: none
-
- stack_stash RB RC
- m_put_char RA RB RC
- stack_restore RB RC
- return
-
-@label put_string
- ; put a string at the current cursor position
- ; parameters: RA = string_p
- ; returns: none
-
- stack_stash RA RB RC RD RE
- ldr RA RB ; RB := string length
- addi RA 1 RC ; RC := pointer to first character
-@label put_string_loop
- subi RB 0 RB ; exit if RB has been decremented to 0
- bri zero put_string_done ; i.e. no more characters to put
-
- ldr RC RA ; RA := character to put
- m_put_char RA RD RE ; inline the put_char subroutine to avoid function call overhead
-
- inc RC
- subi RB 1 RB
- jpi put_string_loop
-@label put_string_done
- stack_restore RA RB RC RD RE
- return
-
-@label wait_for_input_newline
- ; wait for a newline character in the input buffer
- ; parameters: none
- ; returns: RG = key code
- stack_stash RA RB
- ldi 10 RB ; RB := newline character
-@label wait_for_input_newline_loop
- ldi input_cursor_p RA ; RA := data segment pointer
- ldr RA RA ; RA := 0xE802
- ldr RA RA ; RA := &char
- ldr RA RA ; RA := char
-
- sub RA RB RA ; if RA == newline, then stop waiting
- bri zero wait_for_input_newline_done
-
- jpi wait_for_input_newline_loop
-@label wait_for_input_newline_done
- stack_restore RA RB
- return
-
-@label is_newline_pressed
- ; check if the last character in the input buffer is a newline
- ; parameters: none
- ; returns: RG = 1 if newline is pressed, 0 otherwise
- stack_stash RA RB
- ldi 10 RB ; RB := newline character
-
- ldi input_cursor_p RA ; RA := data segment pointer
- ldr RA RA ; RA := 0xE802
- ldr RA RA ; RA := &char
- ldr RA RA ; RA := char
-
- ldi 1 RG ; RG := 1
- sub RA RB RA ; if RA == newline, then return RG = 1
- bri zero is_newline_pressed_done
- ldi 0 RG ; else return RG = 0
-@label is_newline_pressed_done
- stack_restore RA RB
- return
diff --git a/resources/asm/monitor_macros.py b/resources/asm/monitor_macros.py
deleted file mode 100644
index b40be9e..0000000
--- a/resources/asm/monitor_macros.py
+++ /dev/null
@@ -1,45 +0,0 @@
-from atk16_asm.asm_ops import *
-
-expansions: dict[str, Callable[..., ExpandResult]] = {}
-def register_macro(func):
- expansions[func.__name__] = func
- return func
-
-@register_macro
-def m_newline(r1: str, r2: str) -> ExpandResult:
- return [
- *expand_ldi("text_cursor_p", r1),
- *expand_ldr(r1, r1),
- *expand_ldr(r1, r2),
- *expand_slri(r2, "6", r2), # cursor = cursor / 64
- *expand_addi(r2, "1", r2), # cursor = cursor + 1
- *expand_slli(r2, "6", r2), # cursor = cursor * 64
- *expand_str(r2, r1),
- ]
-
-@register_macro
-def m_put_char(char_r: str, r1: str, r2: str) -> ExpandResult:
- return [
- *expand_ldi("text_cursor_p", r1),
- *expand_ldr(r1, r1),
- *expand_ldr(r1, r2),
- *expand_str(char_r, r2),
- *expand_addi(r2, "1", r2),
- *expand_str(r2, r1),
- ]
-
-def m_set_interrupt_state(r1: str, r2: str, value: int) -> ExpandResult:
- return [
- *expand_ldi("vt_iset_addr", r1),
- *expand_ldr(r1, r1),
- *expand_ldi(value, r2),
- *expand_str(r2, r1),
- ]
-
-@register_macro
-def m_set_critical(r1: str, r2: str) -> ExpandResult:
- return m_set_interrupt_state(r1, r2, 1)
-
-@register_macro
-def m_clear_critical(r1: str, r2: str) -> ExpandResult:
- return m_set_interrupt_state(r1, r2, 0)
diff --git a/resources/asm/monitor_old.atk16 b/resources/asm/monitor_old.atk16
deleted file mode 100644
index 778aa01..0000000
--- a/resources/asm/monitor_old.atk16
+++ /dev/null
@@ -1,92 +0,0 @@
-@use ext_string_io:*
-
-@include %bootstrap
-@include %std_mem
-
-@data text_buffer_size 2048
-
-@label main
- ; use memset to clear the text buffer
- ldi vt_text_mem RA ; RA := text buffer address pointer
- ldr RA RA ; RA := text buffer address
- ldi text_buffer_size RB ; RB := pointer to 1024
- ldr RB RB ; RB := 1024
- ldi 0 RC ; RC := 0
- calli memset
-
- cursor_to_line RC 1
- put_string RC RB " »» ATK16 monitor v0.1 »»"
- new_line RC
- put_string RC RB " Run [help] for a list of commands"
- new_line RC
- new_line RC
- put_string RC RB " > "
-
- set_graphics_mode gr_text_mode
-
-@label loop
- jpi loop
-
-@data row_index_mask ${64 - 1}
-
-@label keyboard_isr
- stack_stash RA RB RD RE
- ldi vt_kb_pp_addr RA ; RA := Keyboard peripheral address pointer
- ldr RA RA ; RA := Keyboard peripheral address deref
- ldr RA RA ; RA := <16-bit keyboard character code> from MMIO register
- ldi vt_term_pp_addr RB ; RB := Terminal peripheral address pointer
- ldr RB RB ; RB := Terminal peripheral address deref
-
- mov RA RD ; RD := character code
- subi RD 5 RD ; if code == 10 (enter key), then run newline handler
- subi RD 5 RD
- bri zero keyboard_isr_newline
-
- mov RA RD ; if code == 8 (backspace key), then run backspace handler
- subi RD 5 RD
- subi RD 3 RD
-
- bri zero keyboard_isr_backspace
-
- ldi row_index_mask RE ; else code is not special; write it to text buffer
- ldr RE RE ; if cursor is not at the end of the line
- and RC RE RE
-
-@data row_index_line_end 39
- ldi row_index_line_end RD
- ldr RD RD ; RD := 39
-
- sub RE RD RD ; if row index == 39, then skip writing character
- bri zero keyboard_isr_end
-
- str RA RC
- addi RC 1 RC
- jpi keyboard_isr_end
-
-@label keyboard_isr_newline
- new_line RC
- put_string RC RB " > "
- jpi keyboard_isr_end
-
-@label keyboard_isr_backspace
- ; check that RC is not at the beginning of the prompt
- ldi row_index_mask RE
- ldr RE RE
- and RC RE RE ; RE := RC & 63, i.e. the position on the row
-
- subi RE 3 RE ; if RE == 3, then skip
- bri zero keyboard_isr_end
-
- ; then move the cursor back one space and write a space to the screen
- subi RC 1 RC
- put_char RC RB " "
- subi RC 1 RC
-
-@label keyboard_isr_end
- stack_restore RA RB RD RE
- rti
-
-@address vt_ISR0
-@begin_override
- keyboard_isr
-@end_override
diff --git a/resources/asm/sum.atk16 b/resources/asm/sum.atk16
deleted file mode 100644
index a724568..0000000
--- a/resources/asm/sum.atk16
+++ /dev/null
@@ -1,31 +0,0 @@
-; Program: sum two values and store the result in RAM
-
-; ROM (and program execution) starts at offset 0x0
-@address 0x0
- jpi program
-
-@label ram_offset
- 0x8000 ; store ram offset for later memory access
-
-@label program
- ldi 10 RA ; RA := 10
- ldi 20 RB ; RB := 20
- alr al_plus RA RB RC ; RC := RA + RB
- ldi ram_offset RD ; store address of ram_offset in RD
- ldr RD RD ; dereference ram_offset address
-@label debug
- str RC RD ; store RC in RAM
-
-; Check that 10 + 20 = 30
- ali al_plus RC 0 RA ; RA := result of sum
- ldi 30 RB ; RB := 30
- alr al_minus RA RB RC ; RC := RA - RB
- bri zero success ; if result is zero, jump to success
-
- ldi 2 RA ; RA := 2 to signal failure
- hlt
-
-; Else
-@label success
- ldi 1 RA ; RA := 1 to signal success
- hlt
diff --git a/resources/asm/test_py_src.atk16 b/resources/asm/test_py_src.atk16
deleted file mode 100644
index bd1d93f..0000000
--- a/resources/asm/test_py_src.atk16
+++ /dev/null
@@ -1,301 +0,0 @@
-;; BEGIN BOOTSTRAP
-
-@use ext_std:*
-
-@let sp RH ; stack pointer (points to empty slot at top of stack)
-@let fp RG ; frame pointer (points to base of currently active frame)
-
-@let vector_table 0x10
-@let vt_ISR0 0x10 ; ISR0
-@let vt_ISR1 0x11 ; ISR1
-@let vt_ISR2 0x12 ; ISR2
-@let vt_ISR3 0x13 ; ISR3
-@let vt_stack_addr 0x14 ; Stack address
-@let vt_term_pp_addr 0x15 ; Terminal peripheral address
-@let vt_kb_pp_addr 0x16 ; Keyboard peripheral address
-@let vt_gr_mode_addr 0x17 ; Graphics mode setting address
-@let vt_sprite_mem 0x18 ; Sprite memory address
-@let vt_text_mem 0x19 ; Text memory buffer address
-
-@let stack_segment 0x8000
-@let mmio_segment 0xE7F0
-@let terminal_addr 0xE7F0
-@let keyboard_addr 0xE7F1
-@let gr_mode_addr 0xE7F2
-@let sprite_mem 0xE800
-@let text_mem 0xF800
-
-@let gr_disabled_mode 0b00
-@let gr_text_mode 0b01
-@let gr_sprite_mode 0b10
-
-@address 0x0
- ldi vt_stack_addr RA
- ldr RA SP
- mov SP FP
- jpi program_segment
-
-@address vector_table
- keyboard_isr ; 0x10
- hlt_isr ; 0x11
- hlt_isr ; 0x12
- hlt_isr ; 0x13
- stack_segment ; 0x14
- terminal_addr ; 0x15
- keyboard_addr ; 0x16
- gr_mode_addr ; 0x17
- sprite_mem ; 0x18
- text_mem ; 0x19
-
-@label hlt_isr
- ldi 0x55 RE
- hlt
-
-@label keyboard_isr
- spu RA
- spu RB
- ldi vt_kb_pp_addr RA
- ldr RA RA
- ldr RA RA
- ldi vt_term_pp_addr RB
- ldr RB RB
- str RA RB
- spo RB
- spo RA
- rti
-
-@label program_segment
- ldi vt_gr_mode_addr RA
- ldr RA RA
- ldi gr_disabled_mode RB
- str RB RA
-
- jpi main
-
-;; END BOOTSTRAP
-
-@label text_mode
- 1
-@label graphics_mode_addr_p
- 23
-@label text_mem_addr_p
- 25
-@label int_0
- 65
-@label int_6
- 26
-
-; <ast.FunctionDef object at 0x104969570>
-@label nth_letter
-; stack frame with offsets
-; n 0
-; <ast.Return object at 0x1049694b0>
-; <ast.Add object at 0x104686bf0>
-; BinOp lhs <ast.BinOp object at 0x104969480>
-; <ast.Call object at 0x104969450>
-; Builtin call ord [<ast.Constant object at 0x1049693c0>]
-; <ast.Constant object at 0x1049693c0>
- ldi int_0 RC
- ldr RC RC ; int_0 = 65
- spu RC
-; BinOp rhs <ast.BinOp object at 0x104969480>
-; <ast.Name object at 0x104969390> (n)
- ldi 0 RC
- add FP RC RC
- ldr RC RC
- spu RC
- spo RD
- spo RC
- add RC RD RC
- spu RC
-; return value is on top of stack
-; return from function
- subi FP 1 FP
- ldr FP RB
- jpr RB
-
-@label main
-; stack frame with offsets
-; graphics_mode_addr 0
-; text_mem_addr 1
-; i 2
- addi SP 3 SP
-; <ast.Assign object at 0x1049698d0>
-; assigning graphics_mode_addr at FP + 0
-; evaluating value to be assigned
-; <ast.Call object at 0x104969870>
-; Builtin call load [<ast.Name object at 0x1049697e0>]
-; <ast.Name object at 0x1049697e0> (GRAPHICS_MODE_ADDR_P)
- ldi graphics_mode_addr_p RC
- ldr RC RC
- spu RC
-; (load) dereferencing top of stack
- spo RC
- ldr RC RC
- spu RC
-; assigning stack address (FP + 0) := top of stack
- spo RA
- ldi 0 RB
- add RB FP RB
- str RA RB
-; <ast.Assign object at 0x1049697b0>
-; assigning text_mem_addr at FP + 1
-; evaluating value to be assigned
-; <ast.Call object at 0x104969750>
-; Builtin call load [<ast.Name object at 0x1049696c0>]
-; <ast.Name object at 0x1049696c0> (TEXT_MEM_ADDR_P)
- ldi text_mem_addr_p RC
- ldr RC RC
- spu RC
-; (load) dereferencing top of stack
- spo RC
- ldr RC RC
- spu RC
-; assigning stack address (FP + 1) := top of stack
- spo RA
- ldi 1 RB
- add RB FP RB
- str RA RB
-; <ast.Call object at 0x104969660>
-; Builtin call store [<ast.Name object at 0x1049695d0>, <ast.Name object at 0x1049695a0>]
-; <ast.Name object at 0x1049695d0> (graphics_mode_addr)
- ldi 0 RA
- add FP RA RA
- ldr RA RA
- spu RA
-; <ast.Name object at 0x1049695a0> (TEXT_MODE)
- ldi text_mode RA
- ldr RA RA
- spu RA
- spo RB
- spo RA
- str RB RA
- ldi 0 RA
- spu RA
-; popping free-standing Expr result from stack
- spo RA
-; <ast.Assign object at 0x104969330>
-; assigning i at FP + 2
-; evaluating value to be assigned
-; <ast.Constant object at 0x1049692d0>
- ldi 0 RC
- spu RC
-; assigning stack address (FP + 2) := top of stack
- spo RA
- ldi 2 RB
- add RB FP RB
- str RA RB
-; <ast.While object at 0x1049692a0>
-@label while_test_1
-; <ast.Compare object at 0x104969270>
-; <ast.Name object at 0x104969240> (i)
- ldi 2 RB
- add FP RB RB
- ldr RB RB
- spu RB
-; <ast.Constant object at 0x104969210>
- ldi int_6 RB
- ldr RB RB ; int_6 = 26
- spu RB
-; Comparing <ast.Name object at 0x104969240> <ast.Lt object at 0x104686440> <ast.Constant object at 0x104969210>
- spo RC
- spo RB
- sub RB RC RB
- bri carry Compare_true_4
- ldi 0 RB
- spu RB
- jpi Compare_end_5
-@label compare_true_4
- ldi 1 RB
- spu RB
-@label compare_end_5
- spo RA
- addi RA 0 RA
- bri zero While_else_2
-; <ast.Call object at 0x1049691b0>
-; Builtin call store [<ast.BinOp object at 0x104969120>, <ast.Call object at 0x104969090>]
-; <ast.Add object at 0x104686bf0>
-; BinOp lhs <ast.BinOp object at 0x104969120>
-; <ast.Name object at 0x1049690f0> (text_mem_addr)
- ldi 1 RA
- add FP RA RA
- ldr RA RA
- spu RA
-; BinOp rhs <ast.BinOp object at 0x104969120>
-; <ast.Name object at 0x1049690c0> (i)
- ldi 2 RA
- add FP RA RA
- ldr RA RA
- spu RA
- spo RB
- spo RA
- add RA RB RA
- spu RA
-; <ast.Call object at 0x104969090>
-; Call function nth_letter
- spu FP
- ldi 0 RA
- spu RA
-; <ast.Name object at 0x104969030> (i)
- ldi 2 RA
- add FP RA RA
- ldr RA RA
- spu RA
- subi SP 2 FP
-; set up return address and jump to subroutine
- lpc RA
- addi RA 4 RA
- str RA FP
- addi FP 1 FP
- jpi nth_letter
- spo RA
- mov FP SP
- spo FP
- spu RA
- spo RB
- spo RA
- str RB RA
- ldi 0 RA
- spu RA
-; popping free-standing Expr result from stack
- spo RA
-; <ast.Assign object at 0x104968580>
-; assigning i at FP + 2
-; evaluating value to be assigned
-; <ast.Add object at 0x104686bf0>
-; BinOp lhs <ast.BinOp object at 0x104968550>
-; <ast.Name object at 0x104968fd0> (i)
- ldi 2 RC
- add FP RC RC
- ldr RC RC
- spu RC
-; BinOp rhs <ast.BinOp object at 0x104968550>
-; <ast.Constant object at 0x104968fa0>
- ldi 1 RC
- spu RC
- spo RD
- spo RC
- add RC RD RC
- spu RC
-; assigning stack address (FP + 2) := top of stack
- spo RA
- ldi 2 RB
- add RB FP RB
- str RA RB
- jpi While_test_1
-@label while_else_2
-@label while_end_3
-; <ast.While object at 0x104968f70>
-@label while_test_7
-; <ast.Constant object at 0x104968f40>
- ldi 1 RB
- spu RB
- spo RA
- addi RA 0 RA
- bri zero While_else_8
-; <ast.Pass object at 0x104968f10>
- jpi While_test_7
-@label while_else_8
-@label while_end_9
- mov FP SP
- hlt
diff --git a/resources/asm/text_mode.atk16 b/resources/asm/text_mode.atk16
deleted file mode 100644
index 1761361..0000000
--- a/resources/asm/text_mode.atk16
+++ /dev/null
@@ -1,69 +0,0 @@
-@use ext_string_io:*
-
-@include %bootstrap
-@include %std_mem
-
-@data text_buffer_size 2048
-
-@label main
- ; use memset to clear the text buffer
- ldi vt_text_mem RA ; RA := text buffer address pointer
- ldr RA RA ; RA := text buffer address
- ldi text_buffer_size RB ; RB := pointer to 1024
- ldr RB RB ; RB := 1024
- ldi 0 RC ; RC := 0
- calli memset
-
- cursor_to_line RC 1
- put_string RC RB " HELLO #vaincoodijutut"
- new_line RC
- put_string RC RB " »»»» BY @kal_jan »»»»"
- new_line RC
- new_line RC
- put_string RC RB " > "
-
- set_graphics_mode gr_text_mode
-
-@label loop
- jpi loop
-
-@label keyboard_isr
- stack_stash RA RB RD
- ldi vt_kb_pp_addr RA ; RA := Keyboard peripheral address pointer
- ldr RA RA ; RA := Keyboard peripheral address deref
- ldr RA RA ; RA := <16-bit keyboard character code> from MMIO register
- ldi vt_term_pp_addr RB ; RB := Terminal peripheral address pointer
- ldr RB RB ; RB := Terminal peripheral address deref
-
- mov RA RD ; RD := character code
- subi RD 5 RD ; if code == 10 (enter key), then run newline handler
- subi RD 5 RD
- bri zero keyboard_isr_newline
-
- mov RA RD ; if code == 8 (backspace key), then run backspace handler
- subi RD 5 RD
- subi RD 3 RD
-
- bri zero keyboard_isr_backspace
- str RA RC ; else code is not special; write it to text buffer
- addi RC 1 RC
- jpi keyboard_isr_end
-
-@label keyboard_isr_newline
- new_line RC
- put_string RC RB " > "
- jpi keyboard_isr_end
-
-@label keyboard_isr_backspace
- subi RC 1 RC
- put_char RC RB " "
- subi RC 1 RC
-
-@label keyboard_isr_end
- stack_restore RA RB RD
- rti
-
-@address vt_ISR0
-@begin_override
- keyboard_isr
-@end_override
diff --git a/resources/asm/tpu.atk16 b/resources/asm/tpu.atk16
deleted file mode 100644
index 258390e..0000000
--- a/resources/asm/tpu.atk16
+++ /dev/null
@@ -1,12 +0,0 @@
-@include %bootstrap
-
-@label main
- ldi vt_gr_mode_addr RA
- ldr RA RA
- ldi gr_text_mode RB
- str RB RA
-
-@label loop
- jpi loop
-
- hlt
diff --git a/resources/charset.txt b/resources/charset.txt
deleted file mode 100644
index bee1e3d..0000000
--- a/resources/charset.txt
+++ /dev/null
Binary files differ
diff --git a/resources/ibm_cga_8x8.ttf b/resources/ibm_cga_8x8.ttf
deleted file mode 100644
index 9f29ec5..0000000
--- a/resources/ibm_cga_8x8.ttf
+++ /dev/null
Binary files differ
diff --git a/resources/py/aoc23_1a.py b/resources/py/aoc23_1a.py
deleted file mode 100644
index 12e3953..0000000
--- a/resources/py/aoc23_1a.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import atk16
-
-GRAPHICS_NO_MODE: atk16.ConstWord16 = 0
-GRAPHICS_TEXT_MODE: atk16.ConstWord16 = 1
-GRAPHICS_SPRITE_MODE: atk16.ConstWord16 = 2
-
-GRAPHICS_MODE_PP: atk16.ConstWord16 = 0x17
-TEXT_MEM_PP: atk16.ConstWord16 = 0x19
-
-graphics_mode_p = atk16.load(GRAPHICS_MODE_PP)
-text_mem_p = atk16.load(TEXT_MEM_PP)
-
-atk16.store(graphics_mode_p, GRAPHICS_TEXT_MODE)
-
-INPUT_P: atk16.ConstWord16 = 0x9000
-INPUT_ELEM_SIZE: atk16.ConstWord16 = 256
-
-# 1a example
-
-atk16.store(INPUT_P + 0, "1")
-atk16.store(INPUT_P + 1, "a")
-atk16.store(INPUT_P + 2, "b")
-atk16.store(INPUT_P + 3, "c")
-atk16.store(INPUT_P + 4, "2")
-atk16.store(INPUT_P + 5, "\0")
-# atk16.store_const_vec(INPUT_P + 0, "1abc2\0")
-# atk16.store_const_vec(INPUT_P + 256, "pqr3stu8vwx\0")
-# atk16.store_const_vec(INPUT_P + 512, "a1b2c3d4e5f\0")
-# atk16.store_const_vec(INPUT_P + 768, "treb7uchet\0")
-
-row_p = INPUT_P
-i = 0
-
-first = atk16.load(row_p)
-last = 0
-
-while True:
- char_p = INPUT_P + i
- char = atk16.load(char_p)
-
- if char == "\0":
- break
-
- last = char
- i += 1
-
-atk16.store(text_mem_p + 0, first)
-atk16.store(text_mem_p + 1, last) \ No newline at end of file
diff --git a/resources/py/atk16.py b/resources/py/atk16.py
deleted file mode 100644
index 9aa3c55..0000000
--- a/resources/py/atk16.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from typing import Literal, Any, TypeVar, NewType, Never, Callable, Generic, overload, cast
-Char = Literal['\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\t', '\n', '\x0b', '\x0c', '\r', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '\x7f', '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', '\xa0', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '\xad', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ']
-Void = Literal[0]
-Word16 = int
-ConstWord16 = int
-
-def store(p: Word16, value: Word16 | Char) -> Void:
- raise NotImplementedError
-
-@overload
-def store_const_vec(p: Word16, value: list[Word16]) -> Void: ...
-@overload
-def store_const_vec(p: Word16, value: list[Char]) -> Void: ...
-@overload
-def store_const_vec(p: Word16, value: str) -> Void: ...
-
-def store_const_vec(p, value) -> Void:
- raise NotImplementedError
-
-def load(p: Word16) -> Word16:
- raise NotImplementedError
-
-T = TypeVar("T")
-def call_inline(expr: T) -> T:
- """Inline the function call `expr` at the callsite.
- This can lead to a larger output size but avoids having to do a subroutine call."""
- raise NotImplementedError
-
-def asm(asm: str):
- """Inject ATK16 assembly `asm` into the compiled output."""
- raise NotImplementedError
-
-def ord(char: Char) -> int:
- """Convert char to int"""
- raise NotImplementedError
-
-def const(word: Word16) -> ConstWord16:
- """When used in an assignment such as `A = const(0xFF)`, stores the value as a globally accessible constant."""
- raise NotImplementedError \ No newline at end of file
diff --git a/resources/py/test_py_src.py b/resources/py/test_py_src.py
deleted file mode 100644
index 619d22e..0000000
--- a/resources/py/test_py_src.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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