commit cf38c68a0d2fbb76063d5e63691c7cc4e1e295cb
parent abd884945d66755c239d54ea258a4f366c0e23ae
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sun, 4 Dec 2022 10:15:56 -0500
posix/vm: bump memory to 16MB
uxntal requires a lot of memory...
Diffstat:
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/asm/uxntal.c b/fs/asm/uxntal.c
@@ -29,6 +29,7 @@ typedef struct {
Uint16 addr;
} Reference;
+// TODO: this is pretty memory hungry by Dusk standards, revisit algo.
typedef struct {
Uint8 data[LENGTH];
unsigned int ptr;
@@ -44,7 +45,6 @@ typedef struct {
Program p;
-// TODO: compile error
static char* ops[$20] = {
"LIT"0, "INC"0, "POP"0, "NIP"0, "SWP"0, "ROT"0, "DUP"0, "OVR"0,
"EQU"0, "NEQ"0, "GTH"0, "LTH"0, "JMP"0, "JCN"0, "JSR"0, "STH"0,
@@ -58,12 +58,12 @@ static int shex(char *s) { int n = 0, i = 0; char c; while((c = s[i++])) if(c
static int slen(char *s) { int i = 0; while(s[i]) i++; return i; } /* string length */
static int spos(char *s, char c) { Uint8 i = 0, j; while((j = s[i++])) if(j == c) return i; return -1; } /* character position */
static char *scpy(char *src, char *dst, int len) { int i = 0; while((dst[i] = src[i]) && i < len - 2) i++; dst[i + 1] = 0; return dst; } /* string copy */
-static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); while(*src) *ptr++ = *src++; *ptr = 0; return dst; } /* string cat */
+static char *scat(char *dst, char *src) { char *ptr = dst + slen(dst); while(*src) *ptr++ = *src++; *ptr = 0; return dst; } /* string cat */
static int parse(char *w, int hdl);
static int
-error(const char *name, const char *msg)
+error(char *name, char *msg)
{
fprintf(name, msg, "%s: %s\n", ConsoleOut());
return 0;
@@ -79,6 +79,7 @@ static Macro *
findmacro(char *name)
{
int i;
+ // TODO: compile error below
for(i = 0; i < p.mlen; i++)
if(scmp(p.macros[i].name, name, $40))
return &p.macros[i];
@@ -251,7 +252,7 @@ writelitbyte(Uint8 b)
}
static int
-doinclude(const char *filename)
+doinclude(char *filename)
{
int hdl;
char w[$40];
diff --git a/fs/doc/cc/usage.txt b/fs/doc/cc/usage.txt
@@ -58,6 +58,7 @@ are a few differences:
to write that?!?) must be written as "a ? (b ? c : d) : (e ? f : g)"
* The keyword "static" has a slightly different meaning. See below.
* No multi-dimensional array.
+* No "const" attribute
## Pre-processor
diff --git a/posix/vm.c b/posix/vm.c
@@ -18,7 +18,7 @@ The VM is little endian.
#include <stdlib.h>
#undef FOPEN // some platforms' fcntl.h define FOPEN which clashes below.
-#define MEMSZ 0x100000 // 1MB
+#define MEMSZ 0x1000000 // 16MB
#define STACKSZ 0x800
#define RSTOP MEMSZ
#define PSTOP (RSTOP-STACKSZ)