A2osX/SYS/KERNEL.S.DEV.txt

223 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-06-03 18:30:57 +00:00
PREFIX /A2OSX.SRC
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
*/--------------------------------------
* #GetDevByIDA
* ##IN:
2015-03-14 21:48:35 +00:00
* A = DevID
* ##OUT:
2015-03-14 21:48:35 +00:00
* CC = OK, CS = ERROR
* Y,A = DEVSLOT
* 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
*/--------------------------------------
2017-01-12 17:43:45 +00:00
* #GetDevByNameYA
* ##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
* Y,A = DEVSLOT
*\--------------------------------------
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
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
*/--------------------------------------
2017-01-12 17:43:45 +00:00
* #GetDevStatusA
* ##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)
*/--------------------------------------
* #MkNodYA
2017-01-12 17:43:45 +00:00
* return a S.FILE for a given Device NAME
* ##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
bcs .9
>PUSHWI S.NODE.DEV
>PUSHBI S.MEM.F.INIT0
jsr K.GetMem
bcs .9
2017-01-12 17:43:45 +00:00
>STYA ZPPtr3 Ptr3=S.NODE
ldy #S.NODE.T
lda #S.NODE.T.CDEV
2017-01-12 17:43:45 +00:00
sta (ZPPtr3),y
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
clc
.9 rts
2017-01-12 17:43:45 +00:00
.99 lda #MLI.ERR.IO
sec
rts
.4 jmp $ffff
*/--------------------------------------
* #MkNodA
* return a S.FILE for a given Socket
* ##IN:
* A=hSocket
* ##OUT:
* CC = OK, CS = ERROR
* A = hFILE
*\--------------------------------------
K.MkNodA sec
rts
*/--------------------------------------
* #MKFIFO
* return a S.FILE to a new FIFO
* ##IN:
* ##OUT:
* CC = OK, CS = ERROR
* A = hFILE
*\--------------------------------------
K.MKFIFO >PUSHWI 256
2017-01-12 17:43:45 +00:00
>PUSHBI 0
jsr K.GetMem
bcs .99
phx save FIFO buffer
>PUSHWI S.NODE.FIFO
>PUSHBI S.MEM.F.INIT0
jsr K.GetMem
bcs .9
2017-01-12 17:43:45 +00:00
>STYA ZPPtr1
ldy #S.NODE.T
lda #S.NODE.T.FIFO
2017-01-12 17:43:45 +00:00
sta (ZPPtr1),y
iny S.NODE.FIFO.hMem
pla
2017-01-12 17:43:45 +00:00
sta (ZPPtr1),y
txa
clc
rts
.9 plx get back FIFO buffer
pha save error code
txa
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