nanoFORTH
v2.2
|
nanoForth Virtual Machine class implementation More...
Namespaces | |
N4VM | |
Macros | |
#define | DUMP_PER_LINE 0x10 |
#define | S2D(u, v) (((DU2)(u)<<16) | D_LO(v)) |
: stand-alone functions to reduce register allocation in _invoke More... | |
#define | D_HI(u) ((U16)((u)>>16)) |
#define | D_LO(u) ((U16)((u)&0xffff)) |
#define | DISPATCH(op) switch(op) |
#define | CODE(i, g) case i: { g; } break |
Data Stack and Return Stack Ops | |
| |
#define | SP0 ((DU*)&dic[N4_DIC_SZ + N4_STK_SZ]) |
#define | TOS (*vm.sp) |
#define | SS(i) (*(vm.sp+(i))) |
#define | PUSH(v) (*(--vm.sp)=(DU)(v)) |
#define | POP() (*vm.sp++) |
#define | RPUSH(a) (*(vm.rp++)=(IU)(a)) |
#define | RPOP() (*(--vm.rp)) |
#define | BOOL(f) ((f) ? -1 : 0) |
Dictionary Index <=> Pointer Converters | |
#define | DIC(n) ((U8*)dic + (n)) |
#define | IDX(p) ((IU)((U8*)(p) - dic)) |
Functions | |
void | N4VM::_nest (IU xt) |
void | N4VM::_init () |
void | N4VM::_dump (IU p0, U16 sz0) |
void | N4VM::_immediate (U16 op) |
void | N4VM::_clock () |
void | N4VM::_dplus () |
void | N4VM::_dminus () |
void | N4VM::_dneg () |
IU | N4VM::_invoke (U8 op, IU xt=0) |
void | N4VM::setup (const char *code, Stream &io, U8 ucase) |
void | N4VM::push (int v) |
int | N4VM::pop () |
void | N4VM::serv_isr () |
interrupt service routine More... | |
void | N4VM::outer () |
outer-interpreter More... | |
nanoForth Virtual Machine class implementation
#define TOS (*vm.sp) |
pointer to top of current stack
#define SS | ( | i | ) | (*(vm.sp+(i))) |
pointer to the nth on stack
#define PUSH | ( | v | ) | (*(--vm.sp)=(DU)(v)) |
push v onto parameter stack
#define POP | ( | ) | (*vm.sp++) |
pop value off parameter stack
#define RPUSH | ( | a | ) | (*(vm.rp++)=(IU)(a)) |
push address onto return stack
#define RPOP | ( | ) | (*(--vm.rp)) |
pop address from return stack
#define BOOL | ( | f | ) | ((f) ? -1 : 0) |
TRUE=-1 per common Forth idiom
#define DUMP_PER_LINE 0x10 |
show a section of memory in Forth dump format
: stand-alone functions to reduce register allocation in _invoke
32-bit operators
#define D_HI | ( | u | ) | ((U16)((u)>>16)) |
#define D_LO | ( | u | ) | ((U16)((u)&0xffff)) |
#define DISPATCH | ( | op | ) | switch(op) |
#define CODE | ( | i, | |
g | |||
) | case i: { g; } break |