|
|
|
@ -26,8 +26,8 @@ static intptr_t dict[100] = {
|
|
|
|
|
#define state dict[0]
|
|
|
|
|
#define BASE dict[1]
|
|
|
|
|
#define LATEST dict[2]
|
|
|
|
|
#define begin dict[3]
|
|
|
|
|
static intptr_t *here = &begin;
|
|
|
|
|
#define BEGIN dict[3]
|
|
|
|
|
static intptr_t *here = &BEGIN;
|
|
|
|
|
static char *in;
|
|
|
|
|
|
|
|
|
|
static intptr_t * saved_sp;
|
|
|
|
@ -115,7 +115,9 @@ N(mod, "mod", &w_ndiv) { sp[1] %= sp[0]; ++sp; NEXT; }
|
|
|
|
|
N(and, "and", &w_mod) { sp[1] &= sp[0]; ++sp; NEXT; }
|
|
|
|
|
N(or, "or", &w_and) { sp[1] |= sp[0]; ++sp; NEXT; }
|
|
|
|
|
N(xor, "xor", &w_or) { sp[1] ^= sp[0]; ++sp; NEXT; }
|
|
|
|
|
N(compname, "_c", &w_xor) ;
|
|
|
|
|
N(eq, "=", &w_xor) { sp[1] = sp[0] == sp[1]; ++sp; NEXT; }
|
|
|
|
|
N(lt, "<", &w_eq) { sp[1] = sp[0] > sp[1]; ++sp; NEXT; }
|
|
|
|
|
N(compname, "_c", &w_lt) ;
|
|
|
|
|
C(intr, "[", &w_compname) { state = 0; NEXT; }
|
|
|
|
|
N(comp, "]", &w_intr) { state = -1; NEXT; }
|
|
|
|
|
N(comma, ",", &w_comp) { *here++ = *sp++; NEXT; }
|
|
|
|
@ -151,7 +153,12 @@ W(decimal, "decimal", &w_execute) LIT(10), LIT(&BASE), poke, END
|
|
|
|
|
W(hex, "hex", &w_decimal) LIT(16), LIT(&BASE), poke, END
|
|
|
|
|
N(dot, ".", &w_hex) ;
|
|
|
|
|
N(emit, "emit", &w_dot) { foci_putchar(*sp++); NEXT; }
|
|
|
|
|
#define LATEST_INIT &w_emit
|
|
|
|
|
I(begin, "begin", &w_emit) FTH(here), LIT(sizeof(intptr_t)), sub, END
|
|
|
|
|
I(until, "until", &w_begin) LIT(bz), comma, comma, END
|
|
|
|
|
I(again, "again", &w_until) LIT(b), comma, comma, END
|
|
|
|
|
I(fwhile, "while", &w_again) FTH(fif), END
|
|
|
|
|
I(repeat, "repeat", &w_fwhile) swap, FTH(again), FTH(then), END
|
|
|
|
|
#define LATEST_INIT &w_repeat
|
|
|
|
|
|
|
|
|
|
void enter_forth(const void * const ptr)
|
|
|
|
|
{
|
|
|
|
|