;*************************** AMUS Program Label ******************************
; Filename: ARXDIR.M68                                      Date: 03/03/88
; Category: UTIL         Hash Code: 663-653-341-474      Version: 2.0
; Initials: DDSS/AM      Name: DAVE DRAKE
; Company: DOUBLE-D SOFTWARE SERVICES              Telephone #: 7024382173
; Related Files: ARXHIV.*,ARXRES.*,ARXDOC.DOC
; Min. Op. Sys.: ???                           Expertise Level: INT
; Special: 
; Description: Modification of Dave Pallman Archive Routines to handle
;		random files!
; 
;*****************************************************************************
;***************************************************************************;
;									    ;
;				   ARCDIR				    ;
;			  display archive directory			    ;
;									    ;
;			  Author: David F. Pallmann			    ;
;	     Copyright (C) 1984 by LMS Technical Services, Inc.		    ;
;									    ;
;***************************************************************************;
;
;				   ARXDIR
;		 Modified for Random file handling (Ver 2.0)
;
;			   Author: David A. Drake
;	      Copyright (C) 1988 by Double-D Software Services
;
;***************************************************************************;

OBJNAM	ARXDIR.LIT

VMAJOR=2	;16-Mar-88 DDD add random file handling

;edit history
VEDIT=100.	;06-Jan-84 DFP creation.

;universals
SEARCH	SYS
SEARCH	SYSSYM

;registers
IMP=A5					;impure index

;impure area
.OFINI
.OFDEF	ARCDIR,D.DDB			;DDB for reading archive directory
.OFDEF	FILE,22				;v2-file header buffer (was 14)
.OFDEF	BUFFER,10			;PACK-UNPACK buffer
.OFSIZ	IMPSIZ

START:	PHDR	-1,0,PH$REE!PH$REU	;program header
	GETIMP	IMPSIZ,IMP		;allocate impure area

;get archive specification

GETARC:	BYP
	LIN
	BNE	10$
	TYPESP	archive name:
	KBD	EXIT
	BYP
10$:	FSPEC	ARCDIR(IMP),MAP
	INIT	ARCDIR(IMP)
	OPENI	ARCDIR(IMP)
	CLR	D2

LOOP:	CTRLC	ENDFIL
	LEA	A0,FILE(IMP)
	MOV	#22,D0			;v2 - was 14
10$:	FILINB	ARCDIR(IMP)
	TST	ARCDIR+D.SIZ(IMP)
	JEQ	ENDFIL
	MOVB	D1,(A0)+
	SOB	D0,10$

DISPLY:	INC	D2
	MOV	D2,D1
	DCVT	0,OT$TRM
	TAB
;filename
	LEA	A1,FILE(IMP)
	LEA	A2,BUFFER(IMP)
	UNPACK
	UNPACK
	CLRB	@A2
	TTYL	BUFFER(IMP)			;filename
	TYPESP
	LEA	A2,BUFFER(IMP)
	UNPACK
	CLRB	@A2
	TTYL	BUFFER(IMP)			;ext
	TAB
;ppn
	PRPPN	FILE+6(IMP)
	TAB
;size in bytes
	MOV	FILE+10(IMP),D1
	DCVT	0,OT$TRM!OT$TSP
	TYPESP	bytes
	TAB
;v2-size in blocks
	MOV	FILE+14(IMP),D1
	DCVT	0,OT$TRM!OT$TSP
	TYPESP	blocks
	TAB
;v2-random or seq
	MOVB	FILE+20(IMP),D1
	CMPB	D1,#'S
	BNE	100$	
	TYPECR	Sequential
	BR	200$

100$:	TYPECR	Random

200$:	JMP	LOOP

ENDFIL:	CLOSE	ARCDIR(IMP)

EXIT:	CRLF
	EXIT

	END