2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2017-03-07 16:40:32 +00:00
|
|
|
|
LOMEM $900
|
2015-03-14 21:48:35 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #GetDevByIDA
|
|
|
|
|
* ##IN:
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* A = DevID
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* ##OUT:
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* CC = OK, CS = ERROR
|
2016-12-09 16:36:24 +00:00
|
|
|
|
* Y,A = DEVSLOT
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* note: X Unmodified
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.GetDevByIDA cmp DevMgr.Count
|
2016-09-21 15:20:37 +00:00
|
|
|
|
bcs K.GetDevDNF
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
pha save ID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
adc #DevMgr.Table
|
|
|
|
|
tay
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2016-09-29 15:30:15 +00:00
|
|
|
|
pla
|
|
|
|
|
php
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
plp
|
2015-06-03 18:30:57 +00:00
|
|
|
|
adc /DevMgr.Table
|
|
|
|
|
rts CC
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* #GetDevByNameYA
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* ##IN:
|
|
|
|
|
* Y,A = Ptr to device name (PStr)
|
|
|
|
|
* ##OUT:
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* CC = OK, CS = ERROR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* X = DEVID
|
2016-12-09 16:36:24 +00:00
|
|
|
|
* Y,A = DEVSLOT
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.GetDevByNameYA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
>LDYAI DevMgr.Table+S.DEV.F
|
|
|
|
|
>STYA ZPPtr2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr2)
|
|
|
|
|
and #S.DEV.F.LEN
|
|
|
|
|
cmp (ZPPtr1)
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr1),y
|
|
|
|
|
cmp (ZPPtr2),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-10-07 20:48:49 +00:00
|
|
|
|
dey
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sbc #S.DEV.F
|
2015-06-03 18:30:57 +00:00
|
|
|
|
tay
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr2+1
|
|
|
|
|
sbc /S.DEV.F
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 lda ZPPtr2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
2016-10-03 15:59:36 +00:00
|
|
|
|
adc #S.DEV
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcc .4
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.4 inx
|
|
|
|
|
cpx DevMgr.Count
|
|
|
|
|
bne .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.GetDevDNF lda #MLI.ERR.NODEV CS from cpx/beq
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* #GetDevStatusA
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* ##IN:
|
|
|
|
|
* A = DevID
|
|
|
|
|
* ##OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* Y,A = Ptr to S.DEVINFO
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.GetDevStatusA jsr K.GetDevByIDA
|
2016-09-21 15:20:37 +00:00
|
|
|
|
bcs K.GetDevDNF
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ldx #DEVMGR.STATUS
|
|
|
|
|
jmp (ZPPtr1)
|
2016-12-06 16:57:00 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #MkNodYA
|
2017-03-07 16:40:32 +00:00
|
|
|
|
* return a hFile for a given Device Name
|
2016-12-06 16:57:00 +00:00
|
|
|
|
* ##IN:
|
|
|
|
|
* Y,A=DevName
|
|
|
|
|
* ##OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
lda (pDev)
|
|
|
|
|
sta .2+1
|
|
|
|
|
sta .4+1
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
sta .3+1
|
|
|
|
|
sta .4+2
|
|
|
|
|
|
|
|
|
|
txa Pass DEV.ID to OPEN
|
|
|
|
|
ldx #DEVMGR.OPEN
|
|
|
|
|
jsr .4
|
2016-12-08 16:53:29 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
>PUSHWI S.NODE.DEV
|
2016-12-08 16:53:29 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0
|
|
|
|
|
jsr K.GetMem
|
2016-12-09 16:36:24 +00:00
|
|
|
|
bcs .9
|
2016-12-08 16:53:29 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr3 Ptr3=S.NODE
|
2016-12-09 16:36:24 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.NODE.T
|
|
|
|
|
lda #S.NODE.T.CDEV
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3),y
|
2016-12-09 16:36:24 +00:00
|
|
|
|
|
|
|
|
|
iny #S.NODE.DEV.ID
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda #$ff Self Modified
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
iny #S.NODE.DEV.JMP
|
|
|
|
|
.2 lda #$ff
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
iny ##S.NODE.DEV.JMP+1
|
|
|
|
|
.3 lda #$ff
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
txa
|
2016-12-06 16:57:00 +00:00
|
|
|
|
clc
|
2016-12-08 16:53:29 +00:00
|
|
|
|
.9 rts
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
|
|
|
|
.99 lda #MLI.ERR.IO
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
.4 jmp $ffff
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #MkNodA
|
2017-03-07 16:40:32 +00:00
|
|
|
|
* return a hFile for a given Socket
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ##IN:
|
|
|
|
|
* A=hSocket
|
|
|
|
|
* ##OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*\--------------------------------------
|
2017-03-09 07:11:44 +00:00
|
|
|
|
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
|
|
|
|
|
txa
|
|
|
|
|
.9 rts
|
2016-12-06 16:57:00 +00:00
|
|
|
|
*/--------------------------------------
|
2016-12-08 16:53:29 +00:00
|
|
|
|
* #MKFIFO
|
|
|
|
|
* return a S.FILE to a new FIFO
|
2016-12-06 16:57:00 +00:00
|
|
|
|
* ##IN:
|
|
|
|
|
* ##OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*\--------------------------------------
|
2016-12-08 16:53:29 +00:00
|
|
|
|
K.MKFIFO >PUSHWI 256
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>PUSHBI 0
|
2016-12-08 16:53:29 +00:00
|
|
|
|
jsr K.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
stx .1+1 save FIFO buffer
|
2016-12-08 16:53:29 +00:00
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
>PUSHWI S.NODE.FIFO
|
2016-12-08 16:53:29 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0
|
|
|
|
|
jsr K.GetMem
|
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
2016-12-08 16:53:29 +00:00
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
ldy #S.NODE.T
|
|
|
|
|
lda #S.NODE.T.FIFO
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr1),y
|
2016-12-08 16:53:29 +00:00
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
iny S.NODE.FIFO.hMem
|
2017-03-07 16:40:32 +00:00
|
|
|
|
.1 lda #$ff Self Modified
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr1),y
|
2016-12-08 16:53:29 +00:00
|
|
|
|
txa
|
2016-12-06 16:57:00 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-12-08 16:53:29 +00:00
|
|
|
|
|
2017-03-07 16:40:32 +00:00
|
|
|
|
.9 pha save error code
|
|
|
|
|
lda .1+1 get back FIFO buffer
|
2016-12-08 16:53:29 +00:00
|
|
|
|
jsr K.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.99 rts
|
2016-02-24 19:52:24 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.DEV
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|