aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_asm/builtin_asm
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-14 17:20:34 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-14 17:20:34 +0300
commit367813568d723e598a38a7327fc2bb4abcfc598c (patch)
treef4c72a5e3f3992d8b43ed0a5e695c8e9aa790ecf /atk16_asm/builtin_asm
parent2f69a9ac8c2de9d37248baa5c774c2813f070ba0 (diff)
Add data_segment feature, refactor
Diffstat (limited to 'atk16_asm/builtin_asm')
-rw-r--r--atk16_asm/builtin_asm/bootstrap.atk1618
-rw-r--r--atk16_asm/builtin_asm/std_bump_alloc.atk166
-rw-r--r--atk16_asm/builtin_asm/std_math.atk166
3 files changed, 15 insertions, 15 deletions
diff --git a/atk16_asm/builtin_asm/bootstrap.atk16 b/atk16_asm/builtin_asm/bootstrap.atk16
index 28d8aa1..b3b4254 100644
--- a/atk16_asm/builtin_asm/bootstrap.atk16
+++ b/atk16_asm/builtin_asm/bootstrap.atk16
@@ -31,10 +31,10 @@
@let vt_text_mem 0x19 ; Text memory buffer address
@address vector_table
- hlt_isr ; 0x10
- hlt_isr ; 0x11
- hlt_isr ; 0x12
- hlt_isr ; 0x13
+ no_op_isr ; 0x10
+ no_op_isr ; 0x11
+ no_op_isr ; 0x12
+ no_op_isr ; 0x13
stack_segment ; 0x14
terminal_addr ; 0x15
keyboard_addr ; 0x16
@@ -42,9 +42,13 @@
sprite_mem ; 0x18
text_mem ; 0x19
-@label hlt_isr
- ldi 0x55 RE
- hlt
+@label no_op_isr
+ rti
+
+; Define data segment location to this address
+; Programs can use `@data label value` to inject data here
+@label data_segment
+@data_segment
; Example ISR for keyboard to terminal
; @label keyboard_to_terminal_isr
diff --git a/atk16_asm/builtin_asm/std_bump_alloc.atk16 b/atk16_asm/builtin_asm/std_bump_alloc.atk16
index 1d87435..32516bc 100644
--- a/atk16_asm/builtin_asm/std_bump_alloc.atk16
+++ b/atk16_asm/builtin_asm/std_bump_alloc.atk16
@@ -21,10 +21,8 @@
; The alloc_next value is a pointer to the next free word in the heap.
; It is stored in the first word of the heap.
-@label bump_next_p
- heap_segment
-@label bump_arena_start
- ${heap_segment - 1}
+@data bump_next_p heap_segment
+@data bump_arena_start ${heap_segment - 1}
@label bump_reset
; reset the heap to its initial state (zero allocated blocks)
diff --git a/atk16_asm/builtin_asm/std_math.atk16 b/atk16_asm/builtin_asm/std_math.atk16
index 58b9cdb..6544b32 100644
--- a/atk16_asm/builtin_asm/std_math.atk16
+++ b/atk16_asm/builtin_asm/std_math.atk16
@@ -1,7 +1,5 @@
-@label mul_sign_mask
- ${2 ** 15}
-@label mul_not_mask
- 0xFFFF
+@data mul_sign_mask ${2 ** 15}
+@data mul_not_mask 0xFFFF
@label mul
; multiply a signed (a) and a signed (b)