2019-07-27 20:51:39 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.PIPE.SRCBUF .EQ ZPDRV
|
|
|
|
|
IO.PIPE.DSTBUF .EQ ZPDRV+2
|
|
|
|
|
IO.PIPE.CNT .EQ ZPDRV+4
|
|
|
|
|
IO.PIPE.BASEH .EQ ZPDRV+6
|
|
|
|
|
IO.PIPE.BUFH .EQ ZPDRV+7
|
|
|
|
|
IO.PIPE.SIZEH .EQ ZPDRV+8
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.OPEN.PIPE ldy #S.FD.PIPE.S
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
lda IO.hFD
|
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.CLOSE.PIPE ldy #S.FD.PIPE.S
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
bmi .1 remote PS closed its end
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 jsr IO.CLOSE.NOD
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.hMem
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
beq .2
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL2 FreeStkObj
|
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.2 lda IO.hFD
|
|
|
|
|
jmp K.FreeMem
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* (pStack)+2 count
|
|
|
|
|
* (pStack)+0 buf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.WRITE.PIPE ldy #S.FD.PIPE.S
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
|
|
|
|
|
bpl .10
|
|
|
|
|
jmp IO.READ.PIPE.EOF Remote PS closed the Pipe
|
|
|
|
|
|
|
|
|
|
.10 ldy #S.FD.PIPE.Free
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
ldy #2
|
|
|
|
|
cmp (pStack),y
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Free+1
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
ldy #3
|
|
|
|
|
sbc (pStack),y
|
|
|
|
|
bcc IO.READ.PIPE.NODATA not enough room in PIPE
|
|
|
|
|
|
|
|
|
|
>PULLW IO.PIPE.SRCBUF
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Head+1
|
|
|
|
|
jsr IO.PIPE.GET.BUF
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
>STYA IO.PIPE.DSTBUF
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
>PULLA get cnt lo
|
|
|
|
|
sta IO.PIPE.CNT
|
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
>PULLA get cnt hi
|
|
|
|
|
sta IO.PIPE.CNT+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
pha
|
|
|
|
|
ldy #S.FD.PIPE.Head
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
sta SETWRITEAUX
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.1 inx
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
beq .8
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
pha
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.2 lda (IO.PIPE.SRCBUF)
|
|
|
|
|
sta (IO.PIPE.DSTBUF),y
|
|
|
|
|
|
|
|
|
|
inc IO.PIPE.SRCBUF
|
|
|
|
|
bne .4
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
inc IO.PIPE.SRCBUF+1
|
|
|
|
|
.4 iny
|
|
|
|
|
bne .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda IO.PIPE.BUFH
|
|
|
|
|
inc
|
|
|
|
|
cmp IO.PIPE.SIZEH
|
|
|
|
|
beq .6
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta IO.PIPE.BUFH
|
|
|
|
|
inc IO.PIPE.DSTBUF+1
|
|
|
|
|
bra .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.6 stz IO.PIPE.BUFH
|
|
|
|
|
lda IO.PIPE.BASEH Pipe Buffer Base
|
|
|
|
|
sta IO.PIPE.DSTBUF+1
|
|
|
|
|
bra .1
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
|
|
|
|
.8 sta CLRWRITEAUX
|
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
tya
|
|
|
|
|
ldy #S.FD.PIPE.Head
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
lda IO.PIPE.BUFH
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
ldy #S.FD.PIPE.Free
|
|
|
|
|
jsr IO.PIPE.SUB.CNT
|
|
|
|
|
|
|
|
|
|
iny #S.FD.PIPE.Used
|
|
|
|
|
|
|
|
|
|
jsr IO.PIPE.ADD.CNT
|
|
|
|
|
jmp IO.READ.PIPE.EXIT
|
|
|
|
|
|
|
|
|
|
IO.READ.PIPE.EOF
|
|
|
|
|
lda #MLI.E.EOF
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
IO.READ.PIPE.NODATA
|
|
|
|
|
lda #E.NODATA
|
|
|
|
|
sec
|
|
|
|
|
>RET 4
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.READ.PIPE ldy #S.FD.PIPE.Used+1
|
|
|
|
|
lda (pFD),y Data ?
|
|
|
|
|
dey
|
|
|
|
|
ora (pFD),y
|
|
|
|
|
bne .10 yes...
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
ldy #S.FD.PIPE.S
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
bmi IO.READ.PIPE.EOF Remote PS closed the Pipe
|
|
|
|
|
bpl IO.READ.PIPE.NODATA
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.10 >PULLW IO.PIPE.DSTBUF get dest buf
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Tail+1
|
|
|
|
|
jsr IO.PIPE.GET.BUF
|
|
|
|
|
|
|
|
|
|
>STYA IO.PIPE.SRCBUF
|
|
|
|
|
|
|
|
|
|
>PULLA get cnt lo
|
|
|
|
|
tax
|
|
|
|
|
ldy #S.FD.PIPE.Used
|
|
|
|
|
cmp (pFD),y
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
>PULLA get cnt hi
|
|
|
|
|
pha
|
|
|
|
|
iny #S.FD.PIPE.Used+1
|
|
|
|
|
sbc (pFD),y
|
|
|
|
|
pla
|
|
|
|
|
bcc .12 cnt < Used
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
tax
|
|
|
|
|
iny
|
|
|
|
|
lda (pFD),y X,A = Used
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.12 stx IO.PIPE.CNT
|
|
|
|
|
sta IO.PIPE.CNT+1
|
|
|
|
|
|
|
|
|
|
eor #$ff
|
|
|
|
|
pha
|
|
|
|
|
txa
|
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
|
|
|
|
ldy #S.FD.PIPE.Tail
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
tay
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta SETREADAUX
|
|
|
|
|
|
|
|
|
|
.1 inx
|
|
|
|
|
bne .2
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
beq .8
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
pha
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.2 lda (IO.PIPE.SRCBUF),y
|
|
|
|
|
sta (IO.PIPE.DSTBUF)
|
|
|
|
|
|
|
|
|
|
inc IO.PIPE.DSTBUF
|
|
|
|
|
bne .4
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
inc IO.PIPE.DSTBUF+1
|
|
|
|
|
.4 iny
|
|
|
|
|
bne .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda IO.PIPE.BUFH
|
|
|
|
|
inc
|
|
|
|
|
cmp IO.PIPE.SIZEH
|
|
|
|
|
beq .6
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta IO.PIPE.BUFH
|
|
|
|
|
inc IO.PIPE.SRCBUF+1
|
|
|
|
|
bra .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.6 stz IO.PIPE.BUFH
|
|
|
|
|
lda IO.PIPE.BASEH
|
|
|
|
|
sta IO.PIPE.SRCBUF+1 Restore Pipe Buf base
|
|
|
|
|
bra .1
|
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
.8 sta CLRREADAUX
|
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
tya
|
|
|
|
|
ldy #S.FD.PIPE.Tail
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
lda IO.PIPE.BUFH
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
ldy #S.FD.PIPE.Free
|
|
|
|
|
jsr IO.PIPE.ADD.CNT
|
|
|
|
|
|
|
|
|
|
iny #S.FD.PIPE.Used
|
|
|
|
|
|
|
|
|
|
jsr IO.PIPE.SUB.CNT
|
2019-10-03 06:25:27 +00:00
|
|
|
|
IO.READ.PIPE.EXIT
|
2019-07-27 20:51:39 +00:00
|
|
|
|
>LDYA IO.PIPE.CNT Y,A = bytes written
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.PIPE.GET.BUF lda (pFD),y
|
|
|
|
|
sta IO.PIPE.BUFH
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Size+1
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
sta IO.PIPE.SIZEH
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.hMem
|
|
|
|
|
lda (pFD),y
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL2 GetStkObjPtr
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
sta IO.PIPE.BASEH Pipe Buffer Base
|
|
|
|
|
* clc
|
|
|
|
|
adc IO.PIPE.BUFH
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.PIPE.ADD.CNT clc
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
adc IO.PIPE.CNT
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
adc IO.PIPE.CNT+1
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.PIPE.SUB.CNT sec
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
sbc IO.PIPE.CNT
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
sbc IO.PIPE.CNT+1
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.EOF.PIPE clc
|
|
|
|
|
ldy #S.FD.PIPE.Used
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
ora (pFD),y
|
|
|
|
|
beq .8
|
|
|
|
|
lda #0
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 lda #$ff
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.PIPE
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
|
|
|
|
ASM
|