Skip to content

Virtual Machine

Uri edited this page Dec 24, 2021 · 1 revision

Virtual Machine Commands

R[] is virtual machine registers. First function argument should be put into R[4], second into R[5], etc. IP is a virtual machine instruction pointer.

All arguments of instructions has byte size (8 bits).

JAF a hi lo

Jump if Arity Fail.

If current arguments count is not equal to a then jump to IP + (hi<<8 + lo).

JAFX a hi lo

Jump if Arity Fail eXtended.

If current arguments count is less than a then jump to IP + (hi<<8 + lo).

GOTO r acc

Jump to function R[r] and set arguments count to acc.

MOVE src dst

Copy R[src] into R[dst].

MOV2 src1 dst1 src2 dst2

Copy R[src1] into R[dst1], then copy R[src2] into R[dst2].

REFI r i ret

Copy (ref R[r] R[i]) into R[ret].

Clone this wiki locally