mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-12-24 15:29:29 +00:00
Restore sandbox buffer sizes and add keep flags for module loading
Also expanded sandbox radar example (ex.10.pla)
This commit is contained in:
parent
2d14aa3021
commit
930fbe2faf
BIN
SANDBOX.PO
BIN
SANDBOX.PO
Binary file not shown.
@ -11,8 +11,15 @@ import stdlib
|
||||
//
|
||||
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
|
||||
end
|
||||
|
@ -62,12 +62,12 @@ const iobuffer = $0800
|
||||
const databuff = $0C00
|
||||
const strlinbuf = $1000
|
||||
const strheapmap = $1500
|
||||
const strheapmsz = $40 // = memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
|
||||
const strheapmsz = $80 // = memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
|
||||
const maxlnlen = 79
|
||||
const strheap = $6800
|
||||
const strheasz = $2000
|
||||
const codebuff = $8800
|
||||
const codebuffsz = $3000
|
||||
const strheasz = $4000
|
||||
const codebuff = $A800
|
||||
const codebuffsz = $1000
|
||||
const pgjmp = 16
|
||||
const changed = 1
|
||||
const insmode = 2
|
||||
|
@ -2,6 +2,22 @@ const MODADDR = $1000
|
||||
const inbuff = $200
|
||||
const freemem = $0006
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// CFFA1 addresses.
|
||||
//
|
||||
const CFFADest = $00
|
||||
@ -882,17 +898,18 @@ def loadmod(mod)
|
||||
//
|
||||
// Call init routine if it exists.
|
||||
//
|
||||
fixup = 0
|
||||
if init
|
||||
fixup = adddef(init - defofst + bytecode, @deflast)()
|
||||
modend = init - defofst + bytecode
|
||||
else
|
||||
fixup = 0
|
||||
fixup = adddef(init - defofst + bytecode, @deflast)()
|
||||
if !(systemflags & modinitkeep)
|
||||
modend = init - defofst + bytecode
|
||||
fin
|
||||
fin
|
||||
//
|
||||
// Free up the end-of-module in main memory.
|
||||
//
|
||||
releaseheap(modend)
|
||||
return fixup
|
||||
return fixup | (systemflags & modkeep)
|
||||
end
|
||||
//
|
||||
// Command mode
|
||||
@ -942,13 +959,17 @@ def execmod(modfile)
|
||||
|
||||
if stodci(modfile, @moddci)
|
||||
saveheap = heap
|
||||
savesym = lastsym
|
||||
saveflags = systemflags
|
||||
^lastsym = 0
|
||||
perr = loadmod(@moddci)
|
||||
savesym = lastsym
|
||||
saveflags = systemflags
|
||||
^lastsym = 0
|
||||
perr = loadmod(@moddci)
|
||||
if perr >= modkeep
|
||||
perr = perr & ~modkeep
|
||||
else
|
||||
lastsym = savesym
|
||||
heap = saveheap
|
||||
fin
|
||||
systemflags = saveflags
|
||||
lastsym = savesym
|
||||
heap = saveheap
|
||||
fin
|
||||
end
|
||||
//
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user