ACOS: new string functions, KERNEL & SBIN: some memleak fixed, CIFS : fixed some malformed FRAMES

This commit is contained in:
burniouf 2021-07-13 18:52:04 +02:00
parent cb628265b7
commit 3c55ead88e
20 changed files with 399 additions and 196 deletions

View File

@ -841,7 +841,7 @@ Print A (char) to hFILE
`>PUSHB character` `>PUSHB character`
`>SYSCALL fputc` `>SYSCALL fputc`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# putchar (BLOCKING) # putchar (BLOCKING)
@ -855,7 +855,7 @@ Print A (char) to StdOut
`lda character` `lda character`
`>SYSCALL putchar` `>SYSCALL putchar`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# puts (BLOCKING) # puts (BLOCKING)
@ -869,7 +869,7 @@ Write Str to StdOut, appends '\r\n'
`>LDYAI str` `>LDYAI str`
`>SYSCALL PutS` `>SYSCALL PutS`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# fputs (BLOCKING) # fputs (BLOCKING)
@ -884,7 +884,7 @@ Write Str to hFILE
`>PUSHW str` `>PUSHW str`
`>SYSCALL fputs` `>SYSCALL fputs`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# fgets (BLOCKING) # fgets (BLOCKING)
@ -903,8 +903,8 @@ string is then terminated with a null byte.
`>PUSHW n` `>PUSHW n`
`>SYSCALL fgets` `>SYSCALL fgets`
## RETURN VALUE ## RETURN VALUE
Y,A: s Y,A: s
CC = success CC = success
# getchar (BLOCKING) # getchar (BLOCKING)
@ -917,7 +917,7 @@ Get char from StdIn
**In:** **In:**
`>SYSCALL getchar` `>SYSCALL getchar`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
A = char A = char
@ -932,7 +932,7 @@ Get char from Node
`lda stream` `lda stream`
`>SYSCALL getc` `>SYSCALL getc`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
A = char A = char
@ -947,7 +947,7 @@ push byte back into input stream
`>PUSHB stream` `>PUSHB stream`
`>SYSCALL ungetc` `>SYSCALL ungetc`
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
A = char A = char
@ -979,7 +979,7 @@ TODO: replace flags/ftype/auxtype with mode="w+,t=TYP,x=AUXTYPE"
+ ,t=123 or t=$ff or t=TXT + ,t=123 or t=$ff or t=TXT
+ ,x=12345 or x=$ffff + ,x=12345 or x=$ffff
## RETURN VALUE ## RETURN VALUE
CC : A = hFILE CC : A = hFILE
CS : A = EC CS : A = EC
@ -1063,7 +1063,7 @@ Test the end-of-file indicator for hFILE
`>SYSCALL feof` `>SYSCALL feof`
## RETURN VALUE ## RETURN VALUE
CC : CC :
A = $ff EOF A = $ff EOF
A = 0 NOT EOF A = 0 NOT EOF
CS : CS :
@ -1123,20 +1123,20 @@ Prints C-Style String
## ASM ## ASM
**In:** **In:**
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes) PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
`>PUSHW format` `>PUSHW format`
`>PUSHW i` `>PUSHW i`
`...` `...`
`>PUSHBI 2` #bytecount `>PUSHBI 2` #bytecount
`>SYSCALL PrintF` `>SYSCALL PrintF`
FPrintF : FPrintF :
`>PUSHB hFILE` `>PUSHB hFILE`
`>PUSHW format` `>PUSHW format`
`>PUSHW i` `>PUSHW i`
`...` `...`
`>PUSHBI 2` #bytecount `>PUSHBI 2` #bytecount
`>SYSCALL fprintf` `>SYSCALL fprintf`
SPrintF : SPrintF :
`>PUSHW str` `>PUSHW str`
`>PUSHW format` `>PUSHW format`
`>PUSHW i` `>PUSHW i`
@ -1148,7 +1148,7 @@ SPrintF :
CC : success, Y,A = bytes sent CC : success, Y,A = bytes sent
CS : error, A = code from Output CS : error, A = code from Output
Specifiers : Specifiers :
+ %b : pull 1 byte to Print BIN + %b : pull 1 byte to Print BIN
+ %d : pull 1 byte unsigned DEC 0..255 + %d : pull 1 byte unsigned DEC 0..255
+ %D : pull 2 bytes unsigned DEC 0..65535 + %D : pull 2 bytes unsigned DEC 0..65535
+ %u : pull 4 bytes long unsigned DEC 0..4294967295 + %u : pull 4 bytes long unsigned DEC 0..4294967295
@ -1172,11 +1172,11 @@ Specifiers :
+ \\\\ : Print \ + \\\\ : Print \
+ \\% : Print % + \\% : Print %
Modifiers for len and padding : Modifiers for len and padding :
+ %d : '9' '12' + %d : '9' '12'
+ %2d : ' 9' '12' + %2d : ' 9' '12'
+ %02d : '09' '12' + %02d : '09' '12'
+ %11s : 'ABCDEFGH ' + %11s : 'ABCDEFGH '
+ %011s : 'ABCDEFGH000' + %011s : 'ABCDEFGH000'
+ %2f : '3.14' + %2f : '3.14'

Binary file not shown.

Binary file not shown.

View File

@ -41,18 +41,18 @@ CODE.LDYXI lda #$A0 LDY #imm
jsr CODE.EmitByte jsr CODE.EmitByte
tya tya
jsr CODE.EmitByte jsr CODE.EmitByte
*--------------------------------------
lda #$A2 LDX #imm CODE.LDXI lda #$A2 LDX #imm
jsr CODE.EmitByte jsr CODE.EmitByte
txa txa
jmp CODE.EmitByte bra CODE.EmitByte
*-------------------------------------- *--------------------------------------
CODE.JSRRT lda #$20 JSR CODE.JSRRT lda #$20 JSR
jsr CODE.EmitByte jsr CODE.EmitByte
lda J.RT,x lda J.RT,x
jsr CODE.EmitByte jsr CODE.EmitByte
lda J.RT+1,x lda J.RT+1,x
jmp CODE.EmitByte bra CODE.EmitByte
*-------------------------------------- *--------------------------------------
CODE.FPUCALL lda #$A2 LDX #imm CODE.FPUCALL lda #$A2 LDX #imm
jsr CODE.EmitByte jsr CODE.EmitByte
@ -65,10 +65,6 @@ CODE.FPUCALL lda #$A2 LDX #imm
lda /A2osX.FPUCALL lda /A2osX.FPUCALL
bra CODE.EmitByte bra CODE.EmitByte
*-------------------------------------- *--------------------------------------
CODE.FPRINTCRLF ldx #C.CR
jsr CODE.PutChar
ldx #C.LF
*--------------------------------------
CODE.PutChar lda #$A9 LDA #imm CODE.PutChar lda #$A9 LDA #imm
jsr CODE.EmitByte jsr CODE.EmitByte
txa txa

View File

@ -715,6 +715,9 @@ CORE.IsEndExp cmp #')' CS = true
cmp #';' cmp #';'
beq CORE.ToUpperCase.RTS beq CORE.ToUpperCase.RTS
cmp #'\'
beq CORE.ToUpperCase.RTS
CORE.IsEndInst cmp #':' CS = true CORE.IsEndInst cmp #':' CS = true
beq .8 beq .8

View File

@ -34,7 +34,14 @@ FN.KEY
sec sec
rts rts
*-------------------------------------- *--------------------------------------
FN.LEFTd jsr CORE.CheckOP FN.LEFTd ldx #RT.LEFTd.ID
bra FN.RIGHTd.1
FN.RIGHTd ldx #RT.RIGHTd.ID
FN.RIGHTd.1 phx
jsr CORE.CheckOP
bcs .99 bcs .99
jsr EXP.Eval jsr EXP.Eval
@ -55,7 +62,7 @@ FN.LEFTd jsr CORE.CheckOP
jsr CORE.CheckCP jsr CORE.CheckCP
bcs .99 bcs .99
ldx #RT.LEFTd.ID plx
jsr CODE.JSRRT jsr CODE.JSRRT
lda #'$' lda #'$'
@ -66,7 +73,9 @@ FN.LEFTd jsr CORE.CheckOP
.90 lda #E.TMISMATCH .90 lda #E.TMISMATCH
sec sec
.99 rts
.99 plx
rts
*-------------------------------------- *--------------------------------------
FN.LEN jsr CORE.CheckOP FN.LEN jsr CORE.CheckOP
bcs .99 bcs .99
@ -90,11 +99,58 @@ FN.LEN jsr CORE.CheckOP
sec sec
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
FN.MIDd FN.MIDd jsr CORE.CheckOP
bcs .99
jsr EXP.Eval str
bcs .99
lda EXP.TYPE
beq .90
jsr CORE.CheckComma
bcs .99
jsr EXP.Eval start
bcs .99
lda EXP.TYPE
bne .90
jsr CORE.CheckComma
bcc .1
ldy #255
ldx #255
jsr CODE.PUSHYXI
bra .2
.1 jsr EXP.Eval len
bcs .99
lda EXP.TYPE
bne .90
.2 jsr CORE.CheckCP
bcs .99
ldx #RT.MIDd.ID
jsr CODE.JSRRT
lda #'$'
sta EXP.TYPE
clc
rts
.90 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
FN.PDL FN.PDL
FN.PEEK FN.PEEK
FN.RANDOM FN.RANDOM
FN.RIGHTd
FN.RNDd FN.RNDd
lda #E.CSYN lda #E.CSYN
sec sec

View File

@ -72,10 +72,12 @@ KW.GOTO1 jsr CODE.EmitByte
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
KW.HOME KW.HOME ldx #8 CLRSCR
lda #E.CSYN jsr CODE.LDXI
sec
rts ldx #RT.OUTX.ID
clc
jmp CODE.JSRRT
*-------------------------------------- *--------------------------------------
* IP exp THEN st1 ELSE st2 * IP exp THEN st1 ELSE st2
*-------------------------------------- *--------------------------------------
@ -203,10 +205,21 @@ KW.INFO
sec sec
rts rts
*-------------------------------------- *--------------------------------------
KW.INPUT jsr CORE.GetNextCharNB KW.INPUT stz hIn Defaut to Keyboard
bcs .9
jsr CORE.CreateOrGetVar jsr CORE.GetNextCharNB
bcs .9
cmp #'"'
bne .5
jsr EXP.CreateStrConst
bcs .99
ldx #RT.StrOut.ID
jsr CODE.JSRRT
.5 jsr CORE.CreateOrGetVar
bcs .99 bcs .99
ldx #RT.INPUT.ID ldx #RT.INPUT.ID
@ -253,18 +266,20 @@ KW.POSITION
sec sec
rts rts
*-------------------------------------- *--------------------------------------
KW.PRINT stz hOut reset to hStdOut KW.PRINT stz ZPPtr2 put ending CR
stz hOut Default to screen
stz ZPPtr2 put ending CR
ldy #S.PS.hStdOut
lda (pPS),y
sta hOut Default to screen
.10 jsr CORE.GetNextCharNB .10 jsr CORE.GetNextCharNB
bcs .8 bcs .8
.11 jsr CORE.IsEndInst .11 cmp #'\'
bne .13
.12 ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
bra .10
.13 jsr CORE.IsEndInst
bcs .8 bcs .8
jsr CORE.IsKW jsr CORE.IsKW
@ -287,7 +302,10 @@ KW.PRINT stz hOut reset to hStdOut
jsr CORE.GetCharNB jsr CORE.GetCharNB
bcs .8 bcs .8
.70 jsr CORE.IsEndInst .70 cmp #'\'
beq .12
jsr CORE.IsEndInst
bcs .8 bcs .8
jsr CORE.IsKW jsr CORE.IsKW
@ -313,7 +331,8 @@ KW.PRINT stz hOut reset to hStdOut
.8 bit ZPPtr2 .8 bit ZPPtr2
bmi .80 bmi .80
jsr CODE.FPRINTCRLF ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
.80 clc .80 clc
rts rts

View File

@ -51,7 +51,8 @@ RT.StrOut ldy #S.PS.hStdOut
>PUSHA >PUSHA
lda (pStack),y lda (pStack),y
>PUSHA >PUSHA
>SYSCALL fputs >PUSHBI 0
>SYSCALL fprintf
inc pStack inc pStack
inc pStack inc pStack
rts rts
@ -115,6 +116,9 @@ RT.INPUT lda #0
stz ZPPtr1 stz ZPPtr1
ldx #0 OUT.ELW
jsr RT.OUTX
.1 >SYSCALL GetChar .1 >SYSCALL GetChar
bcs RT.INPUT.9 bcs RT.INPUT.9
@ -124,44 +128,80 @@ RT.INPUT lda #0
bcs .7 bcs .7
cmp #C.CR cmp #C.CR
beq RT.INPUT.8 bne .2
cmp #C.BS lda #0
sta (ZPStrBuf),y
ldx #4 OUT.CRLF
jsr RT.OUTX
bra RT.INPUT.8
.2 cmp #C.BS
bne .1 bne .1
cpy #0 cpy #0
beq .1 beq .1
>SYSCALL PutChar ldx 6 OUT.BSSPBS
lda #C.SPACE jsr RT.OUTX
>SYSCALL PutChar
lda #C.BS
>SYSCALL PutChar
dec ZPPtr1 dec ZPPtr1
bra .1 bra .1
.7 sta (ZPStrBuf),y .7 cpy #255
bcs .1
sta (ZPStrBuf),y
>SYSCALL PutChar >SYSCALL PutChar
inc ZPPtr1 inc ZPPtr1
bne .1 bra .1
RT.INPUT.8 lda #0 RT.INPUT.8 ldx #2 OUT.DLW
sta (ZPStrBuf),y jsr RT.OUTX
>PUSHW ZPStrBuf >PUSHW ZPStrBuf
clc clc
RT.INPUT.9 rts RT.INPUT.9 rts
*-------------------------------------- *--------------------------------------
RT.LEFTd >PULLW ZPPtr2 cnt RT.LEFTd >PULLB ZPPtr2 cnt
lda (pStack) inc pStack
sta ZPPtr1 >PULLW ZPPtr1 src str
ldy #1
lda (pStack),y
sta ZPPtr1+1
ldy #0 ldy #0
.1 lda (ZPPtr1),y
sta (ZPStrBuf),y
beq .8
iny
cpy ZPPtr2
bne .1
lda #0
sta (ZPStrBuf),y
.8 >PUSHW ZPStrBuf
clc
rts
*--------------------------------------
RT.LEN >PULLYA str
>SYSCALL strlen
>PUSHYA
rts
*--------------------------------------
RT.MIDd >PULLA len
tax
inc pStack
>PULLB ZPPtr2 start
inc pStack
>PULLW ZPPtr1 src str
ldy #0
.1 lda (ZPPtr1),y .1 lda (ZPPtr1),y
beq .8 beq .8
@ -169,16 +209,69 @@ RT.LEFTd >PULLW ZPPtr2 cnt
cpy ZPPtr2 cpy ZPPtr2
bne .1 bne .1
lda #0 tya
sta (ZPPtr1),y clc
adc ZPPtr1
sta ZPPtr1
bcc .2
.8 rts inc ZPPtr1+1
*--------------------------------------
RT.LEN >PULLYA str .2 ldy #0
>SYSCALL strlen
>PUSHYA .3 txa
beq .8
lda (ZPPtr1),y
sta (ZPStrBuf),y
beq .80
iny
dex
bne .3
txa
.8 sta (ZPStrBuf),y
.80 >PUSHW ZPStrBuf
clc
rts rts
*-------------------------------------- *--------------------------------------
RT.RIGHTd >PULLB ZPPtr2 cnt
inc pStack
>PULLW ZPPtr1 src str
ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
tya
sec
sbc ZPPtr2
bcc .8
beq .8
clc
adc ZPPtr1
sta ZPPtr1
bcc .2
inc ZPPtr1+1
.2 ldy #$ff
.3 iny
lda (ZPPtr1),y
sta (ZPStrBuf),y
bne .3
.8 >PUSHW ZPStrBuf
clc
rts
*--------------------------------------
RT.STRd >PULLYA int RT.STRd >PULLYA int
pha pha
>PUSHW ZPStrBuf >PUSHW ZPStrBuf
@ -195,6 +288,14 @@ RT.VAL >PULLYA str
>PUSHYA >PUSHYA
rts rts
*-------------------------------------- *--------------------------------------
RT.OUTCRLF ldx #4 CRLF
RT.OUTX ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW L.OUT,x
>SYSCALL FPutS
rts
*--------------------------------------
MAN MAN
SAVE usr/src/bin/acos.s.rt SAVE usr/src/bin/acos.s.rt
LOAD usr/src/bin/acos.s LOAD usr/src/bin/acos.s

View File

@ -76,7 +76,6 @@ CS.START cld
*-------------------------------------- *--------------------------------------
L.MSG.GREETINGS .DA MSG.GREETINGS L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.USAGE .DA MSG.USAGE L.MSG.USAGE .DA MSG.USAGE
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.COMPILING .DA MSG.COMPILING L.MSG.COMPILING .DA MSG.COMPILING
L.MSG.DEBUG .DA MSG.DEBUG L.MSG.DEBUG .DA MSG.DEBUG
L.MSG.TRACE .DA MSG.TRACE L.MSG.TRACE .DA MSG.TRACE
@ -86,6 +85,11 @@ L.MSG.FWREFERR .DA MSG.FWREFERR
L.MSG.RUN .DA MSG.RUN L.MSG.RUN .DA MSG.RUN
L.MSG.STR .DA MSG.STR L.MSG.STR .DA MSG.STR
L.MSG.INT16 .DA MSG.INT16 L.MSG.INT16 .DA MSG.INT16
L.OUT .DA OUT.ELW
.DA OUT.DLW
.DA OUT.CRLF
.DA OUT.BSSPBS
.DA OUT.CLRSCR
L.FMT.DATE .DA FMT.DATE L.FMT.DATE .DA FMT.DATE
L.FMT.TIME .DA FMT.TIME L.FMT.TIME .DA FMT.TIME
*-------------------------------------- *--------------------------------------
@ -186,6 +190,10 @@ RT.LEFTd.ID .EQ *-J.RT
.DA RT.LEFTd .DA RT.LEFTd
RT.LEN.ID .EQ *-J.RT RT.LEN.ID .EQ *-J.RT
.DA RT.LEN .DA RT.LEN
RT.MIDd.ID .EQ *-J.RT
.DA RT.MIDd
RT.RIGHTd.ID .EQ *-J.RT
.DA RT.RIGHTd
RT.STRd.ID .EQ *-J.RT RT.STRd.ID .EQ *-J.RT
.DA RT.STRd .DA RT.STRd
RT.TIMEd.ID .EQ *-J.RT RT.TIMEd.ID .EQ *-J.RT
@ -207,6 +215,10 @@ RT.IntGet.ID .EQ *-J.RT
.DA RT.IntGet .DA RT.IntGet
RT.IntOut.ID .EQ *-J.RT RT.IntOut.ID .EQ *-J.RT
.DA RT.IntOut .DA RT.IntOut
RT.OUTCRLF.ID .EQ *-J.RT
.DA RT.OUTCRLF
RT.OUTX.ID .EQ *-J.RT
.DA RT.OUTX
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
* Called once at process creation * Called once at process creation
@ -482,7 +494,8 @@ MSG.GREETINGS .AZ "\r\nACOS-Shell %d.%d\r\n\r\n"
MSG.USAGE .AS "Usage : ACOS <option> file\r\n" MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
.AS " -D : Debug Mode\r\n" .AS " -D : Debug Mode\r\n"
.AS " -T : Trace On" .AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n" .AZ "\r\n"
*--------------------------------------
MSG.COMPILING .AZ "***Compiling : %s...\r\n" MSG.COMPILING .AZ "***Compiling : %s...\r\n"
MSG.DEBUG .AZ "***CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n" MSG.DEBUG .AZ "***CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
MSG.TRACE .AZ "%05D>%s\r\n" MSG.TRACE .AZ "%05D>%s\r\n"
@ -493,6 +506,19 @@ MSG.RUN .AZ "***Code size: %D, Data Size: %D, Running...\r\n"
MSG.STR .AZ "%s" MSG.STR .AZ "%s"
MSG.INT16 .AZ "%I" MSG.INT16 .AZ "%I"
*-------------------------------------- *--------------------------------------
OUT.ELW .DA #C.ESC
.AZ "[?7h" Enable Line Wrap
OUT.DLW .DA #C.ESC
.AZ "[?7l" Disable Line Wrap
OUT.CRLF .DA #C.CR,#C.LF,#0
OUT.BSSPBS .DA #C.BS,#C.SPACE,#C.BS,#0
OUT.CLRSCR .DA #C.ESC
.AS "c"
.DA #C.ESC
.AS "(B"
.DA #C.ESC
.AZ ")0"
*--------------------------------------
FMT.DATE .AZ "%d/%m/%Y" FMT.DATE .AZ "%d/%m/%Y"
FMT.TIME .AZ "%H:%M:%S" FMT.TIME .AZ "%H:%M:%S"
*-------------------------------------- *--------------------------------------

View File

@ -129,6 +129,7 @@ CIFS.OpenDir >STYA pPath resolved path
bcs .9 bcs .9
>STYA ZPPtr2 >STYA ZPPtr2
stx hFD
lda #S.FD.T.DIR lda #S.FD.T.DIR
sta (ZPPtr2) sta (ZPPtr2)
@ -147,9 +148,12 @@ CIFS.OpenDir >STYA pPath resolved path
>PUSHW pPath >PUSHW pPath
>PUSHWI 0 >PUSHWI 0
txa >PUSHB hFD
>PUSHA
>SYSCALL2 mknod >SYSCALL2 mknod
bcc .9
jsr CIFS.FreeFD
sec
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -292,7 +296,8 @@ CIFS2.ReadDir jsr GetPFD
.9 jmp Exit.NODATA .9 jmp Exit.NODATA
.99 jmp Exit.KO .99 stz CIFS.Status
jmp FreeRespData
*-------------------------------------- *--------------------------------------
CIFS2.ReadDir.GetBuf CIFS2.ReadDir.GetBuf
ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H Search Count ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H Search Count
@ -472,6 +477,7 @@ CIFS2.ReadDir.FillBuf
rts rts
*-------------------------------------- *--------------------------------------
CIFS.CloseReg
CIFS.CloseDir tax CIFS.CloseDir tax
lda Nod.Table.hName-2,x lda Nod.Table.hName-2,x
@ -531,7 +537,9 @@ CIFS.FOpen >STYA pPath resolved path
jsr AppendTypePtr2 jsr AppendTypePtr2
.2 tya .2 jsr AddYReqLen
tya
ldy #S.NETBIOS+S.SMB.H+6 NameLength ldy #S.NETBIOS+S.SMB.H+6 NameLength
sta (ZPReqPtr),y sta (ZPReqPtr),y
@ -539,10 +547,6 @@ CIFS.FOpen >STYA pPath resolved path
inc +1 for \0 inc +1 for \0
jsr Add2ByteCount jsr Add2ByteCount
jsr AddYReqLenPtr2
jsr SetReqLen
ldx #1 FILE_OPEN ldx #1 FILE_OPEN
ldy #3 fopen flags ldy #3 fopen flags
@ -565,6 +569,8 @@ CIFS.FOpen >STYA pPath resolved path
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 CreateDisposition ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 CreateDisposition
sta (ZPReqPtr),y sta (ZPReqPtr),y
jsr SetReqLen
jsr WriteSocket jsr WriteSocket
bcs .9 bcs .9
@ -632,8 +638,13 @@ CIFS2.FOpen jsr ReadSocket
>PUSHWZ mod >PUSHWZ mod
>PUSHB hFD >PUSHB hFD
>SYSCALL2 mknod >SYSCALL2 mknod
bcc .91
jsr CIFS.FreeFD
sec
.91 jsr Exit.KO .91 stz CIFS.Status
jmp FreeRespData
bra .90 bra .90
.9 jsr Exit.NODATA .9 jsr Exit.NODATA
@ -694,7 +705,7 @@ CIFS2.FClose sta hFILE
bcs .99 bcs .99
lda hFILE lda hFILE
jsr CIFS.CloseDir jsr CIFS.CloseReg
jmp Exit.OK jmp Exit.OK
@ -990,13 +1001,33 @@ CIFS2.FWrite jsr ReadSocket
.90 >POP 5 .90 >POP 5
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
CIFS.FFlush CIFS.FFlush clc Nothing to do
rts
*--------------------------------------
CIFS2.FFlush CIFS2.FFlush
CIFS.FSeek *--------------------------------------
CIFS.FSeek ldy #5 hNod
lda (pStack),y
jsr GetPFD
>PULLA
tax whence
>PULLL DWORD
inc pStack
clc
rts
*--------------------------------------
CIFS2.FSeek CIFS2.FSeek
*--------------------------------------
CIFS.FTell CIFS.FTell
*--------------------------------------
CIFS2.FTell CIFS2.FTell
*--------------------------------------
CIFS.FEOF CIFS.FEOF
*--------------------------------------
CIFS2.FEOF lda #MLI.E.BADCALL CIFS2.FEOF lda #MLI.E.BADCALL
sec sec
rts rts
@ -1152,6 +1183,12 @@ CIFS.NewFD >LDYAI S.FD.REG
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CIFS.FreeFD pha
lda hFD
>SYSCALL2 FreeMem
pla
rts
*--------------------------------------
CIFS.RWGetFidOfs CIFS.RWGetFidOfs
ldx #6 ldx #6
ldy #S.FD.REG.REF ldy #S.FD.REG.REF

View File

@ -31,11 +31,11 @@ pPath .BS 2
flags .BS 1 flags .BS 1
ftype .BS 1 ftype .BS 1
auxtype .BS 2 auxtype .BS 2
ZPRespPtr .BS 2 ZPRespPtr .BS 2
bFlag .BS 1 bFlag .BS 1
ByteCountOfs .BS 1 ByteCountOfs .BS 1
DWORD .BS 4
ZS.END .ED ZS.END .ED
*-------------------------------------- *--------------------------------------
@ -245,18 +245,14 @@ CIFS.Negotiate lda (pStack)
ldy #S.NETBIOS+S.SMB.H.FLAGS ldy #S.NETBIOS+S.SMB.H.FLAGS
sta (ZPCtxPtr),y sta (ZPCtxPtr),y
phx txa hSMBContext
lda hResp jsr FreeRespData
>SYSCALL2 FreeMem
pla
clc clc
>RET 2 bra .99
.97 lda hResp .97 jsr FreeRespData
>SYSCALL2 FreeMem
.98 lda #MLI.E.IO .98 lda #MLI.E.IO
@ -353,14 +349,12 @@ CIFS.SessionSetup
lda (ZPRespPtr),y lda (ZPRespPtr),y
sta (ZPCtxPtr),y sta (ZPCtxPtr),y
.8 lda hResp .8 jsr FreeRespData
>SYSCALL2 FreeMem
clc clc
>RET 7 bra .99
.97 lda hResp .97 jsr FreeRespData
>SYSCALL2 FreeMem
.98 lda #MLI.E.IO .98 lda #MLI.E.IO
sec sec
@ -459,14 +453,12 @@ CIFS.TreeConnect
lda (ZPRespPtr),y lda (ZPRespPtr),y
sta (ZPCtxPtr),y sta (ZPCtxPtr),y
.8 lda hResp .8 jsr FreeRespData
>SYSCALL2 FreeMem
clc clc
>RET 5 bra .99
.97 lda hResp .97 jsr FreeRespData
>SYSCALL2 FreeMem
.98 lda #MLI.E.IO .98 lda #MLI.E.IO
sec sec
@ -701,27 +693,6 @@ AppendTypePtr2 ldx #0
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .1
inc ZPReqLen+1
.1 tya
sec +1 for \0
adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
Add2ByteCount ldy ByteCountOfs Add2ByteCount ldy ByteCountOfs
clc clc
adc (ZPReqPtr),y adc (ZPReqPtr),y
@ -734,6 +705,28 @@ Add2ByteCount ldy ByteCountOfs
sta (ZPReqPtr),y sta (ZPReqPtr),y
rts rts
*-------------------------------------- *--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPPtr2
sta ZPPtr2
bcc AddYReqLen
inc ZPPtr2+1
*--------------------------------------
AddYReqLen tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .8
inc ZPReqLen+1
.8 rts
*--------------------------------------
AppendPath ldx #0 AppendPath ldx #0
.1 lda (pPath) .1 lda (pPath)
@ -807,14 +800,7 @@ Sleep2 stz CIFS.Retries
sec sec
rts rts
*-------------------------------------- *--------------------------------------
Exit.KO pha Exit.OK jsr FreeRespData
jsr Exit.OK
pla
clc
rts
*--------------------------------------
Exit.OK lda hResp
>SYSCALL2 FreeMem
stz CIFS.Status stz CIFS.Status
* clc * clc

View File

@ -5,11 +5,7 @@ NEW
* address $FFCB (ROM rts opcode) for rom switching to function. * address $FFCB (ROM rts opcode) for rom switching to function.
* $FF9B * $FF9B
*-------------------------------------- *--------------------------------------
IRQ pha IRQ ldx #$FA save 6 bytes of page 0
phx
phy
ldx #$FA save 6 bytes of page 0
.2 lda $00,x .2 lda $00,x
sta IRQ.ZPSave-$FA,x sta IRQ.ZPSave-$FA,x
@ -67,9 +63,6 @@ IRQ.Done ldx #$FA
* lda IRQ.DoneCn+2 * lda IRQ.DoneCn+2
* sta mslot * sta mslot
ply
plx
pla
rti rti
*-------------------------------------- *--------------------------------------
IRQ.GoX jmp (inttbl,x) interrupt routine x IRQ.GoX jmp (inttbl,x) interrupt routine x

View File

@ -17,7 +17,6 @@ IAC.BUF.MAX .EQ 32
ZS.START ZS.START
ZPPtr1 .BS 2 ZPPtr1 .BS 2
TimeOut .BS 1 TimeOut .BS 1
hErr .BS 1
ArgIndex .BS 1 ArgIndex .BS 1
ArgDev .BS 1 ArgDev .BS 1
ArgProg .BS 1 ArgProg .BS 1
@ -39,7 +38,7 @@ CS.START cld
.DA #0 .DA #0
.DA CS.END-CS.START Code Size (without Constants) .DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize .DA DS.END-DS.START Data SegmentSize
.DA #32 Stack Size .DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size .DA #ZS.END-ZS.START Zero Page Size
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
@ -78,18 +77,17 @@ CS.RUN ldy #S.PS.ARGC
beq .1 valid option, check next arg beq .1 valid option, check next arg
ldx ArgIndex
lda ArgDev lda ArgDev
bne .2 bne .2
lda ArgIndex stx ArgDev
sta ArgDev
bra .1 bra .1
.2 lda ArgProg .2 lda ArgProg
bne .9 bne .9
lda ArgIndex stx ArgProg
sta ArgProg
bra .1 bra .1
.9 >PUSHW L.MSG.USAGE .9 >PUSHW L.MSG.USAGE
@ -99,17 +97,12 @@ CS.RUN ldy #S.PS.ARGC
sec sec
.99 rts .99 rts
.8 lda ArgDev .8 lda ArgProg
beq .9 beq .9
lda ArgProg
beq .9
ldy #S.PS.hStdErr
lda (pPS),y
sta hErr
lda ArgDev lda ArgDev
beq .9
>SYSCALL ArgV >SYSCALL ArgV
>PUSHYA >PUSHYA
>PUSHBI O.RDWR >PUSHBI O.RDWR
@ -119,13 +112,14 @@ CS.RUN ldy #S.PS.ARGC
>SYSCALL FOpen >SYSCALL FOpen
bcs .99 bcs .99
sta hFILE
ldy #S.PS.hStdIn ldy #S.PS.hStdIn
sta (pPS),y sta (pPS),y
iny #S.PS.hStdOut iny #S.PS.hStdOut
sta (pPS),y sta (pPS),y
iny #S.PS.hStdErr iny #S.PS.hStdErr
sta (pPS),y sta (pPS),y
sta hFILE
CS.RUN.LOOP0 >SLEEP CS.RUN.LOOP0 >SLEEP

View File

@ -5,7 +5,7 @@ NEW
.OR $2000 .OR $2000
.TF sbin/initd .TF sbin/initd
*-------------------------------------- *--------------------------------------
INITDDBG .EQ 0 INITDDBG .EQ 1
*-------------------------------------- *--------------------------------------
.INB inc/macros.i .INB inc/macros.i
.INB inc/a2osx.i .INB inc/a2osx.i
@ -64,8 +64,6 @@ CS.RUN ldy #S.PS.PID
cmp #1 cmp #1
bne .9 bne .9
* bra .55
ldy #S.PS.hStdIn ldy #S.PS.hStdIn
lda (pPS),y lda (pPS),y
>SYSCALL FEOF >SYSCALL FEOF
@ -80,7 +78,6 @@ CS.RUN ldy #S.PS.PID
cmp #18 CTRL-R for Root mode cmp #18 CTRL-R for Root mode
bne .1 bne .1
*.55
>LDYA L.MSG.CTRLR >LDYA L.MSG.CTRLR
>SYSCALL PutS >SYSCALL PutS
@ -144,6 +141,7 @@ CS.RUN.ETCINIT >LDYAI 256
jsr CS.RUN.ERRMSG jsr CS.RUN.ERRMSG
.FIN .FIN
jsr .81 jsr .81
pla pla
sec sec
rts rts

View File

@ -46,7 +46,7 @@ CS.START cld
.DA #0 .DA #0
.DA CS.END-CS.START Code Size (without Constants) .DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size .DA DS.END-DS.START Data Segment Size
.DA #32 Stack Size .DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size .DA #ZS.END-ZS.START Zero Page Size
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
@ -87,7 +87,6 @@ CS.RUN >LDYA L.ETCISSUE
*-------------------------------------- *--------------------------------------
CS.RUN.EXECPS >LDYA L.ETCMOTD CS.RUN.EXECPS >LDYA L.ETCMOTD
jsr CS.RUN.DumpFile jsr CS.RUN.DumpFile
jsr CS.CLEANUP
>PUSHW L.SHELL >PUSHW L.SHELL
>PUSHBI S.PS.F.HOLD >PUSHBI S.PS.F.HOLD
@ -317,13 +316,10 @@ CS.RUN.DumpFile >PUSHYA
>SYSCALL FClose >SYSCALL FClose
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT CS.DOEVENT sec
sec
rts rts
*-------------------------------------- *--------------------------------------
CS.QUIT CS.QUIT clc
CS.CLEANUP
.8 clc
rts rts
*-------------------------------------- *--------------------------------------
CS.END CS.END

View File

@ -347,24 +347,6 @@ DEV.MkFD stx .8+1
DEV.MkFD.Y .DA #S.FD.REG,#S.FD.DIR,#S.FD.PIPE DEV.MkFD.Y .DA #S.FD.REG,#S.FD.DIR,#S.FD.PIPE
DEV.MkFD.T .DA #S.FD.T.REG,#S.FD.T.DIR,#S.FD.T.PIPE DEV.MkFD.T .DA #S.FD.T.REG,#S.FD.T.DIR,#S.FD.T.PIPE
*-------------------------------------- *--------------------------------------
DEV.Destroy ldx IO.hDevNod
lda Nod.Table.hName-2,x
beq .1
stz Nod.Table.hName-2,x
jsr K.FreeMem
ldx IO.hDevNod
.1 lda Nod.Table.hFD-2,x
beq .8
stz Nod.Table.hFD-2,x
jmp K.FreeMem
.8 clc
rts
*--------------------------------------
MAN MAN
SAVE usr/src/sys/kernel.s.dev SAVE usr/src/sys/kernel.s.dev
LOAD usr/src/sys/kernel.s LOAD usr/src/sys/kernel.s

View File

@ -71,8 +71,7 @@ FS.OPEN.REG >MLICALL MLIGETFILEINFO
bcc .8 bcc .8
.99 pha Save Error Code .99 pha Save Error Code
lda IO.hFD jsr FS.CLOSE.REG
jsr K.Close
pla pla
sec sec
@ -103,8 +102,7 @@ FS.OPEN.DIR ldx #1
bcc .9 bcc .9
.98 pha Save Error Code .98 pha Save Error Code
lda IO.hFD jsr FS.CLOSE.DIR
jsr K.Close
pla pla
sec sec
rts rts

View File

@ -131,6 +131,7 @@ Kernel.Init3 sta SETALTZP
sta SETIOUDIS sta SETIOUDIS
sta SETDHIRES sta SETDHIRES
bmi .10 bmi .10
sta CLRIOUDIS sta CLRIOUDIS
.10 jsr MemMgrInit .10 jsr MemMgrInit

View File

@ -338,10 +338,9 @@ PS.Load ldy #$ff
.6 lda K.S.STAT+S.STAT.P.TYPE .6 lda K.S.STAT+S.STAT.P.TYPE
cmp #S.FI.T.BIN cmp #S.FI.T.BIN
bne .7 beq .8
jmp PS.LoadBIN
.7 cmp #S.FI.T.TXT cmp #S.FI.T.TXT
beq PS.Load.SCRIPT beq PS.Load.SCRIPT
cmp #S.FI.T.SYS cmp #S.FI.T.SYS
@ -359,9 +358,9 @@ PS.Load ldy #$ff
>LDYAI PS.SHUTDOWN >LDYAI PS.SHUTDOWN
jsr PS.Find.PATH jsr PS.Find.PATH
bcs PS.RTS bcs .99
jmp PS.LoadBIN .8 jmp PS.LoadBIN
*-------------------------------------- *--------------------------------------
PS.Load.IPATH lda #E.BADPATH PS.Load.IPATH lda #E.BADPATH
.HS 2C .HS 2C

View File

@ -387,6 +387,24 @@ K.FClose jsr PFT.CheckNodeA
bcs K.FRead.RTS bcs K.FRead.RTS
jmp UNISTD.Close jmp UNISTD.Close
*--------------------------------------
DEV.Destroy ldx IO.hDevNod
lda Nod.Table.hName-2,x
beq .1
stz Nod.Table.hName-2,x
jsr K.FreeMem
ldx IO.hDevNod
.1 lda Nod.Table.hFD-2,x
beq .8
stz Nod.Table.hFD-2,x
jmp K.FreeMem
.8 clc
rts
*/-------------------------------------- */--------------------------------------
* # FRead (BLOCKING) * # FRead (BLOCKING)
* Read bytes from file * Read bytes from file