A2osX/BIN/LSDEV.S.txt
2018-11-19 08:43:00 +01:00

260 lines
4.8 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
PREFIX
AUTO 4,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
*--------------------------------------
ZPFDPtr .EQ ZPBIN
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #4 ZP
.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.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
>STZ.G Table.Index
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
>LDA.G Table.Index
.1 tax
lda Dev.Table.hFD,x
beq .7
>STA.G DEV.FD
>SYSCALL GetMemPtr
>STYA ZPFDPtr S.FD
jsr DumpDevFD
bcs .9
>PUSHEA.G DEV.DIB
>LDA.G DEV.FD
>SYSCALL GetDevStatus
bcc .6
>PUSHA
>PUSHBI 6
>LDYA L.MSG2.ERR
>SYSCALL printf
bcs .9
bra .7
.6 jsr DumpDevDIB
.7 >INC.G Table.Index
cmp #K.DEV.MAX
bne .1
clc
.9 rts
*--------------------------------------
DumpDevFD ldy #S.FD.DEV.DRVPTR+1
>PUSHB (ZPFDPtr),y
dey
>PUSHB (ZPFDPtr),y
lda #S.FD.DEV.NAME
clc
adc ZPFDPtr
tay
lda /S.FD.DEV.NAME
adc ZPFDPtr+1
>PUSHYA
>PUSHB.G DEV.FD
>PUSHB.G Table.Index
>PUSHBI 6
>LDYA L.MSG1
>SYSCALL printf
rts
*--------------------------------------
DumpDevDIB >PUSHB.G DEV.DIB+S.DIB.VERSION+1
>PUSHB.G DEV.DIB+S.DIB.VERSION
>PUSHEA.G DEV.DIB+S.DIB.IDS
>PUSHB.G DEV.DIB+S.DIB.ST
>PUSHB.G DEV.DIB+S.DIB.T
>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
>PUSHBI 8
>LDYA L.MSG2
>SYSCALL printf
bcs .9
>LDA.G DEV.DIB+S.DIB.S
bpl .4 char device...
>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
>LDYA L.MSG2.B
bra .8
.4 >PUSHBI 0
>LDYA L.MSG2.C
.8 >SYSCALL printf
.9 rts
*--------------------------------------
DumpNod >LDYA L.MSG3
>SYSCALL puts
>LDA.G Table.Index
.1 tax
lda Nod.Table.hPath,x
beq .7
>SYSCALL GetMemPtr
>PUSHYA
>LDA.G Table.Index
tax
lda Nod.Table.hFD,x
>SYSCALL GetMemPtr
>STYA ZPFDPtr
lda (ZPFDPtr)
tax
>PUSHW L.FD.T,x
>LDA.G Table.Index
tax
lda Nod.Table.hFD,x
>PUSHA
txa
>PUSHA
>PUSHBI 6
>LDYA L.MSG4
>SYSCALL printf
.7 >INC.G Table.Index
cmp #K.OF.MAX
bne .1
clc
.9 rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "ID hFD Name Addr. Status Typ/Sub IDString Version Size (BLK)"
MSG1 .AZ "%03d $%h %7s $%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 "ID hFD Type Filepath"
MSG4 .AZ "%03d $%h %5s %s\r\n"
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"
*--------------------------------------
.DUMMY
.OR 0
DS.START
Table.Index .BS 1
DEV.FD .BS 1
DEV.DIB .BS S.DIB
DEV.SFLAGS .BS 9
DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/LSDEV.S
ASM