diff options
Diffstat (limited to 'asm')
| -rw-r--r-- | asm/bootstrap.atk16 | 22 | ||||
| -rw-r--r-- | asm/ext_string_io.py | 5 | ||||
| -rw-r--r-- | asm/text_mode.atk16 | 35 |
3 files changed, 44 insertions, 18 deletions
diff --git a/asm/bootstrap.atk16 b/asm/bootstrap.atk16 index 9d69872..a65fc99 100644 --- a/asm/bootstrap.atk16 +++ b/asm/bootstrap.atk16 @@ -43,17 +43,17 @@ ldi 0x55 RE hlt -@label keyboard_isr - stack_stash RA RB - 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 - str RA RB ; terminal <- character code (ASCII?) - mov RA RE ; RE := character code (for debugging) - stack_restore RA RB - rti +; @label keyboard_isr +; stack_stash RA RB +; 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 +; str RA RB ; terminal <- character code (ASCII?) +; mov RA RE ; RE := character code (for debugging) +; stack_restore RA RB +; rti @label program_segment ; define short prelude that sets up vital instructions diff --git a/asm/ext_string_io.py b/asm/ext_string_io.py index 7b026ba..dd17123 100644 --- a/asm/ext_string_io.py +++ b/asm/ext_string_io.py @@ -2,8 +2,7 @@ from asm_ops import * from ext_std import expand_addi def to_char_code(c: str): - if c == " " or c == "%SPACE": return 0 - else: return ord(c) - 64 + return ord(c) _counter = 0 def get_unique_name(prefix: str): @@ -17,7 +16,7 @@ def expand_put_char(cursor_reg: str, scratch_reg: str, c: str) -> ExpandResult: return [ ["ldi", str(to_char_code(c)), scratch_reg], ["str", scratch_reg, cursor_reg], - *expand_addi("RA", "1", "RA"), + *expand_addi(cursor_reg, "1", cursor_reg), ] def expand_put_string(cursor_reg: str, scratch_reg: str, *rest: str) -> ExpandResult: diff --git a/asm/text_mode.atk16 b/asm/text_mode.atk16 index fa4f297..7ec9fef 100644 --- a/asm/text_mode.atk16 +++ b/asm/text_mode.atk16 @@ -8,12 +8,39 @@ @include bootstrap @label main - cursor_to_line RA 1 - put_string RA RB " HELLO CORECAMP" - cursor_to_line RA 2 - put_string RA RB " BY JAN" + cursor_to_line RC 1 + put_string RC RB " HELLO CORECAMP" + cursor_to_line RC 2 + put_string RC RB " BY JAN" + cursor_to_line RC 4 + put_string RC RB " > " set_graphics_mode gr_text_mode @label loop jpi loop + +@label keyboard_isr + stack_stash RA RB + 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 + + str RA RC + mov RA RD + addi RC 1 RC + + subi RA 5 RA + subi RA 5 RA + bri zero keyboard_isr_clear + jpi keyboard_isr_end +@label keyboard_isr_clear + ; cursor_to_line RC 4 + ; put_string RC RB " " + cursor_to_line RC 4 + put_string RC RB " > " +@label keyboard_isr_end + stack_restore RA RB + rti |
