aboutsummaryrefslogtreecommitdiffstats
path: root/asm/bootstrap.atk16
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2023-04-14 11:43:43 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2023-04-14 14:52:43 +0300
commit15337f762451deabdabec873e7aa8a2a483ec75c (patch)
tree2e245c9f07b1bb0398d68f8f9d7f979e85fa8cce /asm/bootstrap.atk16
parente6d966cebc15e21cb64012d314f74f54dc35eead (diff)
Set up MMIO with keyboard, terminal emulator
Diffstat (limited to 'asm/bootstrap.atk16')
-rw-r--r--asm/bootstrap.atk1625
1 files changed, 21 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