2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,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
|
|
|
|
|
* X = DevID
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.GetDevByName >STYA ZPPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #0
|
2018-12-13 16:39:24 +00:00
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
.1 lda Dev.Table.hPath,x
|
2018-10-11 15:23:06 +00:00
|
|
|
|
beq K.GetDev.NODEV
|
|
|
|
|
jsr K.GetMemPtr
|
2018-06-25 05:59:43 +00:00
|
|
|
|
|
|
|
|
|
>STYA ZPPtr2
|
2018-12-11 16:41:25 +00:00
|
|
|
|
|
2018-07-11 15:13:29 +00:00
|
|
|
|
ldy #$ff
|
2016-10-07 20:48:49 +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
|
2018-06-25 05:59:43 +00:00
|
|
|
|
bne .4
|
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
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
lda Dev.Table.hFD,x
|
|
|
|
|
jmp K.GetMemPtr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.4 inx
|
2018-07-09 15:25:38 +00:00
|
|
|
|
cpx DevMgr.DevCnt
|
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
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `int getdevstatus(short int hFD, S.DIB* dstat);`
|
2018-07-19 15:33:55 +00:00
|
|
|
|
* ## ASM
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `>PUSHWI S.DIB`
|
|
|
|
|
* `lda DevID`
|
|
|
|
|
* `>SYSCALL GetDevStatus`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-01-15 06:50:44 +00:00
|
|
|
|
*\--------------------------------------
|
2018-09-06 15:36:44 +00:00
|
|
|
|
K.GetDevStatus jsr K.GetMemPtr
|
|
|
|
|
>STYA pFD
|
2018-09-07 14:12:42 +00:00
|
|
|
|
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>PULLW K.S.IOCTL+S.IOCTL.BUFPTR
|
|
|
|
|
|
|
|
|
|
lda #S.IOCTL.STATCODE.GETDIB
|
2018-09-07 14:12:42 +00:00
|
|
|
|
K.GetDevStatus.I
|
2018-07-19 15:33:55 +00:00
|
|
|
|
sta K.S.IOCTL+S.IOCTL.STATCODE
|
2018-09-07 14:12:42 +00:00
|
|
|
|
|
|
|
|
|
jsr K.IOCTL.GetPDrv
|
2018-07-19 15:33:55 +00:00
|
|
|
|
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>LDYAI K.S.IOCTL
|
|
|
|
|
|
|
|
|
|
ldx #IOCTL.STATUS
|
2018-09-06 15:36:44 +00:00
|
|
|
|
jmp (pDrv)
|
2018-07-17 15:45:59 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # MKDev
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* Create a hDEV
|
|
|
|
|
* ## C
|
2018-12-11 16:41:25 +00:00
|
|
|
|
* `hDEV mkdev (S.FD * fd, const char *devname)`
|
2018-10-05 14:58:38 +00:00
|
|
|
|
* ## ASM
|
2018-12-11 16:41:25 +00:00
|
|
|
|
* `>PUSHW devname`
|
|
|
|
|
* `>LDYA fd`
|
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
|
|
|
|
*\--------------------------------------
|
2018-12-11 16:41:25 +00:00
|
|
|
|
K.MKDev jsr MEM.SPtr1PPtr2 ptr1=fd, ptr2=name
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2018-07-17 15:45:59 +00:00
|
|
|
|
ldx DevMgr.DevCnt
|
|
|
|
|
cmp #K.DEV.MAX
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
>LDYAI S.FD.DEV
|
2018-08-11 10:57:57 +00:00
|
|
|
|
ldx #S.MEM.F.FD
|
|
|
|
|
jsr MEM.GetMem.YAX
|
2018-08-24 12:40:19 +00:00
|
|
|
|
bcs .99
|
2018-09-07 14:12:42 +00:00
|
|
|
|
>STYA pFD
|
2018-10-11 15:23:06 +00:00
|
|
|
|
txa
|
2018-07-17 15:45:59 +00:00
|
|
|
|
|
|
|
|
|
ldx DevMgr.DevCnt
|
2018-08-08 15:13:37 +00:00
|
|
|
|
sta Dev.Table.hFD,x
|
2018-07-17 15:45:59 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
ldy #S.FD.DEV-1
|
2018-07-17 15:45:59 +00:00
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
.1 lda (ZPPtr1),y
|
2018-10-05 14:58:38 +00:00
|
|
|
|
sta (pFD),y
|
2018-09-07 14:12:42 +00:00
|
|
|
|
dey
|
2018-07-17 15:45:59 +00:00
|
|
|
|
bpl .1
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
>LDYAI K.IOBuf
|
|
|
|
|
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
|
|
|
|
|
|
|
|
|
|
lda #S.IOCTL.STATCODE.STATUS
|
|
|
|
|
|
|
|
|
|
jsr K.GetDevStatus.I
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
lda K.IOBuf Get Status byte
|
|
|
|
|
bit #S.DIB.S.IRQ
|
|
|
|
|
beq .8
|
2018-09-07 14:12:42 +00:00
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
.3 lda IRQ.Vectors+1,x
|
|
|
|
|
beq .7
|
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
cpx #K.IRQDEV.MAX*2
|
2018-12-11 16:41:25 +00:00
|
|
|
|
bne .3
|
2018-07-17 15:45:59 +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
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
.7 lda pFD
|
2018-10-11 15:23:06 +00:00
|
|
|
|
sta IRQ.Vectors,x
|
|
|
|
|
lda pFD+1
|
|
|
|
|
sta IRQ.Vectors+1,x
|
|
|
|
|
|
2018-12-11 16:41:25 +00:00
|
|
|
|
.8 >LDYA ZPPtr2
|
|
|
|
|
jsr K.NewStr
|
|
|
|
|
bcs .99
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
ldx DevMgr.DevCnt
|
|
|
|
|
sta Dev.Table.hPath,x
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
2018-10-11 15:23:06 +00:00
|
|
|
|
inc DevMgr.DevCnt
|
2018-12-18 14:37:07 +00:00
|
|
|
|
* clc
|
2018-10-11 15:23:06 +00:00
|
|
|
|
rts
|
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
|