18#define show(s) { io->print(F(s)); io->flush(); }
36#define ENC8(p, c) (*(U8*)(p)++=(U8)(c))
37#define ENCA(p, a) { IU x=(IU)(a); ENC8(p,(x)>>8); ENC8(p,(x)&0xff); }
38#define GETA(p) (((IU)(*(U8*)(p))<<8) + *((U8*)(p)+1))
39#define STORE(p, v) { DU x=(DU)(v); ENC8(p,(x)>>8); ENC8(p,(x)&0xff); }
40#define FETCH(p) (((DU)(*(U8*)(p))<<8) + *((U8*)(p)+1))
nanoForth main controller
uint16_t U16
16-bit unsigned integer, for return stack, and pointers
Definition n4.h:66
S16 DU
16-bit data unit (CELL)
Definition n4.h:76
U16 IU
16-bit instruction unit (ADDR)
Definition n4.h:75
uint8_t U8
8-bit unsigned integer, for char and short int
Definition n4.h:65
constexpr U16 N4_DIC_SZ
Definition n4_core.h:12
constexpr U16 N4_RAM_SZ
Definition n4_core.h:15
constexpr U16 N4_STK_SZ
Definition n4_core.h:13
constexpr U16 N4_TIB_SZ
Definition n4_core.h:14
Definition n4_core.cpp:18
void d_nib(U8 n)
print a nibble
Definition n4_core.cpp:114
U8 trc
tracing control flag
Definition n4_core.cpp:28
char uc(char c)
Definition n4_core.cpp:40
void d_out(U16 p, U16 v)
send output to GPIO ports
Definition n4_core.cpp:82
void set_pre(const char *code)
set embedded Forth code
Definition n4_core.cpp:36
void d_name(U8 *p)
print 3 characters name
Definition n4_core.cpp:132
void set_ucase(U8 uc)
set case sensitiveness
Definition n4_core.cpp:39
void d_pin(U16 p, U16 v)
set pin a given pinMode (INPUT, OUTPUT)
Definition n4_core.cpp:80
U16 a_in(U16 p)
fetch from analog port
Definition n4_core.cpp:99
void d_chr(char c)
print a char to console
Definition n4_core.cpp:70
void clear_tib()
reset input buffer
Definition n4_core.cpp:172
N4Task vm
VM context.
Definition n4_core.cpp:23
U8 ok()
check whether input buffer is empty
Definition n4_core.cpp:218
void d_num(DU n)
sent a number literal to console
Definition n4_core.cpp:79
void d_u8(U8 c)
print a 8-bit hex number
Definition n4_core.cpp:115
Stream * io
default to Arduino Serial Monitor
Definition n4_core.cpp:27
U8 number(U8 *str, DU *num)
Definition n4_core.cpp:148
void d_str(U8 *p)
handle dot string (byte-stream leading with length)
Definition n4_core.cpp:113
void set_hex(U8 f)
enable/disable hex numeric radix
Definition n4_core.cpp:38
U8 * get_token(U8 rst)
get a token from console input
Definition n4_core.cpp:246
void d_adr(IU a)
print a 12-bit address
Definition n4_core.cpp:77
void d_ptr(U8 *p)
print a pointer
Definition n4_core.cpp:78
void a_out(U16 p, U16 v)
send output to GPIO ports
Definition n4_core.cpp:100
void mstat()
display MMU statistics
Definition n4_core.cpp:46
U16 d_in(U16 p)
fetch from GPIO port
Definition n4_core.cpp:81
char key()
Arduino's Serial.getchar(), yield to user tasks when waiting.
Definition n4_core.cpp:65
U8 scan(U8 *tkn, const char *lst, IU *id)
Definition n4_core.cpp:283
void set_io(Stream *s)
initialize or redirect IO stream
Definition n4_core.cpp:37
void d_mem(U8 *base, U8 *p0, IU sz, U8 delim)
Definition n4_core.cpp:120
U8 dic[N4_RAM_SZ]
base of dictionary
Definition n4_core.cpp:22
IU * rp
base of return stack
Definition n4_core.h:46
DU * sp
top of data stack
Definition n4_core.h:47