1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-12-25 06:29:21 +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:
David Schmenk 2014-12-07 20:49:09 -08:00
parent 2d14aa3021
commit 930fbe2faf
6 changed files with 112 additions and 50 deletions

Binary file not shown.

View File

@ -11,8 +11,15 @@ import stdlib
// //
const restxt1 = $0001 const restxt1 = $0001
const restxt2 = $0002 const restxt2 = $0002
const reshgr1 = $0004 const resxtxt1 = $0004
const reshgr2 = $0008 const resxtxt2 = $0008
const resxhgr1 = $0010 const reshgr1 = $0010
const resxhgr2 = $0020 const reshgr2 = $0020
const resxhgr1 = $0040
const resxhgr2 = $0080
//
// Module don't free memory
//
const modkeep = $1000
const modinitkeep = $2000
end end

View File

@ -62,12 +62,12 @@ const iobuffer = $0800
const databuff = $0C00 const databuff = $0C00
const strlinbuf = $1000 const strlinbuf = $1000
const strheapmap = $1500 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 maxlnlen = 79
const strheap = $6800 const strheap = $6800
const strheasz = $2000 const strheasz = $4000
const codebuff = $8800 const codebuff = $A800
const codebuffsz = $3000 const codebuffsz = $1000
const pgjmp = 16 const pgjmp = 16
const changed = 1 const changed = 1
const insmode = 2 const insmode = 2

View File

@ -2,6 +2,22 @@ const MODADDR = $1000
const inbuff = $200 const inbuff = $200
const freemem = $0006 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. // CFFA1 addresses.
// //
const CFFADest = $00 const CFFADest = $00
@ -882,17 +898,18 @@ def loadmod(mod)
// //
// Call init routine if it exists. // Call init routine if it exists.
// //
fixup = 0
if init if init
fixup = adddef(init - defofst + bytecode, @deflast)() fixup = adddef(init - defofst + bytecode, @deflast)()
if !(systemflags & modinitkeep)
modend = init - defofst + bytecode modend = init - defofst + bytecode
else fin
fixup = 0
fin fin
// //
// Free up the end-of-module in main memory. // Free up the end-of-module in main memory.
// //
releaseheap(modend) releaseheap(modend)
return fixup return fixup | (systemflags & modkeep)
end end
// //
// Command mode // Command mode
@ -946,10 +963,14 @@ def execmod(modfile)
saveflags = systemflags saveflags = systemflags
^lastsym = 0 ^lastsym = 0
perr = loadmod(@moddci) perr = loadmod(@moddci)
systemflags = saveflags if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym lastsym = savesym
heap = saveheap heap = saveheap
fin fin
systemflags = saveflags
fin
end end
// //
// Get heap start. // Get heap start.

View File

@ -9,10 +9,17 @@ const freemem = $0006
// //
const restxt1 = $0001 const restxt1 = $0001
const restxt2 = $0002 const restxt2 = $0002
const reshgr1 = $0004 const resxtxt1 = $0004
const reshgr2 = $0008 const resxtxt2 = $0008
const resxhgr1 = $0010 const reshgr1 = $0010
const resxhgr2 = $0020 const reshgr2 = $0020
const resxhgr1 = $0040
const resxhgr2 = $0080
//
// Module don't free memory
//
const modkeep = $1000
const modinitkeep = $2000
// //
// Pedefined functions. // Pedefined functions.
// //
@ -317,8 +324,8 @@ asm memxcpy
end end
asm crout asm crout
DEX DEX
LDA #$8D LDA #$0D
STA ESTKL,X BNE +
; FALL THROUGH TO COUT ; FALL THROUGH TO COUT
end end
// //
@ -1047,21 +1054,25 @@ def loadmod(mod)
// //
// Call init routine if it exists. // Call init routine if it exists.
// //
fixup = 0 // This is repurposed for the return code
if init if init
fixup = adddef(defbank, init - defofst + defaddr, @deflast)() fixup = adddef(defbank, init - defofst + defaddr, @deflast)()
if !(systemflags & modinitkeep)
//
// Free init routine unless initkeep
//
if defbank if defbank
xheap = init - defofst + defaddr xheap = init - defofst + defaddr
else else
modend = init - defofst + defaddr modend = init - defofst + defaddr
fin fin
else fin
fixup = 0
fin fin
// //
// Free up the end-of-module in main memory. // Free up the end-of-module in main memory.
// //
releaseheap(modend) releaseheap(modend)
return fixup return fixup | (systemflags & modkeep)
end end
// //
// Command mode // Command mode
@ -1235,11 +1246,15 @@ def execmod(modfile)
saveflags = systemflags saveflags = systemflags
^lastsym = 0 ^lastsym = 0
perr = loadmod(@moddci) perr = loadmod(@moddci)
systemflags = saveflags if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym lastsym = savesym
xheap = savexheap xheap = savexheap
heap = saveheap heap = saveheap
fin fin
systemflags = saveflags
fin
end end
// //
// Get heap start. // Get heap start.

View File

@ -1,6 +1,22 @@
const membank = $FFEF const membank = $FFEF
const MODADDR = $1000 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 // SOS flags
// //
const O_READ = 1 const O_READ = 1
@ -1084,12 +1100,11 @@ def loadmod(mod)
// //
// Call init routine if it exists. // Call init routine if it exists.
// //
fixup = 0
if init if init
fixup = adddef(defext, init - defofst + defaddr, @deflast)() fixup = adddef(defext, init - defofst + defaddr, @deflast)()
else
fixup = 0
fin fin
return fixup return fixup | (systemflags & modkeep)
end end
// //
// Command mode // Command mode
@ -1224,7 +1239,9 @@ def execmod(modfile)
savesym = lastsym savesym = lastsym
saveflags = systemflags saveflags = systemflags
perr = loadmod(@moddci) perr = loadmod(@moddci)
systemflags = saveflags if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym lastsym = savesym
heap = saveheap heap = saveheap
while modid while modid
@ -1232,6 +1249,8 @@ def execmod(modfile)
seg_release(modseg[modid]) seg_release(modseg[modid])
loop loop
fin fin
systemflags = saveflags
fin
end end
// //
// Init console. // Init console.