diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2024-02-20 16:55:14 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2024-02-20 16:56:09 +0200 |
| commit | 549901c85044b6ccd912688d6be007c2fdacc6c6 (patch) | |
| tree | 15d1123eedb4347472e4b47fec880e2e5b79927e /resources/asm/text_mode.atk16 | |
| parent | abf0594c78087434bced59054896f7f411e18faf (diff) | |
Refactor dir structure
Diffstat (limited to 'resources/asm/text_mode.atk16')
| -rw-r--r-- | resources/asm/text_mode.atk16 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/resources/asm/text_mode.atk16 b/resources/asm/text_mode.atk16 new file mode 100644 index 0000000..f20eac9 --- /dev/null +++ b/resources/asm/text_mode.atk16 @@ -0,0 +1,58 @@ +@opt stack_pointer RG +@opt csr_scratch RH +@use ext_std:* +@use ext_string_io:* + +; bootstrap code (must be called to set up mandatory data) +; will jump to label main +@include bootstrap + +@label main + cursor_to_line RC 1 + put_string RC RB " HELLO #vaincoodijutut" + new_line RC + put_string RC RB " »»»» BY @kal_jan »»»»" + new_line RC + new_line RC + put_string RC RB " > " + + set_graphics_mode gr_text_mode + +@label loop + jpi loop + +@label keyboard_isr + stack_stash RA RB RD + ldi vt_kb_pp_addr RA ; RA := Keyboard peripheral address pointer + ldr RA RA ; RA := Keyboard peripheral address deref + ldr RA RA ; RA := <16-bit keyboard character code> from MMIO register + ldi vt_term_pp_addr RB ; RB := Terminal peripheral address pointer + ldr RB RB ; RB := Terminal peripheral address deref + + mov RA RD ; RD := character code + subi RD 5 RD ; if code == 10 (enter key), then run newline handler + subi RD 5 RD + bri zero keyboard_isr_newline + + mov RA RD ; if code == 8 (backspace key), then run backspace handler + subi RD 5 RD + subi RD 3 RD + + bri zero keyboard_isr_backspace + str RA RC ; else code is not special; write it to text buffer + addi RC 1 RC + jpi keyboard_isr_end + +@label keyboard_isr_newline + new_line RC + put_string RC RB " > " + jpi keyboard_isr_end + +@label keyboard_isr_backspace + subi RC 1 RC + put_char RC RB " " + subi RC 1 RC + +@label keyboard_isr_end + stack_restore RA RB RD + rti |
