2017-01-12 17:43:45 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-03-15 16:44:15 +00:00
|
|
|
|
LOMEM $A00
|
2017-01-12 17:43:45 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # FPutCAY
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* Print A (char) to File
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* A : char to print
|
|
|
|
|
* Y = hFILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.FPutCAY sta K.PutC.Char
|
|
|
|
|
sty K.PutC.Node
|
|
|
|
|
tya
|
|
|
|
|
phy
|
|
|
|
|
bne K.PutCA.1
|
|
|
|
|
K.PutCA.8 ply
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # PutCA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* Print A (char) to StdOut
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* A : char to print
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* 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
|
|
|
|
|
*--------------------------------------
|
2017-03-28 15:46:12 +00:00
|
|
|
|
K.PutCA.SSOCK lda (pDev) #S.NODE.HANDLER
|
|
|
|
|
jsr K.GetMemPtrA
|
|
|
|
|
>STYA .1
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.SSOCK.HSKT
|
|
|
|
|
>PUSHB (pDev),y
|
|
|
|
|
>PUSHB K.PutC.Char
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.SSOCK.WRITE
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
tax Function Offset for write
|
|
|
|
|
.1 jmp $ffff
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # FGetCA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* Get char from File
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* A = hFILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
* A = char
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # GetC
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* Get char from StdIn
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* none.
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
* A = char
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.GetC ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
|
2017-03-28 15:46:12 +00:00
|
|
|
|
K.FGetCA sta K.PutC.Node
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-03-28 15:46:12 +00:00
|
|
|
|
K.GetC.REG lda K.PutC.Node
|
|
|
|
|
jmp K.FReadA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-03-28 15:46:12 +00:00
|
|
|
|
K.GetC.SSOCK lda (pDev) #S.NODE.HANDLER
|
|
|
|
|
jsr K.GetMemPtrA
|
|
|
|
|
>STYA .1
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.SSOCK.READ
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
tax Function Offset for READ
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.SSOCK.HSKT
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
|
|
|
|
|
.1 jmp $ffff
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.GetC.FIFO
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # FPutS
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* Write String to FILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* PUSHW : CPtr
|
|
|
|
|
* PUSHB : hFILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.FPutS
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # PutSYA
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* Write String to StdOut
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* Y,A : CPtr
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.PutSYA
|
2017-03-28 15:46:12 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # FGetS
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* Read String From FILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* PUSHW : CPtr
|
|
|
|
|
* PUSHB : hFILE
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.FGetS
|
2017-03-28 15:46:12 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # GetSYA
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* Read String From StdIn
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* Y,A : CPtr
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-03-28 15:46:12 +00:00
|
|
|
|
* CC = success
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.GetSYA
|
|
|
|
|
bra *
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.CHR.IOERR lda #MLI.ERR.IO
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.CHR
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ASM
|