From 83b314c450d276d61672c113c49631191ccc1c4b Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 6 Oct 2019 15:42:09 -0400 Subject: [PATCH] zasm: lower RAM requirements I've tested RAM usage when self-assembling and there weren't as high as I thought. zasm's defaults now use less than 0x1800 bytes of RAM, making it possible, theoretically for now, for a Sega Master System to assemble Collapse OS from within itself. --- apps/zasm/glue.asm | 12 +++++++++--- tools/emul/zasm/zasm.bin | Bin 4672 -> 4672 bytes 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/zasm/glue.asm b/apps/zasm/glue.asm index d20f38b..f093163 100644 --- a/apps/zasm/glue.asm +++ b/apps/zasm/glue.asm @@ -47,19 +47,25 @@ .inc "user.h" ; *** Overridable consts *** +; NOTE: These limits below are designed to be *just* enough for zasm to assemble +; itself. Considering that this app is Collapse OS' biggest app, it's safe to +; assume that it will be enough for many many use cases. If you need to compile +; apps with lots of big symbols, you'll need to adjust these. +; With these default settings, zasm runs with less than 0x1800 bytes of RAM! + ; Maximum number of symbols we can have in the global and consts registry .equ ZASM_REG_MAXCNT 0xff ; Maximum number of symbols we can have in the local registry -.equ ZASM_LREG_MAXCNT 0x40 +.equ ZASM_LREG_MAXCNT 0x20 ; Size of the symbol name buffer size. This is a pool. There is no maximum name ; length for a single symbol, just a maximum size for the whole pool. ; Global labels and consts have the same buf size -.equ ZASM_REG_BUFSZ 0x1000 +.equ ZASM_REG_BUFSZ 0x700 ; Size of the names buffer for the local context registry -.equ ZASM_LREG_BUFSZ 0x200 +.equ ZASM_LREG_BUFSZ 0x100 ; ****** diff --git a/tools/emul/zasm/zasm.bin b/tools/emul/zasm/zasm.bin index ca38d58b888baf0c535287cb0d5240ee15cec305..93dde87e2d0a5b42856601e2c9084b30e4c10c2d 100644 GIT binary patch delta 165 zcmX@0azJInFMjUy|NFA`Wh=<%$QN&B72sv`ku5uG#-PEe$iN`Tz+lI8(n_{WkRjo$ z3WJqgnIH#$5h7ep$EC{}{_>w($5h7ep$EC{}{_>w(N}NG5