Go to the documentation of this file.
36 #define RAM_FLAG 0xe000
38 #define IDX_MASK 0x07ff
39 #define IRET_FLAG 0x8000
40 #define BOOL(f) ((f) ? TRUE : FALSE)
41 #define RAM(i) &_ram[(i) - FORTH_RAM_ADDR]
54 : ((
U16)pgm_read_byte(
_rom+d)<<8) | pgm_read_byte(
_rom+d+1);
56 #define BSET(d, c) (_ram[(d)&IDX_MASK]=(U8)(c))
61 #define S2D(h, l) (((S32)(h)<<16) | ((l)&0xffff))
62 #define DEPTH() ((DU)((U8*)S - RAM(FORTH_STACK_ADDR)) >> 1)
66 #define PUSH(v) { *++S = T; T = (v); }
67 #define RPUSH(v) { *--R = I; I = (v); }
68 #define POP() (T = *S--)
69 #define RPOP() (I = *R++)
70 #define DTOP(d) { *S = (d)&0xffff; T = (d)>>16; }
78 int constexpr opEXIT = 1;
83 int constexpr opENTER = 2;
84 int constexpr opDOLIT = 6;
85 int constexpr opEXEC = 8;
87 #define DEBUG(s,v) if (tCNT) printf((s),(v))
88 #define TAB() if (tCNT) { \
90 for (int i=0; i<tTAB; i++) LOG(" "); \
105 for (
int i=0; i<s; i++) {
112 case opDOLIT:
LOG_H(
"$",
GET(ip));
LOG(
" ");
break;
113 case opEXIT:
LOG(
";"); --tTAB;
break;
114 case opEXEC: w = top;
116 for (--w; (
BGET(w) & 0x7f)>0x20; w--);
117 int len =
BGET(w++) & 0x1f;
118 for (
int i=0; i<len; i++, w++) {
129 #define TRACE(op, ip, t, s)
136 #endif // __EFORTH_VM_H
Stream * io
IO Stream, tied to Serial usually.
Definition: eforth_vm.cpp:24
#define TRACE(op, ip, t, s)
Definition: eforth_vm.h:129
#define RAM(i)
Definition: eforth_vm.h:41
eForth prototype and interface
#define LOG_H(s, n)
Definition: eforth_core.h:23
U8 BGET(U16 d)
Definition: eforth_vm.h:45
void SET(U16 d, U16 v)
Definition: eforth_vm.h:57
#define IDX_MASK
Definition: eforth_vm.h:38
U16 GET(U16 d)
Definition: eforth_vm.h:51
#define LOG_C(c)
Definition: eforth_core.h:21
PGM_P _rom
ROM, Forth built-in words stored in Flash.
Definition: eforth_vm.cpp:28
int16_t S16
16-bit signed integer
Definition: eforth_config.h:25
#define LOG(s)
Definition: eforth_core.h:20
U8 * _ram
RAM, for user defined words.
Definition: eforth_vm.cpp:29
#define TAB()
Definition: eforth_vm.h:128
#define RAM_FLAG
Definition: eforth_vm.h:37
#define BSET(d, c)
Definition: eforth_vm.h:56
uint16_t U16
16-bit unsigned integer
Definition: eforth_config.h:21
#define FORTH_STACK_ADDR
Definition: eforth_config.h:60
S16 DU
data/cell unit
Definition: eforth_config.h:29
Definition: eforth_vm.cpp:13
uint8_t U8
8-bit unsigned integer
Definition: eforth_config.h:22