mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-03-24 13:35:24 +00:00
Shuffle routines around based on available INTERP mem
This commit is contained in:
parent
6d2336a343
commit
309f5d45b0
@ -1,7 +1,4 @@
|
||||
include "inc/cmdsys.plh"
|
||||
byte console[] = ".CONSOLE"
|
||||
byte textmode[] = 16, 0, 15
|
||||
byte prefix[64] = ""
|
||||
//
|
||||
// SOS routines
|
||||
// FILE I/O
|
||||
@ -33,27 +30,6 @@ def setpfx(path)#1
|
||||
fin
|
||||
return path
|
||||
end
|
||||
//
|
||||
// CONSOLE I/O
|
||||
//
|
||||
def dev_control(devnum, code, list)#1
|
||||
byte params[5]
|
||||
|
||||
params.0 = 3
|
||||
params.1 = devnum
|
||||
params.2 = code
|
||||
params:3 = list
|
||||
return syscall($83, @params)
|
||||
end
|
||||
def dev_getnum(name)#1
|
||||
byte params[4]
|
||||
|
||||
params.0 = 2
|
||||
params:1 = name
|
||||
params.3 = 0
|
||||
syscall($84, @params)
|
||||
return params.3
|
||||
end
|
||||
def dev_info(devnum, name, list, listlen)#1
|
||||
byte params[7]
|
||||
|
||||
@ -64,16 +40,6 @@ def dev_info(devnum, name, list, listlen)#1
|
||||
params.6 = listlen
|
||||
return syscall($85, @params)
|
||||
end
|
||||
def init_cons()#0
|
||||
byte nlmode[2]
|
||||
cmdsys.refcons = cmdsys:sysopen(@console)
|
||||
cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
|
||||
cmdsys.devcons = dev_getnum(@console)
|
||||
nlmode:0 = $0D80
|
||||
//nlmode.0 = $80
|
||||
//nlmode.1 = $0D
|
||||
dev_control(cmdsys.devcons, $02, @nlmode)
|
||||
end
|
||||
def volume(devname, volname)#1
|
||||
byte params[9]
|
||||
|
||||
@ -113,7 +79,7 @@ def catalog(path)#0
|
||||
word entry, filecnt, catptr
|
||||
|
||||
if !^path
|
||||
path = @prefix
|
||||
getpfx(path)
|
||||
fin
|
||||
refnum = cmdsys:sysopen(path)
|
||||
if not refnum
|
||||
@ -206,25 +172,19 @@ end
|
||||
//
|
||||
// Command line handler
|
||||
//
|
||||
def shell#0
|
||||
def shell#1
|
||||
byte textmode[3]
|
||||
byte prefix[64]
|
||||
byte err[]
|
||||
byte autorun
|
||||
word cmdptr
|
||||
//
|
||||
// Try to load autorun.
|
||||
// Copy AUTORUN commmand line
|
||||
//
|
||||
cmdptr = heapmark
|
||||
^cmdptr = 0
|
||||
puts("MEM:$"); puth(heapavail); putln
|
||||
autorun = cmdsys:sysopen("AUTORUN")
|
||||
if autorun > 0
|
||||
^cmdptr = cmdsys:sysread(autorun, cmdptr + 1, 64)
|
||||
cmdsys:sysclose(autorun)
|
||||
fin
|
||||
cmdptr = strcpy(heapmark, cmdsys:cmdline)
|
||||
//
|
||||
// Handle commands.
|
||||
//
|
||||
while 1
|
||||
repeat
|
||||
if ^cmdptr
|
||||
when toupper(parsecmd(cmdptr))
|
||||
is 'C'
|
||||
@ -254,8 +214,9 @@ def shell#0
|
||||
volumes
|
||||
break
|
||||
is '+'
|
||||
cmdsys:modexec(striptrail(cmdptr))
|
||||
cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
|
||||
//cmdsys:modexec(striptrail(cmdptr))
|
||||
return striptrail(cmdptr)
|
||||
//cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
|
||||
break
|
||||
otherwise
|
||||
puts("?\n")
|
||||
@ -272,17 +233,10 @@ def shell#0
|
||||
puts(getpfx(@prefix))
|
||||
cmdptr = gets($BA)
|
||||
strcpy(cmdsys:cmdline, cmdptr)
|
||||
loop
|
||||
until 0
|
||||
return 0
|
||||
end
|
||||
//
|
||||
// Init console.
|
||||
//
|
||||
init_cons
|
||||
//
|
||||
// Print PLASMA version
|
||||
//
|
||||
puts("PLASMA 2.0 Dev\n")//; putb(version.1); putc('.'); putb(version.0); putln
|
||||
//
|
||||
// Save pointer to command line handler
|
||||
//
|
||||
cmdsys:cmdparser = @shell
|
||||
|
@ -45,6 +45,12 @@ byte hexchar[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E',
|
||||
// Exported Machine ID.
|
||||
//
|
||||
byte machid = $F2 // Apple ///, 80 columns
|
||||
//
|
||||
// Console and textmode control characters
|
||||
//
|
||||
byte console[] = ".CONSOLE"
|
||||
byte textmode[] = 16, 0, 15
|
||||
|
||||
//
|
||||
// Working input buffer overlayed with strings table
|
||||
//
|
||||
@ -120,8 +126,9 @@ word sysmodsym = @exports
|
||||
//
|
||||
word systemflags = 0
|
||||
word heap = $2000
|
||||
byte modid = 0
|
||||
byte autorun[]
|
||||
byte modseg[15]
|
||||
byte modid = 0
|
||||
word symtbl, lastsym
|
||||
//
|
||||
// CALL SOS
|
||||
@ -817,6 +824,38 @@ def write(refnum, buff, len)#1
|
||||
return perr
|
||||
end
|
||||
//
|
||||
// CONSOLE I/O
|
||||
//
|
||||
def dev_control(devnum, code, list)#1
|
||||
byte params[5]
|
||||
|
||||
params.0 = 3
|
||||
params.1 = devnum
|
||||
params.2 = code
|
||||
params:3 = list
|
||||
return syscall($83, @params)
|
||||
end
|
||||
def dev_getnum(name)#1
|
||||
byte params[4]
|
||||
|
||||
params.0 = 2
|
||||
params:1 = name
|
||||
params.3 = 0
|
||||
syscall($84, @params)
|
||||
return params.3
|
||||
end
|
||||
def init_cons()#0
|
||||
byte nlmode[2]
|
||||
|
||||
refcons = open(@console)
|
||||
devcons = dev_getnum(@console)
|
||||
nlmode:0 = $0D80
|
||||
//nlmode.0 = $80
|
||||
//nlmode.1 = $0D
|
||||
dev_control(devcons, $02, @nlmode)
|
||||
write(refcons, @textmode, 3)
|
||||
end
|
||||
//
|
||||
// MEMORY CALLS
|
||||
//
|
||||
def seg_find(search, pages, id)#3
|
||||
@ -1228,9 +1267,27 @@ sysmods = 0
|
||||
syspath = @sysmods
|
||||
cmdlnptr = @cmdln
|
||||
//
|
||||
// Print PLASMA version
|
||||
//
|
||||
init_cons
|
||||
prstr("PLASMA 2.0 Dev\n")//; putb(version.1); putc('.'); putb(version.0); putln
|
||||
prstr("MEM:$"); prword(availheap); crout
|
||||
//
|
||||
// Exec command line parser
|
||||
//
|
||||
loadmod(@soscmd)
|
||||
modid = 0
|
||||
cmdparser()#0
|
||||
autorun = open("AUTORUN")
|
||||
if autorun > 0
|
||||
cmdln = read(autorun, @cmdln.1, 64)
|
||||
close(autorun)
|
||||
fin
|
||||
//
|
||||
// Call cmd line parser
|
||||
//
|
||||
repeat
|
||||
execmod(cmdparser())
|
||||
write(refcons, @textmode, 3)
|
||||
cmdln = 0
|
||||
until 0
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user