A2osX/SYS/KERNEL.S.DEV.txt
2018-07-09 17:25:38 +02:00

125 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*/--------------------------------------
* # GetDevByID
* **In:**
* A = DevID
* **Out:**
* CC = OK, CS = ERROR
* Y,A = DEVSLOT
*\--------------------------------------
K.GetDevByID cmp DevMgr.DevCnt
bcs K.GetDev.NODEV
tax
lda Dev.Table,x
jmp K.GetMemPtr
* 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
ldy Dev.Table,x
jsr K.GetMemPtr
>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
cpx DevMgr.DevCnt
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