2018-10-05 14:58:38 +00:00
|
|
|
|
NEW
|
2020-08-17 20:47:31 +00:00
|
|
|
|
AUTO 3,1
|
2018-10-05 14:58:38 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-08-17 20:47:31 +00:00
|
|
|
|
.TF bin/lsof
|
2018-10-05 14:58:38 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-17 20:47:31 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/kernel.i
|
2018-10-05 14:58:38 +00:00
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPFDPtr .BS 2
|
2023-10-18 05:41:12 +00:00
|
|
|
|
ZPFNPtr .BS 2
|
2021-03-11 21:40:55 +00:00
|
|
|
|
FILE.ID .BS 2
|
|
|
|
|
ZS.END .ED
|
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
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2018-10-05 14:58:38 +00:00
|
|
|
|
.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
|
2022-11-02 06:54:30 +00:00
|
|
|
|
.DA CS.EVENT
|
2018-10-05 14:58:38 +00:00
|
|
|
|
.DA CS.QUIT
|
2023-05-16 16:53:52 +00:00
|
|
|
|
L.MSG.HEADER .DA MSG.HEADER
|
2023-10-18 05:41:12 +00:00
|
|
|
|
L.MSG.BODY .DA MSG.BODY
|
2018-10-05 14:58:38 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2023-05-16 16:53:52 +00:00
|
|
|
|
CS.RUN >LDYA L.MSG.HEADER
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-10-05 14:58:38 +00:00
|
|
|
|
|
2021-07-24 20:42:23 +00:00
|
|
|
|
ldx #1
|
2020-02-14 07:21:56 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
.1 stx FILE.ID
|
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
ldy FILEs.hFD-1,x
|
2018-10-05 14:58:38 +00:00
|
|
|
|
beq .7
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
|
|
|
|
lda FDs.pLO-1,y
|
|
|
|
|
sta ZPFDPtr
|
|
|
|
|
lda FDs.pHI-1,y
|
|
|
|
|
sta ZPFDPtr+1
|
2020-02-14 07:21:56 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
>PUSHW L.MSG.BODY
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2020-12-15 13:23:22 +00:00
|
|
|
|
txa
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHA
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
2018-11-19 07:43:00 +00:00
|
|
|
|
lda (ZPFDPtr)
|
2023-05-16 16:53:52 +00:00
|
|
|
|
tay
|
|
|
|
|
>PUSHW L.FD.T,y
|
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
lda FILEs.hFD-1,x
|
|
|
|
|
>PUSHA
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
>PUSHW ZPFDPtr
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
lda FILEs.oCnt-1,x
|
|
|
|
|
>PUSHA
|
2020-01-29 21:45:06 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
lda FILEs.hName-1,x
|
|
|
|
|
beq .2
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
bra .6
|
|
|
|
|
|
|
|
|
|
.2 lda ZPFDPtr
|
2023-05-16 16:53:52 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.FD.DEV
|
|
|
|
|
tay
|
|
|
|
|
lda ZPFDPtr+1
|
|
|
|
|
adc /S.FD.DEV
|
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
.6 >PUSHYA
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
>PUSHBI 9
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
* bcs .9
|
|
|
|
|
|
|
|
|
|
.7 ldx FILE.ID
|
|
|
|
|
inx
|
|
|
|
|
cpx #K.FILE.MAX+1
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
* sec
|
|
|
|
|
.9 rts
|
2023-05-16 16:53:52 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-05 14:58:38 +00:00
|
|
|
|
CS.EVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2023-10-18 05:41:12 +00:00
|
|
|
|
MSG.HEADER .CZ "hFILE Type hFD pFD Cnt Filepath"
|
|
|
|
|
MSG.BODY .CZ " %3d %4s %3d %H %3d %s\r\n"
|
2022-11-02 06:54:30 +00:00
|
|
|
|
FD.T.REG .CZ "REG"
|
|
|
|
|
FD.T.DIR .CZ "DIR"
|
|
|
|
|
FD.T.CDEV .CZ "CDEV"
|
|
|
|
|
FD.T.BDEV .CZ "BDEV"
|
|
|
|
|
FD.T.LNK .CZ "LNK"
|
2022-12-23 16:50:50 +00:00
|
|
|
|
FD.T.DSOCK .CZ "DSCK"
|
|
|
|
|
FD.T.SSOCK .CZ "SSCK"
|
2022-11-02 06:54:30 +00:00
|
|
|
|
FD.T.PIPE .CZ "PIPE"
|
2018-10-05 14:58:38 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2020-08-17 20:47:31 +00:00
|
|
|
|
DS.END .ED
|
2018-10-05 14:58:38 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-17 20:47:31 +00:00
|
|
|
|
SAVE usr/src/bin/lsof.s
|
2018-10-05 14:58:38 +00:00
|
|
|
|
ASM
|