diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 5f96c1f4..455a2e9d 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/BIN/CSH.S.txt b/BIN/CSH.S.txt new file mode 100644 index 00000000..1e81f53d --- /dev/null +++ b/BIN/CSH.S.txt @@ -0,0 +1,104 @@ +NEW +PREFIX +AUTO 4,1 Enable MASM3 auto line num + .LIST OFF + .OP 65C02 Target CPU, must match CPU level in header + .OR $2000 usualy $2000, but any value > $100 allowed + .TF BIN/CSH +*-------------------------------------- + .INB INC/MACROS.I + .INB INC/A2OSX.I +*-------------------------------------- +* Zero Page Segment, up to 32 bytes +*-------------------------------------- + .DUMMY + .OR ZPBIN +ZS.START +ZPCSHSymbols .BS 2 +ZPCSHData .BS 2 +ZPCSHValue .BS 2 +ZPCSHStack .BS 2 +ZS.END .ED +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA #0 S.PS.F.EVENT + .DA #0 + .DA CS.END-CS.START Code Size (without Constants) + .DA DS.END-DS.START Data SegmentSize + .DA #16 Stack Size + .DA #ZS.END-ZS.START Zero Page Size + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT + +* Add any address you want be relocated by loader +* Usefull if you have to pass EFFECTIVE address to an API call... +* L.MSG.Test .DA Msg.Test + + .DA 0 +*-------------------------------------- +* Called once at process creation +* Put code for loading LIB here +*-------------------------------------- +CS.INIT clc + rts +*-------------------------------------- +* Called until exit with CS +* if RUN exits with CC, RN entered again +*-------------------------------------- +CS.RUN + +* Put your code here +* >LDYA L.MSG.Test Load EFFECTIVE address +* >SYSCALL puts Call API to print a string + +.8 lda #0 Exit Code = Succes + sec QUIT Process + rts + +.9 lda #E.SYN Exit Code = Succes + sec QUIT Process + rts +*-------------------------------------- +* Called if option S.PS.F.EVENT enabled in Header +* Timer Event : every 10th seconds +*-------------------------------------- +CS.DOEVENT sec + rts +*-------------------------------------- +* Called once, when RUN exited with CS +* Put code for unloading LIB here +*-------------------------------------- +CS.QUIT clc + rts +*-------------------------------------- +CS.END +*-------------------------------------- +* Initialized DATA +*-------------------------------------- + +* Put your constant here : +* MSG.TEST .AZ "Test Message" + +*-------------------------------------- +* Per Process DATA segement (0 filled before INIT) +*-------------------------------------- + .DUMMY + .OR 0 +DS.START +DS.END + .ED +*-------------------------------------- +MAN +SAVE USR/SRC/BIN/CSH.S +ASM diff --git a/BIN/MEMDUMP.S.txt b/BIN/MEMDUMP.S.txt index 41c40b9f..876ff842 100644 --- a/BIN/MEMDUMP.S.txt +++ b/BIN/MEMDUMP.S.txt @@ -101,7 +101,7 @@ CS.RUN >SYSCALL GetChar >LDA.G MEM.COUNT >CMP.G MemStat+S.MSTAT.MLast - beq .10 + beq CS.RUN.FOOTER .8 clc rts @@ -109,7 +109,10 @@ CS.RUN >SYSCALL GetChar .9 sec rts -.10 >PUSHB.G MEM.COUNT +CS.RUN.FOOTER >SYSCALL GetChar + bcs CS.RUN.FOOTER + + >PUSHB.G MEM.COUNT >PUSHB.G USED.COUNT >PUSHBI 2 >LDYA L.MSG2 @@ -231,7 +234,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1 >PUSHA >PUSHBI 3 >LDYA L.MSG1.STR - bra CS.RUN.PRINTMEM.EXIT + bra CS.RUN.PRINTMEM.OUT .2 ldy #15 @@ -241,7 +244,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1 >PUSHBI 16 >LDYA L.MSG1.HEX - bra CS.RUN.PRINTMEM.EXIT + bra CS.RUN.PRINTMEM.OUT CS.RUN.PRINTMEM.BIN @@ -252,7 +255,7 @@ CS.RUN.PRINTMEM.BIN >PUSHBI 2 >LDYA L.MSG1.BIN -CS.RUN.PRINTMEM.EXIT +CS.RUN.PRINTMEM.OUT >SYSCALL printf >INC.G LINE.COUNT diff --git a/BIN/SHELL.S.CL.txt b/BIN/SHELL.S.CL.txt index 49c1bbfa..e4e4c9cd 100644 --- a/BIN/SHELL.S.CL.txt +++ b/BIN/SHELL.S.CL.txt @@ -273,7 +273,7 @@ CL.PrintCmdBuf >LDYA ZPCLBuf rts *-------------------------------------- CL.GetLine >LDYA ZPFileBufPtr - >STYA.G CMD.FileBufPtr + >STYA.G ZPFileBufPtrBak lda (ZPFileBufPtr) beq .9 @@ -416,13 +416,7 @@ CL.CheckCmd ldy #$ff cmp #'/' bne .1 - >LDYA ZPCLBufPtr found /, some path specified, External, no search - >SYSCALL realpath - bcs .9 - - txa - >STA.G CMD.hCmdLine - bra .6 go check type... + bra .4 .2 >PUSHW ZPCLBufPtr >LDYA L.CMD.INT @@ -448,79 +442,14 @@ CL.CheckCmd ldy #$ff clc rts -.4 >LDYAI 256 Get a buffer for found path - >SYSCALL GetMem - bcs .9 - - txa - >STA.G CMD.hCmdLine - - >LDYA L.ENV.PATH ENVNAME=PATH for search - >SYSCALL GetEnv get value for ENV=PATH - bcs .5 no PATH, try workdir - - jsr CL.SearchExt - bcc .6 found in PATH, go check Type - -.5 ldy #S.PS.hPREFIX not found, try in CD - lda (pPs),y - >SYSCALL GetMemPtr - jsr CL.SearchExt - - bcs CL.CheckCmd.90 - -.6 >PUSHEA.G CMD.Stat - >LDA.G CMD.hCmdLine - >SYSCALL GetMemPtr - >SYSCALL STAT - bcs CL.CheckCmd.90 - - lda #$ff - >STA.G CMD.IntCmd - - ldy #CMD.Stat+S.STAT.P.TYPE - lda (pData),y - cmp #S.FI.T.TXT - beq CL.CheckCmd.BIN - cmp #S.FI.T.BIN - beq CL.CheckCmd.BIN - cmp #S.FI.T.SYS - beq CL.CheckCmd.SYS - - lda #E.BADFTYPE - sec - -CL.CheckCmd.90 php - pha - >LDA.G CMD.hCmdLine - >SYSCALL FreeMem - pla - - plp -CL.CheckCmd.RTS - rts -*-------------------------------------- -* BIN : add "/PATH/CMD" -*-------------------------------------- -CL.CheckCmd.BIN >LDA.G CMD.hCmdLine - >SYSCALL GetMemPtr +.4 >LDYA ZPCLBufPtr jsr CL.AddYAToArgV - bra CL.CheckCmd.90 -*-------------------------------------- -CL.CheckCmd.SYS bra * -*-------------------------------------- -CL.SearchExt pha - phy - >PUSHEA.G CMD.Stat - >LDA.G CMD.hCmdLine - >SYSCALL GetMemPtr - >PUSHYA push dest full path - ply - pla - >PUSHYA push search list - >LDYA ZPCLBufPtr push CMD - >SYSCALL FileSearch + lda #$ff + >STA.G CMD.IntCmd + clc + +CL.CheckCmd.RTS rts *-------------------------------------- CL.CheckIO >PUSHW ZPCLBufPtr diff --git a/BIN/SHELL.S.CMD.txt b/BIN/SHELL.S.CMD.txt index fd54e315..38098113 100644 --- a/BIN/SHELL.S.CMD.txt +++ b/BIN/SHELL.S.CMD.txt @@ -160,21 +160,16 @@ Cmd.INT.CD.RTS rts Cmd.INT.CD.HOME >LDYA L.ENV.HOME >SYSCALL GetEnv - bcc .1 + bcc Cmd.INT.CD.1 >LDYA L.ENV.ROOT >SYSCALL GetEnv - bcc .1 + bcc Cmd.INT.CD.1 jmp Cmd.INT.PWD -.1 >SYSCALL ExpandStr - bcs Cmd.INT.CD.RTS - Cmd.INT.CD.1 >STYA ZPPtr1 - txa - >STA.G CMD.hCmdLine - + ldy #1 lda (ZPPtr1),y beq .8 we have '/' @@ -182,17 +177,13 @@ Cmd.INT.CD.1 >STYA ZPPtr1 >PUSHEA.G CMD.Stat >LDYA ZPPtr1 >SYSCALL STAT - bcs .90 + bcs .9 >LDA.G CMD.Stat+S.STAT.P.TYPE cmp #S.FI.T.DIR - beq .1 + bne .90 - lda #E.CSYN - sec - bra .90 - -.1 ldy #0 + ldy #0 .5 iny lda (ZPPtr1),y @@ -210,18 +201,15 @@ Cmd.INT.CD.1 >STYA ZPPtr1 sta (ZPPtr1),y .8 >LDYA ZPPtr1 - >SYSCALL strdup - bcs .90 + >SYSCALL ExpandStr + bcs .9 + txa - jsr Cmd.SetPrefixA + jmp Cmd.SetPrefixA -.90 php - pha - >LDA.G CMD.hCmdLine - >SYSCALL FreeMem - pla - plp +.90 lda #E.CSYN + sec .9 rts *-------------------------------------- Cmd.SetPrefixA pha @@ -1039,10 +1027,10 @@ CMD.IsSwitch >STYA ZPPtr1 sec rts *-------------------------------------- -CMD.StkPushPtr >LDA.G CMD.FileBufPtr +CMD.StkPushPtr >LDA.G ZPFileBufPtrBak jsr CMD.StkPush bcs .9 - >LDA.G CMD.FileBufPtr+1 + >LDA.G ZPFileBufPtrBak+1 jmp CMD.StkPush .9 rts *-------------------------------------- diff --git a/BIN/SHELL.S.txt b/BIN/SHELL.S.txt index c65b5aaf..2c7a1aab 100644 --- a/BIN/SHELL.S.txt +++ b/BIN/SHELL.S.txt @@ -6,8 +6,6 @@ AUTO 4,1 .OR $2000 .TF BIN/SHELL *-------------------------------------- -CSH .EQ 0 -*-------------------------------------- CL.MAX .EQ 159 History.MAX .EQ 256 CMD.STACK.MAX .EQ 64 @@ -56,6 +54,7 @@ E.BADFTYPE .EQ $C8 .INB INC/MLI.I .INB INC/MLI.E.I *-------------------------------------- + .DUMMY .OR ZPBIN ZS.START ZPPtr1 .BS 2 @@ -64,13 +63,8 @@ ZPPtr3 .BS 2 ZPCLBuf .BS 2 ZPArgVBuf .BS 2 ZPFileBufPtr .BS 2 +ZPFileBufPtrBak .BS 2 ZPCLBufPtr .BS 2 - .DO CSH=1 -ZPCSHSymbols .BS 2 -ZPCSHData .BS 2 -ZPCSHValue .BS 2 -ZPCSHStack .BS 2 - .FIN ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -81,9 +75,6 @@ CS.START cld .DA #1 BIN Layout Version 1 .DA #S.PS.F.EVENT S.PS.F .DA #0 - .DA CS.END-CS.START CS - .DA DS.END-DS.START DS - .DA #0 .DA CS.END-CS.START Code Size (without Constants) .DA DS.END-DS.START Data SegmentSize .DA #64 Stack Size @@ -168,9 +159,6 @@ J.CMD.Eval.TOKEN4 .DA M32.Add L.M32.Printf .DA M32.Printf L.ERR.Codes .DA ERR.Codes L.ERR.Messages .DA ERR.Messages - .DO CSH=1 - .INB USR/SRC/BIN/SHELL.R.CSH - .FIN .DA 0 *-------------------------------------- CS.INIT clc @@ -199,9 +187,6 @@ CS.RUN jsr CMD.Init lda #0 jsr ShiftA Remove $0=/bin/shell - .DO CSH=1 - jsr CSH.Init - .FIN bra CS.RUN.LOOP .1 jsr Cmd.INT.CD.HOME @@ -354,11 +339,7 @@ CS.RUN.BATCH >SYSCALL GetChar clc jmp CS.RUN.LOOP.END -.2 .DO CSH=1 - jsr CSH.Run - .ELSE - jsr CL.GetLine - .FIN +.2 jsr CL.GetLine bcc .7 cmp #C.EOF @@ -446,10 +427,7 @@ CS.DOEVENT lda (pEvent) .9 sec rts *-------------------------------------- -CS.QUIT .DO CSH=1 - jsr CSH.Quit - .FIN - jsr HIS.Quit +CS.QUIT jsr HIS.Quit jsr CMD.Quit clc rts @@ -549,9 +527,6 @@ Lookup >STYA ZPPtr2 .INB USR/SRC/BIN/SHELL.S.CMD .INB USR/SRC/BIN/SHELL.S.IO .INB USR/SRC/BIN/SHELL.S.HIS - .DO CSH=1 - .INB USR/SRC/BIN/SHELL.S.CSH - .FIN *-------------------------------------- CS.END *-------------------------------------- @@ -645,9 +620,6 @@ CMD.Eval.TOKEN4 .AZ "+" .AZ "mod" .HS 00 *-------------------------------------- - .DO CSH=1 - .INB USR/SRC/BIN/SHELL.C.CSH - .FIN .INB USR/SRC/X.M32.S .INB USR/SRC/X.ERRORS.S *-------------------------------------- @@ -679,9 +651,7 @@ CL.bExec .BS 1 CMD.hCLBuf .BS 1 -CMD.FileBufPtr .BS 2 CMD.IntCmd .BS 1 -CMD.hCmdLine .BS 1 CMD.hArgVBuf .BS 1 CMD.ArgIndex .BS 1 @@ -700,9 +670,7 @@ HIS.Index .BS 1 IO.hIn .BS 1 IO.hOut .BS 1 IO.hErr .BS 1 - .DO CSH=1 - .INB USR/SRC/BIN/SHELL.G.CSH - .FIN +*-------------------------------------- M32.BUF .BS 12 -1234567890\0 M32.ACC .BS 4 M32.ARG .BS 4 diff --git a/ETC/INIT b/ETC/INIT index f6b18911..c0356cbf 100644 --- a/ETC/INIT +++ b/ETC/INIT @@ -22,14 +22,13 @@ GETTY /DEV/TTY4 ${ROOT}SBIN/LOGIN & #INSDRV LANCEGS.DRV #INSDRV UTHER2.AI.DRV 00:08:DC:12:34:56 #INSDRV UTHERNET2.DRV 00:08:DC:12:34:56 -#STARTPROC TCPIPD -#STARTPROC DHCPCLNT -#STARTPROC TELNETD -#STARTPROC HTTPD +#NETWORKD & +#TELNETD & +#HTTPD & # GUI Section #INSDRV MOUSE.DRV #INSDRV DHGR.DRV -#STARTPROC DESKTOP +#GUI & ECHO *** End INIT *** MAN TEXT ETC/INIT diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index ceeb4041..3a30c099 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -6,8 +6,10 @@ K.VER .EQ $5C00 92.0 K.ENV.SIZE .EQ 512 K.PIPE.SIZE .EQ 256 *-------------------------------------- -K.MEM.ALIGN .EQ 64 -K.MEM.nALIGNm1 .EQ $C0 +K.MEM.ALIGN .EQ 16 +K.MEM.nALIGNm1 .EQ $F0 +*K.MEM.ALIGN .EQ 64 +*K.MEM.nALIGNm1 .EQ $C0 *-------------------------------------- K.IRQDEV.MAX .EQ 4 K.DEV.MAX .EQ 28 diff --git a/SBIN/KCONFIG.S.txt b/SBIN/KCONFIG.S.txt index fcc71dae..a1e5eceb 100644 --- a/SBIN/KCONFIG.S.txt +++ b/SBIN/KCONFIG.S.txt @@ -65,12 +65,7 @@ L.MSG.PROMPT .DA MSG.PROMPT CS.INIT clc rts *-------------------------------------- -CS.RUN >LDYA L.FILENAME - >SYSCALL ExpandStr - txa - >STA.G hFileName - - >PUSHBI 0 +CS.RUN >PUSHBI 0 >LDYA L.MSG.TOPBAR >SYSCALL printf @@ -168,9 +163,7 @@ CS.RUN.Loop >SLEEP rts *-------------------------------------- CS.RUN.Load >PUSHEA.G StatBuf - >LDA.G hFileName - >SYSCALL GetMemPtr - + >LDYA L.FILENAME >SYSCALL Stat bcs .99 @@ -193,8 +186,8 @@ CS.RUN.Load >PUSHEA.G StatBuf >PUSHWI A2osX.KCONFIG >PUSHBI S.FI.T.SYS >PUSHBI O.RDONLY - >LDA.G hFileName - >SYSCALL GetMemPtr + + >LDYA L.FILENAME >SYSCALL LoadFile bcs .99 txa @@ -226,9 +219,7 @@ CS.RUN.Load >PUSHEA.G StatBuf CS.RUN.Save >PUSHWI A2osX.KCONFIG >PUSHBI S.FI.T.SYS >PUSHBI O.WRONLY+O.CREATE+O.TRUNC - - >LDA.G hFileName - >SYSCALL GetMemPtr + >LDYA L.FILENAME >SYSCALL FOpen bcs .9 @@ -334,13 +325,8 @@ CS.DOEVENT sec do not discard TIMER event rts *-------------------------------------- CS.QUIT >LDA.G hFileBuf - beq .1 - >SYSCALL FreeMem - -.1 >LDA.G hFileName beq .8 >SYSCALL FreeMem - .8 clc rts *-------------------------------------- @@ -363,7 +349,7 @@ FILENAME .AZ "${ROOT}A2osX.KCONFIG" MSG.TOPBAR .AZ "\e[37;100m\ec\e[7m\e[1;1HA2osX Kernel Config Utility : " MSG.TOPBAR.OK .AZ "KCONFIG File Successfully Loaded. \e[0m" MSG.TOPBAR.KO .AZ "Invalid/missing KCONFIG File. \e[0m" -MSG.STATUSBAR .AZ "\e[37;100m\e[7m\e[24;1HCtrl-Q:Quit,Ctrl-S:Save,Ctrl-T:Time,Ctrl-P:Preemptive,Ctrl-C:CHRoot,1-7:En/Dis \e[0m" +MSG.STATUSBAR .AZ "\e[37;100m\e[7m\e[24;1HSlot 1-7:En/Dis Ctrl:(Q)uit,(S)ave,(T)iming,(P)reemptive,(C)HRoot \e[0m" MSG.KCONF .AZ "\e[93;44m\e[2;1H------ Actual Kernel Configuration ------\r\n" MSG.FCONF .AZ "\e[93;44m\e[13;1H------ KCONFIG File Configuration -------\r\n" MSG.HZ .AZ " Machine Timing : %d0 Hz\r\n" @@ -391,7 +377,6 @@ MSG.QUIT.ERR .AZ "\ecError [$%h] While Writing KCONFIG File.\r\n\r\n" .DUMMY .OR 0 DS.START -hFileName .BS 1 hFileBuf .BS 1 StatBuf .BS S.STAT DS.END .ED diff --git a/SYS/KERNEL.S.BIN.txt b/SYS/KERNEL.S.BIN.txt index 45f5abbf..e0cb1de0 100644 --- a/SYS/KERNEL.S.BIN.txt +++ b/SYS/KERNEL.S.BIN.txt @@ -19,7 +19,7 @@ BIN.R.Offset .BS 2 * out : * A = hMem To loaded LIB *-------------------------------------- -K.LoadLib jsr BIN.FindLIB +K.LoadLib jsr ENV.Search.LIB bcs .9 >LDYAI K.Buf256 jsr BIN.Load Y,A = "/PATH/BIN" @@ -76,7 +76,7 @@ K.UnloadLib pha *\-------------------------------------- K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0" - jsr BIN.FindDRV + jsr ENV.Search.DRV bcs .9 >LDYAI K.Buf256 jsr BIN.Load Y,A = "/PATH/BIN" @@ -115,32 +115,6 @@ K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0" sec K.LoadDrv.RTS rts *-------------------------------------- -BIN.FindLIB ldx #0 - .HS 2C BIT ABS -BIN.FindDRV ldx #2 - .HS 2C BIT ABS -BIN.FindPATH ldx #4 - - >STYA BIN.CmdLine - - >LDYA BIN.Find.ENV,x - - jsr K.GetEnv get value for Search Path - bcs K.LoadDrv.RTS - - >STYA ENV.SearchPath - - >LDYA BIN.CmdLine - - jmp ENV.FileSearch.YA find LIB/DRV in Search -*-------------------------------------- -BIN.Find.ENV .DA .1 - .DA .2 - .DA .3 -.1 .AZ "LIB" -.2 .AZ "DRV" -.3 .AZ "PATH" -*-------------------------------------- * BIN.Load * in : * Y,A = /BIN/PATH (CSTR) diff --git a/SYS/KERNEL.S.ENV.txt b/SYS/KERNEL.S.ENV.txt index 76c339bc..098308f3 100644 --- a/SYS/KERNEL.S.ENV.txt +++ b/SYS/KERNEL.S.ENV.txt @@ -16,7 +16,6 @@ ENV.BufLen .BS 1 ENV.bNoExp .BS 1 ENV.VarLen .BS 1 ENV.VarName .BS 16 -ENV.ZPSIZE .EQ * .ED *-------------------------------------- K.ExpandStr stz .88+1 Reset Intermediate string... @@ -156,8 +155,8 @@ K.FileSearch pha pla Y,A = filename - jsr ENV.FileSearch.YA - bcs .9 + jsr ENV.Search.YA + bcs K.FileSearch.RTS ldx #$ff @@ -172,10 +171,29 @@ K.FileSearch pha .4 sta $ffff,x Self Modified dex bpl .3 -.9 rts +K.FileSearch.RTS + rts +*-------------------------------------- +ENV.Search.LIB ldx #0 + .HS 2C BIT ABS +ENV.Search.DRV ldx #2 + .HS 2C BIT ABS +ENV.Search.PATH ldx #4 -ENV.FileSearch.YA - >STYA .4+1 + sty .1+1 + sta .2+1 + + >LDYA ENV.VARS,x + + jsr K.GetEnv get value for Search Path + bcs K.FileSearch.RTS + + >STYA ENV.SearchPath + +.1 ldy #$ff SELF MODIFIED +.2 lda #$ff SELF MODIFIED + +ENV.Search.YA >STYA .4+1 >LDYA ENV.SearchPath jsr K.ExpandStr Y,A = Search Path, Expand it @@ -712,6 +730,13 @@ ENV.AddAToBuf ldx ENV.BufLen inc ENV.BufLen rts *-------------------------------------- +ENV.VARS .DA .1 + .DA .2 + .DA .3 +.1 .AZ "LIB" +.2 .AZ "DRV" +.3 .AZ "PATH" +*-------------------------------------- MAN SAVE USR/SRC/SYS/KERNEL.S.ENV LOAD USR/SRC/SYS/KERNEL.S diff --git a/SYS/KERNEL.S.JMP.txt b/SYS/KERNEL.S.JMP.txt index 683edb42..3b256360 100644 --- a/SYS/KERNEL.S.JMP.txt +++ b/SYS/KERNEL.S.JMP.txt @@ -422,13 +422,6 @@ K.GUIOSD.JMP sta SETREADAUX sta CLRWRITEAUX rts *-------------------------------------- -K.realpath.I.GO bit RRAMWRAMBNK1 - bit RRAMWRAMBNK1 - jsr K.realpath.I - bit RRAMWRAMBNK2 - bit RRAMWRAMBNK2 - rts -*-------------------------------------- MAN SAVE USR/SRC/SYS/KERNEL.S.JMP LOAD USR/SRC/SYS/KERNEL.S diff --git a/SYS/KERNEL.S.PFT.txt b/SYS/KERNEL.S.PFT.txt index 4a501dc6..bc062299 100644 --- a/SYS/KERNEL.S.PFT.txt +++ b/SYS/KERNEL.S.PFT.txt @@ -22,7 +22,7 @@ K.PFTRemove.RTS rts * Out : *-------------------------------------- PFT.CheckPathYA stx .6+1 Save SYSCALL # - jsr K.realpath.I realpath in K.Buf256 + jsr STDLIB.realpath.I realpath in K.Buf256 bcs K.PFTRemove.RTS ldx #0 diff --git a/SYS/KERNEL.S.PS.txt b/SYS/KERNEL.S.PS.txt index 2c1b981b..dd89d3e7 100644 --- a/SYS/KERNEL.S.PS.txt +++ b/SYS/KERNEL.S.PS.txt @@ -8,6 +8,7 @@ PS.Flags .BS 1 PS.ArgV .BS 2 PS.ArgSize .BS 2 PS.hMem .BS 1 +PS.NewPSPtr .BS 2 .ED */-------------------------------------- * # ExecL @@ -62,16 +63,16 @@ K.ExecL sty .1+1 K.ExecV >STYA PS.ArgV >PULLB PS.Flags -PS.Exec jsr PS.CreateChild A=PID,Child S.PS at ZPPtr3,PS.Load.hMem +PS.Exec jsr PS.CreateChild A=PID,Child S.PS at PS.NewPSPtr,PS.Load.hMem bcs .9 sta .8+1 - stz K.IOBuf + stz K.IOBuf If !=0 after PS.Load, it's a script jsr PS.Load bcs .90 - jsr PS.AddArgV - bcc .8 + jsr PS.AddArgV K.IOBuf= /.../SHELL, K.Buf256=/.../SCRIPT + bcc .8 or K.IOBuf= 0, K.Buf256=/.../BINFILE .90 pha save error code @@ -130,7 +131,7 @@ PS.CreateChild ldx CORE.PSCount jsr K.GetMem0 Blank Everything in this S.PS bcs .99 - >STYA ZPPtr3 + >STYA PS.NewPSPtr stx PS.hMem txa plx @@ -140,7 +141,7 @@ PS.CreateChild ldx CORE.PSCount ldy #S.PS.PID lda CORE.LastPSID - sta (ZPPtr3),y + sta (PS.NewPSPtr),y ldy #S.PS.hPREFIX copy hPREFIX... lda (pPs),y @@ -152,13 +153,13 @@ PS.CreateChild ldx CORE.PSCount txa ldy #S.PS.hPREFIX - sta (ZPPtr3),y + sta (PS.NewPSPtr),y lda #S.PS.F.DUPENV bit PS.Flags need to create ENV ? beq .6 no... - sta (ZPPtr3) Mark this PS with DUPENV flag + sta (PS.NewPSPtr) Mark this PS with DUPENV flag ldy #S.PS.hENV dup hENV from parent PS lda (pPs),y @@ -171,12 +172,12 @@ PS.CreateChild ldx CORE.PSCount .6 ldy #S.PS.hENV reuse hENV from parent PS lda (pPs),y -.8 sta (ZPPtr3),y +.8 sta (PS.NewPSPtr),y ldy #S.PS.hStdIn .81 lda (pPs),y - sta (ZPPtr3),y + sta (PS.NewPSPtr),y iny cpy #S.PS.hStdErr+1 bne .81 @@ -185,7 +186,7 @@ PS.CreateChild ldx CORE.PSCount lda (pPs),y ldy #S.PS.PPID - sta (ZPPtr3),y + sta (PS.NewPSPtr),y lda #S.PS.F.HOLD bit PS.Flags @@ -195,8 +196,8 @@ PS.CreateChild ldx CORE.PSCount sta (pPs) HOLD parent PS .82 lda #S.PS.F.INIT - ora (ZPPtr3) - sta (ZPPtr3) Make this PS Init.... + ora (PS.NewPSPtr) + sta (PS.NewPSPtr) Make this PS Init.... ldy #S.PS.CPID lda CORE.LastPSID @@ -213,27 +214,28 @@ PS.Load ldy #$ff cmp #'/' bne .1 - >LDYA PS.ArgV found /, some path specified, no search - jsr K.realpath.I.GO BANK1 - bcs .99 - >PUSHWI K.S.STAT - >LDYAI K.Buf256 + >LDYA PS.ArgV found /, some path specified, no search >SYSCALL stat BANK 1 - bcc .6 + bcc .6 REAL path in K.Buf256 .99 rts -.2 >DEBUG +.2 >LDYA PS.ArgV + jsr ENV.Search.PATH Get fullpath in K.Buf256 + bcc .6 + + ldy #S.PS.hPREFIX + lda (pPS),y + jsr K.GetMemPtr + >STYA ENV.SearchPath >LDYA PS.ArgV - jsr BIN.FindPATH Get fullpath in K.Buf256 + jsr ENV.Search.YA bcs .99 - + .6 lda K.S.STAT+S.STAT.P.TYPE cmp #S.FI.T.BIN - bne .7 - >LDYAI K.Buf256 - bra PS.LoadBIN + beq PS.LoadBIN .7 cmp #S.FI.T.TXT beq PS.Load.SCRIPT @@ -247,65 +249,72 @@ PS.Load.IPATH lda #E.BADPATH sec PS.Load.RTS rts -PS.Load.SCRIPT jsr PS.LoadGetHeader +PS.Load.SCRIPT ldx #$ff + +.10 inx Save Script name in IOBuf + lda K.Buf256,x + sta K.IOBuf,x + bne .10 + + jsr PS.LoadGetHeader bcs PS.Load.RTS >LDYAI PS.Load.ROOT - jsr K.GetEnv ZPPtr3 Trashed + jsr K.GetEnv bcs PS.Load.IPATH - >STYA .21+1 + >STYA .2+1 ldx #$ff -.2 inx -.21 lda $ffff,x SELF MODIFIED - sta K.IOBuf,x - bne .2 +.1 inx +.2 lda $ffff,x SELF MODIFIED + sta K.Buf256,x K.Buf256 = "/ROOT/" + bne .1 ldy #0 -.3 lda K.IOBuf+128,y +.3 lda K.IOBuf+128,y Check HEADER= "#!/" cmp PS.Load.HEADER,y bne PS.Load.IBIN iny cpy #3 bne .3 -.4 iny +.4 iny inx lda K.IOBuf+128-1,y - sta K.IOBuf-1,x + sta K.Buf256-1,x K.Buf256 = "/ROOT/BIN/SHELL" beq .5 eor #C.CR bne .4 - sta K.IOBuf-1,x + sta K.Buf256-1,x K.Buf256 = "/ROOT/BIN/SHELL\0" .5 >PUSHWI K.S.STAT - >LDYAI K.IOBuf + >LDYAI K.Buf256 >SYSCALL stat BANK 1 bcs PS.Load.RTS - lda PS.hMem Restore ZPPtr3 trashed by GetEnv - jsr K.GetMemPtr - >STYA ZPPtr3 - >LDYAI K.IOBuf + lda K.S.STAT+S.STAT.P.TYPE + cmp #S.FI.T.BIN + bne PS.Load.IBIN K.Buf256= /.../SHELL, K.IOBuf=/.../SCRIPT *-------------------------------------- -PS.LoadBIN jsr BIN.Load +PS.LoadBIN >LDYAI K.Buf256 + jsr BIN.Load bcs .9 >STYA ZPPtr4 save PTR to Code Segment phy ldy #S.PS.ZP.CODE+1 - sta (ZPPtr3),y save pCode HI... + sta (PS.NewPSPtr),y save pCode HI... dey pla - sta (ZPPtr3),y save pCode LO... + sta (PS.NewPSPtr),y save pCode LO... txa ldy #S.PS.hCS - sta (ZPPtr3),y save CS hMem in S.PS + sta (PS.NewPSPtr),y save CS hMem in S.PS * jsr K.GetMemByID * jsr PS.SetMemOwner Set Ownership @@ -315,8 +324,8 @@ PS.LoadBIN jsr BIN.Load beq .1 ldy #S.PS.F update PS S.PS.F - ora (ZPPtr3),y - sta (ZPPtr3),y + ora (PS.NewPSPtr),y + sta (PS.NewPSPtr),y .1 ldy #H.BIN.DS.SIZE+1 lda (ZPPtr4),y Load DS.SIZE HI @@ -335,14 +344,14 @@ PS.LoadBIN jsr BIN.Load phy ldy #S.PS.ZP.DATA+1 - sta (ZPPtr3),y save pData HI... + sta (PS.NewPSPtr),y save pData HI... dey pla - sta (ZPPtr3),y save pData LO... + sta (PS.NewPSPtr),y save pData LO... txa ldy #S.PS.hDS - sta (ZPPtr3),y save DS hMem in S.PS + sta (PS.NewPSPtr),y save DS hMem in S.PS jsr PS.SetMemOwner Set Ownership @@ -350,7 +359,7 @@ PS.LoadBIN jsr BIN.Load lda (ZPPtr4),y Load SS.SIZE ldy #S.PS.ZP.STACK - sta (ZPPtr3),y save pStack LO... + sta (PS.NewPSPtr),y save pStack LO... tay @@ -364,11 +373,11 @@ PS.LoadBIN jsr BIN.Load bcs .9 ldy #S.PS.ZP.STACK+1 - sta (ZPPtr3),y save pStack HI...(LO already set to Stack TOP) + sta (PS.NewPSPtr),y save pStack HI...(LO already set to Stack TOP) txa ldy #S.PS.hSS - sta (ZPPtr3),y save SS hMem in S.PS + sta (PS.NewPSPtr),y save SS hMem in S.PS jsr PS.SetMemOwner Set Ownership @@ -377,7 +386,7 @@ PS.LoadBIN jsr BIN.Load clc adc #8 Add room for 4 saved PTR ldy #S.PS.ZP.SIZE - sta (ZPPtr3),y + sta (PS.NewPSPtr),y clc .9 rts @@ -386,9 +395,9 @@ PS.LoadGetHeader >PUSHWI 0 Aux type >PUSHBI S.FI.T.TXT >PUSHBI O.RDONLY - >LDYA PS.ArgV + >LDYAI K.IOBuf >SYSCALL fopen - bcs PS.LoadGetHeader.RTS + bcs .9 sta .1+1 >PUSHWI 128 @@ -402,8 +411,7 @@ PS.LoadGetHeader >SYSCALL fclose pla plp -PS.LoadGetHeader.RTS - rts +.9 rts *-------------------------------------- PS.Load.ROOT .AZ "ROOT" PS.Load.HEADER .AZ "#!/" @@ -435,23 +443,42 @@ PS.DupEnv jsr K.GetMemPtr clc .9 rts *-------------------------------------- -* hBIN + PS.ArgV -> #S.PS.hARGV +* K.Buf256= /.../SHELL, K.IOBuf=/.../SCRIPT +* - or - +* K.Buf256=/.../BINFILE,K.IOBuf=0 +* Buf256+IOBUF(?)+PS.ArgV[1,...] -> #S.PS.hARGV *-------------------------------------- -PS.AddArgV stz PS.ArgSize - stz PS.ArgSize+1 - - lda K.IOBuf +PS.AddArgV ldy #$ff In both cases, remove ARGV[0] + +.60 iny + lda (PS.ArgV),y + bne .60 + + tya + sec + adc PS.ArgV + sta PS.ArgV + bcc .70 + + inc PS.ArgV+1 Skip old ARGV[0] = scriptename + +.70 >LDYAI K.Buf256 + jsr K.strlen + >STYA PS.ArgSize + + lda K.IOBuf is there a /BIN/SHELL ? beq .10 >LDYAI K.IOBuf jsr K.strlen - iny +1 for \0 - >STYA PS.ArgSize - ldx #0 ARGC-1 - .HS 2C + jsr PS.AddYAp12ArgSize -.10 ldx #$ff ARGC-1 - >LDYA PS.ArgV +.10 ldx #0 For now, 0 args... + lda K.IOBuf + beq .11 +1 for scriptpath + inx + +.11 >LDYA PS.ArgV >STYA ZPPtr1 .1 lda (ZPPtr1) @@ -465,20 +492,15 @@ PS.AddArgV stz PS.ArgSize lda (ZPPtr1),y bne .2 - tya - sec - adc PS.ArgSize - sta PS.ArgSize - bcc .3 - - inc PS.ArgSize+1 +* lda #0 + jsr PS.AddYAp12ArgSize .3 jsr MEM.AddYp1ToPtr1 bra .1 .4 txa ldy #S.PS.ARGC - sta (ZPPtr3),y + sta (PS.NewPSPtr),y >LDYA PS.ArgSize Add 1 for ending 0 iny @@ -491,14 +513,16 @@ PS.AddArgV stz PS.ArgSize >STYA ZPPtr2 Target Buffer txa ldy #S.PS.hARGV - sta (ZPPtr3),y + sta (PS.NewPSPtr),y + >LDYAI K.Buf256 + jsr PS.AddYAToStrV + lda K.IOBuf beq .6 >LDYAI K.IOBuf - >STYA ZPPtr1 - jsr PS.AddPtr1ToStrV + jsr PS.AddYAToStrV .6 >LDYA PS.ArgV >STYA ZPPtr1 @@ -511,6 +535,7 @@ PS.AddPtr1ToStrVUntil0 jsr PS.AddPtr1ToStrV bra .1 *-------------------------------------- +PS.AddYAToStrV >STYA ZPPtr1 PS.AddPtr1ToStrV ldy #$ff @@ -531,9 +556,20 @@ PS.AddPtr1ToStrV PS.AddPtr1ToStrV.8 rts *-------------------------------------- +PS.AddYAp12ArgSize + pha + tya + sec +1 for \0 + adc PS.ArgSize + sta PS.ArgSize + pla + adc PS.ArgSize+1 + sta PS.ArgSize+1 + rts +*-------------------------------------- PS.SetMemOwner lda CORE.LastPSID ldy #S.MEM.OWNERPID - sta (ZPMEMMGR),y + sta (ZPMemMgrSPtr),y rts */-------------------------------------- * # ExecL diff --git a/SYS/KERNEL.S.STDLIB.txt b/SYS/KERNEL.S.STDLIB.txt index bee606a3..6718a215 100644 --- a/SYS/KERNEL.S.STDLIB.txt +++ b/SYS/KERNEL.S.STDLIB.txt @@ -284,11 +284,15 @@ STDLIB.32.Clear ldx #3 *\-------------------------------------- K.realpath sec .HS 90 BCC -K.realpath.I clc - ror .89+1 - - >STYA ZPPtr1 +STDLIB.realpath.I + clc + ror .82+1 + >SYSCALL ExpandStr + bcs STDLIB.32.RTS + >STYA ZPPtr1 + stx .99+1 save expanded buffer hMem + ldx #$ff lda (ZPPtr1) @@ -321,7 +325,7 @@ K.realpath.I clc bne .4 dex - beq .89 we have '/'....nothing to do... + beq .81 we have '/'....nothing to do... lda K.Buf256,x cmp #'/' @@ -333,7 +337,7 @@ K.realpath.I clc .50 ldx #1 lda K.Buf256,x - beq .89 + beq .81 .5 ldy #0 dot counter=0 @@ -367,7 +371,7 @@ K.realpath.I clc bra .80 .9 dey "../" ? - bne .90 ".../" ??!!...mmm...syntax error + bne .99 ".../" ??!!...mmm...syntax error lda K.Buf256-3,x cmp #'/' "/../" ? @@ -378,7 +382,7 @@ K.realpath.I clc dex txa we found "/../" - beq .90 at the beginning of string...cannot remove /dir/.. + beq .99 at the beginning of string...cannot remove /dir/.. jsr K.RealPath.RemoveAtX remove "/.." @@ -394,17 +398,22 @@ K.realpath.I clc lda K.Buf256,x bne .5 *-------------------------------------- -.89 lda #$ff SELF MODIFIED - bpl .98 +.81 jsr .99 + +.82 lda #$ff SELF MODIFIED + bpl .88 >LDYAI K.Buf256 >SYSCALL StrDup BANK 2 rts -.90 lda #E.BADPATH - sec +.88 clc rts -.98 clc +.99 lda #$ff SELF MODIFIED + jsr K.FreeMem + + lda #E.BADPATH + sec rts *-------------------------------------- K.RealPath.RemoveAtX