nanoFORTH  v2.2
tforth.c File Reference
#include "system.h"
Include dependency graph for tforth.c:

Macros

#define KEY_RUNMODE   "\x03" ": " "VAR" "FGT"
 
#define KEY_COMPILEMODE   "\x0b" "; " "IF " "ELS" "THN" "BGN" "END" "WHL" "RPT" "DO " "LOP" "I "
 
#define KEY_PRIMITIVE   "\x19" "DRP" "DUP" "SWP" ">R " "R> " "+ " "- " "* " "/ " "MOD" "AND" "OR " "XOR" "= " "< " "> " "<= " ">= " "<> " "NOT" "@ " "@@ " "! " "!! " ". "
 
#define PFX_UDJ   0x80U
 
#define PFX_CDJ   0xa0U
 
#define PFX_CALL   0xc0U
 
#define PFX_PRIMITIVE   0xe0U
 
#define I_LIT   0xffU
 
#define I_RET   0xfeU
 
#define I_LOOP   (PFX_PRIMITIVE | 25U)
 
#define I_RDROP2   (PFX_PRIMITIVE | 26U)
 
#define I_I   (PFX_PRIMITIVE | 27U)
 
#define I_P2R2   (PFX_PRIMITIVE | 28U)
 

Functions

static void putmsg (char *msg)
 
static unsigned char * gettkn (void)
 
static char literal (unsigned char *str, unsigned short *num)
 
static char lookup (unsigned char *key, unsigned short *adrs)
 
static char find (unsigned char *key, char *list, unsigned char *id)
 
static void compile (void)
 
static void variable (void)
 
static void forget (void)
 
static void execute (unsigned short adrs)
 
static void primitive (unsigned char ic)
 
static void putnum (unsigned short num)
 
int main (void)
 

Variables

static unsigned short stack [STACK_SIZE]
 
static unsigned short * retstk
 
static unsigned short * parstk
 
static unsigned char dic [DIC_SIZE]
 
static unsigned char * dicptr
 
static unsigned char * dicent
 

Macro Definition Documentation

◆ KEY_RUNMODE

#define KEY_RUNMODE   "\x03" ": " "VAR" "FGT"

◆ KEY_COMPILEMODE

#define KEY_COMPILEMODE   "\x0b" "; " "IF " "ELS" "THN" "BGN" "END" "WHL" "RPT" "DO " "LOP" "I "

◆ KEY_PRIMITIVE

#define KEY_PRIMITIVE   "\x19" "DRP" "DUP" "SWP" ">R " "R> " "+ " "- " "* " "/ " "MOD" "AND" "OR " "XOR" "= " "< " "> " "<= " ">= " "<> " "NOT" "@ " "@@ " "! " "!! " ". "

◆ PFX_UDJ

#define PFX_UDJ   0x80U

◆ PFX_CDJ

#define PFX_CDJ   0xa0U

◆ PFX_CALL

#define PFX_CALL   0xc0U

◆ PFX_PRIMITIVE

#define PFX_PRIMITIVE   0xe0U

◆ I_LIT

#define I_LIT   0xffU

◆ I_RET

#define I_RET   0xfeU

◆ I_LOOP

#define I_LOOP   (PFX_PRIMITIVE | 25U)

◆ I_RDROP2

#define I_RDROP2   (PFX_PRIMITIVE | 26U)

◆ I_I

#define I_I   (PFX_PRIMITIVE | 27U)

◆ I_P2R2

#define I_P2R2   (PFX_PRIMITIVE | 28U)

Function Documentation

◆ putmsg()

static void putmsg ( char *  msg)
static

◆ gettkn()

static unsigned char * gettkn ( void  )
static

◆ literal()

static char literal ( unsigned char *  str,
unsigned short *  num 
)
static

◆ lookup()

static char lookup ( unsigned char *  key,
unsigned short *  adrs 
)
static

◆ find()

static char find ( unsigned char *  key,
char *  list,
unsigned char *  id 
)
static

◆ compile()

static void compile ( void  )
static

◆ variable()

static void variable ( void  )
static

◆ forget()

static void forget ( void  )
static

◆ execute()

static void execute ( unsigned short  adrs)
static

◆ primitive()

static void primitive ( unsigned char  ic)
static

◆ putnum()

static void putnum ( unsigned short  num)
static

◆ main()

int main ( void  )

Variable Documentation

◆ stack

unsigned short stack[STACK_SIZE]
static

◆ retstk

unsigned short* retstk
static

◆ parstk

unsigned short* parstk
static

◆ dic

unsigned char dic[DIC_SIZE]
static

◆ dicptr

unsigned char* dicptr
static

◆ dicent

unsigned char* dicent
static