mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-14 13:29:02 +00:00
-TCP, bugfix (#8) ...nearly working!!! -MKNod API implementation for stream SOCKET -Bugfix in Smartort controller/device detection -Memory leak in CP/MV/RM
224 lines
3.8 KiB
Plaintext
224 lines
3.8 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
*/--------------------------------------
|
||
* # GetDevByIDA
|
||
* ## IN:
|
||
* A = DevID
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = DEVSLOT
|
||
* note: X Unmodified
|
||
*\--------------------------------------
|
||
K.GetDevByIDA cmp DevMgr.Count
|
||
bcs K.GetDevDNF
|
||
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
php
|
||
clc
|
||
adc #DevMgr.Table
|
||
tay
|
||
|
||
plp
|
||
lda #0
|
||
adc /DevMgr.Table
|
||
rts CC
|
||
*/--------------------------------------
|
||
* # GetDevByNameYA
|
||
* ## IN:
|
||
* Y,A = Ptr to device name (PStr)
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* X = DEVID
|
||
* Y,A = DEVSLOT
|
||
*\--------------------------------------
|
||
K.GetDevByNameYA
|
||
>STYA ZPPtr1
|
||
>LDYAI DevMgr.Table+S.DEV.NAME
|
||
>STYA ZPPtr2
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPPtr2)
|
||
cmp (ZPPtr1)
|
||
bne .3
|
||
|
||
tay
|
||
|
||
.2 lda (ZPPtr1),y
|
||
cmp (ZPPtr2),y
|
||
bne .3
|
||
|
||
dey
|
||
bne .2
|
||
|
||
lda ZPPtr2
|
||
sec
|
||
sbc #S.DEV.NAME
|
||
tay
|
||
lda ZPPtr2+1
|
||
sbc /S.DEV.NAME
|
||
clc
|
||
rts
|
||
|
||
.3 lda ZPPtr2
|
||
clc
|
||
adc #S.DEV
|
||
sta ZPPtr2
|
||
bcc .4
|
||
|
||
inc ZPPtr2+1
|
||
|
||
.4 inx
|
||
cpx DevMgr.Count
|
||
bne .1
|
||
|
||
K.GetDevDNF lda #MLI.ERR.NODEV CS from cpx/beq
|
||
rts
|
||
*/--------------------------------------
|
||
* # GetDevStatusA
|
||
* ## IN:
|
||
* A = DevID
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = Ptr to S.DEVINFO
|
||
*\--------------------------------------
|
||
K.GetDevStatusA jsr K.GetDevByIDA
|
||
bcs K.GetDevDNF
|
||
>STYA ZPPtr1
|
||
ldx #DEVMGR.STATUS
|
||
jmp (ZPPtr1)
|
||
*/--------------------------------------
|
||
* # MkNodYA
|
||
* return a hFile for a given Device Name
|
||
* ## IN:
|
||
* Y,A=DevName
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* A = hFILE
|
||
*\--------------------------------------
|
||
K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME
|
||
bcs .9
|
||
>STYA pDev
|
||
stx .1+1
|
||
|
||
ldy #S.DEV.S
|
||
lda (pDev),y
|
||
bit #S.DEV.S.BLOCK
|
||
bne .99
|
||
|
||
txa Pass DEV.ID to OPEN
|
||
ldx #DEVMGR.OPEN
|
||
jsr pDevJmp
|
||
bcs .9
|
||
|
||
>PUSHWI S.NODE.DEV
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
bcs .9
|
||
|
||
>STYA ZPPtr3 Ptr3=S.NODE
|
||
|
||
ldy #S.NODE.T
|
||
lda #S.NODE.T.CDEV
|
||
sta (ZPPtr3),y
|
||
|
||
ldy #S.NODE.DEV.ID
|
||
|
||
.1 lda #$ff Self Modified
|
||
sta (ZPPtr3),y
|
||
|
||
ldy #S.NODE.DEV.JMP
|
||
lda pDev
|
||
sta (ZPPtr3),y
|
||
|
||
iny
|
||
lda pDev+1
|
||
sta (ZPPtr3),y
|
||
txa
|
||
clc
|
||
.9 rts
|
||
|
||
.99 lda #MLI.ERR.IO
|
||
sec
|
||
rts
|
||
*/--------------------------------------
|
||
* # MkNodA
|
||
* return a hFile for a given Socket
|
||
* ## IN:
|
||
* A=hSocket
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* X = hFILE
|
||
* Y,A = pFILE
|
||
*\--------------------------------------
|
||
K.MkNodA sta .1+1
|
||
>PUSHWI S.NODE.SSOCK
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
bcs .9
|
||
|
||
>STYA ZPPtr1
|
||
|
||
ldy #S.NODE.T
|
||
lda #S.NODE.T.SSOCK
|
||
sta (ZPPtr1),y
|
||
|
||
ldy #S.NODE.SSOCK.HSKT
|
||
.1 lda #$ff
|
||
|
||
sta (ZPPtr1),y
|
||
>LDYA ZPPtr1
|
||
.9 rts
|
||
*/--------------------------------------
|
||
* # MKFIFO
|
||
* return a S.FILE to a new FIFO
|
||
* ## IN:
|
||
* ## OUT:
|
||
* CC = OK, CS = ERROR
|
||
* A = hFILE
|
||
*\--------------------------------------
|
||
K.MKFIFO >PUSHWI 256
|
||
>PUSHBI 0
|
||
jsr K.GetMem
|
||
bcs .99
|
||
|
||
stx .1+1 save FIFO buffer
|
||
|
||
>PUSHWI S.NODE.FIFO
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
|
||
bcs .9
|
||
|
||
>STYA ZPPtr1
|
||
|
||
ldy #S.NODE.T
|
||
lda #S.NODE.T.FIFO
|
||
sta (ZPPtr1),y
|
||
|
||
iny S.NODE.FIFO.hMem
|
||
.1 lda #$ff Self Modified
|
||
sta (ZPPtr1),y
|
||
txa
|
||
clc
|
||
rts
|
||
|
||
.9 pha save error code
|
||
lda .1+1 get back FIFO buffer
|
||
jsr K.FreeMemA
|
||
pla
|
||
sec
|
||
|
||
.99 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.DEV
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|