From a9237f58cc1f1bcac2b3aa86cb09d070c94982c9 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sat, 17 Mar 2018 15:52:15 -0700 Subject: [PATCH] Sync cmd exported sysroutines --- src/makefile | 2 +- src/vmsrc/apple/cmd.pla | 17 ++++++++++++++--- src/vmsrc/apple/soscmd.pla | 14 ++++++++------ src/vmsrc/apple/sossys.pla | 4 ++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/makefile b/src/makefile index 82e749c..3c94fc5 100755 --- a/src/makefile +++ b/src/makefile @@ -6,7 +6,7 @@ PLVM01 = rel/apple/A1PLASMA\#060280 PLVM02 = rel/apple/PLASMA.SYSTEM\#FF2000 PLVM802 = rel/apple/PLASMA16.SYSTEM\#FF2000 PLVM03 = rel/apple/SOS.INTERP\#050000 -SOSCMD = rel/apple/SOS.CMD\#0FE1000 +SOSCMD = rel/apple/SOS.CMD\#FE1000 CMD = rel/apple/CMD\#061000 PLVMZP_C64 = vmsrc/c64/plvmzp.inc PLVMC64 = rel/c64/PLASMA diff --git a/src/vmsrc/apple/cmd.pla b/src/vmsrc/apple/cmd.pla index 5457b4e..367a250 100755 --- a/src/vmsrc/apple/cmd.pla +++ b/src/vmsrc/apple/cmd.pla @@ -34,14 +34,15 @@ predef crout()#0, cout(c)#0, prstr(s)#0, prbyte(b)#0, prword(w)#0, print(i)#0, c predef markheap()#1, allocheap(size)#1, allocalignheap(size, pow2, freeaddr)#1, releaseheap(newheap)#1, availheap()#1 predef memset(addr,value,size)#0, memcpy(dst,src,size)#0, strcpy(dst,src)#1, strcat(dst,src)#1 predef uword_isgt(a,b)#1, uword_isge(a,b)#1, uword_islt(a,b)#1, uword_isle(a,b)#1, sext(a)#1, divmod(a,b)#2 -predef execmod(modfile)#1 +predef execmod(modfile)#1, open(path)#1, close(refnum)#1, read(refnum, buff, len)#1, write(refnum, buff, len)#1 // // Exported CMDSYS table // word version = $0200 // 02.00 Dev word syspath word syscmdln -word = @execmod +word = @execmod, @open, @close, @read, @write +byte perr // // Working input buffer overlayed with strings table // @@ -117,7 +118,6 @@ word sysmodsym = @exports // System variable. // word systemflags = 0 -byte perr word heap word xheap = $0800 word lastsym = symtbl @@ -898,6 +898,17 @@ def read(refnum, buff, len)#1 perr = syscall($CA, @params) return params:6 end +def write(refnum, buf, len)#1 + byte params[8] + + params.0 = 4 + params.1 = refnum + params:2 = buf + params:4 = len + params:6 = 0 + perr = syscall($CB, @params) + return params:6 +end // // Heap routines. // diff --git a/src/vmsrc/apple/soscmd.pla b/src/vmsrc/apple/soscmd.pla index 02d8b3d..2a0697b 100755 --- a/src/vmsrc/apple/soscmd.pla +++ b/src/vmsrc/apple/soscmd.pla @@ -79,15 +79,13 @@ def dev_info(devnum, name, list, listlen)#1 end def init_cons()#0 byte nlmode[2] - if !cmdsys.refcons - cmdsys.refcons = cmdsys:sysopen(@console) - fin - cmdsys:syswrite(refcons, @textmode, 3) + 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(devcons, $02, @nlmode) + dev_control(cmdsys.devcons, $02, @nlmode) end def volume(devname, volname)#1 byte params[9] @@ -219,6 +217,10 @@ def parsecmd(strptr)#1 return cmd end // +// Clear out module memory segment +// +cmdsys.modid = 0 +// // Init console. // init_cons @@ -279,7 +281,7 @@ while 1 saveX cmdsys:modexec(striptrail(cmdptr)) restoreX - //close(0) + cmdsys:sysclose(0) init_cons break otherwise diff --git a/src/vmsrc/apple/sossys.pla b/src/vmsrc/apple/sossys.pla index 674db6f..9e12fa4 100755 --- a/src/vmsrc/apple/sossys.pla +++ b/src/vmsrc/apple/sossys.pla @@ -33,9 +33,10 @@ word version = $0200 // 02.00 word syspath word cmdlnptr word = @execmod, @open, @close, @read, @write +byte perr +byte modid = 0 byte refcons = 0 byte devcons = 0 -byte modid = 0 // // String pool. // @@ -117,7 +118,6 @@ word systemflags = 0 word heap = $2000 byte modseg[15] word symtbl, lastsym -byte perr // // CALL SOS // SYSCALL(CMD, PARAMS)