diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2023-04-14 11:43:43 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2023-04-14 14:52:43 +0300 |
| commit | 15337f762451deabdabec873e7aa8a2a483ec75c (patch) | |
| tree | 2e245c9f07b1bb0398d68f8f9d7f979e85fa8cce /asm | |
| parent | e6d966cebc15e21cb64012d314f74f54dc35eead (diff) | |
Set up MMIO with keyboard, terminal emulator
Diffstat (limited to 'asm')
| -rw-r--r-- | asm/bootstrap.atk16 | 25 | ||||
| -rw-r--r-- | asm/idle_loop.atk16 | 10 |
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 |
