From 2434d262c529e596c82eb273f2874be0e750916f Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Wed, 24 Jan 2024 13:01:10 -0800 Subject: [PATCH] Enable external access to execsys --- src/inc/cmdsys.plh | 5 +- src/mk140 | 3 +- src/mk800 | 1 + src/mkinst | 31 +++++++++++ src/scripts/hdinstall.4th | 5 +- src/scripts/hdinstall1.4th | 37 ++++++++++++++ src/scripts/hdinstall2.4th | 102 +++++++++++++++++++++++++++++++++++++ src/vmsrc/apple/cmd.pla | 6 +-- src/vmsrc/apple/cmdjit.pla | 6 +-- 9 files changed, 184 insertions(+), 12 deletions(-) create mode 100644 src/mkinst create mode 100644 src/scripts/hdinstall1.4th create mode 100644 src/scripts/hdinstall2.4th diff --git a/src/inc/cmdsys.plh b/src/inc/cmdsys.plh index 4a69623..ba0e2f5 100644 --- a/src/inc/cmdsys.plh +++ b/src/inc/cmdsys.plh @@ -54,8 +54,9 @@ import cmdsys byte syserr byte jitcount byte jitsize - byte refcons // Apple /// specific - byte devcons // Apple /// specific + word execsys[] // Apple II specific + byte refcons // Apple /// specific + byte devcons // Apple /// specific word lookupsym end // diff --git a/src/mk140 b/src/mk140 index e3420ec..138fcc7 100755 --- a/src/mk140 +++ b/src/mk140 @@ -6,4 +6,5 @@ ./mkfpsos ./mkbld ./mkinet -./mkdemos \ No newline at end of file +./mkdemos +./mkinstall \ No newline at end of file diff --git a/src/mk800 b/src/mk800 index e0c8ea0..bbc4c87 100755 --- a/src/mk800 +++ b/src/mk800 @@ -60,6 +60,7 @@ cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/HR2FORTH RE cat rel/PLFORTH#FE1000 | ./ac.jar -p PLASMA-2.1.po sys/PLFORTH REL #mkdir sys/scripts +cat scripts/hdinstall.4th | ./ac.jar -ptx PLASMA-2.1.po HDINSTALL.4TH TXT cat scripts/plasma.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/PLASMA.4TH TXT cat scripts/machid.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/MACHID.4TH TXT cat scripts/conio.4th | ./ac.jar -ptx PLASMA-2.1.po sys/scripts/CONIO.4TH TXT diff --git a/src/mkinst b/src/mkinst new file mode 100644 index 0000000..b361b29 --- /dev/null +++ b/src/mkinst @@ -0,0 +1,31 @@ +cp ../sysfiles/BLANK140.po PLASMA-2.1-INST.po +./ac.jar -n PLASMA-2.1-INST.po PLASMA.INST +cat ../sysfiles/PRODOS#FF0000 | ./ac.jar -p PLASMA-2.1-INST.po PRODOS SYS +cat rel/apple/CMD#061000 | ./ac.jar -p PLASMA-2.1-INST.po CMD BIN $1000 +cat rel/apple/CMD128#061000 | ./ac.jar -p PLASMA-2.1-INST.po CMD128 BIN $1000 +cat rel/apple/PLASMA.SYSTEM#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLASMA.SYSTEM SYS +cat rel/apple/PLVM.128#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLVM.128 SYS +cat rel/apple/PLVM16#FF2000 | ./ac.jar -p PLASMA-2.1-INST.po PLVM16 SYS +cat rel/apple/JIT#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/JIT REL +cat rel/apple/JIT16#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/JIT16 REL +cat rel/apple/COPY#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/COPY REL +cat rel/apple/DEL#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/DEL REL +cat rel/apple/REN#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/REN REL +cat rel/apple/NEWDIR#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/NEWDIR REL +cat rel/apple/MATCHFILES#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/MATCHFILES REL +cat rel/ARGS#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/ARGS REL +cat rel/LONGJMP#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/LONGJMP REL +cat rel/HRFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/HRFORTH REL +cat rel/HR2FORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/HR2FORTH REL +cat rel/PLFORTH#FE1000 | ./ac.jar -p PLASMA-2.1-INST.po sys/PLFORTH REL +cat scripts/plasma.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/PLASMA.4TH TXT +cat scripts/machid.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/MACHID.4TH TXT +cat scripts/conio.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/CONIO.4TH TXT +cat scripts/fileio.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/FILEIO.4TH TXT +cat scripts/grlib.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/GRLIB.4TH TXT +cat scripts/hgrlib.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/HGRLIB.4TH TXT +cat scripts/int32.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/INT32.4TH TXT +cat scripts/fpu.4th | ./ac.jar -ptx PLASMA-2.1-INST.po sys/scripts/FPU.4TH TXT +cat scripts/hdinstall1.4th | ./ac.jar -ptx PLASMA-2.1-INST.po HDINSTALL.4TH TXT +cat scripts/hdinstall2.4th | ./ac.jar -ptx PLASMA-2.1-INST.po HDINSTALL2.4TH TXT +echo "+PLFORTH HDINSTALL.4TH" | ./ac.jar -ptx PLASMA-2.1-INST.po AUTORUN TXT \ No newline at end of file diff --git a/src/scripts/hdinstall.4th b/src/scripts/hdinstall.4th index 0106907..79ab151 100644 --- a/src/scripts/hdinstall.4th +++ b/src/scripts/hdinstall.4th @@ -24,8 +24,7 @@ SRC" conio.4th" THEN ; -: INPUTSTR" ( STR -- ) - COMPILE ." +: STRINPUT ( STR -- ) DUP 1+ 255 ACCEPT SWAP C! ; : STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE ) @@ -43,7 +42,7 @@ HOME 12 SPACES INVERSETEXT ." PLASMA HD INSTALL" NORMALTEXT CR CR -DEST INPUTSTR" Enter destination " +." Enter destination " DEST STRINPUT DEST C@ 0= ?ABORT" Destination required" 0 1 40 23 VIEWPORT diff --git a/src/scripts/hdinstall1.4th b/src/scripts/hdinstall1.4th new file mode 100644 index 0000000..6a4086f --- /dev/null +++ b/src/scripts/hdinstall1.4th @@ -0,0 +1,37 @@ +SRC" plasma.4th" +SRC" conio.4th" +SRC" machid.4th" +LOOKUP CMDSYS 19 + @ PLASMA EXECSYS + +: STRINPUT ( STR -- ) + DUP 1+ 255 ACCEPT SWAP C! +; +: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE ) + +STRING DEST +STRING FILELIST + +HOME +12 SPACES INVERSETEXT +." PLASMA HD INSTALL" +NORMALTEXT CR CR +." Enter destination " DEST STRINPUT +DEST C@ 0= ?ABORT" Destination required" +0 1 40 23 VIEWPORT + +." Copying install files to " DEST (.") CR +FILELIST " -R * " STRCPY DEST STRCAT +" COPY" SWAP LOADMOD + +DEST SETPFX DROP + +FILELIST " HDINSTALL.4TH" STRCPY +" DEL" SWAP LOADMOD + +FILELIST " HDINSTALL2.4TH HDINSTALL.4TH" STRCPY +" REN" SWAP LOADMOD + +." Stage 2..." CR +0 0 40 24 VIEWPORT + +" PLASMA.SYSTEM" EXECSYS \ No newline at end of file diff --git a/src/scripts/hdinstall2.4th b/src/scripts/hdinstall2.4th new file mode 100644 index 0000000..3faec9d --- /dev/null +++ b/src/scripts/hdinstall2.4th @@ -0,0 +1,102 @@ +SRC" plasma.4th" +SRC" conio.4th" +: RESUME> ; ( PLACE HOLDER TO RESUME EXECUTION ) +: ?EXEC ( F -- ) + NOT IF ( SKIP CODE IN BETWEEN ?EXEC AND RESUME> ) + 1 >R + BEGIN + BL WORD FIND IF + CASE + ' RESUME> OF + R> 1- ?DUP 0= IF ( EXIT IF FINAL RESUME> ) + DROP EXIT + THEN + >R + ENDOF + ' ?EXEC OF ( CHECK FOR NESTED ?EXEC ) + R> 1+ >R + ENDOF + ENDCASE + ELSE + DROP + THEN + AGAIN + THEN +; + +: STRING CREATE 256 ALLOT DOES> ; ( JUST ALLOCATE THE BIGGEST STRING POSSIBLE ) + +: CONFIRM" ( -- F ) + COMPILE ." + ." (Y/N)" + KEY CR TOUPPER CHAR Y = +; + +STRING DEST +STRING FILELIST + +HOME +8 SPACES INVERSETEXT +." PLASMA HD INSTALL STAGE 2" +NORMALTEXT CR CR +0 1 40 23 VIEWPORT + +DEST GETPFX DROP + +." Insert PLASMA.SYS into floppy drive and press a key" KEY DROP +FILELIST " -R /PLASMA.SYS/SYS " STRCPY DEST STRCAT +" COPY" SWAP LOADMOD + +CONFIRM" Copy demos?" +?EXEC + ." Insert PLASMA.DEMOS into floppy drive and press a key" KEY DROP + FILELIST " -R /PLASMA.DEMOS/DEMOS " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD +RESUME> + +CONFIRM" Copy floating point libraries?" +?EXEC + ." Insert PLASMA.FPSOS into floppy drive and press a key" KEY DROP + FILELIST " -R /PLASMA.FPSOS/SYS " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD +RESUME> + +CONFIRM" Copy networking libraries?" +?EXEC + ." Insert PLASMA.INET into floppy drive and press a key" KEY DROP + FILELIST " -R /PLASMA.INET/* " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD +RESUME> + +CONFIRM" Copy build tools?" +?EXEC + DEST " /BLD" STRCAT DROP + " NEWDIR" DEST LOADMOD + ." Insert PLASMA.BLD into floppy drive and press a key" KEY DROP + FILELIST " /PLASMA.BLD/BLD/PLASM /PLASMA.BLD/BLD/CODEOPT " STRCPY + DEST STRCAT + " COPY" SWAP LOADMOD + FILELIST " -R /PLASMA.BLD/BLD/INC " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD + + CONFIRM" Copy sample PLASMA code?" + ?EXEC + FILELIST " -R /PLASMA.BLD/BLD/SAMPLES " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD + RESUME> + + CONFIRM" Copy sample FORTH scripts?" + ?EXEC + ." Insert PLASMA.4TH into floppy drive and press a key" KEY DROP + FILELIST " -R /PLASMA.4TH/BLD/SCRIPTS " STRCPY DEST STRCAT + " COPY" SWAP LOADMOD + RESUME> + +RESUME> + +FILELIST " AUTORUN" +" DEL" SWAP LOADMOD + +." Done" CR +0 0 40 24 VIEWPORT +BYE diff --git a/src/vmsrc/apple/cmd.pla b/src/vmsrc/apple/cmd.pla index 9f8e4e2..7a71b91 100755 --- a/src/vmsrc/apple/cmd.pla +++ b/src/vmsrc/apple/cmd.pla @@ -34,7 +34,7 @@ predef markheap()#1, allocheap(size)#1, allocalignheap(size, pow2, freeaddr)#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, open(path)#1, close(refnum)#1, read(refnum, buff, len)#1, write(refnum, buff, len)#1 -predef lookuptbl(dci)#1 +predef lookuptbl(dci)#1, execsys(sysfile)#0 // // Exported CMDSYS table // @@ -45,8 +45,8 @@ word = @execmod, @open, @close, @read, @write byte perr byte jitcount = 0 byte jitsize = 0 -word = symtbl // Different between Apple II and /// -word = @lookuptbl // +word = @execsys // Different between Apple II and /// +word = @lookuptbl // // Working input buffer overlayed with strings table // diff --git a/src/vmsrc/apple/cmdjit.pla b/src/vmsrc/apple/cmdjit.pla index ffdc997..a152424 100755 --- a/src/vmsrc/apple/cmdjit.pla +++ b/src/vmsrc/apple/cmdjit.pla @@ -52,7 +52,7 @@ predef markheap()#1, allocheap(size)#1, allocalignheap(size, pow2, freeaddr)#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, open(path)#1, close(refnum)#1, read(refnum, buf, len)#1 -predef lookuptbl(dci)#1 +predef lookuptbl(dci)#1, execsys(sysfile)#0 // // Exported CMDSYS table @@ -64,8 +64,8 @@ word = @execmod, @open, @close, @read, 0 // Mark write() as NULL byte perr byte jitcount = 0 byte jitsize = 0 -word = symtbl // Different between Apple II and /// -word = @lookuptbl // +word = @execsys // Different between Apple II and /// +word = @lookuptbl // // Working input buffer overlayed with strings table //