A2osX/SYS/KERNEL.S.DEV.txt
2018-06-18 08:22:50 +02:00

124 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.A
* **In:**
* A = DevID
* **Out:**
* CC = OK, CS = ERROR
* Y,A = DEVSLOT
* note: X Unmodified
*\--------------------------------------
K.GetDevByID.A cmp DevMgr.Count
bcs K.GetDevDNF
asl
asl
asl
asl
tay
lda /Dev.Table
adc #0
rts CC
*/--------------------------------------
* # GetDevByName.YA
* **In:**
* Y,A = Ptr to device name (C-String)
* **Out:**
* CC = OK, CS = ERROR
* X = DEVID
* Y,A = DEVSLOT
*\--------------------------------------
K.GetDevByName.YA
>STYA ZPPtr1
>LDYAI Dev.Table+S.DEV.NAME
>STYA ZPPtr2
ldx #0
.1 ldy #$ff
.2 iny
lda (ZPPtr1),y
cmp (ZPPtr2),y
bne .3
ora (ZPPtr2),y Both char are 0 ?
bne .2 no....loop
lda ZPPtr2
and #$F0
tay
lda ZPPtr2+1
clc
rts
.3 lda ZPPtr2
clc
adc #S.DEV
sta ZPPtr2
bcc .4
inc ZPPtr2+1
.4 inx
cpx DevMgr.Count
bne .1
K.GetDevDNF lda #MLI.E.NODEV CS from cpx/beq
rts
*/--------------------------------------
* # GetDevStatus.A
* **In:**
* A = DevID
* **Out:**
* Y,A = S.DSTAT
*\--------------------------------------
K.DevClose.A ldx #DEVMGR.CLOSE
.HS 2C BIT ABS
K.GetDevStatus.A
ldx #DEVMGR.STATUS
jsr K.GetDevByID.A
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.A
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