From 930fbe2fafc9c30f5e79ef4fe03df26e45ffc371 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sun, 7 Dec 2014 20:49:09 -0800 Subject: [PATCH] Restore sandbox buffer sizes and add keep flags for module loading Also expanded sandbox radar example (ex.10.pla) --- SANDBOX.PO | Bin 143360 -> 143360 bytes src/inc/stdlib.plh | 15 ++++++++--- src/toolsrc/sb.pla | 8 +++--- src/vmsrc/a1cmd.pla | 43 +++++++++++++++++++++++-------- src/vmsrc/cmd.pla | 59 +++++++++++++++++++++++++++---------------- src/vmsrc/soscmd.pla | 37 ++++++++++++++++++++------- 6 files changed, 112 insertions(+), 50 deletions(-) diff --git a/SANDBOX.PO b/SANDBOX.PO index bd87b65b7ad2c9fd7c52daf402fbb10981efa7b3..3a3828678d1ffaec7eb172a86ba56b3a84166da7 100644 GIT binary patch delta 2542 zcmd5-O>7%Q6!y4I6(B1rNI4V|Jp~SqYS(cKk%|(e_3o@a>3U|hJ8rxU;SfP2khl~n z2QH4pp+ZRIV2Z^B^;G%50d=JW0TKuV7lZ_;QZF2G=%KWUh@b^Ri^7}T^n|Z4n!>b#^AHR`0bYbj?`bz3d>cZG#qro?+%Oo|D`2A?`>fyB^awve2 z7vHX5d~2@$?WLc{YVg7P-#tm1^;fPwkKdQCzBkoOt|XnYL?$u3oETrq?AAtClF{b1 z@rg{LnL59mlwZ6s<%}ej5!I}}9Gphi4}*!(&e;(>i{Qbv;N8QIHk0zl<5P}?<|XtA z&VPC?Nt(g;pVM42KOH>2sST6of{8ohLul1^u6#wB>o-3m$I{23=i}<8?t*6shiYp# z$PMzyZ+Gtg@#kMVf8V?RPe2~NOP-QiE(f&g*vw$k2d^aN`3cbBtZrAYKlUg8Y zRhETGHGr3pPUHG7WICD4HMCpgbzIlqyhR=&m0V5{M;x;lHKE{AkMfdU1}VUF^?C68 zGL)L+Y$bJ&fstu&ivs&x)9e@(f`PB5V%?2U}MKqh+0O#*6KwAxbyrbc1pk zaq2mXH;vsba$^1GE%FW-@2GH=x>AYRqruXzWRrK%MYY1e@3LY^h632sdN37&bP2MA zy7!ZSZvPJ?SldPk>f7Waawe}js?(xMY(v<>O&gP;V5%q5>LO%7b$$lIOK}`nw1;fm z^9yXTv9L>?uI&x0f^)nHxLCpkhS#o50%PXE#EXi|ra}^XViey!B+{nF22zT^J=i{! z_A5?r^r0f4UVEm3*gjMas!midO;KsH8%U{D+%9Y%O8ZkM+ismG`Vg0cd*?xLi0wn= zVCuAbSnKq|;DWWlJ=i{!_Nz|2I$;-M@1O<)3iV$qi0wn=pz5@Hrz_z=O0C}M!nP^l zSkiC~sfktbXxCITm}}sq((R&pj_@5e6vkpMzVwkG%1w<=g;d7?^TMr}P(_(CfMEfu z_=u?Y!pAil$ha|aa|$&~#}j^L2J(u}e2HPgD$LA+k6Qp{Ar^PhixWATcw5qlnSqm& z_;Wf0;uLBPHOxPYUI;=|7W~OJG~WuN$oT3-3w}HhG*e>^k@e$*+ z7mP9-pT2zk_Wj4tUz-`ZelTvAdBJ#?ak|$lMz879UNPowXMN4c$+$h`4WlmO^lfh$ zpHKhrj!}C0{r8Mo+jqQY>}H&v_7Nz!K$v41+ybYJEOm&oax-Y}lGZ~?N66l@h-B8(Jt6@YAB1qDwx zAXmW-$OCc|6kLOXzzV>efB*#`C&F<0#= modkeep + perr = perr & ~modkeep + else + lastsym = savesym + heap = saveheap + fin systemflags = saveflags - lastsym = savesym - heap = saveheap fin end // diff --git a/src/vmsrc/cmd.pla b/src/vmsrc/cmd.pla index bc8be77..cd7b647 100644 --- a/src/vmsrc/cmd.pla +++ b/src/vmsrc/cmd.pla @@ -9,10 +9,17 @@ const freemem = $0006 // const restxt1 = $0001 const restxt2 = $0002 -const reshgr1 = $0004 -const reshgr2 = $0008 -const resxhgr1 = $0010 -const resxhgr2 = $0020 +const resxtxt1 = $0004 +const resxtxt2 = $0008 +const reshgr1 = $0010 +const reshgr2 = $0020 +const resxhgr1 = $0040 +const resxhgr2 = $0080 +// +// Module don't free memory +// +const modkeep = $1000 +const modinitkeep = $2000 // // Pedefined functions. // @@ -317,8 +324,8 @@ asm memxcpy end asm crout DEX - LDA #$8D - STA ESTKL,X + LDA #$0D + BNE + ; FALL THROUGH TO COUT end // @@ -984,7 +991,7 @@ def loadmod(mod) // // This is a bytcode def entry - add it to the def directory. // - adddef(defbank, rld=>1 - defofst + defaddr, @deflast) + adddef(defbank, rld=>1 - defofst + defaddr, @deflast) else addr = rld=>1 + modfix if uword_isge(addr, modaddr) // Skip fixups to header @@ -1047,21 +1054,25 @@ def loadmod(mod) // // Call init routine if it exists. // + fixup = 0 // This is repurposed for the return code if init fixup = adddef(defbank, init - defofst + defaddr, @deflast)() - if defbank - xheap = init - defofst + defaddr - else - modend = init - defofst + defaddr + if !(systemflags & modinitkeep) + // + // Free init routine unless initkeep + // + if defbank + xheap = init - defofst + defaddr + else + modend = init - defofst + defaddr + fin fin - else - fixup = 0 fin // // Free up the end-of-module in main memory. // releaseheap(modend) - return fixup + return fixup | (systemflags & modkeep) end // // Command mode @@ -1230,15 +1241,19 @@ def execmod(modfile) if stodci(modfile, @moddci) saveheap = heap - savexheap = xheap - savesym = lastsym - saveflags = systemflags - ^lastsym = 0 - perr = loadmod(@moddci) + savexheap = xheap + savesym = lastsym + saveflags = systemflags + ^lastsym = 0 + perr = loadmod(@moddci) + if perr >= modkeep + perr = perr & ~modkeep + else + lastsym = savesym + xheap = savexheap + heap = saveheap + fin systemflags = saveflags - lastsym = savesym - xheap = savexheap - heap = saveheap fin end // diff --git a/src/vmsrc/soscmd.pla b/src/vmsrc/soscmd.pla index aa3d00a..c5319e9 100644 --- a/src/vmsrc/soscmd.pla +++ b/src/vmsrc/soscmd.pla @@ -1,6 +1,22 @@ const membank = $FFEF const MODADDR = $1000 // +// System flags: memory allocator screen holes. +// +const restxt1 = $0001 +const restxt2 = $0002 +const resxtxt1 = $0004 +const resxtxt2 = $0008 +const reshgr1 = $0010 +const reshgr2 = $0020 +const resxhgr1 = $0040 +const resxhgr2 = $0080 +// +// Module don't free memory +// +const modkeep = $1000 +const modinitkeep = $2000 +// // SOS flags // const O_READ = 1 @@ -1084,12 +1100,11 @@ def loadmod(mod) // // Call init routine if it exists. // + fixup = 0 if init fixup = adddef(defext, init - defofst + defaddr, @deflast)() - else - fixup = 0 fin - return fixup + return fixup | (systemflags & modkeep) end // // Command mode @@ -1224,13 +1239,17 @@ def execmod(modfile) savesym = lastsym saveflags = systemflags perr = loadmod(@moddci) + if perr >= modkeep + perr = perr & ~modkeep + else + lastsym = savesym + heap = saveheap + while modid + modid = modid - 1 + seg_release(modseg[modid]) + loop + fin systemflags = saveflags - lastsym = savesym - heap = saveheap - while modid - modid = modid - 1 - seg_release(modseg[modid]) - loop fin end //