|
eForth1
v2.6
|
eForth Virtual Machine module More...
#include "eforth_vm.h"
Namespaces | |
| EfVM | |
Macros | |
| #define | OP(name) op##name |
| #define | VTABLE enum { OP(NOP) = 0, OPCODES } |
| #define | DISPATCH(op) switch(op) |
| #define | _X(n, code) case op##n: { DEBUG("%s",#n); { code; } break; } |
Functions | |
| void | EfVM::_init () |
| void | EfVM::_qrx () |
More... | |
| void | EfVM::_txsto () |
More... | |
| void | EfVM::_out (U16 p, U16 v) |
More... | |
| 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 | |
| DU * | EfVM::S |
| data stack pointer, 'stack' in Dr. Ting's More... | |
| DU * | EfVM::R |
| return stack pointer, 'rack' in Dr. Ting's More... | |
| DU | EfVM::T |
| TOS, cached top of stack value. More... | |
| DU | EfVM::I |
| RTOS, cached loop counter on return stack. More... | |
IO Streaming interface | |
| Stream * | EfVM::io |
| IO Stream, tied to Serial usually. More... | |
Memory Management Unit | |
| PGM_P | EfVM::_rom |
| ROM, Forth built-in words stored in Flash. More... | |
| U8 * | EfVM::_ram |
| RAM, for user defined words. More... | |
| U8 * | EfVM::_pre |
| Forth code pre-defined/embedded in .ino. More... | |
| CFP | EfVM::_api [CFUNC_MAX] |
| C API function pointer. More... | |
VM Registers | |
| DU * | EfVM::S |
| data stack pointer, 'stack' in Dr. Ting's More... | |
| DU * | EfVM::R |
| return stack pointer, 'rack' in Dr. Ting's More... | |
| DU | EfVM::T |
| TOS, cached top of stack value. More... | |
| DU | EfVM::I |
| RTOS, cached loop counter on return stack. More... | |
IO Streaming interface | |
| Stream * | EfVM::io |
| IO Stream, tied to Serial usually. More... | |
Memory Management Unit | |
| PGM_P | EfVM::_rom |
| ROM, Forth built-in words stored in Flash. More... | |
| U8 * | EfVM::_ram |
| RAM, for user defined words. More... | |
| U8 * | EfVM::_pre |
| Forth code pre-defined/embedded in .ino. More... | |
| CFP | EfVM::_api [CFUNC_MAX] |
| C API function pointer. 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 202405 add computed_goto; DS,RS,top,rtop=>S,R,T,I
| #define OP | ( | name | ) | op##name |
eForth virtual machine outer interpreter (single-step) execution unit
| #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