A2osX/BIN/LSDEV.S.txt

273 lines
5.1 KiB
Plaintext
Raw Normal View History

NEW
2020-08-12 19:31:36 +00:00
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2020-08-12 19:31:36 +00:00
.TF bin/lsdev
*--------------------------------------
2020-08-12 19:31:36 +00:00
.INB inc/macros.i
.INB inc/mli.i
.INB inc/a2osx.i
.INB inc/kernel.i
*--------------------------------------
2019-01-04 13:17:31 +00:00
.DUMMY
.OR ZPBIN
ZS.START
ZPFDPtr .BS 2
2023-10-18 05:41:12 +00:00
hFD .BS 1
2020-08-12 19:31:36 +00:00
ZS.END .ED
*--------------------------------------
2015-06-03 18:30:57 +00:00
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
2015-06-03 18:30:57 +00:00
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
2019-01-04 13:17:31 +00:00
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
2019-05-06 15:38:25 +00:00
.DA #64 Stack Size
2019-01-04 13:17:31 +00:00
.DA #ZS.END-ZS.START Zero Page Size
2015-06-03 18:30:57 +00:00
.DA 0
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
2023-10-18 05:41:12 +00:00
L.MSG.Header .DA MSG.Header
L.MSG.FD .DA MSG.FD
2021-07-24 20:42:23 +00:00
L.MSG.DEV .DA MSG.DEV
L.MSG.DEV.ERR .DA MSG.DEV.ERR
L.MSG.DEV.DIB .DA MSG.DEV.DIB
2023-10-18 05:41:12 +00:00
L.MSG.DEV.NA .DA MSG.DEV.NA
2021-07-24 20:42:23 +00:00
L.MSG.DEV.B .DA MSG.DEV.B
J.FD .DA DumpFD.REG
.DA DumpFD.DIR
.DA DumpFD.CDEV
.DA DumpFD.CDEV
.DA DumpFD.LNK
.DA DumpFD.DSOCK
.DA DumpFD.SSOCK
.DA DumpFD.PIPE
2018-11-19 07:43:00 +00:00
L.FD.T .DA FD.T.REG
.DA FD.T.DIR
.DA FD.T.CDEV
.DA FD.T.BDEV
.DA FD.T.LNK
.DA FD.T.DSOCK
.DA FD.T.SSOCK
.DA FD.T.PIPE
.DA 0
*--------------------------------------
2017-01-12 17:43:45 +00:00
CS.INIT clc
rts
*--------------------------------------
2023-10-18 05:41:12 +00:00
CS.RUN >LDYA L.MSG.Header
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2018-07-19 15:33:55 +00:00
2023-10-18 05:41:12 +00:00
ldx #1
.1 stx hFD
lda FDs.pHI-1,x
2020-04-13 17:04:02 +00:00
beq .7
2018-08-08 15:13:37 +00:00
2023-10-18 05:41:12 +00:00
sta ZPFDPtr+1
lda FDs.pLO-1,x
sta ZPFDPtr
2019-05-06 15:38:25 +00:00
2021-07-24 20:42:23 +00:00
jsr DumpFD
2020-04-13 17:04:02 +00:00
bcs .9
2018-07-19 15:33:55 +00:00
2023-10-18 05:41:12 +00:00
ldx hFD
2021-07-24 20:42:23 +00:00
.7 inx
2023-10-18 05:41:12 +00:00
cpx #K.FD.MAX+1
bne .1
2018-11-19 07:43:00 +00:00
2023-10-18 05:41:12 +00:00
.8 lda #0
2021-07-24 20:42:23 +00:00
sec
2018-01-15 06:50:44 +00:00
.9 rts
*--------------------------------------
2023-10-18 05:41:12 +00:00
DumpFD >PUSHW L.MSG.FD
>PUSHB hFD
ldy #S.FD.DEV.BUSID
lda (ZPFDPtr),y
asl
asl
asl
asl
iny #S.FD.DEV.DEVID
ora (ZPFDPtr),y
>PUSHA
lda (ZPFDPtr) S.FD.T
tax
>PUSHW L.FD.T,x
ldy #S.FD.DEV.BUSPTR+1
>PUSHB (ZPFDPtr),y
dey
>PUSHB (ZPFDPtr),y
>PUSHBI 6
>SYSCALL PrintF
lda (ZPFDPtr)
2021-07-24 20:42:23 +00:00
tax
jmp (J.FD,x)
*--------------------------------------
DumpFD.CDEV
DumpFD.BDEV >PUSHW L.MSG.DEV
2020-02-14 07:21:56 +00:00
2019-01-13 13:10:14 +00:00
lda ZPFDPtr
clc
adc #S.FD.DEV
tay
lda ZPFDPtr+1
adc /S.FD.DEV
2023-10-18 05:41:12 +00:00
>PUSHYA
2020-02-14 07:21:56 +00:00
2023-10-18 05:41:12 +00:00
>PUSHBI 2
2020-02-14 07:21:56 +00:00
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2021-07-24 20:42:23 +00:00
bcs .9
ldy #DEV.DIB+S.DIB-1
ldx #S.DIB-1
.1 lda BLANK.DIB,x
sta (pData),y
dey
dex
bpl .1
lda #S.IOCTL.S.GETDIB
>STA.G DEV.IOCTL+S.IOCTL.S
>LEA.G DEV.DIB
>STYA.G DEV.IOCTL+S.IOCTL.BUFPTR
2023-10-18 05:41:12 +00:00
>PUSHB hFD
>PUSHBI IOCTL.STATUS
>PUSHEA.G DEV.IOCTL
>SYSCALL IOCTL
2021-07-24 20:42:23 +00:00
bcc DumpFD.DevDIB
pha
>PUSHW L.MSG.DEV.ERR
pla
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
.9 rts
*--------------------------------------
2021-07-24 20:42:23 +00:00
DumpFD.DevDIB >PUSHW L.MSG.DEV.DIB
2020-02-14 07:21:56 +00:00
2018-07-19 15:33:55 +00:00
>LDA.G DEV.DIB+S.DIB.S
2018-07-18 15:30:42 +00:00
ldy #DEV.SFLAGS+7
ldx #7
2020-02-14 07:21:56 +00:00
2018-08-24 10:20:23 +00:00
.1 lsr
2018-07-18 15:30:42 +00:00
pha
lda #'-'
2018-08-24 10:20:23 +00:00
bcc .2
2020-02-14 07:21:56 +00:00
2018-07-18 15:30:42 +00:00
lda MSG.SFLAGS,x
2020-02-14 07:21:56 +00:00
2018-08-24 10:20:23 +00:00
.2 sta (pData),y
2018-07-18 15:30:42 +00:00
pla
dey
dex
2018-08-24 10:20:23 +00:00
bpl .1
2020-02-14 07:21:56 +00:00
2018-07-18 15:30:42 +00:00
>PUSHEA.G DEV.SFLAGS
2020-02-14 07:21:56 +00:00
>PUSHB.G DEV.DIB+S.DIB.T
>PUSHB.G DEV.DIB+S.DIB.ST
>PUSHEA.G DEV.DIB+S.DIB.IDS
>PUSHB.G DEV.DIB+S.DIB.VERSION
>PUSHB.G DEV.DIB+S.DIB.VERSION+1
2018-08-24 10:20:23 +00:00
>PUSHBI 8
2020-02-14 07:21:56 +00:00
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2018-08-24 10:20:23 +00:00
bcs .9
2020-02-14 07:21:56 +00:00
2018-07-19 15:33:55 +00:00
>LDA.G DEV.DIB+S.DIB.S
2023-10-18 05:41:12 +00:00
bpl DumpFD.NA char device...
2020-02-14 07:21:56 +00:00
2021-07-24 20:42:23 +00:00
>PUSHW L.MSG.DEV.B
2020-02-14 07:21:56 +00:00
2018-08-24 10:20:23 +00:00
>PUSHBI 0
>PUSHB.G DEV.DIB+S.DIB.SIZE+2
>PUSHB.G DEV.DIB+S.DIB.SIZE+1
>PUSHB.G DEV.DIB+S.DIB.SIZE
>PUSHBI 4
2023-10-18 05:41:12 +00:00
>SYSCALL PrintF
2018-08-24 10:20:23 +00:00
.9 rts
2023-10-18 05:41:12 +00:00
*--------------------------------------
DumpFD.REG
DumpFD.DIR
2021-07-24 20:42:23 +00:00
DumpFD.LNK
DumpFD.DSOCK
2023-10-18 05:41:12 +00:00
DumpFD.SSOCK
DumpFD.PIPE
2020-12-15 13:23:22 +00:00
2023-10-18 05:41:12 +00:00
DumpFD.NA >LDYA L.MSG.DEV.NA
>SYSCALL PutS
2021-07-24 20:42:23 +00:00
rts
2018-11-19 07:43:00 +00:00
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
2023-10-18 05:41:12 +00:00
MSG.Header .CZ "hFD ID Type Addr Name Status TP.ST IDString Version Size (BLK)"
MSG.FD .CZ " %2h %h %4s %H "
MSG.DEV .CZ "%12s "
MSG.DEV.ERR .CZ "[%h] Device Error.\r\n"
MSG.DEV.DIB .CZ "%s %h.%h %16S %3d.%3d "
MSG.DEV.B .CZ "%10u\r\n"
2023-10-18 05:41:12 +00:00
MSG.DEV.NA .CZ "n/a"
2018-11-19 07:43:00 +00:00
*--------------------------------------
2021-07-24 20:42:23 +00:00
MSG.SFLAGS .AS "bwrlneio"
2020-12-15 13:23:22 +00:00
*--------------------------------------
2018-11-19 07:43:00 +00:00
FD.T.REG .AZ "REG"
FD.T.DIR .AZ "DIR"
FD.T.CDEV .AZ "CDEV"
FD.T.BDEV .AZ "BDEV"
FD.T.LNK .AZ "LNK"
FD.T.DSOCK .AZ "DSCK"
FD.T.SSOCK .AZ "SSCK"
2018-11-19 07:43:00 +00:00
FD.T.PIPE .AZ "PIPE"
2019-05-06 12:58:15 +00:00
*--------------------------------------
BLANK.DIB .DA #0 #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
.BS 3
.PS "(No IDS String!)"
2023-04-23 15:20:27 +00:00
.DA #0
2019-05-06 12:58:15 +00:00
.DA #0
.DA 0 K.VER
*--------------------------------------
.DUMMY
.OR 0
DS.START
DEV.IOCTL .BS S.IOCTL
2018-07-19 15:33:55 +00:00
DEV.DIB .BS S.DIB
DEV.SFLAGS .BS 9
2020-08-12 19:31:36 +00:00
DS.END .ED
*--------------------------------------
MAN
2020-08-12 19:31:36 +00:00
SAVE usr/src/bin/lsdev.s
ASM