A2osX/SBIN/CIFSD.S.IO.txt

1724 lines
25 KiB
Plaintext
Raw Normal View History

2021-05-19 12:44:47 +00:00
NEW
AUTO 3,1
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.CallBack >STYA SaveYA
bit CIFS.Status
bmi .1 Busy....
jsr IO.SaveZP
jmp (J.IO.Q,x)
.1 ldy #S.PS.PID
lda (pPS),y
cmp CIFS.PID
bne .2
jsr IO.SaveZP
jmp (J.IO.R,x)
.2 lda #0
sec
rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.SaveZP ldy #ZS.END-ZS.START-1
.1 lda ZS.START,y
sta SaveZP,y
dey
bpl .1
>LDYA SaveYA
rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Sleep ldy #S.PS.PID
lda (pPS),y
sta CIFS.PID
dec CIFS.Status
2023-01-17 06:31:23 +00:00
stz CIFS.Cnt
stz CIFS.Cnt+1
IO.SleepContZ lda #TIMEOUT.MAX
sta TimeOut
IO.SleepCont lda #0
2021-05-19 12:44:47 +00:00
sec
2023-01-17 06:31:23 +00:00
bra IO.RestoreZP
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Exit stz CIFS.Status
*--------------------------------------
IO.RestoreZP php
pha
phx
phy
lda hResp
beq .1
stz hResp
>SYSCALL2 FreeMem
.1 ldy #ZS.END-ZS.START-1
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.2 lda SaveZP,y
sta ZS.START,y
dey
bpl .2
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
ply
plx
pla
plp
rts
*--------------------------------------
IO.Q.ChOwn
IO.R.ChOwn
*--------------------------------------
IO.Q.ChTyp
IO.R.ChTyp
*--------------------------------------
IO.Q.ChAux
IO.R.ChAux
*--------------------------------------
IO.Q.SetAttr
IO.R.SetAttr
*--------------------------------------
IO.Q.ChMod
IO.R.ChMod
*--------------------------------------
IO.Q.FStat
*--------------------------------------
IO.R.FStat lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
IO.Q.Stat >STYA pPath resolved path
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.ReqT2SetupX
2021-05-19 12:44:47 +00:00
ldx #0
.1 lda SMB.QueryPathInfo,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.QueryPathInfo.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.ReqT2SetupPtr2
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPathPtr2
jsr CORE.AddYReqLenPtr2
jsr CORE.SetT2ReqLen
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.WriteSocket
2021-05-19 12:44:47 +00:00
bcs .9
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.9 >POP 4
jmp IO.Exit
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.Stat jsr IO.ReadSocket
bvs .99
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
2021-06-30 19:09:07 +00:00
lda #MLI.E.INVPATH Return this for stat() match ProDOS Behavior
2023-01-17 06:31:23 +00:00
bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.GetRespDataPtr1
jsr IO.FileInfo2StatBuf
2021-06-17 17:38:34 +00:00
>PULLW ZPPtr2 Stat Buffer
2021-05-19 12:44:47 +00:00
inc pStack Skip Filename
inc pStack
2023-01-17 06:31:23 +00:00
jsr IO.StatBuf2Ptr2
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
clc
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.98 >POP 4
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
*--------------------------------------
IO.Q.MKDir >STYA pPath resolved path
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.ReqT2SetupX
2021-05-19 12:44:47 +00:00
ldx #0
.1 lda SMB.CreateDirectory,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.CreateDirectory.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPath
2021-05-19 12:44:47 +00:00
lda #0
sta (ZPReqPtr),y
iny
2023-01-17 06:31:23 +00:00
jsr CORE.SetT2ReqLenYA
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.WriteSocket
bcs .99
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.99 >POP 4
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
*--------------------------------------
IO.R.MKDir jsr IO.ReadSocket
bvs .99
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
* bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.98 >POP 4
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.OpenDir >STYA pPath resolved path
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.NewFD
bcs .98
2021-05-19 12:44:47 +00:00
lda #S.FD.T.DIR
2021-07-25 14:03:41 +00:00
sta (pFD)
2021-05-19 12:44:47 +00:00
lda #0
ldy #S.FD.DIR.EPB
2021-07-25 14:03:41 +00:00
sta (pFD),y EOF Flag
2021-05-19 12:44:47 +00:00
iny
2021-07-25 14:03:41 +00:00
sta (pFD),y
2021-05-19 12:44:47 +00:00
iny
2021-07-25 14:03:41 +00:00
sta (pFD),y
2021-05-19 12:44:47 +00:00
>PUSHW pPath
2021-07-24 20:42:23 +00:00
>PUSHWZ
>PUSHB hFD
2021-05-19 12:44:47 +00:00
>SYSCALL2 mknod
2023-01-17 06:31:23 +00:00
bcc .98
pha
jsr IO.FreeFD
pla
sec
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.98 jmp IO.Exit
2021-05-19 12:44:47 +00:00
*--------------------------------------
* IO.R.OpenDir
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
* A = hDIR
*--------------------------------------
IO.Q.ReadDir jsr IO.GetFD
2021-06-17 17:38:34 +00:00
2021-05-19 12:44:47 +00:00
ldy #S.FD.DIR.EPB
lda (pFD),y
beq .1
lda #MLI.E.EOF
sec
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.1 iny #S.FD.DIR.FC
2021-05-19 12:44:47 +00:00
lda (pFD),y
2023-01-17 06:31:23 +00:00
iny #S.FD.DIR.FC+1
2021-05-19 12:44:47 +00:00
ora (pFD),y
2023-01-17 06:31:23 +00:00
bne IO.Q.ReadDir.Next
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.ReqT2SetupX
2021-05-19 12:44:47 +00:00
ldx #0
.2 lda SMB.FindFirst2,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.FindFirst2.Len
bne .2
2023-01-17 06:31:23 +00:00
bra IO.Q.ReadDir.Send
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
IO.Q.ReadDir.Next
jsr CORE.ReqT2SetupX
2021-05-19 12:44:47 +00:00
ldx #0
.2 lda SMB.FindNext2,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.FindNext2.Len
bne .2
phy
ldy #S.FD.DIR.FC+1
lda (pFD),y
tax
dey
lda (pFD),y
2021-06-17 17:38:34 +00:00
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 Search ID
2021-05-19 12:44:47 +00:00
sta (ZPReqPtr),y
txa
iny
sta (ZPReqPtr),y
ply
2023-01-17 06:31:23 +00:00
IO.Q.ReadDir.Send
2021-05-19 12:44:47 +00:00
lda (pPath)
beq .1
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPath
2021-05-19 12:44:47 +00:00
lda #'\'
sta (ZPReqPtr),y
iny
.1 lda #'*'
sta (ZPReqPtr),y
iny
2022-03-18 17:59:39 +00:00
2021-05-19 12:44:47 +00:00
lda #0
sta (ZPReqPtr),y
iny
2023-01-17 06:31:23 +00:00
jsr CORE.SetT2ReqLenYA
jsr IO.WriteSocket
bcs .99
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.Exit
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.ReadDir jsr IO.GetFD
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.ReadSocket
bvs .99
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
bcs .98
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
ldy #S.FD.DIR.FC
2021-05-19 12:44:47 +00:00
lda (pFD),y
iny
ora (pFD),y
sta bFlag
bne .2
ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H+1 Search ID
lda (ZPRespPtr),y
tax
dey
ora (ZPRespPtr),y
2023-01-17 06:31:23 +00:00
beq .97
2021-05-19 12:44:47 +00:00
lda (ZPRespPtr),y
2021-06-17 17:38:34 +00:00
2021-05-19 12:44:47 +00:00
ldy #S.FD.DIR.FC
sta (pFD),y
iny
txa
sta (pFD),y
2023-01-17 06:31:23 +00:00
.2 jsr CORE.GetRespDataPtr1
jsr IO.R.ReadDir.GetBuf
bcs .98
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.GetRespDataPtr1
jsr IO.R.ReadDir.FillBuf
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
lda hBuf
>SYSCALL2 GetMemPtr
2021-05-19 12:44:47 +00:00
ldx hBuf
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
* clc
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
.97 lda #MLI.E.IO
sec
.98 jmp IO.Exit
.99 jmp IO.SleepCont
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.ReadDir.GetBuf
2021-05-19 12:44:47 +00:00
ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H Search Count
lda bFlag
bne .10
iny
iny
.10 iny
iny
lda (ZPRespPtr),y End Of Search
phy
ldy #S.FD.DIR.EPB
sta (pFD),y
ply
dey
dey
lda (ZPRespPtr),y Search Count
2023-01-17 06:31:23 +00:00
beq .98
2021-05-19 12:44:47 +00:00
tax
lda #1 +Ending 0
sta ZPPtr2
stz ZPPtr2+1
2023-01-17 06:31:23 +00:00
.1 jsr IO.AddSTAT2Ptr2
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
lda #22
2021-05-19 12:44:47 +00:00
clc
2023-01-17 06:31:23 +00:00
jsr IO.AddA2Ptr1
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
lda (ZPPtr1) Filename Len
2021-06-30 19:09:07 +00:00
sec +\0
2023-01-17 06:31:23 +00:00
jsr IO.AddA2Ptr2
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
lda (ZPPtr1) Filename Len
2021-06-30 19:09:07 +00:00
inc +1 skip Filename Len
sec +\0
2023-01-17 06:31:23 +00:00
jsr IO.AddA2Ptr1
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
dex
2021-05-19 12:44:47 +00:00
bne .1
>LDYA ZPPtr2
>SYSCALL2 GetMem
2023-01-17 06:31:23 +00:00
bcs .99
2021-05-19 12:44:47 +00:00
>STYA ZPPtr2
stx hBuf
2023-01-17 06:31:23 +00:00
* clc
2021-05-19 12:44:47 +00:00
rts
2023-01-17 06:31:23 +00:00
.98 lda #MLI.E.EOF
sec
.99 rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.ReadDir.FillBuf
2021-05-19 12:44:47 +00:00
ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H Search Count
lda bFlag
bne .10
iny
iny
.10 lda (ZPRespPtr),y
tax
2021-06-30 19:09:07 +00:00
.1 phx
2023-01-17 06:31:23 +00:00
jsr IO.FileInfo2StatBuf
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
lda #22
2021-06-30 19:09:07 +00:00
clc
2023-01-17 06:31:23 +00:00
jsr IO.AddA2Ptr1
2021-06-30 19:09:07 +00:00
lda (ZPPtr1)
tax Save Filename Len
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
inc ZPPtr1 Skip Filename Len
bne .2
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
inc ZPPtr1+1
2021-05-19 12:44:47 +00:00
2021-06-30 19:09:07 +00:00
.2 ldy #$ff
2021-05-19 12:44:47 +00:00
.3 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .3
2021-06-30 19:09:07 +00:00
txa
2021-05-19 12:44:47 +00:00
sec
2023-01-17 06:31:23 +00:00
jsr IO.AddA2Ptr1
2021-05-19 12:44:47 +00:00
jsr IO.R.ReadDir.AuxT
jsr IO.R.ReadDir.Type
.7 txa
sec +\0
jsr IO.AddA2Ptr2
jsr IO.StatBuf2Ptr2
jsr IO.AddSTAT2Ptr2
.8 plx
dex
bne .1
lda #0
sta (ZPPtr2)
rts
*--------------------------------------
IO.R.ReadDir.AuxT
txa X = filename len
sec
sbc #5 "x.EXT_hhhh" ?
bcc .99
beq .99
tay
lda (ZPPtr2),y
cmp #'_'
bne .99
phy
iny
lda (ZPPtr2),y
jsr IO.IsHexDigit
bcs .9
asl
asl
asl
asl
sta StatBuf+S.STAT.P.AUXTYPE+1
iny
lda (ZPPtr2),y
jsr IO.IsHexDigit
bcs .9
ora StatBuf+S.STAT.P.AUXTYPE+1
sta StatBuf+S.STAT.P.AUXTYPE+1
iny
lda (ZPPtr2),y
jsr IO.IsHexDigit
bcs .9
asl
asl
asl
asl
sta StatBuf+S.STAT.P.AUXTYPE
iny
lda (ZPPtr2),y
jsr IO.IsHexDigit
bcs .9
ora StatBuf+S.STAT.P.AUXTYPE
sta StatBuf+S.STAT.P.AUXTYPE
pla
tax
tay
lda #0
sta (ZPPtr2),y
rts
.9 plx
.99 stz StatBuf+S.STAT.P.AUXTYPE
stz StatBuf+S.STAT.P.AUXTYPE+1
rts
*--------------------------------------
IO.R.ReadDir.Type
txa X = filename len
2021-06-30 19:09:07 +00:00
sec
sbc #4 "x.EXT" ?
bcc .99
beq .99
2021-06-30 19:09:07 +00:00
tay
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
lda (ZPPtr2),y
cmp #'.'
bne .99
2021-06-30 19:09:07 +00:00
phx
2023-01-17 06:31:23 +00:00
ldx #0
2021-06-30 19:09:07 +00:00
.1 phy Y = '.' offset
2021-06-30 19:09:07 +00:00
.2 iny
2021-07-10 19:09:43 +00:00
lda (ZPPtr2),y
beq .4
2023-01-17 06:31:23 +00:00
2021-07-10 19:09:43 +00:00
cmp #'A'
bcc .3
2023-01-17 06:31:23 +00:00
2021-07-10 19:09:43 +00:00
cmp #'Z'+1
bcs .3
2023-01-17 06:31:23 +00:00
2021-07-10 19:09:43 +00:00
eor #$20
2023-01-17 06:31:23 +00:00
.3 cmp PRODOS.FT.TXT,x
bne .5
2021-06-30 19:09:07 +00:00
inx
bra .2
2021-06-30 19:09:07 +00:00
.4 txa
2021-06-30 19:09:07 +00:00
lsr
lsr
tax
lda PRODOS.FT.HEX,x
sta StatBuf+S.STAT.P.TYPE
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
ply
bra .8
2021-06-30 19:09:07 +00:00
.5 txa
and #$FC
2021-06-30 19:09:07 +00:00
clc
adc #4
tax
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
ply
2023-01-17 06:31:23 +00:00
2021-06-30 19:09:07 +00:00
cpx #PRODOS.FT.END
bne .1
2023-01-17 06:31:23 +00:00
iny
lda (ZPPtr2),y
cmp #'0'
bne .9
2023-01-17 06:31:23 +00:00
iny
lda (ZPPtr2),y
2021-06-30 19:09:07 +00:00
jsr IO.IsHexDigit
bcs .9
2021-05-19 12:44:47 +00:00
asl
asl
asl
asl
sta StatBuf+S.STAT.P.TYPE
2021-05-19 12:44:47 +00:00
iny
lda (ZPPtr2),y
2021-05-19 12:44:47 +00:00
jsr IO.IsHexDigit
bcs .9
ora StatBuf+S.STAT.P.TYPE
sta StatBuf+S.STAT.P.TYPE
.8 pla
sec
sbc #4
tax
tay
2021-05-19 12:44:47 +00:00
lda #0
sta (ZPPtr2),y
rts
.9 plx
2021-05-19 12:44:47 +00:00
.99 stz StatBuf+S.STAT.P.TYPE
2021-05-19 12:44:47 +00:00
rts
*--------------------------------------
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.CloseReg
IO.Q.CloseDir tax
2021-05-19 12:44:47 +00:00
2021-07-24 20:42:23 +00:00
lda hFDs.hName-1,x
2021-05-19 12:44:47 +00:00
beq .1
phx
2021-07-24 20:42:23 +00:00
stz hFDs.hName-1,x
2021-05-19 12:44:47 +00:00
>SYSCALL2 FreeMem
plx
2021-07-24 20:42:23 +00:00
.1 lda hFDs-1,x
stz hFDs-1,x
2021-05-19 12:44:47 +00:00
>SYSCALL2 FreeMem
2023-01-17 06:31:23 +00:00
* clc
jmp IO.Exit
2021-05-19 12:44:47 +00:00
*--------------------------------------
* IO.R.CloseDir
2021-05-19 12:44:47 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
* short int fopen ( const char *filename, short int flags, short int ftype, int auxtype );
2021-06-05 15:48:54 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FOpen >STYA pPath resolved path
2021-06-11 17:20:35 +00:00
2021-06-06 19:06:49 +00:00
ldx #S.SMB.H.CMD.NT.CREATE.ANDX
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-05-19 12:44:47 +00:00
2021-05-22 21:05:12 +00:00
ldx #0
2021-06-06 19:06:49 +00:00
.1 lda SMB.ComCreate.H,x
2021-05-22 21:05:12 +00:00
sta (ZPReqPtr),y
iny
inx
2021-06-06 19:06:49 +00:00
cpx #SMB.ComCreate.H.Len
2021-05-22 21:05:12 +00:00
bne .1
2021-05-19 12:44:47 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupPtr2
2021-06-17 17:38:34 +00:00
jsr CORE.AppendPathPtr2
phy
2021-07-10 19:09:43 +00:00
ldy #2
lda (pStack),y TYPE
beq .2
2023-01-17 06:31:23 +00:00
ply
2021-06-17 17:38:34 +00:00
jsr CORE.AppendTypePtr2
phy
lda (pStack) AUXT
tax
ldy #1
ora (pStack),y
2021-07-10 19:09:43 +00:00
beq .2
lda (pStack),y AUXT
ply
jsr CORE.AppendAuxTPtr2
phy
2021-07-10 19:09:43 +00:00
.2 ply
lda #0 ending \0
sta (ZPPtr2),y
jsr CORE.AddYReqLen
tya
2021-06-17 17:38:34 +00:00
ldy #S.NETBIOS+S.SMB.H+6 NameLength
2021-06-06 19:06:49 +00:00
sta (ZPReqPtr),y
2021-05-19 12:44:47 +00:00
* inc +1 for \0
2023-01-17 06:31:23 +00:00
jsr CORE.Add2ByteCount
2021-06-17 17:38:34 +00:00
ldx #1 FILE_OPEN
ldy #3 fopen flags
lda (pStack),y
bit #O.WRONLY
beq .8
2021-06-30 19:09:07 +00:00
bit #O.CREATE
bne .3
2021-06-30 19:09:07 +00:00
2021-06-17 17:38:34 +00:00
ldx #3 FILE_OPEN_IF
2021-05-22 21:05:12 +00:00
2021-06-17 17:38:34 +00:00
.3 bit #O.APPEND
bne .8
2021-06-30 19:09:07 +00:00
2021-06-17 17:38:34 +00:00
ldx #5 FILE_OVERWRITE_IF
2021-05-22 21:05:12 +00:00
.8 txa
2021-06-05 15:48:54 +00:00
2021-06-17 17:38:34 +00:00
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 CreateDisposition
sta (ZPReqPtr),y
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-06 19:06:49 +00:00
2023-01-17 06:31:23 +00:00
.99 >POP 6
2021-06-06 19:06:49 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.FOpen jsr IO.ReadSocket
bvs .99
2021-06-06 19:06:49 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-06-06 19:06:49 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
bcs .98
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.NewFD
bcs .98
jsr IO.R.FOpen.SetFD
ldy #4 path
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
>PUSHWZ mod
>PUSHB hFD
>SYSCALL2 mknod
bcc .98
pha
jsr IO.FreeFD
pla
sec
.98 >POP 6
jmp IO.Exit
.99 jmp IO.SleepCont
*--------------------------------------
IO.R.FOpen.SetFD
2021-07-25 14:03:41 +00:00
lda #S.FD.T.REG
sta (pFD)
2021-06-30 19:09:07 +00:00
2021-06-06 19:06:49 +00:00
ldy #S.NETBIOS+S.SMB.H+6 FileID
lda (ZPRespPtr),y
2021-05-22 21:05:12 +00:00
pha
2021-06-06 19:06:49 +00:00
iny
lda (ZPRespPtr),y
2021-06-17 17:38:34 +00:00
2021-06-06 19:06:49 +00:00
ldy #S.FD.REG.REF+1
2021-06-11 17:20:35 +00:00
sta (pFD),y
2021-06-06 19:06:49 +00:00
dey
pla
2021-06-11 17:20:35 +00:00
sta (pFD),y
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
ldy #3 fopen flags
lda (pStack),y
bit #O.APPEND
beq .3
ldy #S.NETBIOS+S.SMB.H+56+3 EOF
ldx #4
2021-06-30 19:09:07 +00:00
.1 lda (ZPRespPtr),y
pha
dey
dex
bne .1
2021-06-30 19:09:07 +00:00
ldx #4
2023-01-17 06:31:23 +00:00
ldy #S.FD.REG.FPOS
2021-06-30 19:09:07 +00:00
.2 pla
sta (pFD),y
iny
dex
bne .2
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
rts
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
.3 jmp IO.Seek0
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FClose jsr IO.GetFD
2021-06-17 17:38:34 +00:00
2021-06-06 19:06:49 +00:00
ldx #S.SMB.H.CMD.CLOSE
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-06-06 19:06:49 +00:00
ldx #0
2021-06-11 17:20:35 +00:00
.1 lda SMB.ComClose.H,x
2021-05-22 21:05:12 +00:00
sta (ZPReqPtr),y
iny
2021-06-06 19:06:49 +00:00
inx
2021-06-11 17:20:35 +00:00
cpx #SMB.ComClose.H.Len
2021-06-06 19:06:49 +00:00
bne .1
2021-06-17 17:38:34 +00:00
sty ZPReqLen
stz ZPReqLen+1
2021-06-11 17:20:35 +00:00
ldy #S.FD.REG.REF
lda (pFD),y
pha
iny
lda (pFD),y
2021-06-17 17:38:34 +00:00
2021-06-11 17:20:35 +00:00
ldy #S.NETBIOS+S.SMB.H+2 FileID
sta (ZPReqPtr),y
pla
dey
sta (ZPReqPtr),y
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.Exit
2021-05-22 21:05:12 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.FClose sta hFILE
2021-06-06 19:06:49 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.ReadSocket
bvs .99
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
bcs .98
2021-06-17 17:38:34 +00:00
2021-06-19 17:46:36 +00:00
lda hFILE
2023-01-17 06:31:23 +00:00
jsr IO.Q.CloseReg
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
clc
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
.98 jmp IO.Exit
2021-05-22 21:05:12 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
*--------------------------------------
IO.Q.FRead ldy #4 hFILE
2021-06-22 18:59:02 +00:00
lda (pStack),y
2023-01-17 06:31:23 +00:00
jsr IO.GetFD
2021-06-22 18:59:02 +00:00
ldx #S.SMB.H.CMD.READ.ANDX
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-06-22 18:59:02 +00:00
ldx #0
.1 lda SMB.ComRead.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComRead.H.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupPtr2
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.RWGetFidOfs
2021-06-30 19:09:07 +00:00
ldy #1 DataLen HI
lda (pStack),y
2021-06-27 16:59:52 +00:00
beq .2
2021-06-30 19:09:07 +00:00
lda #0
ldx #1 256 bytes to read
bra .3
2021-06-30 19:09:07 +00:00
.2 lda (pStack) DataLen LO
ldx #0
2021-06-30 19:09:07 +00:00
.3 ldy #S.NETBIOS+S.SMB.H+11 MaxCountOfBytesToReturn
2021-06-22 18:59:02 +00:00
sta (ZPReqPtr),y
iny
txa
2021-06-22 18:59:02 +00:00
sta (ZPReqPtr),y
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
.99 >POP 5
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.FRead jsr IO.ReadSocket
bvs .99
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
bcs .98
2021-06-22 18:59:02 +00:00
2021-06-27 16:59:52 +00:00
ldy #S.NETBIOS+S.SMB.H+11 DataLength LO
lda (ZPRespPtr),y
iny
ora (ZPRespPtr),y
bne .10
2021-06-30 19:09:07 +00:00
lda #MLI.E.EOF
sec
2023-01-17 06:31:23 +00:00
bra .98
2021-06-22 18:59:02 +00:00
.10 ldy #S.NETBIOS+S.SMB.H+13 DataOffset LO
2021-06-27 16:59:52 +00:00
lda (ZPRespPtr),y
2021-06-27 16:59:52 +00:00
* clc
adc #4 S.NETBIOS
* clc
adc ZPRespPtr
sta ZPPtr1
2021-06-27 16:59:52 +00:00
lda #0
adc ZPRespPtr+1
sta ZPPtr1+1
ldy #3 DataPtr HI
2021-06-22 18:59:02 +00:00
lda (pStack),y
sta ZPPtr2+1
dey DataPtr LO
lda (pStack),y
sta ZPPtr2
2021-06-22 18:59:02 +00:00
ldy #S.NETBIOS+S.SMB.H+11 DataLength LO
lda (ZPRespPtr),y
tax
2023-01-17 06:31:23 +00:00
jsr IO.CopyXPtr1Ptr2
2021-06-30 19:09:07 +00:00
ldy #S.NETBIOS+S.SMB.H+11
2023-01-17 06:31:23 +00:00
jsr IO.RWSetPFosY
2021-06-27 16:59:52 +00:00
ldy #S.NETBIOS+S.SMB.H+12 DataLength HI
lda (ZPRespPtr),y
beq .2 less than 256
inc CIFS.Cnt+1
ldy #1 DataLen HI
lda (pStack),y
dec
sta (pStack),y
2021-06-30 19:09:07 +00:00
ldy #3 DataPtr HI
lda (pStack),y
inc
sta (pStack),y
bra .7
.2 dey DataLength LO
lda (ZPRespPtr),y
2021-06-30 19:09:07 +00:00
sta CIFS.Cnt
2021-06-30 19:09:07 +00:00
lda #0
sta (pStack) DataLen LO
2023-01-17 06:31:23 +00:00
.7 ldy #1 DataLen HI
lda (pStack),y
ora (pStack) DataLen LO
2023-01-17 06:31:23 +00:00
bne .80
2021-06-30 19:09:07 +00:00
>LDYA CIFS.Cnt
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
clc
2023-01-17 06:31:23 +00:00
.98 >POP 5
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
.80 stz CIFS.Status back to Q
jmp IO.SleepContZ Back to CIFS.FRead for next chunk
*--------------------------------------
* int fwrite ( short int stream, const void * ptr, int count );
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FWrite ldy #4 hFILE
2021-06-11 17:20:35 +00:00
lda (pStack),y
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.GetFD
2021-06-11 17:20:35 +00:00
ldx #S.SMB.H.CMD.WRITE.ANDX
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-06-11 17:20:35 +00:00
ldx #0
.1 lda SMB.ComWrite.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComWrite.H.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupPtr2
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jsr IO.RWGetFidOfs
2021-06-11 17:20:35 +00:00
2021-06-17 17:38:34 +00:00
ldy #3 DataPtr HI
lda (pStack),y
sta ZPPtr1+1
dey DataPtr LO
lda (pStack),y
sta ZPPtr1
dey DataLen HI
lda (pStack),y
beq .5
lda #0
ldx #1 write $100
bra .6
.5 dey DataLen LO
lda (pStack),y
ldx #0 write $0xx
.6 pha
ldy #S.NETBIOS+S.SMB.H+21 DataLength
sta (ZPReqPtr),y
iny
txa
sta (ZPReqPtr),y
pla
pha
clc
adc ZPReqLen
sta ZPReqLen
txa
adc ZPReqLen+1
sta ZPReqLen+1
pla
pha
ldy ByteCountOfs
sta (ZPReqPtr),y
txa
iny
sta (ZPReqPtr),y
plx
2023-01-17 06:31:23 +00:00
jsr IO.CopyXPtr1Ptr2
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2021-06-11 17:20:35 +00:00
2021-06-17 17:38:34 +00:00
ldy #1 DataLen HI
lda (pStack),y
beq .7
2021-06-19 17:46:36 +00:00
dec DataLen - $100
2021-06-17 17:38:34 +00:00
sta (pStack),y
ldy #3 DataPtr HI
lda (pStack),y
2021-06-19 17:46:36 +00:00
inc DataPtr + $100
2021-06-17 17:38:34 +00:00
sta (pStack),y
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-17 17:38:34 +00:00
.7 lda #0
2021-06-19 17:46:36 +00:00
sta (pStack) DataLen = 0
2021-06-17 17:38:34 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-11 17:20:35 +00:00
2023-01-17 06:31:23 +00:00
.99 >POP 5
jmp IO.Exit
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.FWrite jsr IO.ReadSocket
bvs .99
2021-06-11 17:20:35 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-06-11 17:20:35 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
bcs .98
2021-06-17 17:38:34 +00:00
ldy #S.NETBIOS+S.SMB.H+5 Count LO
2023-01-17 06:31:23 +00:00
jsr IO.RWSetPFosY
2021-06-11 17:20:35 +00:00
ldy #S.NETBIOS+S.SMB.H+5 Count LO
lda (ZPRespPtr),y
bne .1
2021-06-30 19:09:07 +00:00
inc CIFS.Cnt+1
bra .7
.1 sta CIFS.Cnt
2021-06-27 20:20:11 +00:00
lda #0
sta (pStack) DataLen LO
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
.7 ldy #1 DataLen HI
2021-06-17 17:38:34 +00:00
lda (pStack),y
ora (pStack) DataLen LO
2023-01-17 06:31:23 +00:00
bne .80
2021-06-30 19:09:07 +00:00
>LDYA CIFS.Cnt
2023-01-17 06:31:23 +00:00
clc
2021-06-22 18:59:02 +00:00
2023-01-17 06:31:23 +00:00
.98 >POP 5
2021-06-11 17:20:35 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-11 17:20:35 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
.80 stz CIFS.Status back to Q
jmp IO.SleepContZ
2021-06-06 19:06:49 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FFlush
IO.R.FFlush clc Nothing to do
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
* int fseek( short int stream, long offset, short int whence );
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FSeek ldy #5 hFILE
lda (pStack),y
2023-01-17 06:31:23 +00:00
jsr IO.GetFD
>PULLA
tax whence
2023-01-17 06:31:23 +00:00
2021-07-25 14:03:41 +00:00
>PULLL ZPPtr1 ZPPtr2
inc pStack
2023-01-17 06:31:23 +00:00
>POP 6
clc
2023-01-17 06:31:23 +00:00
jmp IO.Exit
*--------------------------------------
* IO.R.FSeek
*--------------------------------------
2023-01-17 06:31:23 +00:00
* long ftell( short int stream );
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FTell jsr IO.GetFD
ldy #S.FD.REG.FPOS+3
.1 lda (pFD),y
>PUSHA
dey
cpy #S.FD.REG.FPOS-1
bne .1
2023-01-17 06:31:23 +00:00
clc
2023-01-17 06:31:23 +00:00
jmp IO.Exit
*--------------------------------------
2023-01-17 06:31:23 +00:00
* IO.R.FTell
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.FEOF
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.FEOF lda #MLI.E.BADCALL
2021-05-19 12:44:47 +00:00
sec
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.Remove >STYA pPath resolved path
2021-06-19 17:46:36 +00:00
ldx #S.SMB.H.CMD.DELETE
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-06-19 17:46:36 +00:00
ldx #0
.1 lda SMB.ComDelete.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComDelete.H.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupPtr2
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPathPtr2BF4
jsr CORE.AddYReqLen
2021-06-19 17:46:36 +00:00
tya
inc +1 for BufferFormat
inc +1 for \0
2022-03-18 17:59:39 +00:00
ldy ByteCountOfs
sta (ZPReqPtr),y
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.Exit
2021-06-19 17:46:36 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.Remove jsr IO.ReadSocket
bvs .99
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
* bcs .98
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.98 jmp IO.Exit
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
2021-06-19 17:46:36 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.Q.Rename >STYA pPath resolved src path
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
ldx #S.SMB.H.CMD.RENAME
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupX
2021-06-19 17:46:36 +00:00
ldx #0
.1 lda SMB.ComRename.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComRename.H.Len
bne .1
2023-01-17 06:31:23 +00:00
jsr CORE.ReqSetupPtr2
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPathPtr2BF4
2021-06-19 17:46:36 +00:00
tya
inc +1 for BufferFormat
inc +1 for \0
2023-01-17 06:31:23 +00:00
jsr CORE.Add2ByteCount
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
lda (pStack)
sta pPath
ldy #1
lda (pStack),y
sta pPath+1
2021-06-30 19:09:07 +00:00
.2 inc pPath skip /mount
bne .3
2021-06-30 19:09:07 +00:00
inc pPath+1
2021-06-30 19:09:07 +00:00
.3 lda (pPath)
cmp #'/'
bne .2
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.AppendPathPtr2
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
tya
inc +1 for BufferFormat
inc +1 for \0
2022-03-18 17:59:39 +00:00
ldy ByteCountOfs
sta (ZPReqPtr),y
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.SetReqLen
jsr IO.WriteSocket
bcs .99
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Sleep
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.99 >POP 4
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-19 17:46:36 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.R.Rename jsr IO.ReadSocket
bvs .99
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
bcs .98
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jsr CORE.CheckSMBStatus
* bcs .98
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.98 >POP 4
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
jmp IO.Exit
2021-06-19 17:46:36 +00:00
2023-01-17 06:31:23 +00:00
.99 jmp IO.SleepCont
2021-06-19 17:46:36 +00:00
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.NewFD ldx #1
2021-07-25 14:03:41 +00:00
.1 lda hFDs-1,x
beq .2
inx
cpx #K.hFD.MAX+1
bne .1
lda #E.OOH
* sec
rts
.2 stx hFILE
>LDYAI 16 S.FD.REG = S.FD.DIR = 16
>SYSCALL2 GetMem
bcs .9
>STYA pFD
stx hFD
2023-01-17 06:31:23 +00:00
2021-07-25 14:03:41 +00:00
txa
ldx hFILE
2023-01-17 06:31:23 +00:00
2021-07-25 14:03:41 +00:00
sta hFDs-1,x
stz hFDs.hName-1,x
2023-01-17 06:31:23 +00:00
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
* clc
.9 rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.GetFD sta hFILE
2021-07-25 14:03:41 +00:00
tax
phx
lda hFDs.hName-1,x
>SYSCALL2 GetMemPtr
>STYA pPath
plx
lda hFDs-1,x
>SYSCALL2 GetMemPtr
>STYA pFD
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.FreeFD pha
lda hFD
>SYSCALL2 FreeMem
2023-01-17 06:31:23 +00:00
2021-07-25 14:03:41 +00:00
ldx hFILE
stz hFDs-1,x
2023-01-17 06:31:23 +00:00
pla
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.RWGetFidOfs ldx #6
ldy #S.FD.REG.REF
.1 lda (pFD),y
pha
iny
dex
bne .1
ldx #6
ldy #S.NETBIOS+S.SMB.H+5+5
.2 pla
sta (ZPReqPtr),y
dey
dex
bne .2
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.RWSetPFosY phy
2021-07-25 14:03:41 +00:00
ldy #4 hFILE
lda (pStack),y
2023-01-17 06:31:23 +00:00
jsr IO.GetFD
ply Count LO
phy
lda (ZPRespPtr),y
2023-01-17 06:31:23 +00:00
ldy #S.FD.REG.FPOS
clc
adc (pFD),y
sta (pFD),y
ply
iny Count HI
lda (ZPRespPtr),y
2021-06-30 19:09:07 +00:00
2023-01-17 06:31:23 +00:00
ldy #S.FD.REG.FPOS+1
adc (pFD),y
sta (pFD),y
bcc .8
2021-06-30 19:09:07 +00:00
iny
lda (pFD),y
inc
sta (pFD),y
bne .8
2021-06-30 19:09:07 +00:00
iny
lda (pFD),y
inc
sta (pFD),y
.8 rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.CopyXPtr1Ptr2
ldy #0
.1 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
dex
bne .1
2021-06-30 19:09:07 +00:00
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.AddA2Ptr1 adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
IO.StatBuf2Ptr2 ldy #S.STAT-1
.1 lda StatBuf,y
sta (ZPPtr2),y
dey
bpl .1
rts
*--------------------------------------
IO.AddSTAT2Ptr2 lda #S.STAT
clc
*--------------------------------------
IO.AddA2Ptr2 adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
IO.Seek0 ldy #S.FD.REG.FPOS+3
lda #0
2021-06-30 19:09:07 +00:00
.1 sta (pFD),y
2023-01-17 06:31:23 +00:00
dey
cpy #S.FD.REG.FPOS-1
bne .1
2021-06-30 19:09:07 +00:00
rts
*--------------------------------------
2023-01-17 06:31:23 +00:00
IO.ReadSocket stz hResp
lda hSocket
ldx #LIBTCPIP.Recv
jsr IO.GoLIBTCPIP
clv
bcc .8
cmp #E.NODATA
bne .99
lda TimeOut
beq .98
bit .99 set V
lda #0
sec
rts
.98 lda #MLI.E.OFFLINE
sec
.99 rts
.8 jmp CORE.GetRespData
*--------------------------------------
IO.WriteSocket >PUSHB hSocket
>PUSHW ZPReqPtr
>PUSHW ZPReqLen
ldx #LIBTCPIP.Send
*--------------------------------------
IO.GoLIBTCPIP jmp (pLIBTCPIP)
*--------------------------------------
IO.FileInfo2StatBuf
ldx #S.STAT-1
.1 stz StatBuf,x
dex
bpl .1
ldy #0 Creation Date/Time
ldx #S.STAT.CTIME
jsr IO.FileInfo2StatBufDT
ldy #4 Last Access Date/Time
ldx #S.STAT.ATIME
jsr IO.FileInfo2StatBufDT
ldy #8 Last Write Date/Time
ldx #S.STAT.MTIME
jsr IO.FileInfo2StatBufDT
ldy #12+3 Data Size
ldx #3
.7 lda (ZPPtr1),y
sta StatBuf+S.STAT.SIZE,x
dey
dex
bpl .7
ldy #20 File Attribute
lda (ZPPtr1),y
and #$10
beq .8
lda /S.STAT.MODE.DIR
sta StatBuf+S.STAT.MODE+1
.8 rts
*--------------------------------------
* YYYYYYYM MMM DDDDD
* HHHHHmmm mmm SSSSS
*--------------------------------------
IO.FileInfo2StatBufDT
iny
lda (ZPPtr1),y
lsr
php
clc
adc #80
sta StatBuf+S.TIME.YEAR,x
lda #19
adc #0
sta StatBuf+S.TIME.CENTURY,x
dey
plp
lda (ZPPtr1),y
ror
lsr
lsr
lsr
lsr
sta StatBuf+S.TIME.MONTH,x
lda (ZPPtr1),y
and #$1F
sta StatBuf+S.TIME.DAY,x
iny
iny
lda (ZPPtr1),y
and #$1F
asl
sta StatBuf+S.TIME.SECOND,x
lda (ZPPtr1),y
and #$E0
sta StatBuf+S.TIME.MINUTE,x
iny
2023-01-17 06:31:23 +00:00
lda (ZPPtr1),y
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr StatBuf+S.TIME.MINUTE,x
lsr StatBuf+S.TIME.MINUTE,x
sta StatBuf+S.TIME.HOUR,x
* TODO : S.TIME.WDAY
rts
*--------------------------------------
IO.IsHexDigit jsr IO.IsDigit
bcc .8
cmp #'A'
bcc .9
cmp #'F'+1
bcc .1
cmp #'a'
bcc .9
cmp #'f'+1
bcs .99
eor #$20
.1
* clc
sbc #'A'-11 cc so A->10 (11-CC)
clc
.8 rts
.9 sec
.99 rts
*--------------------------------------
IO.IsDigit cmp #'0'
bcc .9
cmp #'9'+1
bcs .99
and #$0F
* clc
rts
.9 sec
.99 rts
*--------------------------------------
2021-05-19 12:44:47 +00:00
MAN
2023-01-17 06:31:23 +00:00
SAVE usr/src/sbin/cifsd.s.io
LOAD usr/src/sbin/cifsd.s
2021-05-19 12:44:47 +00:00
ASM