aboutsummaryrefslogtreecommitdiffstats
path: root/resources/asm/ast_compiler_bootstrap.atk16
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2024-02-20 16:55:14 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2024-02-20 16:56:09 +0200
commit549901c85044b6ccd912688d6be007c2fdacc6c6 (patch)
tree15d1123eedb4347472e4b47fec880e2e5b79927e /resources/asm/ast_compiler_bootstrap.atk16
parentabf0594c78087434bced59054896f7f411e18faf (diff)
Refactor dir structure
Diffstat (limited to 'resources/asm/ast_compiler_bootstrap.atk16')
-rw-r--r--resources/asm/ast_compiler_bootstrap.atk1674
1 files changed, 74 insertions, 0 deletions
diff --git a/resources/asm/ast_compiler_bootstrap.atk16 b/resources/asm/ast_compiler_bootstrap.atk16
new file mode 100644
index 0000000..2e112eb
--- /dev/null
+++ b/resources/asm/ast_compiler_bootstrap.atk16
@@ -0,0 +1,74 @@
+;; 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 0xE000
+@let terminal_addr 0xE000
+@let keyboard_addr 0xE001
+@let gr_mode_addr 0xE002
+@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