diff --git a/ueforth/common/core.h b/ueforth/common/core.h index d51cf05..f5f9aa4 100644 --- a/ueforth/common/core.h +++ b/ueforth/common/core.h @@ -13,7 +13,9 @@ static struct { static cell_t convert(const char *pos, cell_t n, cell_t *ret) { *ret = 0; cell_t negate = 0; + cell_t base = g_sys.base; if (!n) { return 0; } + if (pos[0] == '$') { base = 16; ++pos; --n; } if (pos[0] == '-') { negate = -1; ++pos; --n; } for (; n; --n) { uintptr_t d = pos[0] - '0'; @@ -22,7 +24,7 @@ static cell_t convert(const char *pos, cell_t n, cell_t *ret) { if (d < 10) { return 0; } } if (d >= (uintptr_t) g_sys.base) { return 0; } - *ret = *ret * g_sys.base + d; + *ret = *ret * base + d; ++pos; } if (negate) { *ret = -*ret; } diff --git a/ueforth/posix/posix.fs b/ueforth/posix/posix.fs index 2860d44..9b2efbf 100644 --- a/ueforth/posix/posix.fs +++ b/ueforth/posix/posix.fs @@ -38,6 +38,14 @@ z" __errno_location" 0 sysfunc __errno_location 1 constant SEEK_CUR 2 constant SEEK_END +( mmap ) +0 constant PROT_NONE +1 constant PROT_READ +2 constant PROT_WRITE +4 constant PROT_EXEC +$10 constant MAP_FIXED +$20 constant MAP_ANONYMOUS + ( Terminal handling ) : n. ( n -- ) base @ swap decimal <# #s #> type base ! ; : esc 27 emit ;