1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-03-25 21:30:44 +00:00

Increase size of command line buffer without additional memory

This commit is contained in:
David Schmenk 2023-03-18 16:05:29 -07:00
parent 267fdebdef
commit af57dfdeeb
4 changed files with 35 additions and 28 deletions

@ -72,7 +72,6 @@ byte hpalignstr = "HEAPALLOCALIGN"
byte hpallocstr = "HEAPALLOC"
byte hprelstr = "HEAPRELEASE"
byte hpavlstr = "HEAPAVAIL"
byte sysmods[] // overlay with exported strings
word memsetstr = "MEMSET"
byte memcpystr = "MEMCPY"
byte uisgtstr = "ISUGT"
@ -84,7 +83,6 @@ byte divmodstr = "DIVMOD"
byte machidstr = "MACHID"
byte sysstr = "SYSCALL"
byte callstr = "CALL"
byte prefix[] // overlay with exported symbols table
word exports = @sysmodstr, @version
word = @sysstr, @syscall
word = @callstr, @call
@ -98,6 +96,7 @@ word = @getcstr, @cin
word = @getsstr, @rdstr
word = @toupstr, @toupper
word = @hpmarkstr, @markheap
byte sysmods[] // overlay with exported strings
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap
word = @hprelstr, @releaseheap
@ -1174,9 +1173,6 @@ def catalog(path)#0
byte i, type, len
word entry
if !^path
path = @prefix
fin
refnum = open(path)
if perr
return
@ -1320,23 +1316,26 @@ end
// Command line processor
//
def docmds#0
strcpy(getlnbuf, @cmdln)
word prefix
prefix = allocheap(64)
pfxop(prefix, GET_PFX)
while 1
if ^getlnbuf
strcpy(@cmdln, getlnbuf)
when toupper(parsecmd(getlnbuf))
is 'C'
catalog(getlnbuf)
catalog(^getlnbuf ?? getlnbuf :: prefix)
break
is 'P'
pfxop(getlnbuf, SET_PFX)
break
is '/'
repeat
prefix--
until prefix[prefix] == '/'
if prefix > 1
pfxop(@prefix, SET_PFX)
^prefix--
until prefix->[^prefix] == '/'
if ^prefix > 1
pfxop(prefix, SET_PFX)
fin
break
is 'V'
@ -1346,11 +1345,16 @@ def docmds#0
execsys(getlnbuf)
break
is '+'
releaseheap(prefix)
//
// Exec module
//
execmod(striptrail(getlnbuf))
//
// Clean up
//
resetmemfiles
prefix = allocheap(64)
break
otherwise
cout('?')
@ -1361,7 +1365,7 @@ def docmds#0
crout()
fin
fin
prstr(pfxop(@prefix, GET_PFX))
prstr(pfxop(prefix, GET_PFX))
rdstr($BA)
loop
end
@ -1398,13 +1402,14 @@ syscmdln = @cmdln
autorun = open(@autorun)
if autorun
cmdln = read(autorun, @cmdln+1, 81)
strcpy(getlnbuf, @cmdln)
close(0)
else
^getlnbuf = 0
//
// Print some startup info.
//
prstr("MEM FREE:$"); prword(availheap); crout
fin
pfxop(@prefix, GET_PFX)
docmds
done

@ -90,7 +90,6 @@ byte hpalignstr = "HEAPALLOCALIGN"
byte hpallocstr = "HEAPALLOC"
byte hprelstr = "HEAPRELEASE"
byte hpavlstr = "HEAPAVAIL"
byte sysmods[] // overlay with exported strings
word memsetstr = "MEMSET"
byte memcpystr = "MEMCPY"
byte uisgtstr = "ISUGT"
@ -102,7 +101,6 @@ byte divmodstr = "DIVMOD"
byte machidstr = "MACHID"
byte sysstr = "SYSCALL"
byte callstr = "CALL"
byte prefix[] // overlay with exported symbols table
word exports = @sysmodstr, @version
word = @sysstr, @syscall
word = @callstr, @call
@ -116,6 +114,7 @@ word = @getcstr, @cin
word = @getsstr, @rdstr
word = @toupstr, @toupper
word = @hpmarkstr, @markheap
byte sysmods[] // overlay with exported strings
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap
word = @hprelstr, @releaseheap
@ -1239,9 +1238,6 @@ def catalog(path)#0
byte i, type, len
word entry
if !^path
path = @prefix
fin
refnum = open(path)
if perr
return
@ -1387,26 +1383,29 @@ end
// Command line processor
//
def docmds#0
word prefix
loadmod(jitmod) // Cannot do this in init code - it will overwrite it!
xheap = $0400 // Reset heap to point at low memory
xheaptop = $A000 // Top below JITC
strcpy(getlnbuf, @cmdln)
prefix = allocheap(64)
pfxop(prefix, GET_PFX)
while 1
if ^getlnbuf
strcpy(@cmdln, getlnbuf)
when toupper(parsecmd(getlnbuf))
is 'C'
catalog(getlnbuf)
catalog(^getlnbuf ?? getlnbuf :: prefix)
break
is 'P'
pfxop(getlnbuf, SET_PFX)
break
is '/'
repeat
prefix--
until prefix[prefix] == '/'
if prefix > 1
pfxop(@prefix, SET_PFX)
^prefix--
until prefix->[^prefix] == '/'
if ^prefix > 1
pfxop(prefix, SET_PFX)
fin
break
is 'V'
@ -1416,6 +1415,7 @@ def docmds#0
execsys(getlnbuf)
break
is '+'
releaseheap(prefix)
//
// Set JIT code pointer
//
@ -1428,6 +1428,7 @@ def docmds#0
// Clean up
//
resetmemfiles
prefix = allocheap(64)
break
otherwise
cout('?')
@ -1438,7 +1439,7 @@ def docmds#0
crout()
fin
fin
prstr(pfxop(@prefix, GET_PFX))
prstr(pfxop(prefix, GET_PFX))
rdstr($BA)
loop
end
@ -1475,13 +1476,14 @@ syscmdln = @cmdln
autorun = open(@autorun)
if autorun
cmdln = read(autorun, @cmdln+1, 81)
strcpy(getlnbuf, @cmdln)
close(0)
else
^getlnbuf = 0
//
// Print some startup info.
//
prstr("MEM FREE:$"); prword(availheap); crout
fin
pfxop(@prefix, GET_PFX)
docmds
done

@ -106,7 +106,6 @@ byte uisltstr[] = "ISULT"
byte uislestr[] = "ISULE"
byte sextstr[] = "SEXT"
byte divmodstr[] = "DIVMOD"
byte sysmods[] = "" // overlay sys path with exports
word exports[] = @sysmodstr, @version
word = @sysstr, @syscall
word = @callstr, @call
@ -119,6 +118,7 @@ word = @putwstr, @prword
word = @getcstr, @cin
word = @getsstr, @rdstr
word = @toupstr, @toupper
byte sysmods[] // overlay sys path with exports
word = @hpmarkstr, @markheap
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap

@ -117,7 +117,6 @@ byte uisltstr[] = "ISULT"
byte uislestr[] = "ISULE"
byte sextstr[] = "SEXT"
byte divmodstr[] = "DIVMOD"
byte sysmods[] = "" // overlay sys path with exports
word exports[] = @sysmodstr, @version
word = @sysstr, @syscall
word = @callstr, @call
@ -130,6 +129,7 @@ word = @putwstr, @prword
word = @getcstr, @cin
word = @getsstr, @rdstr
word = @toupstr, @toupper
byte sysmods[] // overlay sys path with exports
word = @hpmarkstr, @markheap
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap