mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
139 lines
2.5 KiB
Plaintext
139 lines
2.5 KiB
Plaintext
NEW
|
||
PREFIX
|
||
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
|
||
*--------------------------------------
|
||
ZPFDPtr .EQ ZPBIN
|
||
FILE.ID .EQ ZPBIN+2
|
||
*--------------------------------------
|
||
* 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
|
||
|
||
ldx #1
|
||
stx FILE.ID
|
||
|
||
.1 lda OF.Table.hFD-1,x
|
||
beq .7
|
||
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPFDPtr
|
||
|
||
>PUSHW L.MSG1
|
||
|
||
lda FILE.ID
|
||
tax
|
||
>PUSHA
|
||
lda OF.Table.hFD-1,x
|
||
>PUSHA
|
||
|
||
ldx FILE.ID
|
||
lda OF.Table.hPath-1,x
|
||
bne .2
|
||
|
||
lda OF.Table.hFD-1,x
|
||
tax
|
||
|
||
lda Dev.Table-1,x
|
||
sta ZPFDPtr
|
||
clc
|
||
adc #S.FD.DEV
|
||
tay
|
||
lda Dev.Table,x
|
||
sta ZPFDPtr+1
|
||
adc /S.FD.DEV
|
||
|
||
bra .3
|
||
|
||
.2 >SYSCALL GetMemPtr
|
||
|
||
.3 pha
|
||
lda (ZPFDPtr)
|
||
tax
|
||
>PUSHW L.FD.T,x
|
||
pla
|
||
|
||
>PUSHYA
|
||
|
||
>PUSHBI 6
|
||
|
||
>SYSCALL PrintF
|
||
|
||
.7 inc FILE.ID
|
||
ldx FILE.ID
|
||
cpx #K.OF.MAX+1
|
||
bne .1
|
||
|
||
.8 lda #0
|
||
sec
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.EVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
MSG0 .AZ "hFILE hFD Type Filepath"
|
||
MSG1 .AZ "%3d %3d %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
|
||
DS.END
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/BIN/LSOF.S
|
||
ASM
|