A2osX/LIB/LIBCIFS.S.IO.txt

1316 lines
19 KiB
Plaintext
Raw Normal View History

2021-05-19 12:44:47 +00:00
NEW
AUTO 3,1
*--------------------------------------
CIFS.ChTyp
CIFS2.ChTyp
*--------------------------------------
CIFS.ChMod
2021-07-10 19:09:43 +00:00
CIFS2.ChMod
2021-05-19 12:44:47 +00:00
*--------------------------------------
2021-07-10 19:09:43 +00:00
CIFS.FStat
2021-05-19 12:44:47 +00:00
*--------------------------------------
2021-07-10 19:09:43 +00:00
CIFS2.FStat lda #MLI.E.BADCALL
2021-05-19 12:44:47 +00:00
sec
rts
*--------------------------------------
CIFS.Stat >STYA pPath resolved path
2021-06-27 13:48:04 +00:00
* jsr ClearSocket
2021-06-17 17:38:34 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCTX
2021-06-17 17:38:34 +00:00
jsr RequestT2SetupX
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
2021-06-17 17:38:34 +00:00
jsr ReqT2SetupPtr2
2021-05-19 12:44:47 +00:00
2021-06-17 17:38:34 +00:00
jsr AppendPathPtr2
2021-07-10 19:09:43 +00:00
jsr AddYReqLenPtr2
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
jsr SetT2ReqLen
2021-06-11 17:20:35 +00:00
jsr WriteSocket
2021-05-19 12:44:47 +00:00
bcs .9
jmp Sleep
.9 >RET 4
*--------------------------------------
CIFS2.Stat jsr ReadSocket
bcs .9
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
2021-06-30 19:09:07 +00:00
lda #MLI.E.INVPATH Return this for stat() match ProDOS Behavior
2021-06-19 17:46:36 +00:00
bcs .90
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
jsr GetRespDataPtr1
2021-06-17 17:38:34 +00:00
jsr FileInfo2StatBuf
>PULLW ZPPtr2 Stat Buffer
2021-05-19 12:44:47 +00:00
inc pStack Skip Filename
inc pStack
jsr StatBuf2Ptr2
2021-06-19 17:46:36 +00:00
jmp Exit.OK
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
.9 jsr Exit.NODATA
beq .99
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
.90 >POP 4
2021-05-19 12:44:47 +00:00
2021-06-30 19:09:07 +00:00
.99 rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
CIFS.MKDir >STYA pPath resolved path
2021-06-27 13:48:04 +00:00
* jsr ClearSocket
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCtx
2021-06-17 17:38:34 +00:00
jsr RequestT2SetupX
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
jsr AppendPath
lda #0
sta (ZPReqPtr),y
iny
jsr SetT2ReqLenYA
2021-06-11 17:20:35 +00:00
jsr WriteSocket
2021-05-19 12:44:47 +00:00
bcs .9
jmp Sleep
.9 >RET 4
*--------------------------------------
CIFS2.MKDir jsr ReadSocket
bcs .9
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
bcs .90
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
jmp Exit.OK
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
.9 jsr Exit.NODATA
beq .99
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
.90 >POP 4
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
.99 rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
CIFS.OpenDir >STYA pPath resolved path
2021-07-25 14:03:41 +00:00
jsr CIFS.NewFD
2021-05-19 12:44:47 +00:00
bcs .9
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
bcc .9
jsr CIFS.FreeFD
2021-07-25 14:03:41 +00:00
stz CIFS.Status
sec
2021-05-19 12:44:47 +00:00
.9 rts
*--------------------------------------
CIFS2.OpenDir lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.ReadDir jsr CIFS.GetFD
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
* jsr ClearSocket
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCtx
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
rts
.1 iny
lda (pFD),y
iny
ora (pFD),y
bne CIFS.ReadDir.Next
jsr RequestT2SetupX
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
bra CIFS.ReadDir.Send
CIFS.ReadDir.Next
jsr RequestT2SetupX
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
CIFS.ReadDir.Send
lda (pPath)
beq .1
jsr AppendPath
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
jsr SetT2ReqLenYA
2021-06-11 17:20:35 +00:00
jsr WriteSocket
2021-05-19 12:44:47 +00:00
bcs .9
jmp Sleep
.9 rts
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS2.ReadDir jsr CIFS.GetFD
2021-05-19 12:44:47 +00:00
jsr ReadSocket
2021-06-19 17:46:36 +00:00
bcs .9
2021-05-19 12:44:47 +00:00
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
bcs .90
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
2021-06-19 17:46:36 +00:00
beq .90
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
2021-06-19 17:46:36 +00:00
.2 jsr GetRespDataPtr1
2021-05-19 12:44:47 +00:00
jsr CIFS2.ReadDir.GetBuf
2021-06-19 17:46:36 +00:00
bcs .99
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
jsr GetRespDataPtr1
2021-05-19 12:44:47 +00:00
jsr CIFS2.ReadDir.FillBuf
jsr Exit.OK
2021-06-30 19:09:07 +00:00
2021-05-19 12:44:47 +00:00
>LDYA BufPtr
ldx hBuf
2021-06-17 17:38:34 +00:00
2021-05-19 12:44:47 +00:00
clc
2021-06-19 17:46:36 +00:00
.90 rts
2021-05-19 12:44:47 +00:00
2021-06-19 17:46:36 +00:00
.9 jmp Exit.NODATA
2021-05-19 12:44:47 +00:00
.99 stz CIFS.Status
jmp FreeRespData
2021-05-19 12:44:47 +00:00
*--------------------------------------
CIFS2.ReadDir.GetBuf
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
beq .99
tax
lda #1 +Ending 0
sta ZPPtr2
stz ZPPtr2+1
2021-06-27 13:48:04 +00:00
.1 jsr 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
2021-06-27 13:48:04 +00:00
jsr 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
2021-06-27 13:48:04 +00:00
jsr 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
2021-06-27 13:48:04 +00:00
jsr 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
bcs .9
>STYA BufPtr
>STYA ZPPtr2
stx hBuf
.9 rts
.99 lda #MLI.E.EOF
sec
rts
*--------------------------------------
CIFS2.ReadDir.FillBuf
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
jsr 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
2021-06-27 13:48:04 +00:00
jsr AddA2Ptr1
2021-06-30 19:09:07 +00:00
lda (ZPPtr1)
tax Save Filename Len
inc ZPPtr1 Skip Filename Len
bne .2
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
2021-06-27 13:48:04 +00:00
jsr AddA2Ptr1
2021-05-19 12:44:47 +00:00
2021-06-30 19:09:07 +00:00
txa
sec
sbc #4 "x.EXT" ?
bcc .7
tay
lda (ZPPtr2),y
cmp #'.'
bne .7
ldx #0
.4 phy Y = '.' offset
phx
2021-07-10 19:09:43 +00:00
.5 iny
lda (ZPPtr2),y
beq .51
cmp #'A'
bcc .50
cmp #'Z'+1
bcs .50
eor #$20
.50 cmp PRODOS.FT.TXT,x
2021-06-30 19:09:07 +00:00
bne .6
inx
2021-07-10 19:09:43 +00:00
bra .5
2021-06-30 19:09:07 +00:00
2021-07-10 19:09:43 +00:00
.51 pla
2021-06-30 19:09:07 +00:00
lsr
lsr
tax
lda PRODOS.FT.HEX,x
sta StatBuf+S.STAT.P.TYPE
ply
lda #0
sta (ZPPtr2),y
2021-06-27 13:48:04 +00:00
tya
2021-07-10 19:09:43 +00:00
bra .70
2021-06-30 19:09:07 +00:00
.6 pla
clc
adc #4
tax
ply
cpx #PRODOS.FT.END
bne .4
2021-07-10 19:09:43 +00:00
tya
* sec
adc #3
bra .70
2021-06-30 19:09:07 +00:00
.7 txa
2021-07-10 19:09:43 +00:00
.70 sec +\0
2021-06-27 13:48:04 +00:00
jsr AddA2Ptr2
2021-06-30 19:09:07 +00:00
2021-06-27 13:48:04 +00:00
jsr StatBuf2Ptr2
2021-05-19 12:44:47 +00:00
2021-06-27 13:48:04 +00:00
jsr AddSTAT2Ptr2
2021-05-19 12:44:47 +00:00
2021-06-30 19:09:07 +00:00
.8 plx
2021-06-27 13:48:04 +00:00
dex
2021-05-19 12:44:47 +00:00
bne .1
lda #0
sta (ZPPtr2)
rts
*--------------------------------------
CIFS.CloseReg
2021-05-19 12:44:47 +00:00
CIFS.CloseDir tax
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
stz CIFS.Status
clc
rts
*--------------------------------------
CIFS2.CloseDir lda #MLI.E.INVPATH
sec
rts
*--------------------------------------
CIFS.ChOwn
CIFS2.ChOwn
lda #MLI.E.BADCALL
sec
rts
2021-06-05 15:48:54 +00:00
*--------------------------------------
2021-06-06 19:06:49 +00:00
CIFS.FOpen >STYA pPath resolved path
2021-06-05 15:48:54 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCtx
2021-06-11 17:20:35 +00:00
2021-06-06 19:06:49 +00:00
ldx #S.SMB.H.CMD.NT.CREATE.ANDX
jsr RequestSetupX
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
2021-06-17 17:38:34 +00:00
jsr ReqSetupPtr2
2021-07-10 19:09:43 +00:00
ldy #2
lda (pStack),y TYPE
pha
2021-06-17 17:38:34 +00:00
jsr AppendPathPtr2
2021-07-10 19:09:43 +00:00
pla
beq .2
jsr AppendTypePtr2
.2 jsr 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
2021-06-17 17:38:34 +00:00
inc +1 for \0
2021-07-10 19:09:43 +00:00
jsr 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
jsr SetReqLen
2021-06-11 17:20:35 +00:00
jsr WriteSocket
2021-06-06 19:06:49 +00:00
bcs .9
jmp Sleep
.9 >RET 6
*--------------------------------------
CIFS2.FOpen jsr ReadSocket
bcs .9
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
bcs .90
2021-06-22 18:59:02 +00:00
jsr CIFS.NewFD
2021-06-19 17:46:36 +00:00
bcs .91
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
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
ldy #S.FD.REG.REF+2
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
bra .8
2021-06-30 19:09:07 +00:00
.3 jsr CIFS.Seek0
2021-06-06 19:06:49 +00:00
.8 ldy #4 path
2021-05-22 21:05:12 +00:00
2021-06-06 19:06:49 +00:00
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
2021-06-17 17:38:34 +00:00
2021-06-06 19:06:49 +00:00
>PUSHWZ mod
>PUSHB hFD
2021-06-06 19:06:49 +00:00
>SYSCALL2 mknod
bcc .91
jsr CIFS.FreeFD
sec
2021-05-22 21:05:12 +00:00
.91 stz CIFS.Status
2021-07-25 14:03:41 +00:00
jsr FreeRespData
2021-06-19 17:46:36 +00:00
bra .90
2021-06-06 19:06:49 +00:00
2021-06-19 17:46:36 +00:00
.9 jsr Exit.NODATA
beq .99
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
.90 >POP 6
2021-06-22 18:59:02 +00:00
2021-06-19 17:46:36 +00:00
.99 rts
2021-06-06 19:06:49 +00:00
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.FClose jsr CIFS.GetFD
2021-06-06 19:06:49 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCtx
2021-06-17 17:38:34 +00:00
2021-06-06 19:06:49 +00:00
ldx #S.SMB.H.CMD.CLOSE
jsr RequestSetupX
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
2021-06-17 17:38:34 +00:00
jsr SetReqLen
2021-05-22 21:05:12 +00:00
2021-06-11 17:20:35 +00:00
jsr WriteSocket
2021-05-22 21:05:12 +00:00
bcs .9
jmp Sleep
2021-06-06 19:06:49 +00:00
.9 rts
2021-05-22 21:05:12 +00:00
*--------------------------------------
2021-06-06 19:06:49 +00:00
CIFS2.FClose sta hFILE
jsr ReadSocket
2021-05-22 21:05:12 +00:00
bcs .9
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
bcs .99
2021-06-17 17:38:34 +00:00
2021-06-19 17:46:36 +00:00
lda hFILE
jsr CIFS.CloseReg
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
jmp Exit.OK
2021-05-22 21:05:12 +00:00
2021-06-19 17:46:36 +00:00
.9 jmp Exit.NODATA
2021-05-22 21:05:12 +00:00
2021-06-19 17:46:36 +00:00
.99 rts
2021-05-19 12:44:47 +00:00
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.FRead ldy #4 hFILE
2021-06-22 18:59:02 +00:00
lda (pStack),y
2021-07-25 14:03:41 +00:00
jsr CIFS.GetFD
2021-06-22 18:59:02 +00:00
jsr GetCtx
ldx #S.SMB.H.CMD.READ.ANDX
jsr RequestSetupX
ldx #0
.1 lda SMB.ComRead.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComRead.H.Len
bne .1
jsr ReqSetupPtr2
jsr CIFS.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
2021-06-22 18:59:02 +00:00
jsr SetReqLen
jsr WriteSocket
bcs .9
jmp Sleep
.9 >RET 5
2021-06-06 19:06:49 +00:00
*--------------------------------------
2021-06-22 18:59:02 +00:00
CIFS2.FRead jsr ReadSocket
bcs .9
jsr GetRespData
jsr CheckSMBStatus
bcs .90
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
jsr Exit.OK
2021-06-30 19:09:07 +00:00
lda #MLI.E.EOF
sec
bra .90
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
jsr CIFS.CopyX
2021-06-30 19:09:07 +00:00
ldy #S.NETBIOS+S.SMB.H+11
jsr CIFS2.RWSetOfsY
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
.7 jsr Exit.OK
ldy #1 DataLen HI
lda (pStack),y
ora (pStack) DataLen LO
bne .8
2021-06-30 19:09:07 +00:00
>LDYA CIFS.Cnt
2021-06-30 19:09:07 +00:00
bra .90
2021-06-22 18:59:02 +00:00
.8 jmp Sleep2 Back to CIFS.FRead for next chunk
2021-06-22 18:59:02 +00:00
.9 jsr Exit.NODATA
beq .99
.90 >POP 5
.99 rts
2021-06-06 19:06:49 +00:00
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.FWrite ldy #4 hFILE
2021-06-11 17:20:35 +00:00
lda (pStack),y
2021-06-17 17:38:34 +00:00
2021-07-25 14:03:41 +00:00
jsr CIFS.GetFD
2021-06-17 17:38:34 +00:00
2021-06-19 17:46:36 +00:00
jsr GetCtx
2021-06-11 17:20:35 +00:00
ldx #S.SMB.H.CMD.WRITE.ANDX
jsr RequestSetupX
ldx #0
.1 lda SMB.ComWrite.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComWrite.H.Len
bne .1
2021-06-17 17:38:34 +00:00
jsr ReqSetupPtr2
2021-06-30 19:09:07 +00:00
jsr CIFS.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
jsr CIFS.CopyX
2021-06-30 19:09:07 +00:00
2021-06-11 17:20:35 +00:00
jsr SetReqLen
jsr WriteSocket
bcs .9
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
2021-06-19 17:46:36 +00:00
jmp 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
2021-06-19 17:46:36 +00:00
jmp Sleep
2021-06-11 17:20:35 +00:00
.9 >RET 5
2021-06-06 19:06:49 +00:00
*--------------------------------------
2021-06-19 17:46:36 +00:00
CIFS2.FWrite jsr ReadSocket
2021-06-11 17:20:35 +00:00
bcs .9
jsr GetRespData
2021-06-19 17:46:36 +00:00
jsr CheckSMBStatus
bcs .90
2021-06-17 17:38:34 +00:00
ldy #S.NETBIOS+S.SMB.H+5 Count LO
jsr CIFS2.RWSetOfsY
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
.7 jsr Exit.OK
ldy #1 DataLen HI
2021-06-17 17:38:34 +00:00
lda (pStack),y
ora (pStack) DataLen LO
2021-06-11 17:20:35 +00:00
bne .8
2021-06-30 19:09:07 +00:00
>LDYA CIFS.Cnt
clc
bra .90
2021-06-22 18:59:02 +00:00
2021-06-30 19:09:07 +00:00
.8 jmp Sleep2
2021-06-11 17:20:35 +00:00
2021-06-19 17:46:36 +00:00
.9 jsr Exit.NODATA
beq .99
2021-06-11 17:20:35 +00:00
2021-06-19 17:46:36 +00:00
.90 >POP 5
.99 rts
2021-06-06 19:06:49 +00:00
*--------------------------------------
CIFS.FFlush clc Nothing to do
rts
*--------------------------------------
2021-05-19 12:44:47 +00:00
CIFS2.FFlush
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.FSeek ldy #5 hFILE
lda (pStack),y
2021-07-25 14:03:41 +00:00
jsr CIFS.GetFD
>PULLA
tax whence
2021-07-25 14:03:41 +00:00
>PULLL ZPPtr1 ZPPtr2
inc pStack
clc
rts
*--------------------------------------
2021-05-19 12:44:47 +00:00
CIFS2.FSeek
*--------------------------------------
2021-05-19 12:44:47 +00:00
CIFS.FTell
*--------------------------------------
2021-05-19 12:44:47 +00:00
CIFS2.FTell
*--------------------------------------
2021-05-19 12:44:47 +00:00
CIFS.FEOF
*--------------------------------------
2021-07-10 19:09:43 +00:00
CIFS2.FEOF lda #MLI.E.BADCALL
2021-05-19 12:44:47 +00:00
sec
rts
*--------------------------------------
2021-06-19 17:46:36 +00:00
CIFS.Remove >STYA pPath resolved path
2021-06-27 13:48:04 +00:00
* jsr ClearSocket
2021-06-19 17:46:36 +00:00
jsr GetCTX
2021-06-19 17:46:36 +00:00
ldx #S.SMB.H.CMD.DELETE
jsr RequestSetupX
ldx #0
.1 lda SMB.ComDelete.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComDelete.H.Len
bne .1
jsr ReqSetupPtr2
lda #$04 BufferFormat
jsr PutBytePtr2
jsr AppendPathPtr2
2022-03-18 17:59:39 +00:00
jsr 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
2021-06-19 17:46:36 +00:00
jsr SetReqLen
jsr WriteSocket
bcs .9
jmp Sleep
.9 rts
*--------------------------------------
CIFS2.Remove jsr ReadSocket
bcs .9
jsr GetRespData
jsr CheckSMBStatus
bcs .99
jmp Exit.OK
.9 jmp Exit.NODATA
.99 rts
*--------------------------------------
CIFS.Rename >STYA pPath resolved src path
2021-06-27 13:48:04 +00:00
* jsr ClearSocket
2021-06-19 17:46:36 +00:00
jsr GetCTX
2021-06-30 19:09:07 +00:00
2021-06-19 17:46:36 +00:00
ldx #S.SMB.H.CMD.RENAME
jsr RequestSetupX
ldx #0
.1 lda SMB.ComRename.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.ComRename.H.Len
bne .1
jsr ReqSetupPtr2
lda #$04 BufferFormat
jsr PutBytePtr2
jsr AppendPathPtr2
tya
inc +1 for BufferFormat
inc +1 for \0
jsr 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
lda #$04 BufferFormat
jsr PutBytePtr2
jsr 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
jsr SetReqLen
jsr WriteSocket
bcs .9
jmp Sleep
.9 >RET 4
*--------------------------------------
CIFS2.Rename jsr ReadSocket
bcs .9
jsr GetRespData
jsr CheckSMBStatus
bcs .99
2021-06-22 18:59:02 +00:00
jsr Exit.OK
bra .99
2021-06-19 17:46:36 +00:00
.9 jmp Exit.NODATA
.99 >RET 4
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.NewFD ldx #1
.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
2021-07-25 14:03:41 +00:00
txa
ldx hFILE
sta hFDs-1,x
stz hFDs.hName-1,x
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
* clc
.9 rts
*--------------------------------------
2021-07-25 14:03:41 +00:00
CIFS.GetFD sta hFILE
tax
phx
lda hFDs.hName-1,x
>SYSCALL2 GetMemPtr
>STYA pPath
plx
lda hFDs-1,x
>SYSCALL2 GetMemPtr
>STYA pFD
rts
*--------------------------------------
CIFS.FreeFD pha
lda hFD
>SYSCALL2 FreeMem
2021-07-25 14:03:41 +00:00
ldx hFILE
stz hFDs-1,x
pla
rts
*--------------------------------------
CIFS.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
*--------------------------------------
CIFS2.RWSetOfsY phy
2021-07-25 14:03:41 +00:00
ldy #4 hFILE
lda (pStack),y
2021-07-25 14:03:41 +00:00
jsr CIFS.GetFD
ply Count LO
phy
lda (ZPRespPtr),y
ldy #S.FD.REG.REF+2
clc
adc (pFD),y
sta (pFD),y
ply
iny Count HI
lda (ZPRespPtr),y
2021-06-30 19:09:07 +00:00
ldy #S.FD.REG.REF+3
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
*--------------------------------------
CIFS.CopyX ldy #0
.1 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
dex
bne .1
2021-06-30 19:09:07 +00:00
rts
*--------------------------------------
CIFS.Seek0 ldx #4
ldy #S.FD.REG.REF+2
lda #0
2021-06-30 19:09:07 +00:00
.1 sta (pFD),y
iny
dex
bne .1
2021-06-30 19:09:07 +00:00
rts
*--------------------------------------
2021-05-19 12:44:47 +00:00
MAN
SAVE usr/src/lib/libcifs.io.s
LOAD usr/src/lib/libcifs.s
ASM