A2osX/BIN/LSOF.S.txt

119 lines
2.3 KiB
Plaintext
Raw Normal View History

2018-10-05 14:58:38 +00:00
NEW
2018-11-17 17:17:13 +00:00
PREFIX
2018-10-05 14:58:38 +00:00
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/LSOF
*--------------------------------------
.INB INC/MACROS.I
.INB INC/MLI.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
*--------------------------------------
2018-11-19 07:43:00 +00:00
ZPFDPtr .EQ ZPBIN
2018-10-05 14:58:38 +00:00
*--------------------------------------
* 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.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
>LDA.G FILE.ID
.1 tax
2018-11-19 07:43:00 +00:00
lda OF.Table.hPath,x
2018-10-05 14:58:38 +00:00
beq .7
>SYSCALL GetMemPtr
>PUSHYA
>LDA.G FILE.ID
tax
2018-11-19 07:43:00 +00:00
lda OF.Table.hFD,x
2018-10-05 14:58:38 +00:00
>SYSCALL GetMemPtr
2018-11-19 07:43:00 +00:00
>STYA ZPFDPtr
2018-10-05 14:58:38 +00:00
2018-11-19 07:43:00 +00:00
lda (ZPFDPtr)
2018-10-05 14:58:38 +00:00
tax
>PUSHW L.FD.T,x
>LDA.G FILE.ID
tax
2018-11-19 07:43:00 +00:00
lda OF.Table.hFD,x
2018-10-05 14:58:38 +00:00
>PUSHA
txa
>PUSHA
>PUSHBI 6
>LDYA L.MSG1
>SYSCALL printf
.7 >INC.G FILE.ID
2018-11-19 07:43:00 +00:00
cmp #K.OF.MAX
2018-10-05 14:58:38 +00:00
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
.9 rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "ID hFD Type Filepath"
MSG1 .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
FILE.ID .BS 1
DS.END
.ED
*--------------------------------------
MAN
2018-11-19 07:43:00 +00:00
SAVE USR/SRC/BIN/LSOF.S
2018-10-05 14:58:38 +00:00
ASM