mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
169 lines
2.9 KiB
Plaintext
169 lines
2.9 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
*/--------------------------------------
|
||
* # GetDevByID
|
||
* A = DevID
|
||
* ## RETURN VALUE
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = FD
|
||
* X = hFD
|
||
*\--------------------------------------
|
||
K.GetDevByID cmp DevMgr.DevCnt
|
||
bcs K.GetDev.NODEV
|
||
tax
|
||
|
||
lda Dev.Table.hFD,x
|
||
beq K.GetDev.NODEV
|
||
pha
|
||
jsr K.GetMemPtr
|
||
plx
|
||
rts
|
||
*/--------------------------------------
|
||
* # GetDevByName
|
||
* Y,A = Ptr to device name (C-String)
|
||
* ## RETURN VALUE
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = FD
|
||
* X = DevID
|
||
*\--------------------------------------
|
||
K.GetDevByName >STYA ZPPtr1
|
||
|
||
ldx #0
|
||
|
||
.1 lda Dev.Table.hFD,x
|
||
beq K.GetDev.NODEV
|
||
jsr K.GetMemPtr
|
||
|
||
>STYA ZPPtr2
|
||
|
||
lda ZPPtr2
|
||
clc
|
||
adc #S.FD.DEV.NAME
|
||
sta ZPPtr3
|
||
|
||
lda ZPPtr2+1
|
||
adc /S.FD.DEV.NAME
|
||
sta ZPPtr3+1
|
||
|
||
ldy #$ff
|
||
|
||
.2 iny
|
||
lda (ZPPtr1),y
|
||
cmp (ZPPtr3),y
|
||
bne .4
|
||
|
||
ora (ZPPtr3),y Both char are 0 ?
|
||
bne .2 no....loop
|
||
|
||
ldy ZPPtr2
|
||
lda ZPPtr2+1
|
||
clc
|
||
rts
|
||
|
||
.4 inx
|
||
cpx DevMgr.DevCnt
|
||
bne .1
|
||
|
||
K.GetDev.NODEV lda #MLI.E.NODEV
|
||
sec
|
||
K.GetDev.9 rts
|
||
*/--------------------------------------
|
||
* # GetDevStatus
|
||
* ## C
|
||
* `int getdevstatus(short int hFD, S.DIB* dstat);`
|
||
* ## ASM
|
||
* `>PUSHWI S.DIB`
|
||
* `lda DevID`
|
||
* `>SYSCALL GetDevStatus`
|
||
* ## RETURN VALUE
|
||
*\--------------------------------------
|
||
K.GetDevStatus jsr K.GetMemPtr
|
||
>STYA pFD
|
||
|
||
>PULLW K.S.IOCTL+S.IOCTL.BUFPTR
|
||
|
||
lda #S.IOCTL.STATCODE.GETDIB
|
||
K.GetDevStatus.I
|
||
sta K.S.IOCTL+S.IOCTL.STATCODE
|
||
|
||
jsr K.IOCTL.GetPDrv
|
||
|
||
>LDYAI K.S.IOCTL
|
||
|
||
ldx #IOCTL.STATUS
|
||
jmp (pDrv)
|
||
*/--------------------------------------
|
||
* # MKDev
|
||
* Create a hDEV
|
||
* ## C
|
||
* `hDEV mkdev (S.FD * fd)`
|
||
* ## ASM
|
||
* `>LDYA FD.DEV`
|
||
* `>SYSCALL mkdev
|
||
* ## RETURN VALUE
|
||
* A = hDEV
|
||
*\--------------------------------------
|
||
K.MKDev >STYA .1+1
|
||
|
||
ldx DevMgr.DevCnt
|
||
cmp #K.DEV.MAX
|
||
beq .9
|
||
|
||
>LDYAI S.FD.DEV
|
||
ldx #S.MEM.F.FD
|
||
jsr MEM.GetMem.YAX
|
||
bcs .99
|
||
>STYA pFD
|
||
txa
|
||
|
||
ldx DevMgr.DevCnt
|
||
sta Dev.Table.hFD,x
|
||
|
||
ldy #S.FD.DEV-1
|
||
|
||
.1 lda $ffff,y SELF MODIFIED
|
||
sta (pFD),y
|
||
dey
|
||
bpl .1
|
||
|
||
>LDYAI K.IOBuf
|
||
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
|
||
|
||
lda #S.IOCTL.STATCODE.STATUS
|
||
|
||
jsr K.GetDevStatus.I
|
||
bcs .99
|
||
|
||
lda K.IOBuf Get Status byte
|
||
bit #S.DIB.S.IRQ
|
||
beq .8
|
||
|
||
ldx #0
|
||
|
||
.2 lda IRQ.Vectors+1,x
|
||
beq .3
|
||
inx
|
||
inx
|
||
cpx #K.IRQDEV.MAX*2
|
||
bne .2
|
||
|
||
.9 lda #E.OOH
|
||
* sec
|
||
.99 rts
|
||
|
||
.3 lda pFD
|
||
sta IRQ.Vectors,x
|
||
lda pFD+1
|
||
sta IRQ.Vectors+1,x
|
||
|
||
.8 lda DevMgr.DevCnt
|
||
inc DevMgr.DevCnt
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.DEV
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|