Created
July 20, 2018 20:55
-
-
Save johnhw/f02f8097fc3e6ea4a8293577492fd475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p |link_ptr|name_ptr|class_ptr|doc_ptr|data_words... | |
execute: | |
mov x1, x0+D_DATA | |
ldr x0, [x0+D_CLASS] | |
b x0 | |
bytecode: | |
mov x0, [IP] | |
bz stop | |
nxt: | |
mov x2, x0 | |
shl x2, #2 | |
b jmp_table+x2 | |
nxt_byte: | |
shr x0, #1 | |
bnz nxt | |
add x1, #1 | |
b bytecode | |
stop | |
call: | |
pushr IP | |
pop IP | |
b bytecode | |
ret: | |
popr IP | |
b bytecode | |
jmp: | |
pop IP | |
b bytecode | |
zret: | |
pop T0 | |
cmp T0, #0 | |
bnz bytecode | |
popr IP | |
b bytecode | |
.macro binop op | |
pop T0 | |
pop T1 | |
\op T0, T1 | |
push T0 | |
b nxt_byte | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment