A2osX/BIN/LSDEV.S.txt
2020-12-15 14:23:22 +01:00

292 lines
5.3 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
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/lsdev
*--------------------------------------
.INB inc/macros.i
.INB inc/mli.i
.INB inc/a2osx.i
.INB inc/kernel.i
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPFDPtr .BS 2
Index .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
L.MSG2.ERR .DA MSG2.ERR
L.MSG2 .DA MSG2
L.MSG2.C .DA MSG2.C
L.MSG2.B .DA MSG2.B
L.MSG3 .DA MSG3
L.MSG4 .DA MSG4
L.NO.PATH .DA NO.PATH
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
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN jsr DumpDev
bcs .9
jsr DumpNod
bcs .9
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
.9 rts
*--------------------------------------
DumpDev >LDYA L.MSG0
>SYSCALL PutS
ldx #1
stx Index
.1 lda Dev.Table-1,x
sta ZPFDPtr
lda Dev.Table,x
sta ZPFDPtr+1
beq .7
jsr DumpDevFD
bcs .9
ldy #DEV.DIB+S.DIB-1
ldx #S.DIB-1
.2 lda BLANK.DIB,x
sta (pData),y
dey
dex
bpl .2
>PUSHB Index
>PUSHEA.G DEV.DIB
>SYSCALL GetDevStatus
bcc .6
pha
>PUSHW L.MSG2.ERR
pla
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
bcs .9
bra .7
.6 jsr DumpDevDIB
bcs .9
.7 inc Index
inc Index
ldx Index
cpx #K.DEV.MAX*2+1
bne .1
.8 clc
.9 rts
*--------------------------------------
DumpDevFD >PUSHW L.MSG1
>PUSHB Index
>PUSHB (ZPFDPtr) S.FD.T
lda ZPFDPtr
clc
adc #S.FD.DEV
tay
lda ZPFDPtr+1
adc /S.FD.DEV
>PUSHYA
ldy #S.FD.DEV.DRVPTR+1
>PUSHB (ZPFDPtr),y
dey
>PUSHB (ZPFDPtr),y
>PUSHBI 6
>SYSCALL PrintF
rts
*--------------------------------------
DumpDevDIB >PUSHW L.MSG2
>LDA.G DEV.DIB+S.DIB.S
ldy #DEV.SFLAGS+7
ldx #7
.1 lsr
pha
lda #'-'
bcc .2
lda MSG.SFLAGS,x
.2 sta (pData),y
pla
dey
dex
bpl .1
>PUSHEA.G DEV.SFLAGS
>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
>PUSHBI 8
>SYSCALL PrintF
bcs .9
>LDA.G DEV.DIB+S.DIB.S
bpl .4 char device...
>PUSHW L.MSG2.B
>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
bra .8
.4 >PUSHW L.MSG2.C
>PUSHBI 0
.8 >SYSCALL PrintF
.9 rts
*--------------------------------------
DumpNod >LDYA L.MSG3
>SYSCALL PutS
ldx #2
.1 stx Index
lda Nod.Table.hFD-2,x
beq .7
>PUSHW L.MSG4
txa
>PUSHA
lda Nod.Table.hFD-2,x
>PUSHA
>SYSCALL GetMemPtr
>STYA ZPFDPtr
lda (ZPFDPtr)
tax
>PUSHW L.FD.T,x
ldx Index
lda Nod.Table.hName-2,x
bne .2
>LDYA L.NO.PATH
bra .3
.2 >SYSCALL GetMemPtr
.3 >PUSHYA
>PUSHBI 6
>SYSCALL PrintF
ldx Index
.7 inx
inx
cpx #K.NOD.MAX+2
bne .1
clc
.9 rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "hDev Tp Name Addr. Status Typ/Sub IDString Version Size (BLK)"
MSG1 .AZ "%03d %h %12s $%H "
MSG2.ERR .AZ "Device Error : $%h\r\n"
MSG2 .AZ "%s $%h/$%h %16S %03d.%03d "
MSG2.B .AZ "%10u\r\n"
MSG2.C .AZ "n/a\r\n"
MSG.SFLAGS .AS "bwrlneio"
*--------------------------------------
MSG3 .AZ "hNod hFD Type Filepath"
MSG4 .AZ "%03d $%h %5s %s\r\n"
NO.PATH .AZ "(no path)"
*--------------------------------------
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 "DSOCK"
FD.T.SSOCK .AZ "SSOCK"
FD.T.PIPE .AZ "PIPE"
*--------------------------------------
BLANK.DIB .DA #0 #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
.BS 3
>PSTR "(No IDS String!)"
.DA #0 #S.DIB.T.PRODOS
.DA #0
.DA 0 K.VER
*--------------------------------------
.DUMMY
.OR 0
DS.START
DEV.DIB .BS S.DIB
DEV.SFLAGS .BS 9
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/lsdev.s
ASM