Skip to content

Instantly share code, notes, and snippets.

@johnhw
Created July 20, 2018 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnhw/f02f8097fc3e6ea4a8293577492fd475 to your computer and use it in GitHub Desktop.
Save johnhw/f02f8097fc3e6ea4a8293577492fd475 to your computer and use it in GitHub Desktop.
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