eForth1  v2.4
eforth_vm.h File Reference

eForth Virtual Machine module header More...

#include "eforth_core.h"
Include dependency graph for eforth_vm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 EfVM
 

Macros

#define RAM_FLAG   0xe000
 
#define IDX_MASK   0x07ff
 
#define IRET_FLAG   0x8000
 
#define BOOL(f)   ((f) ? TRUE : FALSE)
 
#define RAM(i)   &_ram[(i) - FORTH_RAM_ADDR]
 
#define BSET(d, c)   (_ram[(d)&IDX_MASK]=(U8)(c))
 
#define S2D(h, l)   (((S32)(h)<<16) | ((l)&0xffff))
 
#define DEPTH()   ((DU)((U8*)DS - RAM(FORTH_STACK_ADDR)) >> 1)
 
#define PUSH(v)   { *++DS = top; top = (v); }
 
#define RPUSH(v)   { *--RS = rtop; rtop = (v); }
 
#define POP()   (top = *DS--)
 
#define RPOP()   (rtop = *RS++)
 
#define DTOP(d)   { *DS = (d)&0xffff; top = (d)>>16; }
 
Tracing
#define DEBUG(s, v)
 
#define TAB()   /* skip */
 
#define TRACE(op, ip, w, t, s)   /* skip */
 

Functions

U8 EfVM::BGET (U16 d)
 
U16 EfVM::GET (U16 d)
 
void EfVM::SET (U16 d, U16 v)
 

Detailed Description

eForth Virtual Machine module header

eForth Memory map

0x0000-0x1fff ROM (8K Flash memory)
0x2000-0x24ff RAM (2K dynamic memory)
0x2000-0x201f User Variables
0x2020-0x23ff User Dictionary
0x2400-0x247f Data/Return Stacks
0x2480-0x24ff TIB (Terminal Input Buffer)
0x2500 heap

Data and Return Stack

S R
| |
top -> [S0, S1, S2,..., R1, R0] <- rtop

Note: Dr. Ting uses U8 (0~255) for wrap-around control

Macro Definition Documentation

◆ RAM_FLAG

#define RAM_FLAG   0xe000

RAM ranger (0x2000~0x7fff)

◆ IDX_MASK

#define IDX_MASK   0x07ff

RAM index mask (0x0000~0x07ff)

◆ IRET_FLAG

#define IRET_FLAG   0x8000

interrupt return flag

◆ BOOL

#define BOOL (   f)    ((f) ? TRUE : FALSE)

◆ RAM

#define RAM (   i)    &_ram[(i) - FORTH_RAM_ADDR]

◆ BSET

#define BSET (   d,
 
)    (_ram[(d)&IDX_MASK]=(U8)(c))

◆ S2D

#define S2D (   h,
 
)    (((S32)(h)<<16) | ((l)&0xffff))

◆ DEPTH

#define DEPTH ( )    ((DU)((U8*)DS - RAM(FORTH_STACK_ADDR)) >> 1)

push a value onto stack top

◆ PUSH

#define PUSH (   v)    { *++DS = top; top = (v); }

◆ RPUSH

#define RPUSH (   v)    { *--RS = rtop; rtop = (v); }

◆ POP

#define POP ( )    (top = *DS--)

◆ RPOP

#define RPOP ( )    (rtop = *RS++)

◆ DTOP

#define DTOP (   d)    { *DS = (d)&0xffff; top = (d)>>16; }

◆ DEBUG

#define DEBUG (   s,
 
)

◆ TAB

#define TAB ( )    /* skip */

◆ TRACE

#define TRACE (   op,
  ip,
  w,
  t,
 
)    /* skip */
EfVM::top
DU top
ALU (i.e. cached top of stack value)
Definition: eforth_vm.cpp:20
RAM
#define RAM(i)
Definition: eforth_vm.h:41
R
U8 R
assembler return stack index
Definition: eforth_asm.c:15
EfVM::rtop
DU rtop
cached loop counter on return stack
Definition: eforth_vm.cpp:21