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 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

View File

@ -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

View File

@ -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)()
if !(systemflags & modinitkeep)
modend = init - defofst + bytecode
else
fixup = 0
fin
fin
//
// Free up the end-of-module in main memory.
//
releaseheap(modend)
return fixup
return fixup | (systemflags & modkeep)
end
//
// Command mode
@ -946,10 +963,14 @@ def execmod(modfile)
saveflags = systemflags
^lastsym = 0
perr = loadmod(@moddci)
systemflags = saveflags
if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym
heap = saveheap
fin
systemflags = saveflags
fin
end
//
// Get heap start.

View File

@ -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
//
@ -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 !(systemflags & modinitkeep)
//
// Free init routine unless initkeep
//
if defbank
xheap = init - defofst + defaddr
else
modend = init - defofst + defaddr
fin
else
fixup = 0
fin
fin
//
// Free up the end-of-module in main memory.
//
releaseheap(modend)
return fixup
return fixup | (systemflags & modkeep)
end
//
// Command mode
@ -1235,11 +1246,15 @@ def execmod(modfile)
saveflags = systemflags
^lastsym = 0
perr = loadmod(@moddci)
systemflags = saveflags
if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym
xheap = savexheap
heap = saveheap
fin
systemflags = saveflags
fin
end
//
// Get heap start.

View File

@ -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,7 +1239,9 @@ def execmod(modfile)
savesym = lastsym
saveflags = systemflags
perr = loadmod(@moddci)
systemflags = saveflags
if perr >= modkeep
perr = perr & ~modkeep
else
lastsym = savesym
heap = saveheap
while modid
@ -1232,6 +1249,8 @@ def execmod(modfile)
seg_release(modseg[modid])
loop
fin
systemflags = saveflags
fin
end
//
// Init console.