mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
161 lines
2.7 KiB
Plaintext
161 lines
2.7 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*/--------------------------------------
|
||
* # GetDevByID
|
||
* **In:**
|
||
* A = DevID
|
||
* **Out:**
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = FD
|
||
* X = hFD
|
||
*\--------------------------------------
|
||
K.GetDevByID cmp DevMgr.DevCnt
|
||
bcs K.GetDev.NODEV
|
||
tax
|
||
|
||
lda Dev.Table.hFD,x
|
||
pha
|
||
ldy Dev.Table.pFDLO,x
|
||
lda Dev.Table.pFDHI,x
|
||
plx
|
||
|
||
* clc
|
||
|
||
.9 rts CC
|
||
*/--------------------------------------
|
||
* # GetDevByName
|
||
* **In:**
|
||
* Y,A = Ptr to device name (C-String)
|
||
* **Out:**
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = FD
|
||
* X = DevID
|
||
*\--------------------------------------
|
||
K.GetDevByName >STYA ZPPtr1
|
||
|
||
ldx #0
|
||
|
||
.1 ldy Dev.Table.pFDLO,x
|
||
lda Dev.Table.pFDHI,x
|
||
|
||
>STYA ZPPtr2
|
||
|
||
lda ZPPtr2
|
||
clc
|
||
adc #S.FD.DEV.NAME
|
||
sta ZPPtr3
|
||
|
||
lda ZPPtr2+1
|
||
adc #0
|
||
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
|
||
* **In:**
|
||
* `>PUSHWI S.DIB`
|
||
* `lda DevID`
|
||
* `>SYSCALL GetDevStatus`
|
||
* **Out:**
|
||
*\--------------------------------------
|
||
K.GetDevStatus pha
|
||
|
||
>PULLW K.S.IOCTL+S.IOCTL.BUFPTR
|
||
|
||
pla
|
||
jsr K.GetMemPtr
|
||
bcs K.GetDev.9
|
||
|
||
>STYA pFD
|
||
|
||
ldy #S.FD.DEV.DRVPTR
|
||
lda (pFD),y
|
||
sta .1+1
|
||
iny
|
||
lda (pFD),y
|
||
sta .1+2
|
||
|
||
lda #S.IOCTL.STATCODE.GETDIB
|
||
sta K.S.IOCTL+S.IOCTL.STATCODE
|
||
|
||
>LDYAI K.S.IOCTL
|
||
|
||
ldx #IOCTL.STATUS
|
||
.1 jmp $ffff
|
||
|
||
.9 rts
|
||
*/--------------------------------------
|
||
* # MKDev
|
||
* **In:**
|
||
* Y,A = Ptr to FD.DEV
|
||
* **Out:**
|
||
* A = DEVID
|
||
*\--------------------------------------
|
||
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 .2+1
|
||
phx
|
||
|
||
ldx DevMgr.DevCnt
|
||
sta Dev.Table.pFDHI,x
|
||
tya
|
||
sta Dev.Table.pFDLO,x
|
||
pla
|
||
sta Dev.Table.hFD,x
|
||
|
||
lda #0 TODO Irq Flag
|
||
sta Dev.Table.F,x
|
||
|
||
ldx #S.FD.DEV-1
|
||
|
||
.1 lda $ffff,x SELF MODIFIED
|
||
.2 sta $ffff,x SELF MODIFIED
|
||
dex
|
||
bpl .1
|
||
|
||
lda DevMgr.DevCnt
|
||
inc DevMgr.DevCnt
|
||
rts
|
||
|
||
.9 lda #K.E.OOH
|
||
* sec
|
||
.99 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.DEV
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|