eForth1
v2.4
|
eForth Virtual Machine module More...
#include "eforth_vm.h"
Namespaces | |
EfVM | |
Macros | |
#define | OP(name) op##name |
#define | _X(n, code) case op##n: { DEBUG("%s",#n); { code; } break; } |
#define | DISPATCH(op) switch(op) |
Functions | |
void | EfVM::_init () |
void | EfVM::_yield () |
More... | |
void | EfVM::_qrx () |
More... | |
void | EfVM::_txsto () |
More... | |
void | EfVM::_ummod () |
(udl udh u – ur uq) unsigned double divided by a single More... | |
void | EfVM::_out (U16 p, U16 v) |
void | vm_init (PGM_P rom, U8 *ram, void *io_stream, const char *code) |
void | _ccall () |
void | vm_cfunc (int n, CFP fp) |
More... | |
void | vm_push (int v) |
push value onto VM data stack More... | |
int | vm_pop () |
pop TOS off VM data stack More... | |
Variables | |
VM Registers | |
IU | EfVM::IP |
instruction pointer, IU is 16-bit, opcode is 8-bit More... | |
IU | EfVM::W |
work register, IU is 16-bit More... | |
DU * | EfVM::DS |
data stack pointer, Dr. Ting's stack More... | |
DU * | EfVM::RS |
return stack pointer, Dr. Ting's rack More... | |
DU | EfVM::top |
ALU (i.e. cached top of stack value) More... | |
DU | EfVM::rtop |
cached loop counter on return stack More... | |
IU | EfVM::IR |
interrupt service routine More... | |
Memory Management Unit | |
PGM_P | EfVM::_rom |
ROM, Forth word stored in Arduino Flash Memory. More... | |
U8 * | EfVM::_ram |
RAM, memory block for user define dictionary. More... | |
U8 * | EfVM::_pre |
Pre-built/embedded Forth code. More... | |
CFP | EfVM::_api [CFUNC_MAX] |
IO Streaming interface | |
Stream * | EfVM::io |
Stream IO interface. More... | |
VM Registers | |
IU | EfVM::IP |
instruction pointer, IU is 16-bit, opcode is 8-bit More... | |
IU | EfVM::W |
work register, IU is 16-bit More... | |
DU * | EfVM::DS |
data stack pointer, Dr. Ting's stack More... | |
DU * | EfVM::RS |
return stack pointer, Dr. Ting's rack More... | |
DU | EfVM::top |
ALU (i.e. cached top of stack value) More... | |
DU | EfVM::rtop |
cached loop counter on return stack More... | |
IU | EfVM::IR |
interrupt service routine More... | |
Memory Management Unit | |
PGM_P | EfVM::_rom |
ROM, Forth word stored in Arduino Flash Memory. More... | |
U8 * | EfVM::_ram |
RAM, memory block for user define dictionary. More... | |
U8 * | EfVM::_pre |
Pre-built/embedded Forth code. More... | |
CFP | EfVM::_api [CFUNC_MAX] |
IO Streaming interface | |
Stream * | EfVM::io |
Stream IO interface. More... | |
eForth Virtual Machine module
Revision Note: Threading model evolution 202212 EfVMSub module - vtable subroutine calling 202301 indirect threading - computed label jumping 202302 direct threading - opcode => code(); continue = $NEXT
#define OP | ( | name | ) | op##name |
#define DISPATCH | ( | op | ) | switch(op) |
void vm_init | ( | PGM_P | rom, |
U8 * | ram, | ||
void * | io_stream, | ||
const char * | code | ||
) |
void _ccall | ( | ) |
C interface implementation
TODO: build formal C callstack construct
fetch C function pointer
pop off TOS
call C function
void vm_cfunc | ( | int | n, |
CFP | fp | ||
) |
function pointer
assign C interface (in slot n)
void vm_push | ( | int | v | ) |
push value onto VM data stack
proxy to VM
int vm_pop | ( | ) |
pop TOS off VM data stack