2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2019-05-25 19:24:07 +00:00
|
|
|
|
AUTO 3,1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # GetDevByName
|
2017-09-14 15:21:06 +00:00
|
|
|
|
* Y,A = Ptr to device name (C-String)
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-08-08 15:13:37 +00:00
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* Y,A = FD
|
2019-02-28 16:45:33 +00:00
|
|
|
|
* X = hDev
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2019-01-13 13:10:14 +00:00
|
|
|
|
K.GetDevByName >STYA ZPPtr1 requested dev name
|
2019-02-27 15:00:56 +00:00
|
|
|
|
ldx #1
|
2018-12-13 16:39:24 +00:00
|
|
|
|
|
2019-02-27 15:00:56 +00:00
|
|
|
|
.1 lda Dev.Table-1,x
|
2019-01-13 13:10:14 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.FD.DEV
|
|
|
|
|
sta ZPPtr2
|
2019-02-27 15:00:56 +00:00
|
|
|
|
lda Dev.Table,x
|
2019-01-13 13:10:14 +00:00
|
|
|
|
beq K.GetDev.NODEV
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
adc /S.FD.DEV
|
|
|
|
|
sta ZPPtr2+1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-07-11 15:13:29 +00:00
|
|
|
|
ldy #$ff
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPtr1),y
|
2018-12-11 16:41:25 +00:00
|
|
|
|
cmp (ZPPtr2),y
|
2019-01-13 13:10:14 +00:00
|
|
|
|
bne .7
|
2017-10-10 15:40:23 +00:00
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
ora (ZPPtr2),y Both char are 0 ?
|
2017-10-10 15:40:23 +00:00
|
|
|
|
bne .2 no....loop
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
ldy Dev.Table-1,x
|
|
|
|
|
lda Dev.Table,x
|
2019-01-13 13:10:14 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
.7 inx
|
|
|
|
|
inx
|
2019-02-27 15:00:56 +00:00
|
|
|
|
cpx #K.DEV.MAX*2+1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2018-06-25 05:59:43 +00:00
|
|
|
|
K.GetDev.NODEV lda #MLI.E.NODEV
|
|
|
|
|
sec
|
2018-07-11 15:13:29 +00:00
|
|
|
|
K.GetDev.9 rts
|
2018-01-15 06:50:44 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # GetDevStatus
|
2018-07-19 15:33:55 +00:00
|
|
|
|
* ## C
|
2020-02-16 20:45:16 +00:00
|
|
|
|
* `int getdevstatus(short int DevID, S.DIB *dstat);`
|
2018-07-19 15:33:55 +00:00
|
|
|
|
* ## ASM
|
2020-02-19 06:53:24 +00:00
|
|
|
|
* `>PUSHB DevID`
|
2020-02-16 20:45:16 +00:00
|
|
|
|
* `>PUSHW S.DIB`
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `>SYSCALL GetDevStatus`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-01-15 06:50:44 +00:00
|
|
|
|
*\--------------------------------------
|
2020-02-16 20:45:16 +00:00
|
|
|
|
K.GetDevStatus >PULLW K.S.IOCTL+S.IOCTL.BUFPTR
|
|
|
|
|
>PULLA
|
|
|
|
|
tax
|
|
|
|
|
|
2019-02-27 15:00:56 +00:00
|
|
|
|
lda Dev.Table,x
|
2019-01-13 13:10:14 +00:00
|
|
|
|
beq K.GetDev.NODEV
|
2019-02-27 15:00:56 +00:00
|
|
|
|
ldy Dev.Table-1,x
|
2019-01-13 13:10:14 +00:00
|
|
|
|
>STYA pFD
|
|
|
|
|
|
2018-07-19 15:33:55 +00:00
|
|
|
|
lda #S.IOCTL.STATCODE.GETDIB
|
2020-02-16 20:45:16 +00:00
|
|
|
|
jmp SHARED.GetDevStatus
|
2018-07-17 15:45:59 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # MKDev
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* Create a hDEV
|
|
|
|
|
* ## C
|
2020-02-16 20:45:16 +00:00
|
|
|
|
* `hDEV mkdev (S.FD *fd, const char *devname)`
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* ## ASM
|
2020-02-16 20:45:16 +00:00
|
|
|
|
* `>PUSHW fd`
|
2018-12-11 16:41:25 +00:00
|
|
|
|
* `>PUSHW devname`
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* `>SYSCALL mkdev
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* A = hDEV
|
2018-07-17 15:45:59 +00:00
|
|
|
|
*\--------------------------------------
|
2020-02-16 20:45:16 +00:00
|
|
|
|
K.MKDev >PULLW ZPPtr2 ptr2=name
|
|
|
|
|
>PULLW ZPPtr1 ptr1=fd
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2019-02-27 15:00:56 +00:00
|
|
|
|
ldx DevMgr.DevIdx
|
|
|
|
|
cpx #K.DEV.MAX*2+1
|
2018-07-17 15:45:59 +00:00
|
|
|
|
beq .9
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
ldx #S.FD.DEV
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
.1 iny Get DEV name length
|
|
|
|
|
inx compute FD+NAME+\0 in X
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
bne .1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
txa
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
jsr MEM.GetKrnlBuf
|
2018-08-24 12:40:19 +00:00
|
|
|
|
bcs .99
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
>STYA pFD
|
2019-01-13 13:10:14 +00:00
|
|
|
|
>STYA .4+1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-02-27 15:00:56 +00:00
|
|
|
|
ldx DevMgr.DevIdx
|
2019-01-13 13:10:14 +00:00
|
|
|
|
sta Dev.Table,x
|
2019-02-27 15:00:56 +00:00
|
|
|
|
tya
|
|
|
|
|
sta Dev.Table-1,x
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
ldy #S.FD.DEV-1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
.2 lda (ZPPtr1),y
|
2018-10-05 14:58:38 +00:00
|
|
|
|
sta (pFD),y
|
2018-09-07 14:12:42 +00:00
|
|
|
|
dey
|
2019-01-13 13:10:14 +00:00
|
|
|
|
bpl .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
ldx #S.FD.DEV-1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
.3 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
.4 sta $ffff,x
|
|
|
|
|
bne .3
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
>LDYAI K.IOBuf
|
|
|
|
|
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
|
|
|
|
|
|
2019-07-24 05:53:09 +00:00
|
|
|
|
lda #S.IOCTL.STATCODE.STATUS
|
2020-02-16 20:45:16 +00:00
|
|
|
|
jsr SHARED.GetDevStatus
|
2018-09-07 14:12:42 +00:00
|
|
|
|
bcs .99
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
lda K.IOBuf Get Status byte
|
|
|
|
|
bit #S.DIB.S.IRQ
|
|
|
|
|
beq .8
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
ldx #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-01-13 13:10:14 +00:00
|
|
|
|
.5 lda IRQ.Vectors+1,x
|
2018-12-11 16:41:25 +00:00
|
|
|
|
beq .7
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
inx
|
|
|
|
|
inx
|
2019-02-27 15:00:56 +00:00
|
|
|
|
cpx #K.IRQDEV.MAX*2+1
|
2019-01-13 13:10:14 +00:00
|
|
|
|
bne .5
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-10-21 20:54:07 +00:00
|
|
|
|
.9 lda #E.OOH
|
2018-07-17 15:45:59 +00:00
|
|
|
|
* sec
|
2018-08-24 12:40:19 +00:00
|
|
|
|
.99 rts
|
2018-10-11 15:23:06 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
.7 ldy #IOCTL.IRQ+4
|
|
|
|
|
lda (pDRV),y
|
2018-10-11 15:23:06 +00:00
|
|
|
|
sta IRQ.Vectors,x
|
2019-07-16 15:42:36 +00:00
|
|
|
|
iny
|
2020-02-16 20:45:16 +00:00
|
|
|
|
lda (pDRV),y
|
2018-10-11 15:23:06 +00:00
|
|
|
|
sta IRQ.Vectors+1,x
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
2019-02-27 15:00:56 +00:00
|
|
|
|
.8 lda DevMgr.DevIdx
|
|
|
|
|
inc DevMgr.DevIdx
|
|
|
|
|
inc DevMgr.DevIdx
|
2018-12-18 14:37:07 +00:00
|
|
|
|
* clc
|
2018-10-11 15:23:06 +00:00
|
|
|
|
rts
|
2020-02-16 20:45:16 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # IOCTL
|
|
|
|
|
* ## C
|
|
|
|
|
* `int ioctl(short int DevID, int request, void * param );`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHB hDEV`
|
|
|
|
|
* `>PUSHB request`
|
|
|
|
|
* `>PUSHW param`
|
|
|
|
|
* `>SYSCALL IOCTL`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* Y,A = ...
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.IOCTL ldy #3 hDev
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
lda Dev.Table,x
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
ldy Dev.Table-1,x
|
|
|
|
|
>STYA pFD
|
|
|
|
|
|
|
|
|
|
jsr SHARED.GetPDrv
|
|
|
|
|
|
|
|
|
|
ldy #2 request
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
>PULLYA param
|
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
|
|
|
|
|
|
|
|
|
jmp (pDrv)
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
lda #MLI.E.NODEV
|
|
|
|
|
>RET 4
|
2016-02-24 19:52:24 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.DEV
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|