From 975ecf9a89b760fc1f7ce8792333a5735ac10861 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 23 Aug 2015 22:58:21 +0200 Subject: [PATCH] PAD works properly now (it's just an alias for HERE, but we make sure that 84 bytes of space is always available). --- Applications/util/fforth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Applications/util/fforth.c b/Applications/util/fforth.c index 98bf3d29..d639e2c3 100644 --- a/Applications/util/fforth.c +++ b/Applications/util/fforth.c @@ -314,6 +314,7 @@ static jmp_buf onerror; #define MAX_LINE_LENGTH 160 #define ALLOCATION_CHUNK_SIZE 128 +#define PAD_SIZE 84 #define CELL sizeof(cell_t) #define DSTACKSIZE 64 @@ -484,7 +485,7 @@ static void* ensure_workspace(size_t length) { uint8_t* p = here + length; - if (p > here_top) + while ((p+PAD_SIZE) > here_top) { uint8_t* newtop = sbrk(ALLOCATION_CHUNK_SIZE); if (newtop != here_top) @@ -1035,7 +1036,7 @@ COM( notequals0_word, notequals0_cb, "0<>", ¬_equals_word, ) //@W COM( one_word, rvarword, "1", ¬equals0_word, (void*)1 ) //@W COM( or_word, or_cb, "OR", &one_word, ) //@W COM( over_word, peekcon_cb, "OVER", &or_word, (void*)1 ) //@W -COM( pad_word, rvarword, "PAD", &over_word, &here ) //@W +COM( pad_word, rivarword, "PAD", &over_word, &here ) //@W COM( pick_word, pick_cb, "PICK", &pad_word, ) //@W COM( pling_word, pling_cb, "!", &pick_word, ) //@W COM( q_dup_word, q_dup_cb, "?DUP", &pling_word, ) //@W -- 2.34.1