2019-07-27 20:51:39 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
2020-12-15 13:23:22 +00:00
|
|
|
|
PIPE.SRCBUF .EQ ZPDRV
|
|
|
|
|
PIPE.DSTBUF .EQ ZPDRV+2
|
|
|
|
|
PIPE.CNT .EQ ZPDRV+4
|
|
|
|
|
PIPE.BASEH .EQ ZPDRV+6
|
|
|
|
|
PIPE.BUFH .EQ ZPDRV+7
|
|
|
|
|
PIPE.SIZEH .EQ ZPDRV+8
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.OPEN ldy #S.FD.PIPE.S
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
|
|
|
|
lda IO.hDevNod
|
2019-07-27 20:51:39 +00:00
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.CLOSE ldy #S.FD.PIPE.S
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
|
|
|
|
bmi .1 remote PS closed its end
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda #$80
|
|
|
|
|
sta (pFD),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.1 ldy #S.FD.PIPE.hMem
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
|
|
|
|
beq .2
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL2 FreeStkObj
|
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.2 jmp DEV.Destroy
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
* (pStack)+2 buf
|
|
|
|
|
* (pStack)+0 count
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.WRITE ldy #S.FD.PIPE.S
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
|
|
|
|
bpl .10
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jmp PIPE.eEOF Remote PS closed the Pipe
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
.10 ldy #S.FD.PIPE.Free
|
|
|
|
|
lda (pFD),y
|
2021-05-14 20:58:20 +00:00
|
|
|
|
cmp (pStack)
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Free+1
|
|
|
|
|
lda (pFD),y
|
2021-05-14 20:58:20 +00:00
|
|
|
|
ldy #1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sbc (pStack),y
|
2021-05-14 20:58:20 +00:00
|
|
|
|
bcc PIPE.eNODATA not enough room in PIPE
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Head+1
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jsr PIPE.GetBuf
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
>STYA PIPE.DSTBUF
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
>PULLA get cnt lo
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.CNT
|
2019-07-27 20:51:39 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
>PULLA get cnt hi
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.CNT+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
pha
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
|
|
|
|
>PULLW PIPE.SRCBUF
|
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
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
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.2 lda (PIPE.SRCBUF)
|
|
|
|
|
sta (PIPE.DSTBUF),y
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
inc PIPE.SRCBUF
|
2019-07-27 20:51:39 +00:00
|
|
|
|
bne .4
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
inc PIPE.SRCBUF+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.4 iny
|
|
|
|
|
bne .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
lda PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
inc
|
2020-12-15 13:23:22 +00:00
|
|
|
|
cmp PIPE.SIZEH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
beq .6
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.BUFH
|
|
|
|
|
inc PIPE.DSTBUF+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
bra .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.6 stz PIPE.BUFH
|
|
|
|
|
lda PIPE.BASEH Pipe Buffer Base
|
|
|
|
|
sta PIPE.DSTBUF+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
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
|
2020-12-15 13:23:22 +00:00
|
|
|
|
lda PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
|
|
|
|
ldy #S.FD.PIPE.Free
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jsr PIPE.SubCnt
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
iny #S.FD.PIPE.Used
|
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jsr PIPE.AddCnt
|
|
|
|
|
jmp PIPE.EXIT
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.eEOF lda #MLI.E.EOF
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.eNODATA lda #E.NODATA
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sec
|
2021-05-14 20:58:20 +00:00
|
|
|
|
>RET 5
|
2019-07-27 20:51:39 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.READ ldy #S.FD.PIPE.Used+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
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
|
2021-05-14 20:58:20 +00:00
|
|
|
|
bmi PIPE.eEOF Remote PS closed the Pipe
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
bpl PIPE.eNODATA
|
|
|
|
|
|
|
|
|
|
.10 ldy #S.FD.PIPE.Tail+1
|
|
|
|
|
jsr PIPE.GetBuf
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
>STYA PIPE.SRCBUF
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
>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
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.12 stx PIPE.CNT
|
|
|
|
|
sta PIPE.CNT+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
eor #$ff
|
|
|
|
|
pha
|
|
|
|
|
txa
|
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
|
|
|
|
>PULLW PIPE.DSTBUF get dest buf
|
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
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
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.2 lda (PIPE.SRCBUF),y
|
|
|
|
|
sta (PIPE.DSTBUF)
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
inc PIPE.DSTBUF
|
2019-07-27 20:51:39 +00:00
|
|
|
|
bne .4
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
inc PIPE.DSTBUF+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
.4 iny
|
|
|
|
|
bne .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
lda PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
inc
|
2020-12-15 13:23:22 +00:00
|
|
|
|
cmp PIPE.SIZEH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
beq .6
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.BUFH
|
|
|
|
|
inc PIPE.SRCBUF+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
bra .1
|
2020-03-12 07:46:43 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.6 stz PIPE.BUFH
|
|
|
|
|
lda PIPE.BASEH
|
|
|
|
|
sta PIPE.SRCBUF+1 Restore Pipe Buf base
|
2019-07-27 20:51:39 +00:00
|
|
|
|
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
|
2020-12-15 13:23:22 +00:00
|
|
|
|
lda PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
|
|
|
|
ldy #S.FD.PIPE.Free
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jsr PIPE.AddCnt
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
iny #S.FD.PIPE.Used
|
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
jsr PIPE.SubCnt
|
|
|
|
|
|
|
|
|
|
PIPE.EXIT >LDYA PIPE.CNT Y,A = bytes written
|
2021-05-19 12:44:47 +00:00
|
|
|
|
inc pStack Discard hFILE
|
2019-07-27 20:51:39 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.GetBuf lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.FD.PIPE.Size+1
|
|
|
|
|
lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.SIZEH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sta PIPE.BASEH Pipe Buffer Base
|
2019-07-27 20:51:39 +00:00
|
|
|
|
* clc
|
2020-12-15 13:23:22 +00:00
|
|
|
|
adc PIPE.BUFH
|
2019-07-27 20:51:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.AddCnt clc
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
adc PIPE.CNT
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
adc PIPE.CNT+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.SubCnt sec
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sbc PIPE.CNT
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
iny
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda (pFD),y
|
2020-12-15 13:23:22 +00:00
|
|
|
|
sbc PIPE.CNT+1
|
2019-07-27 20:51:39 +00:00
|
|
|
|
sta (pFD),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-05-14 20:58:20 +00:00
|
|
|
|
PIPE.EOF clc
|
2019-07-27 20:51:39 +00:00
|
|
|
|
ldy #S.FD.PIPE.Used
|
|
|
|
|
lda (pFD),y
|
|
|
|
|
iny
|
|
|
|
|
ora (pFD),y
|
|
|
|
|
beq .8
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2019-07-27 20:51:39 +00:00
|
|
|
|
lda #0
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.8 dec lda #$ff
|
2019-07-27 20:51:39 +00:00
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-12-15 13:23:22 +00:00
|
|
|
|
SAVE usr/src/sys/kernel.s.pipe
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2019-07-27 20:51:39 +00:00
|
|
|
|
ASM
|