Drop more stdlib things.

This commit is contained in:
Brad Nelson
2021-01-08 20:48:42 -08:00
parent ef0e18ace8
commit 71b661e2e3
6 changed files with 20 additions and 10 deletions

View File

@ -27,7 +27,9 @@ STRIP_ARGS = -S \
--remove-section=.note.ABI-tag --remove-section=.note.ABI-tag
LIBS=-ldl LIBS=-ldl
WINFLAGS = -mwindows -luser32 WINFLAGS = -ffreestanding -fno-stack-check \
-fno-stack-protector -mno-stack-arg-probe \
-mwindows -lkernel32
# Default to 32-bit Windows for maximum portability. # Default to 32-bit Windows for maximum portability.
ifeq ($(WIN_ARCH),) ifeq ($(WIN_ARCH),)
@ -201,7 +203,7 @@ $(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip \
mkdir -p $(DEPLOY)/static mkdir -p $(DEPLOY)/static
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
cp -r $(WINDOWS)/uEforth.exe $(DEPLOY)/static cp -r $(WINDOWS)/uEforth.exe $(DEPLOY)/static/ueforth.windows
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
cp -r site/* $(DEPLOY) cp -r site/* $(DEPLOY)

View File

@ -163,6 +163,10 @@ variable hld
: s>z ( a n -- z ) here >r $place r> ; : s>z ( a n -- z ) here >r $place r> ;
: z>s ( z -- a n ) 0 over begin dup c@ while 1+ swap 1+ swap repeat drop ; : z>s ( z -- a n ) 0 over begin dup c@ while 1+ swap 1+ swap repeat drop ;
( Fill, Move )
: cmove ( a a n -- ) for aft >r dup c@ r@ c! 1+ r> 1+ then next 2drop ;
: fill ( a a n -- ) swap for swap aft 2dup c! 1 + then next 2drop ;
( Better Errors ) ( Better Errors )
: notfound ( a n n -- ) : notfound ( a n n -- )
if cr ." ERROR: " type ." NOT FOUND!" cr -1 throw then ; if cr ." ERROR: " type ." NOT FOUND!" cr -1 throw then ;

View File

@ -59,7 +59,8 @@ static cell_t find(const char *name, cell_t len) {
} }
static void create(const char *name, cell_t length, cell_t flags, void *op) { static void create(const char *name, cell_t length, cell_t flags, void *op) {
memcpy(g_sys.heap, name, length); // name char *pos = (char *) g_sys.heap;
for (cell_t n = length; n; --n) { *pos++ = *name++; } // name
g_sys.heap += CELL_LEN(length); g_sys.heap += CELL_LEN(length);
*g_sys.heap++ = length; // length *g_sys.heap++ = length; // length
*g_sys.heap++ = (cell_t) g_sys.last; // link *g_sys.heap++ = (cell_t) g_sys.last; // link
@ -141,11 +142,11 @@ static void ueforth_run() {
static void ueforth(int argc, char *argv[], void *heap, static void ueforth(int argc, char *argv[], void *heap,
const char *src, cell_t src_len) { const char *src, cell_t src_len) {
memset(&g_sys, 0, sizeof(g_sys)); g_sys.ip = 0;
g_sys.heap = (cell_t *) heap; g_sys.heap = (cell_t *) heap + 4; // Leave a little room.
ueforth_run(); ueforth_run();
g_sys.sp = g_sys.heap + sizeof(cell_t); g_sys.heap += STACK_SIZE; g_sys.sp = g_sys.heap + 1; g_sys.heap += STACK_SIZE;
g_sys.rp = g_sys.heap; g_sys.heap += STACK_SIZE; g_sys.rp = g_sys.heap + 1; g_sys.heap += STACK_SIZE;
g_sys.last[-1] = 1; // Make ; IMMEDIATE g_sys.last[-1] = 1; // Make ; IMMEDIATE
g_sys.DOLIT_XT = FIND("DOLIT"); g_sys.DOLIT_XT = FIND("DOLIT");
g_sys.DOEXIT_XT = FIND("EXIT"); g_sys.DOEXIT_XT = FIND("EXIT");

View File

@ -46,8 +46,6 @@ typedef uint64_t udcell_t;
X("!", STORE, *(cell_t *) tos = (*sp)|0; --sp; DROP) \ X("!", STORE, *(cell_t *) tos = (*sp)|0; --sp; DROP) \
X("L!", LSTORE, *(int32_t *) tos = (*sp)|0; --sp; DROP) \ X("L!", LSTORE, *(int32_t *) tos = (*sp)|0; --sp; DROP) \
X("C!", CSTORE, *(uint8_t *) tos = (*sp)|0; --sp; DROP) \ X("C!", CSTORE, *(uint8_t *) tos = (*sp)|0; --sp; DROP) \
X("FILL", FILL, memset((void *) (sp[-1] | 0), tos | 0, (*sp | 0)); sp -= 2; DROP) \
X("MOVE", MOVE, memmove((void *) (sp[-1] | 0), (void *) (*sp | 0), tos | 0); sp -= 2; DROP) \
X("SP@", SPAT, DUP; tos = (cell_t) sp) \ X("SP@", SPAT, DUP; tos = (cell_t) sp) \
X("SP!", SPSTORE, sp = (cell_t *) tos; DROP) \ X("SP!", SPSTORE, sp = (cell_t *) tos; DROP) \
X("RP@", RPAT, DUP; tos = (cell_t) rp) \ X("RP@", RPAT, DUP; tos = (cell_t) rp) \

View File

@ -18,6 +18,11 @@ handlers:
upload: static/index.html upload: static/index.html
secure: always secure: always
- url: /static/uEforth.exe
static_files: static/ueforth.windows
upload: static/ueforth.windows
secure: always
- url: /static - url: /static
static_dir: static static_dir: static
secure: always secure: always

View File

@ -6,7 +6,7 @@
#include "common/calling.h" #include "common/calling.h"
#define HEAP_SIZE (10 * 1024 * 1024) #define HEAP_SIZE (10 * 1024 * 1024)
#define STACK_SIZE (16 * 1024) #define STACK_SIZE (64 * 1024)
#define PLATFORM_OPCODE_LIST \ #define PLATFORM_OPCODE_LIST \
X("GETPROCADDRESS", GETPROCADDRESS, \ X("GETPROCADDRESS", GETPROCADDRESS, \