mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-30 08:51:06 +00:00
204 lines
4.0 KiB
Plaintext
204 lines
4.0 KiB
Plaintext
|
PR#3
|
|||
|
PREFIX /A2OSX.SRC
|
|||
|
NEW
|
|||
|
INC 1
|
|||
|
AUTO 6
|
|||
|
.LIST OFF
|
|||
|
*/--------------------------------------
|
|||
|
* #FPutCAY
|
|||
|
* Print A (char) to File
|
|||
|
* ##In:
|
|||
|
* A : char to print
|
|||
|
* Y = hFILE
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
*\--------------------------------------
|
|||
|
K.FPutCAY sta K.PutC.Char
|
|||
|
sty K.PutC.Node
|
|||
|
tya
|
|||
|
phy
|
|||
|
bne K.PutCA.1
|
|||
|
K.PutCA.8 ply
|
|||
|
clc
|
|||
|
rts
|
|||
|
*/--------------------------------------
|
|||
|
* #PutCA
|
|||
|
* Print A (char) to StdOut
|
|||
|
* ##In:
|
|||
|
* A : char to print
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
*\--------------------------------------
|
|||
|
K.PutCA sta K.PutC.Char
|
|||
|
phy
|
|||
|
ldy #S.PS.hStdOut
|
|||
|
lda (pPs),y
|
|||
|
beq K.PutCA.8 NUL
|
|||
|
|
|||
|
phx
|
|||
|
|
|||
|
K.PutCA.1 sta K.PutC.Node
|
|||
|
jsr K.GetMemPtrA
|
|||
|
>STYA pDev
|
|||
|
|
|||
|
ldy #S.NODE.T
|
|||
|
lda (pDev),y
|
|||
|
asl
|
|||
|
tax
|
|||
|
jsr K.PutCA.Jmp
|
|||
|
|
|||
|
plx
|
|||
|
ply
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
K.PutCA.Jmp jmp (.1,x)
|
|||
|
.1 .DA K.PutCA.REG
|
|||
|
.DA K.CHR.IOERR DIR
|
|||
|
.DA K.PutCA.CDEV
|
|||
|
.DA K.CHR.IOERR BDEV
|
|||
|
.DA K.CHR.IOERR LNK
|
|||
|
.DA K.CHR.IOERR DSOCK
|
|||
|
.DA K.PutCA.SSOCK
|
|||
|
.DA K.PutCA.FIFO
|
|||
|
*--------------------------------------
|
|||
|
K.PutCA.REG lda K.PutC.Node
|
|||
|
ldy K.PutC.Char
|
|||
|
jmp K.FWriteAY
|
|||
|
*--------------------------------------
|
|||
|
K.PutCA.CDEV ldy #S.NODE.DEV.JMP
|
|||
|
lda (pDev),y
|
|||
|
sta .1+1
|
|||
|
iny
|
|||
|
lda (pDev),y
|
|||
|
sta .1+2
|
|||
|
lda K.PutC.Char
|
|||
|
ldx #DEVMGR.WRITE
|
|||
|
.1 jmp $ffff
|
|||
|
*--------------------------------------
|
|||
|
K.PutCA.SSOCK sec
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
K.PutCA.FIFO ldy #S.NODE.FIFO.S
|
|||
|
lda (pDev),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 (pDev),y
|
|||
|
jsr K.GetMemPtrA
|
|||
|
>STYA .1+2
|
|||
|
|
|||
|
ldy #S.NODE.FIFO.Head
|
|||
|
lda (pDev),y
|
|||
|
inc
|
|||
|
dey #S.NODE.FIFO.Tail
|
|||
|
cmp (pDev),y
|
|||
|
beq .9 FIFO is full
|
|||
|
iny
|
|||
|
sta (pDev),y
|
|||
|
tay
|
|||
|
lda K.PutC.Char
|
|||
|
.1 sta $ffff,y
|
|||
|
clc
|
|||
|
rts
|
|||
|
|
|||
|
.9 lda #MLI.ERR.VOLFULL
|
|||
|
sec
|
|||
|
rts
|
|||
|
|
|||
|
.99 lda #MLI.ERR.EOF
|
|||
|
sec
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
K.PutC.Char .BS 1
|
|||
|
K.PutC.Node .BS 1
|
|||
|
*/--------------------------------------
|
|||
|
* #FGetCA
|
|||
|
* Get char from File
|
|||
|
* ##In:
|
|||
|
* A = hFILE
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
* A = char
|
|||
|
*\--------------------------------------
|
|||
|
K.FGetCA
|
|||
|
*/--------------------------------------
|
|||
|
* #GetC
|
|||
|
* Get char from StdIn
|
|||
|
* ##In:
|
|||
|
* none.
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
* A = char
|
|||
|
*\--------------------------------------
|
|||
|
K.GetC ldy #S.PS.hStdIn
|
|||
|
lda (pPs),y
|
|||
|
|
|||
|
sta K.PutC.Node
|
|||
|
jsr K.GetMemPtrA
|
|||
|
>STYA pDev
|
|||
|
|
|||
|
ldy #S.NODE.T
|
|||
|
lda (pDev),y
|
|||
|
asl
|
|||
|
tax
|
|||
|
jmp (.1,x)
|
|||
|
|
|||
|
.1 .DA K.GetC.REG
|
|||
|
.DA K.CHR.IOERR DIR
|
|||
|
.DA K.GetC.CDEV
|
|||
|
.DA K.CHR.IOERR BDEV
|
|||
|
.DA K.CHR.IOERR LNK
|
|||
|
.DA K.CHR.IOERR DSOCK
|
|||
|
.DA K.GetC.SSOCK
|
|||
|
.DA K.GetC.FIFO
|
|||
|
*--------------------------------------
|
|||
|
K.GetC.REG
|
|||
|
*--------------------------------------
|
|||
|
K.GetC.CDEV ldx #DEVMGR.READ
|
|||
|
ldy #S.NODE.DEV.JMP
|
|||
|
lda (pDev),y
|
|||
|
sta .1+1
|
|||
|
iny
|
|||
|
lda (pDev),y
|
|||
|
sta .1+2
|
|||
|
.1 jmp $ffff
|
|||
|
*--------------------------------------
|
|||
|
K.GetC.SSOCK
|
|||
|
*--------------------------------------
|
|||
|
K.GetC.FIFO
|
|||
|
*/--------------------------------------
|
|||
|
* #FPutS
|
|||
|
* Print String to FILE
|
|||
|
* ##In:
|
|||
|
* PUSHW : CPtr
|
|||
|
* PUSHB : hFILE
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
*\--------------------------------------
|
|||
|
K.FPutS
|
|||
|
*/--------------------------------------
|
|||
|
* #PutSYA
|
|||
|
* Print String to StdOut
|
|||
|
* ##In:
|
|||
|
* Y,A : CPtr
|
|||
|
* ##Out:
|
|||
|
* CC = success
|
|||
|
*\--------------------------------------
|
|||
|
K.PutSYA
|
|||
|
*--------------------------------------
|
|||
|
K.FGetS
|
|||
|
*--------------------------------------
|
|||
|
K.GetSYA
|
|||
|
bra *
|
|||
|
*--------------------------------------
|
|||
|
K.CHR.IOERR lda #MLI.ERR.IO
|
|||
|
sec
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
MAN
|
|||
|
SAVE SYS/KERNEL.S.CHR
|
|||
|
LOAD SYS/KERNEL.S
|
|||
|
ASM
|