commit edf94cfdd60515da65bb649c9feb414c6c74df45
parent febbef693f7d371d0530bfdac4eab54dd6f795ac
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sun, 9 Oct 2022 10:31:56 -0400
Bump xhere size and reduce syspad size
Compiling COS' CVM requires more than 32K of memory of the AST and the problem
caused by a $4000 syspad isn't present any more.
Diffstat:
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/app/cos/cvm.c b/fs/app/cos/cvm.c
@@ -243,14 +243,13 @@ static void opexec(byte op) {
COSVM* COSVM_init(char *bin_path, char *blkfs_path)
{
File *bfp = fopen(bin_path);
- int c;
+ int c, i=0;
if (!bfp) {
fprintf("Can't open forth bin\n", ConsoleOut());
return NULL;
}
c = fgetc(bfp);
while (c >= 0) {
- // Compiles up to this point!
vm.mem[i++] = c;
c = fgetc(bfp);
}
@@ -261,7 +260,7 @@ COSVM* COSVM_init(char *bin_path, char *blkfs_path)
fprintf("Can't open\n", ConsoleOut());
return NULL;
}
- if (blkfs->size < 100 * 1024) {
+ if (blkfp->size < 100 * 1024) {
fclose(blkfp);
fprintf("blkfs too small, something's wrong, aborting.\n", ConsoleOut());
return NULL;
@@ -273,6 +272,7 @@ COSVM* COSVM_init(char *bin_path, char *blkfs_path)
vm.maxRS = #[ RS_ADDR c]# ;
memset(vm.iord, 0, $400);
memset(vm.iowr, 0, $400);
+ // Compiles up to this point!
vm.iowr[ #[ BLK_PORT c]# ] = iowr_blk;
vm.PC = 0;
vm.running = 1;
diff --git a/fs/lib/scratch.fs b/fs/lib/scratch.fs
@@ -13,8 +13,9 @@ struct[ Scratchpad
sfield size
sfield ptr
- ' Scratchpad structsz &+ :buf(
+ SZ &+ :buf(
: :)buf ( self -- a ) dup :buf( swap size + ;
+ : :usedsz dup ptr over :buf( - ;
: :allot ( n self -- a )
dup >r ptr over + r@ :)buf >= if
." scratch reload!" nl> r@ :buf( to r@ ptr then
diff --git a/fs/sys/scratch.fs b/fs/sys/scratch.fs
@@ -7,7 +7,5 @@
\ these cursor live in the system scratchpad, they'd be overwritten by faster-
\ paced data.
-\ TODO: investigate why CC has memory corruption when running tests with a $4000
-\ syspad.
-create _syspad $8000 scratchpad$
+create _syspad $4000 scratchpad$
_syspad structbind Scratchpad syspad
diff --git a/fs/sys/xhere.fs b/fs/sys/xhere.fs
@@ -13,7 +13,7 @@
\ Without xhere, this data is written to here and permanently uses system
\ memory.
-32 1024 * const XHERESZ
+48 1024 * const XHERESZ
1024 const XHEREWARN
create _buf XHERESZ allot
diff --git a/testcvm.fs b/testcvm.fs
@@ -1,2 +1,3 @@
f<< /app/cos/cvm.fs
+nl> syspad :usedsz .x nl>
bye