mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-17 15:06:49 +00:00
f7681deebe
Enh : UNAME
287 lines
5.5 KiB
Plaintext
287 lines
5.5 KiB
Plaintext
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.MSG.DEV .DA MSG.DEV
|
||
L.MSG.DEV.ERR .DA MSG.DEV.ERR
|
||
L.MSG.DEV.DIB .DA MSG.DEV.DIB
|
||
L.MSG.DEV.C .DA MSG.DEV.C
|
||
L.MSG.DEV.B .DA MSG.DEV.B
|
||
L.MSG.PIPE .DA MSG.PIPE
|
||
L.NO.PATH .DA NO.PATH
|
||
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
|
||
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 >LDYA L.MSG0
|
||
>SYSCALL PutS
|
||
|
||
ldx #0
|
||
|
||
.1 stx Index
|
||
lda hFDs,x
|
||
beq .7
|
||
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPFDPtr
|
||
|
||
jsr DumpFD
|
||
bcs .9
|
||
|
||
ldx Index
|
||
|
||
.7 inx
|
||
cpx #K.hFD.MAX
|
||
bne .1
|
||
|
||
lda #0
|
||
sec
|
||
.9 rts
|
||
*--------------------------------------
|
||
DumpFD lda (ZPFDPtr)
|
||
tax
|
||
jmp (J.FD,x)
|
||
*--------------------------------------
|
||
DumpFD.REG
|
||
DumpFD.DIR
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DumpFD.CDEV
|
||
DumpFD.BDEV >PUSHW L.MSG.DEV
|
||
|
||
jsr DumpFD.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 7
|
||
|
||
>SYSCALL PrintF
|
||
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
|
||
|
||
ldx Index
|
||
>PUSHB hFDs,x
|
||
>PUSHBI IOCTL.STATUS
|
||
>PUSHEA.G DEV.IOCTL
|
||
>SYSCALL IOCTL
|
||
bcc DumpFD.DevDIB
|
||
|
||
pha
|
||
>PUSHW L.MSG.DEV.ERR
|
||
pla
|
||
>PUSHA
|
||
>PUSHBI 1
|
||
>SYSCALL PrintF
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DumpFD.DevDIB >PUSHW L.MSG.DEV.DIB
|
||
|
||
>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.MSG.DEV.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.MSG.DEV.C
|
||
>PUSHBI 0
|
||
|
||
.8 >SYSCALL PrintF
|
||
.9 rts
|
||
*--------------------------------------
|
||
DumpFD.LNK
|
||
DumpFD.DSOCK
|
||
DumpFD.SSOCK clc
|
||
rts
|
||
*--------------------------------------
|
||
DumpFD.PIPE >PUSHW L.MSG.PIPE
|
||
|
||
jsr DumpFD.T
|
||
|
||
jsr DumpFD.Name
|
||
|
||
>PUSHBI 5
|
||
>SYSCALL PrintF
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DumpFD.T ldx Index
|
||
>PUSHB hFDs,x
|
||
|
||
lda (ZPFDPtr) S.FD.T
|
||
tax
|
||
>PUSHW L.FD.T,x
|
||
rts
|
||
*--------------------------------------
|
||
DumpFD.Name ldx Index
|
||
lda hFDs.hName,x
|
||
beq .1
|
||
|
||
>SYSCALL GetMemPtr
|
||
>PUSHYA
|
||
rts
|
||
|
||
.1 >PUSHYA L.NO.PATH
|
||
rts
|
||
*--------------------------------------
|
||
CS.EVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
MSG0 .CZ "hFD Type Name Addr Status Typ/Sub IDString Version Size (BLK)"
|
||
MSG.DEV .CZ "%3d %4s %12s %H "
|
||
MSG.DEV.ERR .CZ "[%h] Device Error.\r\n"
|
||
MSG.DEV.DIB .CZ "%s $%h/$%h %16S %03d.%03d "
|
||
MSG.DEV.B .CZ "%10u\r\n"
|
||
MSG.DEV.C .CZ "n/a\r\n"
|
||
MSG.PIPE .CZ "%3d %5s %s\r\n"
|
||
*--------------------------------------
|
||
MSG.SFLAGS .AS "bwrlneio"
|
||
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 "DSCK"
|
||
FD.T.SSOCK .AZ "SSCK"
|
||
FD.T.PIPE .AZ "PIPE"
|
||
*--------------------------------------
|
||
BLANK.DIB .DA #0 #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||
.BS 3
|
||
.PS "(No IDS String!)"
|
||
.DA #0 #S.DIB.T.PRODOS
|
||
.DA #0
|
||
.DA 0 K.VER
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DEV.IOCTL .BS S.IOCTL
|
||
DEV.DIB .BS S.DIB
|
||
DEV.SFLAGS .BS 9
|
||
DS.END .ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/lsdev.s
|
||
ASM
|