feat: add comma, fix allot, and support bare-metal custom memory
Co-authored-by: aider (openrouter/moonshotai/kimi-k2.6) <aider@aider.chat>
This commit is contained in:
+14
-2
@@ -456,13 +456,25 @@ void do_here(Word* w) {
|
||||
void do_allot(Word* w) {
|
||||
(void)w;
|
||||
int64_t n = data_pop();
|
||||
if (here + n > user_mem + user_mem_size) {
|
||||
forth_printf("User memory overflow\n");
|
||||
int64_t idx = here - user_mem;
|
||||
if (idx + n < 0 || idx + n > user_mem_size) {
|
||||
forth_printf("User memory out of bounds\n");
|
||||
return;
|
||||
}
|
||||
here += n;
|
||||
}
|
||||
|
||||
void do_comma(Word* w) {
|
||||
(void)w;
|
||||
int64_t val = data_pop();
|
||||
if (here + 1 > user_mem + user_mem_size) {
|
||||
forth_printf("User memory overflow\n");
|
||||
return;
|
||||
}
|
||||
here->num = val;
|
||||
here++;
|
||||
}
|
||||
|
||||
// Variable and constant
|
||||
void do_variable(Word* w) {
|
||||
(void)w;
|
||||
|
||||
Reference in New Issue
Block a user