nanoFORTH
v2.2
|
nanoForth Core Utilities More...
#include "n4.h"
Go to the source code of this file.
Data Structures | |
struct | N4Task |
Namespaces | |
N4Core | |
Macros | |
#define | show(s) { io->print(F(s)); io->flush(); } |
Logical Memory Access Ops | |
#define | ENC8(p, c) (*(U8*)(p)++=(U8)(c)) |
1-byte write (Note: increment calling pointer by 1) More... | |
#define | ENCA(p, a) { IU x=(IU)(a); ENC8(p,(x)>>8); ENC8(p,(x)&0xff); } |
instruction unit write, prevent alignment issue (on 32-bit CPU) and preserve Big-Endian encoding More... | |
#define | GETA(p) (((IU)(*(U8*)(p))<<8) + *((U8*)(p)+1)) |
instruction unit read More... | |
#define | STORE(p, v) { DU x=(DU)(v); ENC8(p,(x)>>8); ENC8(p,(x)&0xff); } |
data unit store, same as ENC for 16-bit Forth (physical vs logical) More... | |
#define | FETCH(p) (((DU)(*(U8*)(p))<<8) + *((U8*)(p)+1)) |
DU fetch. More... | |
Functions | |
void | N4Core::mstat () |
display MMU statistics More... | |
void | N4Core::set_pre (const char *code) |
set embedded Forth code More... | |
void | N4Core::set_io (Stream *s) |
initialize or redirect IO stream More... | |
void | N4Core::set_hex (U8 f) |
enable/disable hex numeric radix More... | |
void | N4Core::set_ucase (U8 uc) |
set case sensitiveness More... | |
char | N4Core::uc (char c) |
Console IO Functions with Cooperative Threading support | |
char | N4Core::key () |
Arduino's Serial.getchar(), yield to user tasks when waiting. More... | |
void | N4Core::d_chr (char c) |
print a char to console More... | |
void | N4Core::d_adr (IU a) |
print a 12-bit address More... | |
void | N4Core::d_ptr (U8 *p) |
print a pointer More... | |
void | N4Core::d_num (DU n) |
sent a number literal to console More... | |
void | N4Core::d_pin (U16 p, U16 v) |
set pin a given pinMode (INPUT, OUTPUT) More... | |
U16 | N4Core::d_in (U16 p) |
fetch from GPIO port More... | |
void | N4Core::d_out (U16 p, U16 v) |
send output to GPIO ports More... | |
U16 | N4Core::a_in (U16 p) |
fetch from analog port More... | |
void | N4Core::a_out (U16 p, U16 v) |
send output to GPIO ports More... | |
void | N4Core::d_str (U8 *p) |
handle dot string (byte-stream leading with length) More... | |
void | N4Core::d_nib (U8 n) |
print a nibble More... | |
void | N4Core::d_u8 (U8 c) |
print a 8-bit hex number More... | |
dot_* for Console Input/Output Routines | |
void | N4Core::d_mem (U8 *base, U8 *p0, IU sz, U8 delim) |
void | N4Core::d_name (U8 *p) |
print 3 characters name More... | |
void | N4Core::d_name (U8 op, const char *lst, U8 space) |
Input buffer Functions | |
U8 | N4Core::number (U8 *str, DU *num) |
void | N4Core::clear_tib () |
reset input buffer More... | |
U8 | N4Core::ok () |
check whether input buffer is empty More... | |
U8 * | N4Core::get_token (U8 rst=0) |
get a token from console input More... | |
U8 | N4Core::scan (U8 *tkn, const char *lst, IU *id) |
Console IO Functions with Cooperative Threading support | |
char | N4Core::key () |
Arduino's Serial.getchar(), yield to user tasks when waiting. More... | |
void | N4Core::d_chr (char c) |
print a char to console More... | |
void | N4Core::d_adr (IU a) |
print a 12-bit address More... | |
void | N4Core::d_str (U8 *p) |
handle dot string (byte-stream leading with length) More... | |
void | N4Core::d_ptr (U8 *p) |
print a pointer More... | |
void | N4Core::d_nib (U8 n) |
print a nibble More... | |
void | N4Core::d_u8 (U8 c) |
print a 8-bit hex number More... | |
void | N4Core::d_num (DU n) |
sent a number literal to console More... | |
void | N4Core::d_pin (U16 p, U16 v) |
set pin a given pinMode (INPUT, OUTPUT) More... | |
U16 | N4Core::d_in (U16 p) |
fetch from GPIO port More... | |
void | N4Core::d_out (U16 p, U16 v) |
send output to GPIO ports More... | |
U16 | N4Core::a_in (U16 p) |
fetch from analog port More... | |
void | N4Core::a_out (U16 p, U16 v) |
send output to GPIO ports More... | |
dot_* for Console Input/Output Routines | |
void | N4Core::d_mem (U8 *base, U8 *p0, IU sz, U8 delim) |
void | N4Core::d_name (U8 *p) |
print 3 characters name More... | |
void | N4Core::d_name (U8 op, const char *lst, U8 space) |
Input buffer Functions | |
void | N4Core::clear_tib () |
reset input buffer More... | |
U8 | N4Core::ok () |
check whether input buffer is empty More... | |
U8 * | N4Core::get_token (U8 rst=0) |
get a token from console input More... | |
U8 | N4Core::number (U8 *str, DU *num) |
U8 | N4Core::scan (U8 *tkn, const char *lst, IU *id) |
Console IO Functions with Cooperative Threading support | |
char | N4Core::key () |
Arduino's Serial.getchar(), yield to user tasks when waiting. More... | |
void | N4Core::d_chr (char c) |
print a char to console More... | |
void | N4Core::d_adr (IU a) |
print a 12-bit address More... | |
void | N4Core::d_ptr (U8 *p) |
print a pointer More... | |
void | N4Core::d_num (DU n) |
sent a number literal to console More... | |
void | N4Core::d_pin (U16 p, U16 v) |
set pin a given pinMode (INPUT, OUTPUT) More... | |
U16 | N4Core::d_in (U16 p) |
fetch from GPIO port More... | |
void | N4Core::d_out (U16 p, U16 v) |
send output to GPIO ports More... | |
U16 | N4Core::a_in (U16 p) |
fetch from analog port More... | |
void | N4Core::a_out (U16 p, U16 v) |
send output to GPIO ports More... | |
void | N4Core::d_str (U8 *p) |
handle dot string (byte-stream leading with length) More... | |
void | N4Core::d_nib (U8 n) |
print a nibble More... | |
void | N4Core::d_u8 (U8 c) |
print a 8-bit hex number More... | |
dot_* for Console Input/Output Routines | |
void | N4Core::d_mem (U8 *base, U8 *p0, IU sz, U8 delim) |
void | N4Core::d_name (U8 *p) |
print 3 characters name More... | |
void | N4Core::d_name (U8 op, const char *lst, U8 space) |
Input buffer Functions | |
U8 | N4Core::number (U8 *str, DU *num) |
void | N4Core::clear_tib () |
reset input buffer More... | |
U8 | N4Core::ok () |
check whether input buffer is empty More... | |
U8 * | N4Core::get_token (U8 rst=0) |
get a token from console input More... | |
U8 | N4Core::scan (U8 *tkn, const char *lst, IU *id) |
Variables | |
Default Heap sizing | |
constexpr U16 | N4_DIC_SZ = 0x400 |
constexpr U16 | N4_STK_SZ = 0x80 |
constexpr U16 | N4_TIB_SZ = 0x80 |
constexpr U16 | N4_RAM_SZ = N4_DIC_SZ + N4_STK_SZ + N4_TIB_SZ |
nanoForth Core Utilities
#define show | ( | s | ) | { io->print(F(s)); io->flush(); } |
instruction unit write, prevent alignment issue (on 32-bit CPU) and preserve Big-Endian encoding
data unit store, same as ENC for 16-bit Forth (physical vs logical)
|
constexpr |
default dictionary size
|
constexpr |
default parameter/return stack size
|
constexpr |
terminal input buffer size