A2osX/SYS/KERNEL.S.IO.txt
2018-06-21 17:12:10 +02:00

90 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*--------------------------------------
IO.SELECT jsr K.GetMemPtr
>STYA pNode
rts
*--------------------------------------
IO
*--------------------------------------
IO.WRITE lda (pNode) #S.NODE.T
tax
*--------------------------------------
jmp (.1,x)
.1 .DA IO.WRITE.REG
.DA STDIO.IOERR DIR
.DA IO.WRITE.CDEV
.DA STDIO.IOERR BDEV
.DA STDIO.IOERR LNK
.DA STDIO.IOERR DSOCK
.DA IO.WRITE.SSOCK
.DA IO.WRITE.FIFO
*--------------------------------------
IO.WRITE.REG >PUSHW K.S.IOCTL+S.IOCTL.BUFPTR
>PUSHW K.S.IOCTL+S.IOCTL.BYTECNT
ldy #S.NODE.REG.REF
>PUSHB (pNode),y
jmp K.FWrite
*--------------------------------------
IO.WRITE.CDEV ldy #S.NODE.DEV.JMP
lda (pNode),y
sta .1+1
iny
lda (pNode),y
sta .1+2
lda K.IOBuf
ldx #IOCTL.WRITE
.1 jmp $ffff
*--------------------------------------
IO.WRITE.SSOCK lda (pNode) #S.NODE.HANDLER
jsr K.GetMemPtr
>STYA .1
ldy #S.NODE.SSOCK.HSKT
>PUSHB (pNode),y
>PUSHB K.IOBuf
ldy #S.NODE.SSOCK.WRITE
lda (pNode),y
tax Function Offset for write
.1 jmp $ffff
*--------------------------------------
IO.WRITE.FIFO ldy #S.NODE.FIFO.S
lda (pNode),y
beq .9 Remote PS did not opened yet the pipe
cmp #S.NODE.FIFO.S.Closed
beq .99 Remote PS closed the Pipe
ldy #S.NODE.FIFO.hMem
lda (pNode),y
jsr K.GetMemPtr
>STYA .1+2
ldy #S.NODE.FIFO.Head
lda (pNodae),y
inc
dey #S.NODE.FIFO.Tail
cmp (pNode),y
beq .9 FIFO is full
iny
sta (pNode),y
tay
lda K.IOBuf
.1 sta $ffff,y
clc
rts
.9 lda #MLI.E.VOLFULL
.HS 2C bit abs
.99 lda #MLI.E.EOF
sec
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.IO
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM