diff options
Diffstat (limited to 'asm')
| -rw-r--r-- | asm/atk16.py | 11 | ||||
| -rw-r--r-- | asm/bootstrap.atk16 | 24 | ||||
| -rw-r--r-- | asm/fibo.atk16 | 2 | ||||
| -rw-r--r-- | asm/idle_loop.atk16 | 2 | ||||
| -rw-r--r-- | asm/test_py_src.atk16 | 165 | ||||
| -rw-r--r-- | asm/test_py_src.py | 8 | ||||
| -rw-r--r-- | asm/test_py_src.pydis | 63 | ||||
| -rw-r--r-- | asm/text_mode.atk16 | 2 |
8 files changed, 262 insertions, 15 deletions
diff --git a/asm/atk16.py b/asm/atk16.py new file mode 100644 index 0000000..143dd52 --- /dev/null +++ b/asm/atk16.py @@ -0,0 +1,11 @@ +def atk_store(addr: int, value: int): + return NotImplemented + +def atk_load(addr: int) -> int: + return NotImplemented + +def atk_put_char(c: int): + return NotImplemented + +def atk_enable_text_mode(): + return NotImplemented diff --git a/asm/bootstrap.atk16 b/asm/bootstrap.atk16 index a65fc99..6363d71 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 @@ -61,7 +61,7 @@ @address 0x0 ; set up stack pointer to point to beginning of stack segment ldi vt_stack_addr RA - ldr RA RF + ldr RA __STACK_POINTER jpi program_segment @address program_segment diff --git a/asm/fibo.atk16 b/asm/fibo.atk16 index fb375b3..34999a9 100644 --- a/asm/fibo.atk16 +++ b/asm/fibo.atk16 @@ -1,4 +1,4 @@ -@opt stack_pointer RF +@opt stack_pointer RG @opt csr_scratch RH @use ext_std:* diff --git a/asm/idle_loop.atk16 b/asm/idle_loop.atk16 index 442923c..dd7d879 100644 --- a/asm/idle_loop.atk16 +++ b/asm/idle_loop.atk16 @@ -1,4 +1,4 @@ -@opt stack_pointer RF +@opt stack_pointer RG @opt csr_scratch RH @use ext_std:* diff --git a/asm/test_py_src.atk16 b/asm/test_py_src.atk16 new file mode 100644 index 0000000..af8489b --- /dev/null +++ b/asm/test_py_src.atk16 @@ -0,0 +1,165 @@ +@opt stack_pointer RG +@opt csr_scratch RH +@use ext_std:* +@include bootstrap +@label py_consts +; 0: 0 + 0 +; 1: ('*',) + 0 +; 2: 63488 + 63488 +; 3: 72 + 72 +; 4: 63489 + 63489 +; 5: 69 + 69 +; 6: 63490 + 63490 +; 7: 76 + 76 +; 8: 63491 + 63491 +; 9: 63492 + 63492 +; 10: 79 + 79 +; 11: None + 0 +@label atk_store + str RB RA + rsr +@label atk_enable_text_mode + set_graphics_mode gr_text_mode + rsr +@label main +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 1 + ldi atk_enable_text_mode RA + spu RA +; PRECALL 0 +; CALL 0 + spo RA + csr RA +; POP_TOP None + spo RA +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 2 + ldi atk_store RA + spu RA +; LOAD_CONST 2 + ldi ${py_consts + 2} RA + ldr RA RA + spu RA +; LOAD_CONST 3 + ldi ${py_consts + 3} RA + ldr RA RA + spu RA +; PRECALL 2 +; CALL 2 + spo RB + spo RA + spo RC + csr RC +; POP_TOP None + spo RA +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 2 + ldi atk_store RA + spu RA +; LOAD_CONST 4 + ldi ${py_consts + 4} RA + ldr RA RA + spu RA +; LOAD_CONST 5 + ldi ${py_consts + 5} RA + ldr RA RA + spu RA +; PRECALL 2 +; CALL 2 + spo RB + spo RA + spo RC + csr RC +; POP_TOP None + spo RA +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 2 + ldi atk_store RA + spu RA +; LOAD_CONST 6 + ldi ${py_consts + 6} RA + ldr RA RA + spu RA +; LOAD_CONST 7 + ldi ${py_consts + 7} RA + ldr RA RA + spu RA +; PRECALL 2 +; CALL 2 + spo RB + spo RA + spo RC + csr RC +; POP_TOP None + spo RA +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 2 + ldi atk_store RA + spu RA +; LOAD_CONST 8 + ldi ${py_consts + 8} RA + ldr RA RA + spu RA +; LOAD_CONST 7 + ldi ${py_consts + 7} RA + ldr RA RA + spu RA +; PRECALL 2 +; CALL 2 + spo RB + spo RA + spo RC + csr RC +; POP_TOP None + spo RA +; PUSH_NULL None + ldi 0 RA + spu RA +; LOAD_NAME 2 + ldi atk_store RA + spu RA +; LOAD_CONST 9 + ldi ${py_consts + 9} RA + ldr RA RA + spu RA +; LOAD_CONST 10 + ldi ${py_consts + 10} RA + ldr RA RA + spu RA +; PRECALL 2 +; CALL 2 + spo RB + spo RA + spo RC + csr RC +; POP_TOP None + spo RA +; LOAD_CONST 11 + ldi ${py_consts + 11} RA + ldr RA RA + spu RA +; RETURN_VALUE None +@label keep_alive + jpi keep_alive
\ No newline at end of file diff --git a/asm/test_py_src.py b/asm/test_py_src.py new file mode 100644 index 0000000..89658f8 --- /dev/null +++ b/asm/test_py_src.py @@ -0,0 +1,8 @@ +from atk16 import * + +atk_enable_text_mode() +atk_store(0xF800, 65 + 7) # H +atk_store(0xF801, 65 + 4) # E +atk_store(0xF802, 65 + 11) # L +atk_store(0xF803, 65 + 11) # L +atk_store(0xF804, 65 + 14) # O diff --git a/asm/test_py_src.pydis b/asm/test_py_src.pydis new file mode 100644 index 0000000..483f073 --- /dev/null +++ b/asm/test_py_src.pydis @@ -0,0 +1,63 @@ +### Constants +(0, ('*',), 63488, 72, 63489, 69, 63490, 76, 63491, 63492, 79, None) + +### Names +('atk16', 'atk_enable_text_mode', 'atk_store') + +### Instructions +RESUME 0 +LOAD_CONST 0 +LOAD_CONST 1 +IMPORT_NAME 0 +IMPORT_STAR None +PUSH_NULL None +LOAD_NAME 1 +PRECALL 0 +CALL 0 +POP_TOP None +PUSH_NULL None +LOAD_NAME 2 +LOAD_CONST 2 +LOAD_CONST 3 +PRECALL 2 +CALL 2 +POP_TOP None +PUSH_NULL None +LOAD_NAME 2 +LOAD_CONST 4 +LOAD_CONST 5 +PRECALL 2 +CALL 2 +POP_TOP None +PUSH_NULL None +LOAD_NAME 2 +LOAD_CONST 6 +LOAD_CONST 7 +PRECALL 2 +CALL 2 +POP_TOP None +PUSH_NULL None +LOAD_NAME 2 +LOAD_CONST 8 +LOAD_CONST 7 +PRECALL 2 +CALL 2 +POP_TOP None +PUSH_NULL None +LOAD_NAME 2 +LOAD_CONST 9 +LOAD_CONST 10 +PRECALL 2 +CALL 2 +POP_TOP None +LOAD_CONST 11 +RETURN_VALUE None +warn: cannot serialize <class 'tuple'> (('*',)), emitting zero +warn: cannot serialize <class 'NoneType'> (None), emitting zero +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: PRECALL +Skipping not implemented opcode: RETURN_VALUE diff --git a/asm/text_mode.atk16 b/asm/text_mode.atk16 index 54741dc..f20eac9 100644 --- a/asm/text_mode.atk16 +++ b/asm/text_mode.atk16 @@ -1,4 +1,4 @@ -@opt stack_pointer RF +@opt stack_pointer RG @opt csr_scratch RH @use ext_std:* @use ext_string_io:* |
