The VM CPU understands 16 basic instructions:

ebci_INop    '..............................................
ebci_IConst  'type,val......................................
ebci_IFrame  '..............................................
ebci_IFCall  'addr,npars....................................
ebci_IPCall  'id pfunc......................................
ebci_INData  'n. var to alloc...............................
ebci_IStore  'offset, bLocal................................
ebci_IFetch  'offset, bLocal................................
ebci_IChop   '..............................................
ebci_IReturn '..............................................
ebci_IJump   'addr..........................................
ebci_IEnd    '..............................................
ebci_IBinOp  'opcode........................................
ebci_IUnOp   'opcode........................................
ebci_IRow    'row (only for debug purpose)..................
ebci_IPopJF  'addr..........................................
INop
No operation, not used ;-).

IConst (type,val)
It pushes a constant onto the stack.

IFrame
It facilitates IFCall/IReturn by saving the current top of variables stack in anticipation of a IFCall statement and saves the current BP pointer (Base Pointer for variables). See IFCall/IReturn.

IFCall (address, npars)
It performs a high level function call facility. The
address operand specifies the next instruction address to execute. The npars is used to allocate the local variables for function/sub parameters.

IPCall (id p.func)
It executes a private (internal function) given its code and make an automatic IReturn instruction also.

INData (n)
It creates n entries in the top of stack for variables.

IStore (offset,blocal)
It pops the top item from the stack and stores it in the variable referenced by BP and offset.

IFetch (offset,blocal)
It retrieves a variable from the stack using the BP and offset and pushes it onto the stack.

IChop
It discards the top element from the stack by popping it into oblivion.
Used after a
IPCall or IFCall sub.

IReturn
It returns from a function/sub, leaving the return value on the top of the stack. It restore the PC and BP counters and the local variable pool. See IFCall and IFrame.

IJump (address)
It jumps to the specified address

IEnd
It terminates the program

IBinOp (opcode)
It pops the top two items from the stack, applies the opcode and pushes the result onto the stack. The two operands must be of the same type.

IUnOp (opcode)
It pops one element from the stack, applies the unary opcode and pushes the result onto the stack.

IRow (row)
It serves only for debug purpose; it tells the compiler the row you are executing based on the source file so the cRunTimeError can give you the row of the error.

IPopJF (address)
It pops the top of the stack and if its value is False it jump to address. This instruction is used when translating the 'if', 'for', 'while' statements.
Copyright 2005 by Lorenzi Davide, created using Dynamic HTML Editor
The Virtual Machine Instruction Set