A2osX/BIN/LSOF.S.txt

139 lines
2.5 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
2020-02-14 07:21:56 +00:00
FILE.ID .EQ ZPBIN+2
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
2019-10-03 06:25:27 +00:00
*--------------------------------------
2018-10-05 14:58:38 +00:00
.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
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2018-10-05 14:58:38 +00:00
2020-02-14 07:21:56 +00:00
ldx #1
stx FILE.ID
.1 lda OF.Table.hFD-1,x
2018-10-05 14:58:38 +00:00
beq .7
2020-02-14 07:21:56 +00:00
2018-10-05 14:58:38 +00:00
>SYSCALL GetMemPtr
2019-02-26 16:50:42 +00:00
>STYA ZPFDPtr
2020-02-14 07:21:56 +00:00
>PUSHW L.MSG1
lda FILE.ID
2018-10-05 14:58:38 +00:00
tax
2020-02-14 07:21:56 +00:00
>PUSHA
lda OF.Table.hFD-1,x
>PUSHA
ldx FILE.ID
2019-02-27 15:00:56 +00:00
lda OF.Table.hPath-1,x
2019-02-26 16:50:42 +00:00
bne .2
2020-02-14 07:21:56 +00:00
2019-02-27 15:00:56 +00:00
lda OF.Table.hFD-1,x
2019-02-26 16:50:42 +00:00
tax
2019-02-27 15:00:56 +00:00
lda Dev.Table-1,x
2019-02-26 16:50:42 +00:00
sta ZPFDPtr
clc
adc #S.FD.DEV
tay
2019-02-27 15:00:56 +00:00
lda Dev.Table,x
2019-02-26 16:50:42 +00:00
sta ZPFDPtr+1
adc /S.FD.DEV
bra .3
2020-01-29 21:45:06 +00:00
2019-02-26 16:50:42 +00:00
.2 >SYSCALL GetMemPtr
2020-02-14 07:21:56 +00:00
.3 pha
2018-11-19 07:43:00 +00:00
lda (ZPFDPtr)
2018-10-05 14:58:38 +00:00
tax
>PUSHW L.FD.T,x
2020-02-14 07:21:56 +00:00
pla
>PUSHYA
2018-10-05 14:58:38 +00:00
>PUSHBI 6
2020-02-14 07:21:56 +00:00
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2020-02-14 07:21:56 +00:00
.7 inc FILE.ID
ldx FILE.ID
cpx #K.OF.MAX+1
2018-10-05 14:58:38 +00:00
bne .1
2020-01-29 21:45:06 +00:00
.8 lda #0
sec
2018-10-05 14:58:38 +00:00
.9 rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
2019-02-26 16:50:42 +00:00
MSG0 .AZ "hFILE hFD Type Filepath"
2020-02-14 07:21:56 +00:00
MSG1 .AZ "%3d %3d %5s %s\r\n"
2018-10-05 14:58:38 +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 "DSOCK"
FD.T.SSOCK .AZ "SSOCK"
FD.T.PIPE .AZ "PIPE"
*--------------------------------------
.DUMMY
.OR 0
DS.START
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