mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
187 lines
3.2 KiB
Plaintext
187 lines
3.2 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*/--------------------------------------
|
||
* #GetDevByIDA
|
||
* ##IN:
|
||
* A = DevID
|
||
* ##OUT:
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = DEVSLOT
|
||
* note: X Unmodified
|
||
*\--------------------------------------
|
||
K.GetDevByIDA cmp DevMgr.LastDevID
|
||
beq .1
|
||
bcs K.GetDevDNF
|
||
|
||
.1 pha save ID
|
||
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
adc #DevMgr.Table
|
||
tay
|
||
pla
|
||
php
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
plp
|
||
adc /DevMgr.Table
|
||
rts CC
|
||
*/--------------------------------------
|
||
* #GetDevIDByNameYA
|
||
* ##IN:
|
||
* Y,A = Ptr to device name (PStr)
|
||
* ##OUT:
|
||
* CC = OK, CS = ERROR
|
||
* X = DEVID
|
||
* Y,A = DEVSLOT
|
||
*\--------------------------------------
|
||
K.GetDevByNameYA
|
||
>STYA ZPQuickPtr1
|
||
>LDYAI DevMgr.Table+S.DEV.NAME
|
||
>STYA ZPQuickPtr2
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPQuickPtr1)
|
||
cmp (ZPQuickPtr2)
|
||
bne .3
|
||
|
||
tay
|
||
|
||
.2 lda (ZPQuickPtr1),y
|
||
cmp (ZPQuickPtr2),y
|
||
bne .3
|
||
|
||
dey
|
||
bne .2
|
||
|
||
lda ZPQuickPtr2
|
||
sec
|
||
sbc #S.DEV.NAME
|
||
tay
|
||
lda ZPQuickPtr2+1
|
||
sbc /S.DEV.NAME
|
||
clc
|
||
rts
|
||
|
||
.3 lda ZPQuickPtr2
|
||
clc
|
||
adc #S.DEV
|
||
sta ZPQuickPtr2
|
||
bcc .4
|
||
|
||
inc ZPQuickPtr2+1
|
||
|
||
.4 cpx DevMgr.LastDevID
|
||
inx
|
||
bcc .1
|
||
|
||
K.GetDevDNF lda #DEVMGR.ERRDNF
|
||
rts
|
||
*/--------------------------------------
|
||
* #GetDevInfoA
|
||
* ##IN:
|
||
* A = DevID
|
||
* ##OUT:
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = Ptr to S.DEVINFO
|
||
*\--------------------------------------
|
||
K.GetDevInfoA jsr K.GetDevByIDA
|
||
bcs K.GetDevDNF
|
||
>STYA ZPQuickPtr1
|
||
ldx #DEVMGR.GETINFO
|
||
jmp (ZPQuickPtr1)
|
||
*/--------------------------------------
|
||
* #MkNodYA
|
||
* return a S.FILE from a given Device
|
||
* ##IN:
|
||
* Y,A=DevName
|
||
* ##OUT:
|
||
* CC = OK, CS = ERROR
|
||
* A = hFILE
|
||
*\--------------------------------------
|
||
K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME,Ptr2=DEVSLOT
|
||
bcs .9
|
||
|
||
>PUSHWI S.NODE.DEV
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
bcs .9
|
||
|
||
>STYA ZPQuickPtr3 Ptr3=S.NODE
|
||
|
||
ldy #S.DEV.DEVID
|
||
lda (ZPQuickPtr2),y
|
||
pha
|
||
|
||
iny #S.DEV.F
|
||
lda (ZPQuickPtr2),y
|
||
asl CS if Block device
|
||
|
||
ldy #S.NODE.T
|
||
lda #S.NODE.T.CDEV
|
||
adc #0 add CS if blok
|
||
sta (ZPQuickPtr3),y
|
||
|
||
iny #S.NODE.DEV.ID
|
||
pla
|
||
sta (ZPQuickPtr3),y
|
||
|
||
clc
|
||
.9 rts
|
||
*/--------------------------------------
|
||
* #MKFIFO
|
||
* return a S.FILE to a new FIFO
|
||
* ##IN:
|
||
* ##OUT:
|
||
* CC = OK, CS = ERROR
|
||
* A = hFILE
|
||
*\--------------------------------------
|
||
K.MKFIFO >PUSHWI 256
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
bcs .99
|
||
|
||
phx save FIFO buffer
|
||
|
||
>PUSHWI S.NODE.FIFO
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr K.GetMem
|
||
|
||
bcs .9
|
||
|
||
>STYA ZPQuickPtr1
|
||
|
||
ldy #S.NODE.T
|
||
lda #S.NODE.T.FIFO
|
||
sta (ZPQuickPtr1),y
|
||
|
||
iny S.NODE.FIFO.hMem
|
||
pla
|
||
sta (ZPQuickPtr1),y
|
||
txa
|
||
clc
|
||
rts
|
||
|
||
.9 plx get back FIFO buffer
|
||
pha save error code
|
||
txa
|
||
jsr K.FreeMemA
|
||
pla
|
||
sec
|
||
|
||
.99 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.DEV
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|