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*)DS - RAM(FORTH_STACK_ADDR)) >> 1)
66 #define PUSH(v) { *++DS = top; top = (v); }
67 #define RPUSH(v) { *--RS = rtop; rtop = (v); }
68 #define POP() (top = *DS--)
69 #define RPOP() (rtop = *RS++)
70 #define DTOP(d) { *DS = (d)&0xffff; top = (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, w, t, s)
136 #endif // __EFORTH_VM_H
Stream * io
Stream IO interface.
Definition: eforth_vm.cpp:33
DU top
ALU (i.e. cached top of stack value)
Definition: eforth_vm.cpp:20
#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 word stored in Arduino Flash Memory.
Definition: eforth_vm.cpp:26
int16_t S16
16-bit signed integer
Definition: eforth_config.h:25
#define LOG(s)
Definition: eforth_core.h:20
U8 * _ram
RAM, memory block for user define dictionary.
Definition: eforth_vm.cpp:27
#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 TRACE(op, ip, w, t, s)
Definition: eforth_vm.h:129
#define FORTH_STACK_ADDR
Definition: eforth_config.h:60
S16 DU
data/cell unit
Definition: eforth_config.h:29
Definition: eforth_vm.cpp:12
uint8_t U8
8-bit unsigned integer
Definition: eforth_config.h:22