Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-07-31 17:10:59 +02:00
parent b6155f20db
commit 55e11e5b0e
14 changed files with 221 additions and 279 deletions

Binary file not shown.

View File

@ -107,7 +107,7 @@ CS.QUIT clc
CS.END
MSG.USAGE .AS "Usage : KILL <signal> PID\r\n"
.AS " -0 : No Signal\r\n"
.AZ " -1 : SIGQUIT\r\n"
.AS " -1 : SIGQUIT\r\n"
.AZ " -2 : SIGKILL\r\n"
SSCANF.PID .AZ "%d"
*--------------------------------------

View File

@ -84,7 +84,7 @@ CMD.CD.YA >SYSCALL realpath
bcs CMD.POPD.RTS
>STYA ZPPtr1
stx M32.TMP Save hMem
stx ZPTmpW Save hMem
ldy #1
lda (ZPPtr1),y
@ -96,7 +96,6 @@ CMD.CD.YA >SYSCALL realpath
.12 >PUSHEA.G StatBuf
>LDYA ZPPtr1
>SYSCALL STAT
bcs .19
.10 >LDA.G StatBuf+S.STAT.P.TYPE
@ -106,7 +105,7 @@ CMD.CD.YA >SYSCALL realpath
lda #MLI.E.INVPATH
.19 pha
lda M32.TMP
lda ZPTmpW
>SYSCALL freemem
pla
sec
@ -119,7 +118,7 @@ CMD.CD.YA >SYSCALL realpath
cmp #'/'
bne .14
lda M32.TMP
lda ZPTmpW
jmp CMD.SetPrefixA already ends with a /
.14 iny
@ -129,19 +128,17 @@ CMD.CD.YA >SYSCALL realpath
bcs .19
>STYA ZPPtr2
ldy #$ff
jsr StrCpyPtr1Ptr2
.2 iny
lda (ZPPtr2),y
bne .2
iny
sta (ZPPtr2),y
dey
lda #'/'
sta (ZPPtr2),y
iny
lda #0
sta (ZPPtr2),y
phx
lda M32.TMP
lda ZPTmpW
>SYSCALL freemem
pla
*--------------------------------------
@ -597,12 +594,12 @@ CMD.CALL >LDA.G hFuncList
>SYSCALL SListLookup
bcs CMD.CALL.UNDEF
>STYA M32.TMP KeyID
>STYA ZPTmpW KeyID
>PUSHWZ From Start
>PUSHWI $ffff all
>PUSHWZ Allocate..
>PUSHW M32.TMP KeyID
>PUSHW ZPTmpW KeyID
>LDA.G hFuncList
>SYSCALL SListGetData
bcs CMD.CALL.RTS
@ -756,7 +753,7 @@ CMD.EXIT.POPX lda (pData)
CMD.EXIT.POP0 clc
rts
*--------------------------------------
CMD.BREAK jsr CORE.StkGetCtx Get context in CORE.Test
CMD.BREAK jsr CORE.StkGetCtx Get context in CORE.TestResult
bcs .9
tax
@ -794,7 +791,7 @@ CMD.SWITCH jsr CORE.StkGetCtx
jsr CORE.StkPush Push EXP hVALUE
bcs .9
>LDA.G CORE.Test
lda CORE.TestResult
beq .1
ora #$80
@ -804,7 +801,7 @@ CMD.SWITCH jsr CORE.StkGetCtx
.9 rts
*--------------------------------------
CMD.CASE jsr CORE.StkGetCtx Get context in CORE.Test
CMD.CASE jsr CORE.StkGetCtx Get context in CORE.TestResult
bcs .9
@ -841,13 +838,13 @@ CMD.CASE jsr CORE.StkGetCtx Get context in CORE.Test
ror CS if !=
and #$80
eor #$80
>ORA.G CORE.Test
ora CORE.TestResult
ora #C.CASE
jmp CORE.StkPush
.9 jmp CMD.Exec.CSYN
*--------------------------------------
CMD.DEFAULT jsr CORE.StkGetCtx Get context in CORE.Test
CMD.DEFAULT jsr CORE.StkGetCtx Get context in CORE.TestResult
bcs .9
and #$3F
@ -866,7 +863,7 @@ CMD.DEFAULT jsr CORE.StkGetCtx Get context in CORE.Test
.9 jmp CMD.Exec.CSYN
*--------------------------------------
CMD.END jsr CORE.StkGetCtx Get context in CORE.Test
CMD.END jsr CORE.StkGetCtx Get context in CORE.TestResult
bcs CMD.END.CSYN
and #$3F
@ -923,23 +920,23 @@ CMD.FOR jsr CORE.StkGetCtx
lda (ZPArgVBufPtr)
cmp #'('
beq FOR.FILE
beq CMD.FOR.FILE
cmp #'`'
bne FOR.LIST
bne CMD.FOR.LIST
jmp FOR.EXEC
jmp CMD.FOR.EXEC
.9 rts
*--------------------------------------
FOR.LIST >LDYA ZPArgVBufPtr
CMD.FOR.LIST >LDYA ZPArgVBufPtr
>SYSCALL strdup
bcs .9
bcs FOR.FILE.9
jsr CORE.StkPushYAX Push listPtr,hList
>LDYA ZPVarNamePtr
>SYSCALL strdup
bcs .9
bcs FOR.FILE.9
txa
jsr CORE.StkPush Push hVARNAME
@ -951,21 +948,11 @@ FOR.LIST >LDYA ZPArgVBufPtr
jsr CORE.StkPush
jsr CMD.NEXT.LIST.1
bcs .9
bcs FOR.FILE.9
>ORA.G CORE.Test
ora #C.FOR Push FOR
pha
lda (pData)
tay
pla
sta (pData),y
* clc
.9 rts
jmp CMD.FOR.LOOP
*--------------------------------------
FOR.FILE jsr CORE.ArgV.NextChar skip "("
CMD.FOR.FILE jsr CORE.ArgV.NextChar skip "("
>PUSHWZ Aux type
>PUSHBI S.FI.T.TXT
@ -992,27 +979,19 @@ FOR.FILE jsr CORE.ArgV.NextChar skip "("
jsr CMD.NEXT.LINE
bcs FOR.FILE.9
>ORA.G CORE.Test
ora #C.FOR Push FOR
pha
lda (pData)
tay
pla
sta (pData),y
* clc
bra CMD.FOR.LOOP
FOR.FILE.9 rts
*--------------------------------------
FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
CMD.FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
jsr IO.Pipe.Out
bcs .9
bcs FOR.FILE.9
>PUSHB.G CORE.PSFlags
>LDYA ZPArgVBufPtr
>SYSCALL execl
bcs .9
bcs FOR.FILE.9
>LDA.G IO.hOut
ldy #S.PS.hStdOut
@ -1025,13 +1004,13 @@ FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
>PUSHBI O.RDONLY+O.TEXT
>LEA.G IO.FIFO
>SYSCALL fopen
bcs .9
bcs FOR.FILE.9
jsr CORE.StkPush push hPIPE
>LDYA ZPVarNamePtr
>SYSCALL strdup
bcs .9
bcs FOR.FILE.9
txa
jsr CORE.StkPush Push hVARNAME
@ -1043,9 +1022,9 @@ FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
jsr CORE.StkPush
jsr CMD.NEXT.LINE
bcs .9
bcs FOR.FILE.9
>ORA.G CORE.Test
CMD.FOR.LOOP ora CORE.TestResult
ora #C.FOR Push FOR
pha
lda (pData)
@ -1053,9 +1032,7 @@ FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
pla
sta (pData),y
* clc
.9 rts
rts
*--------------------------------------
CMD.NEXT jsr CORE.StkGet Y = StkPtr
bcs .9
@ -1293,7 +1270,7 @@ CMD.IF jsr CORE.StkGetCtx
jsr EXP.TEST
bcs .9
.3 >LDA.G CORE.IntCmd
.3 lda CORE.IntCmd
cmp #C.WHILE
bne .8
@ -1301,10 +1278,12 @@ CMD.IF jsr CORE.StkGetCtx
jsr CORE.StkPushYA Push BEFORE WHILE/IF
bcs .9
.8 >LDA.G CORE.Test
>ORA.G CORE.IntCmd
jmp CORE.StkPush
.8 lda CORE.TestResult
ora CORE.IntCmd
jsr CORE.StkPush
clc
.9 rts
*--------------------------------------
CMD.LOOP jsr CORE.StkPull

View File

@ -16,12 +16,12 @@ CORE.Quit >LDA.G CORE.hArgVBuf
>SYSCALL FreeMem
CORE.FUNCRESET >LDA.G hFuncList
beq CORE.Quit.9
beq .8
>SYSCALL SListFree
>STZ.G hFuncList
CORE.Quit.9 rts
.8 rts
*--------------------------------------
* http://heirloom.sourceforge.net/sh/sh.1.html
*--------------------------------------
@ -65,7 +65,7 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
lda #$ff
>STA.G CORE.IntCmd assume external
sta CORE.IntCmd assume external
jsr CORE.GetCharNB
bcc .11
@ -125,14 +125,13 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
.41 jsr CORE.SkipCharsA
txa
>STA.G CORE.IntCmd
stx CORE.IntCmd
.42 jsr CORE.StkGet
bcs CORE.Run.7 no particular context, exec...
tax
>LDA.G CORE.IntCmd
lda CORE.IntCmd
bmi .45
and #$3F
@ -202,8 +201,9 @@ CORE.ExecCmd.1 lda #0
>LDYA ZPArgVBuf
>STYA ZPArgVBufPtr
>LDA.G CORE.IntCmd
lda CORE.IntCmd
bmi CORE.ExecExtCmd
asl
tax
jmp (J.CMD,x)
@ -330,16 +330,12 @@ CORE.Lookup >STYA ZPPtr2
clc
.8 rts
.4 inc ZPPtr1
bne .5
inc ZPPtr1+1
.4 jsr IncPtr1
.5 lda (ZPPtr1)
lda (ZPPtr1)
bne .4
inc ZPPtr1
bne .6
inc ZPPtr1+1
jsr IncPtr1
.6 inx
@ -389,12 +385,7 @@ CORE.ArgV.Dup >STYA ZPPtr1
inc
pha
ldy #0
.6 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .6
jsr StrCpyPtr1Ptr2
jsr CORE.ArgV.DupNextY
bra .5
@ -418,38 +409,38 @@ CORE.ArgV.Add >LDYA ZPArgVBufPtr
>STYA ZPArgVBufPrev Save String start of Expand
lda #C.SPACE
sta M32.TMP
sta ZPTmpW
jsr CORE.GetCharNB
bcs .9
cmp #'"'
bne .10
sta M32.TMP
sta ZPTmpW
bra .1
.10 cmp #'('
bne .11
ldx #')'
stx M32.TMP
stx ZPTmpW
bra .12
.11 cmp #'`'
bne .12
sta M32.TMP
sta ZPTmpW
.12 jsr CORE.ArgV.PutChar
.1 jsr CORE.GetNextChar
bcs .5
.2 cmp M32.TMP
.2 cmp ZPTmpW
bne .3
jsr CORE.GetNextChar
bra .5
.3 ldy M32.TMP
.3 ldy ZPTmpW
cpy #C.SPACE
bne .40
jsr CORE.IsEndCmd
@ -682,7 +673,7 @@ CORE.StkGetCtx jsr CORE.StkGet
.1 lda #$40 ...set Parent = true
.2 >STA.G CORE.Test
.2 sta CORE.TestResult
txa
rts

View File

@ -17,8 +17,7 @@ EXP.GET jsr CORE.ArgV.Next
jsr CORE.LookupArgVBuf
bcs .94
txa
>STA.G CORE.Operator
stx CORE.Operator
jsr CORE.ArgV.Next get next argument
beq .94
@ -48,10 +47,8 @@ EXP.GET jsr CORE.ArgV.Next
sec
rts
EXP.FPU.EXEC >LDA.G CORE.Operator
tax
lda EXP.OP.MATH.FPU,x
tax
EXP.FPU.EXEC ldy CORE.Operator
ldx EXP.OP.MATH.FPU,y
jmp A2osX.FpuCall
*--------------------------------------
@ -59,7 +56,7 @@ EXP.TEST lda (ZPArgVBufPtr)
beq .9
lda #$80
>STA.G CORE.TestOp No Op
sta CORE.LogicOp No Op
.10 >LDYA L.EXP.BEGIN
jsr CORE.LookupArgVBuf
@ -71,11 +68,11 @@ EXP.TEST lda (ZPArgVBufPtr)
asl in C
php
>LDA.G CORE.Test get parent
lda CORE.TestResult get parent
asl discard true/false
plp get new
ror set ctx and parent
>STA.G CORE.Test
sta CORE.TestResult
jsr CORE.ArgV.Next
beq .9
@ -85,13 +82,12 @@ EXP.TEST lda (ZPArgVBufPtr)
bcs .1
txa
>STA.G CORE.Operator
stx CORE.Operator
jsr EXP.TEST.UNARY
bcs .9
>EOR.G CORE.Test
eor CORE.TestResult
sta (pData),y
lda (ZPArgVBufPtr)
bra .8 go check ]
@ -106,13 +102,13 @@ EXP.TEST lda (ZPArgVBufPtr)
>LDYA L.EXP.OP.BINARY -eq -ne .... ?
jsr CORE.LookupArgVBuf
bcs .9
txa
>STA.G CORE.Operator
stx CORE.Operator
jsr EXP.TEST.BINARY
bcs .9
>EOR.G CORE.Test
eor CORE.TestResult
sta (pData),y
jsr CORE.ArgV.Next
@ -132,31 +128,31 @@ EXP.TEST lda (ZPArgVBufPtr)
jsr CORE.LookupArgVBuf
bcs .9
txa 0 = AND, 1 = OR
>STA.G CORE.TestOp
stx CORE.LogicOp 0 = AND, 1 = OR
txa
beq .84
>lda.G CORE.Test OR : prev test is true, exit
lda CORE.TestResult OR : prev test is true, exit
bmi .88
bra .85
.84 >lda.G CORE.Test AND : prev test is false, exit
.84 lda CORE.TestResult AND : prev test is false, exit
bpl .88
.85 >LDA.G CORE.Test
>STA.G CORE.TestArg
.85 lda CORE.TestResult
sta CORE.PrevTestResult
jsr CORE.ArgV.Next
beq .9
jmp .10
.80 >LDA.G CORE.TestOp
.80 lda CORE.LogicOp
bne .88 NONE, or OR : exit with last result
>LDA.G CORE.TestArg AND : stop if false
>AND.G CORE.Test
>STA.G CORE.Test
lda CORE.PrevTestResult AND : stop if false
and CORE.TestResult
sta CORE.TestResult
.88 clc
rts
@ -164,7 +160,7 @@ EXP.TEST lda (ZPArgVBufPtr)
EXP.TEST.UNARY jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN we need one arg or ]
>LDA.G CORE.Operator
lda CORE.Operator
asl
tax
jmp (J.EXP.OP.UNARY,x)
@ -230,7 +226,7 @@ EXP.OP.UNARY.Z lda (ZPArgVBufPtr) [ -Z ] ?
beq EXP.OP.UNARY.ESYN
bra EXP.OP.UNARY.DEF.9 FALSE
*--------------------------------------
EXP.TEST.BINARY >LDA.G CORE.Operator
EXP.TEST.BINARY lda CORE.Operator
cmp #6 =, !=, <= <, >=, >
bcs EXP.TEST.BINARY.NUM
@ -299,21 +295,14 @@ EXP.TEST.BINARY.NUM
.5 lda #%001 001 ACC < ARG
EXP.TEST.BINARY.END
pha
>LDA.G CORE.Operator
tax
pla
clc
ldx CORE.Operator
and EXP.OP.BINARY.BITS,x
beq .80
beq .8 false
lda #$80 true
clc
rts
.80 lda #0 false
clc
rts
.8 rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/SH.S.EXP

View File

@ -61,13 +61,9 @@ HIS.Add >LDA.G HIS.hBuf
bra .10 retry....
.2 clc A = ending O offset
adc ZPPTR1
sta ZPPTR1
bcc .3
inc ZPPTR1+1
.3 ldy #$ff
.2 jsr AddAPtr1 A = ending O offset
ldy #$ff
.4 iny
lda (ZPCLBuf),y
@ -126,13 +122,9 @@ HIS.GetNext >LDA.G HIS.hBuf
HIS.SetA jsr HIS.GetA
tya
clc
adc ZPPTR1
sta ZPPTR1
bcc .1
inc ZPPTR1+1
jsr AddAPtr1
.1 jsr CL.CLR
jsr CL.CLR
ldy #$ff

View File

@ -145,12 +145,12 @@ IO.PrintBatchErrMsg
.11 >STYA ZPPtr2
stz M32.TMP Line Count
stz M32.TMP+1
stz ZPTmpW Line Count
stz ZPTmpW+1
.1 inc M32.TMP
.1 inc ZPTmpW
bne .2
inc M32.TMP+1
inc ZPTmpW+1
.2 ldy #$ff
@ -210,7 +210,7 @@ IO.PrintBatchErrMsg
sta (ZPCLBuf),y
bra .7
.8 >PUSHW M32.TMP
.8 >PUSHW ZPTmpW
>PUSHW ZPCLBuf
>PUSHBI 4
>PUSHW L.MSG.BATCHERR
@ -245,11 +245,7 @@ IO.PrintErrMsg pha Save EC for PrintF
bmi .8
lda (ZPPTR1)
sec
adc ZPPTR1
sta ZPPTR1
bcc .3
inc ZPPTR1+1
jsr AddAp1Ptr1
bra .3
.8 >PUSHW ZPPTR1

View File

@ -76,11 +76,17 @@ ZPArgVBufPrev .BS 2
ZPArgVBufPtr .BS 2
ZPVarNamePtr .BS 2
CORE.IntCmd .BS 1
CORE.Operator .BS 1
CORE.LogicOp .BS 1
CORE.TestResult .BS 1
CORE.PrevTestResult .BS 1
M32.ACC .BS 4
M32.TMP .BS 4
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPTmpW .BS 2
ZS.END .ED
*--------------------------------------
@ -531,12 +537,7 @@ RemoveStrFromArgV
.2 jsr AddYp1Ptr1
ldy #$ff
.4 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .4
jsr StrCpyPtr1Ptr2
tya
beq .8
@ -551,11 +552,12 @@ RemoveStrFromArgV
.8 rts
*--------------------------------------
GetPtr1Next lda (ZPPtr1)
beq .8
inc ZPPtr1
bne .8
beq IncPtr1.8
IncPtr1 inc ZPPtr1
bne IncPtr1.8
inc ZPPtr1+1
.8 rts
IncPtr1.8 rts
*--------------------------------------
GetPtr1Len ldy #$ff
@ -565,13 +567,24 @@ GetPtr1Len ldy #$ff
rts
*--------------------------------------
AddYp1Ptr1 tya
sec
AddAp1Ptr1 sec
.HS 90 BCC
AddAPtr1 clc
adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
StrCpyPtr1Ptr2 ldy #$ff
.1 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .1
rts
*--------------------------------------
ToUpperCase cmp #'a'
bcc .8
cmp #'z'+1
@ -602,13 +615,18 @@ MSG.PRINTENV .AZ "%s = %s\r\n"
MSG.PID .AZ "PID=%d\r\n"
FMT.DATE .AZ "%A (%w), %B %d %Y"
FMT.TIME .AZ "%H:%M:%S (%I:%M:%S%p)"
FMT.GETKEY .AZ "%d"
FMT.GETKEY .AZ "%d"
M32.Printf .AZ "%L"
*--------------------------------------
HOME .AZ "${HOME}"
HOME.PROFILE .AZ "${HOME}PROFILE"
PS1 .AZ "${PS1}"
.HS 00 To Make It ArgV
*--------------------------------------
EscChars .AS 'DBAC'
EscChars.Cnt .EQ *-EscChars
EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
*--------------------------------------
IN .AZ "IN"
*--------------------------------------
CMD .AZ ".."
@ -707,11 +725,6 @@ EXP.OP.LOGIC .AZ "AND"
.HS 00
*--------------------------------------
.INB USR/SRC/SHARED/X.ERRORS.S
*--------------------------------------
EscChars .AS 'DBAC'
EscChars.Cnt .EQ *-EscChars
EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
M32.Printf .AZ "%L"
*--------------------------------------
.DUMMY
.OR 0
@ -743,15 +756,9 @@ CL.Ptr .BS 1
CL.Len .BS 1
CL.bReady .BS 1
CORE.IntCmd .BS 1
CORE.hArgVBuf .BS 1
CORE.PSFlags .BS 1
CORE.ArgIndex .BS 1
CORE.Test .BS 1
CORE.TestOp .BS 1
CORE.TestArg .BS 1
CORE.Operator .BS 1
HIS.hBuf .BS 1
HIS.Count .BS 1
@ -761,7 +768,7 @@ IO.hIn .BS 1
IO.hOut .BS 1
IO.hErr .BS 1
*M32.BUF .BS 12 -1234567890\0
*M32.BUF .BS 12 -1234567890\0
M32.BUF .EQ *
IO.FIFO .BS 12 /DEV/FIFOxx\0
*--------------------------------------

View File

@ -124,7 +124,7 @@ CORE.Events jsr CORE.GetEvents
pha
>PUSHWZ Param
>PUSHWZ Param
>PUSHBI IOCTL.CONTROL request
pla

View File

@ -1,24 +1,6 @@
NEW
AUTO 3,1
*--------------------------------------
IO.OPEN.CDEV
IO.OPEN.BDEV jsr K.IOCTL.GetPDrv
ldx #IOCTL.OPEN
lda IO.hDev
jsr K.IOCTL.pDrvJmp
bcs .9
lda IO.hDev
.9 rts
*--------------------------------------
IO.OPEN.DSOCK
*--------------------------------------
IO.OPEN.SSOCK lda IO.hFD
clc
rts
*--------------------------------------
IO.CLOSE.REG
IO.CLOSE.DIR ldy #S.FD.REG.REF
lda (pFD),y
@ -35,47 +17,6 @@ IO.CLOSE.DIR ldy #S.FD.REG.REF
.2 lda IO.hFD
jmp K.FreeMem
*--------------------------------------
IO.CLOSE.CDEV
IO.CLOSE.BDEV
clc
rts
*--------------------------------------
IO.CLOSE.DSOCK
IO.CLOSE.SSOCK
ldy #S.FD.SSOCK.CLOSE
lda (pFD),y
tax Function Offset in LIB
ldy #S.FD.SSOCK.IOHANDLER
lda (pFD),y
jsr K.GetMemPtr
>STYA .1+1
lda IO.hFD
.1 jmp $FFFF SELF MODIFIED
*--------------------------------------
IO.CLOSE.NOD ldx #2
lda IO.hFD
.1 cmp Nod.Table.hFD-2,x
bne .2
stz Nod.Table.hFD-2,x
lda Nod.Table.hPath-2,x
stz Nod.Table.hPath-2,x
jmp K.FreeMem
.2 inx
cpx #K.Nod.MAX+2
bne .1
lda #E.INVH
* sec
rts
*--------------------------------------
IO.READ.REG ldx #MLIREAD
.HS 2C BIT ABS
*--------------------------------------
@ -93,6 +34,23 @@ IO.WRITE.REG ldx #MLIWRITE
>LDYA K.MLI.PARAMS+6
.9 rts
*--------------------------------------
IO.OPEN.CDEV
IO.OPEN.BDEV jsr K.IOCTL.GetPDrv
ldx #IOCTL.OPEN
lda IO.hDev
jsr K.IOCTL.pDrvJmp
bcs .9
lda IO.hDev
.9 rts
*--------------------------------------
IO.CLOSE.CDEV
IO.CLOSE.BDEV
clc
rts
*--------------------------------------
IO.READ.CDEV ldx #IOCTL.READ
.HS 2C BIT ABS
*--------------------------------------
@ -110,11 +68,15 @@ IO.WRITE.CDEV ldx #IOCTL.WRITE
.9 rts
*--------------------------------------
IO.WRITE.SSOCK ldy #S.FD.SSOCK.WRITE
.HS 2C BIT ABS
IO.OPEN.DSOCK
*--------------------------------------
IO.READ.SSOCK ldy #S.FD.SSOCK.READ
IO.OPEN.SSOCK lda IO.hFD
clc
rts
*--------------------------------------
IO.CLOSE.DSOCK
IO.CLOSE.SSOCK
ldy #S.FD.SSOCK.CLOSE
lda (pFD),y
tax Function Offset in LIB
@ -127,6 +89,22 @@ IO.READ.SSOCK ldy #S.FD.SSOCK.READ
.1 jmp $FFFF SELF MODIFIED
*--------------------------------------
IO.READ.SSOCK ldy #S.FD.SSOCK.READ
.HS 2C BIT ABS
*--------------------------------------
IO.WRITE.SSOCK ldy #S.FD.SSOCK.WRITE
lda (pFD),y
tax Function Offset in LIB
ldy #S.FD.SSOCK.IOHANDLER
lda (pFD),y
jsr K.GetMemPtr
>STYA .1+1
lda IO.hFD
.1 jmp $FFFF SELF MODIFIED
*/--------------------------------------
* # IOCTL
* ## C
@ -166,19 +144,6 @@ K.IOCTL.GetPDrv ldy #S.FD.DEV.DRVPTR
lda (pFD),y
sta pDRV+1
rts
*--------------------------------------
IO.EOF lda (pFD)
tax
jmp (.1,x)
.1 .DA IO.EOF.REG
.DA STDIO.IOERR DIR
.DA IO.EOF.CDEV
.DA STDIO.IOERR BDEV
.DA STDIO.IOERR LNK
.DA STDIO.IOERR DSOCK
.DA IO.EOF.SSOCK
.DA IO.EOF.PIPE
*--------------------------------------
IO.EOF.REG >MLICALL MLIGETMARK
bcs IO.EOF.REG.RTS
@ -226,11 +191,6 @@ IO.EOF.FALSE lda #0
* clc
rts
*--------------------------------------
IO.GetPFD sta IO.hFD
jsr K.GetMemPtr
>STYA pFD
rts
*--------------------------------------
* X = 0 > REG
* X = 1 > DIR
* X = 2 > PIPE
@ -293,6 +253,27 @@ IO.MLI.OPEN >LDYAI 1024 get a ProDOS IOBUF
* clc
.9 rts
*--------------------------------------
IO.CLOSE.NOD ldx #2
lda IO.hFD
.1 cmp Nod.Table.hFD-2,x
bne .2
stz Nod.Table.hFD-2,x
lda Nod.Table.hPath-2,x
stz Nod.Table.hPath-2,x
jmp K.FreeMem
.2 inx
cpx #K.Nod.MAX+2
bne .1
lda #E.INVH
* sec
rts
*--------------------------------------
IO.DEV.FIFO .AS "/DEV/FIFO"
*--------------------------------------
MAN

View File

@ -100,7 +100,7 @@ MEM.GetMem.YAX stx MEM.ReqFlags
.4 cpx Mem.LastSlot any other slot to check?
bne .1 last one, create a new slot
lda MEM.BestSlot
beq .5

View File

@ -385,16 +385,15 @@ PS.LoadBIN jsr BIN.Load K.Buf256= "${ROOT}BIN/SHELL\0", K.IOBuf=/.../SCRIPT
lda (ZPPtr4),y Load SS.SIZE
ldy #S.PS.ZP.STACK
sta (PS.NewPSPtr),y save pStack LO...
sta (PS.NewPSPtr),y save pStack LO...
tay
beq .3 SS.SIZE.LO=0, set as default $100
lda #1 SS.SIZE.HI
lda #$ff SS.SIZE.HI
.HS 2C bit abs
.3 lda #1
.3 inc
ldx #S.MEM.F.ALIGN+S.MEM.F.STACK
jsr MEM.GetMem.YAX
@ -410,16 +409,8 @@ PS.LoadBIN jsr BIN.Load K.Buf256= "${ROOT}BIN/SHELL\0", K.IOBuf=/.../SCRIPT
ldy #S.PS.hSS
sta (PS.NewPSPtr),y save SS hMem in S.PS
jsr Mem.SetOwner Set Ownership
jmp Mem.SetOwner Set Ownership
* ldy #H.BIN.ZP.SIZE
* lda (ZPPtr4),y
* clc
* adc #10 Add room for 5 saved PTR
* ldy #S.PS.ZP.SIZE
* sta (PS.NewPSPtr),y
* clc
.9 rts
*--------------------------------------
PS.LoadGetHeader

View File

@ -1199,7 +1199,18 @@ K.FSeek.RTS
K.FEOF jsr PFT.CheckNodeA
bcs K.FSeek.RTS
jmp IO.EOF
IO.EOF lda (pFD)
tax
jmp (.1,x)
.1 .DA IO.EOF.REG
.DA STDIO.IOERR DIR
.DA IO.EOF.CDEV
.DA STDIO.IOERR BDEV
.DA STDIO.IOERR LNK
.DA STDIO.IOERR DSOCK
.DA IO.EOF.SSOCK
.DA IO.EOF.PIPE
*/--------------------------------------
* # FTell
* Return the current value of the file-position indicator

View File

@ -66,7 +66,7 @@ UNISTD.Open ldx #5 /DEV/
bne .2
lda Nod.Table.hFD-2,x return hFD
jsr IO.GetPFD
jsr UNISTD.GetPFD
bra .71
@ -168,7 +168,7 @@ IO.OPEN.ERR pha Save Error Code
* `lda fd`
* `>SYSCALL close`
*\--------------------------------------
K.Close jsr IO.GetPFD
K.Close jsr UNISTD.GetPFD
UNISTD.Close lda (pFD) #S.FD.T
tax
@ -196,7 +196,7 @@ UNISTD.Close lda (pFD) #S.FD.T
* CC: Y,A = bytes read
* CS: A = EC
*\--------------------------------------
K.Read jsr IO.GetPFD
K.Read jsr UNISTD.GetPFD
UNISTD.Read lda (pFD) #S.FD.T
tax
@ -224,7 +224,7 @@ UNISTD.Read lda (pFD) #S.FD.T
* CC: Y,A = bytes written
* CS: A = EC
*\--------------------------------------
K.Write jsr IO.GetPFD
K.Write jsr UNISTD.GetPFD
UNISTD.Write lda (pFD) #S.FD.T
tax
@ -239,6 +239,11 @@ UNISTD.Write lda (pFD) #S.FD.T
.DA IO.WRITE.SSOCK
.DA IO.WRITE.PIPE
*--------------------------------------
UNISTD.GetPFD sta IO.hFD
jsr K.GetMemPtr
>STYA pFD
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.UNISTD
LOAD USR/SRC/SYS/KERNEL.S