mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
128 lines
2.2 KiB
Plaintext
128 lines
2.2 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*/--------------------------------------
|
||
* # GetDevByID
|
||
* **In:**
|
||
* A = DevID
|
||
* **Out:**
|
||
* CC = OK, CS = ERROR
|
||
* Y,A = DEVSLOT
|
||
*\--------------------------------------
|
||
K.GetDevByID cmp DevMgr.Count
|
||
bcs K.GetDev.NODEV
|
||
|
||
tax
|
||
|
||
lda Dev.Table+1,x
|
||
beq K.GetDev.NODEV
|
||
ldy Dev.Table,x
|
||
|
||
* clc
|
||
|
||
.9 rts CC
|
||
*/--------------------------------------
|
||
* # GetDevByName
|
||
* **In:**
|
||
* Y,A = Ptr to device name (C-String)
|
||
* **Out:**
|
||
* CC = OK, CS = ERROR
|
||
* X = DEVID
|
||
* Y,A = DEVSLOT
|
||
*\--------------------------------------
|
||
K.GetDevByName >STYA ZPPtr1
|
||
|
||
ldx #0
|
||
|
||
lda Dev.Table+1,x
|
||
beq .4
|
||
ldy Dev.Table,x
|
||
|
||
>STYA ZPPtr2
|
||
|
||
lda (ZPPtr2)
|
||
clc
|
||
adc #S.NODE.DEV.NAME
|
||
sta ZPPtr3
|
||
ldy #1
|
||
lda (ZPPtr2)
|
||
adc #0
|
||
sta ZPPtr3+1
|
||
|
||
.1 ldy #$ff
|
||
|
||
.2 iny
|
||
lda (ZPPtr1),y
|
||
cmp (ZPPtr3),y
|
||
bne .4
|
||
|
||
ora (ZPPtr3),y Both char are 0 ?
|
||
bne .2 no....loop
|
||
|
||
lda ZPPtr3
|
||
and #$F0
|
||
tay
|
||
lda ZPPtr3+1
|
||
clc
|
||
rts
|
||
|
||
.4 inx
|
||
inx
|
||
cpx DevMgr.Count
|
||
bne .1
|
||
|
||
K.GetDev.NODEV lda #MLI.E.NODEV
|
||
sec
|
||
rts
|
||
*/--------------------------------------
|
||
* # GetDevStatus
|
||
* **In:**
|
||
* A = DevID
|
||
* **Out:**
|
||
* Y,A = S.DSTAT
|
||
*\--------------------------------------
|
||
K.DevClose ldx #IOCTL.CLOSE
|
||
.HS 2C BIT ABS
|
||
K.GetDevStatus ldx #IOCTL.STATUS
|
||
jsr K.GetDevByID
|
||
bcs K.IOCTL.9
|
||
|
||
>STYA pDev
|
||
|
||
jmp (pDev)
|
||
*/--------------------------------------
|
||
* # IOCTL
|
||
* ## C
|
||
* `int ioctl ( short int id, short int op, void *param);`
|
||
* ## ASM
|
||
* **In:**
|
||
* `PUSHWI param`
|
||
* `lda #op`
|
||
* `ldy id`
|
||
* `>SYSCALL IOCTL`
|
||
* **Out:**
|
||
* Y,A = ...
|
||
*\--------------------------------------
|
||
K.IOCTL tax op
|
||
>PULLB .1+1 param LO
|
||
>PULLB .2+1 param HI
|
||
|
||
tya id
|
||
|
||
jsr K.GetDevByID
|
||
bcs K.IOCTL.9
|
||
|
||
>STYA pDev
|
||
|
||
.1 ldy #$ff SELF MODIFIED
|
||
.2 lda #$ff SELF MODIFIED
|
||
|
||
jmp (pDev) x = op
|
||
|
||
K.IOCTL.9 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.DEV
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|