aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
Diffstat (limited to 'asm')
-rw-r--r--asm/bootstrap.atk1625
-rw-r--r--asm/idle_loop.atk1610
2 files changed, 31 insertions, 4 deletions
diff --git a/asm/bootstrap.atk16 b/asm/bootstrap.atk16
index 73165b9..29ed0ea 100644
--- a/asm/bootstrap.atk16
+++ b/asm/bootstrap.atk16
@@ -1,16 +1,33 @@
@let stack_segment 0x8000
@let vector_table 0x10
+@let terminal_addr 0xE000
+@let keyboard_addr 0xE001
@address vector_table
- hlt_isr ; 0x10 ISR0
- hlt_isr ; 0x11 ISR1
- hlt_isr ; 0x12 ISR2
- hlt_isr ; 0x13 ISR3
+ hlt_isr ; 0x10 ISR0
+ hlt_isr ; 0x11 ISR1
+ hlt_isr ; 0x12 ISR2
+ keyboard_isr ; 0x13 ISR3 (keyboard)
stack_segment ; 0x14 Stack address
0x0 ; 0x15 Interrupt PC address (IPCA)
+ terminal_addr ; 0x16 Terminal peripheral address
+ keyboard_addr ; 0x17 Keyboard peripheral address
@label hlt_isr
ldi 0x55 RE
+ hlt
+
+@label keyboard_isr
+ spu RA ; use RA, RB
+ spu RB
+ ldi 0x17 RA ; RA := 0x17 Keyboard peripheral address pointer
+ ldr RA RA ; RA := 0xE001 Keyboard peripheral address deref
+ ldr RA RA ; RA := <16-bit keyboard character code> from MMIO register
+ ldi 0x16 RB ; RB := 0x16 Terminal peripheral address pointer
+ ldr RB RB ; RB := 0xE000 Terminal peripheral address deref
+ str RA RB ; terminal <- character code
+ spo RB ; restore RA, RB
+ spo RA
rti
@label program_segment
diff --git a/asm/idle_loop.atk16 b/asm/idle_loop.atk16
new file mode 100644
index 0000000..442923c
--- /dev/null
+++ b/asm/idle_loop.atk16
@@ -0,0 +1,10 @@
+@opt stack_pointer RF
+@opt csr_scratch RH
+@use ext_std:*
+
+; bootstrap code (must be called to setup mandatory data)
+; will jump to label main
+@include bootstrap
+
+@label main
+ jpi main