;*********************************
; SHODDB.M68 - SHOW DDB
;
; by Dave Heyliger - AMUS Staff
;
; Usage: SHODDB input file
;*********************************
;search normal files and AAA (on AMUS Network)
SEARCH SYS
SEARCH SYSSYM
SEARCH AAA
;create a version number
VMAJOR =1.
VMINOR =0.
VEDIT =100.
;MACRO definitions below:
DEFINE TYPE1 AA,BB,CC ;AA: string, BB: string, CC: offset
TYPE 'AA ;type string
TAB ;tab over
CLR D1 ;clear D1 for OCVT
MOV'BB FILE+'CC(A4),D1 ;get the number into D1
OCVT 0,OT$TRM ;type it out (0 leading spaces)
CRLF ;type a return
ENDM ;end of TYPE1
DEFINE TYPE2 AA,BB,CC ;AA: string, BB: string, CC: instr.
TYPE 'AA ;type out string
TAB ;tab over
LEA A1,FILE+'BB(A4) ;point to offset in DDB
LEA A2,BUFFER(A4) ;point to buffer space
UNPACK ;unpack
'CC ;maybe twice...
CLRB @A2 ;clear byte at end of string
LEA A2,BUFFER(A4) ;repoint to start of string
TTYL @A2 ;type it out
CRLF ;and type out a return
ENDM ;end of TYPE2
;define two variables: FILE and BUFFER
.OFINI
.OFDEF FILE,D.DDB
.OFDEF BUFFER,8.
.OFSIZ IMPSIZ
;start of program: produce header, A4 points to variables above
START: PHDR -1,0,PH$REE!PH$REU
GETIMP IMPSIZ,A4
;see if filespec is on input line
BYP ;bypass all leading white space
LIN ;just a CR?
BNE 10$ ;nope, there is some input
TYPECR <Usage: SHODDB filespec (default extension is .TXT)>
EXIT
;get the filespec from the input line, fill the DDB
10$: FSPEC FILE(A4),TXT ;process ASCII input line
INIT FILE(A4) ;create block buffer & get DVR
LOOKUP FILE(A4) ;fill the D.WRK space with DIR info
JNE QUIT ;quit if not found
;no special TYPE MACRO for the PPN but note routine..
TYPE <D.PPN> ;type out header
TAB ;tab over
TYPE <[> ;type left bracket
PRPPN FILE+D.PPN(A4) ;print out P,PN
TYPECR <]> ;and right bracket