A; Gives LBN of files from index file -- must be privileged (APR5)o; By Nicholas Zymaris 25-DEC-84r ac.enb==200& .mcall qiow$s, svtk$s, nbof$l, exit$s- nbof$l ; Define FNA block offsets locallyriostat: .blkw 2 -fidbuf: .word 1,1,0 ; File ID (FID) of fileS3acc: .byte 0,ac.enb ; AC.ENB set --> enable access len=1000buff: .blkw len;buff2: .blkw lenCradarg: .word 3,r50cnt,,filbuf ; Argument block for R50ASCa+r50cnt: .word 12. ; Convert 12. charactersuCfilmes: .ascii <15><12>/File: / ; (This location must not be moved)r5filmsz=.-filmes ; Make sure this is an even addressa.filbfs=16 ; Maximum filename, extension sizefilbuf: .blkb filbfslbnmsg: .ascii /Starting LBN: /t lbnmsl=.-lbnmsg"idxlbm: .ascii /Index entry LBN: / idxlbl=.-idxlbm 07errmsg:.ascii <15><12>/Nonstandard file header at VBN /f errmsl=.-errmsg .even+files: .blkw 1 ; Number of files on volumeu6idxbas: .blkw 1 ; Base address (LBN) of index entries4; NOTE: ; Index file assumed contiguous after here- ; (valid for first 16 index entries only)f<maxvbn: .blkw 1 ; Maximum VBN of index file (No EOF marker)7trpadr: ; Addresses of SST service routines (0=none)b7 .WORD nomem ; Odd address or nonexistent memory error ( .WORD nomem ; Memory protect violation$ .WORD 0 ; T-bit or breakpoint trap! .WORD 0 ; Execution of I/O Trap-% .WORD resins ; Reserved instructionr# .WORD 0 ; Non-RSX EMT instruction  .WORD 0 ; Trap instruction# .WORD 0 ; Reserved for future usem5 trplen=<.-trpadr>/2 ; Word length of table for Exec.e.nomem: add #6,sp ; Hope it's the right offset9resins: mov #end,(sp) ; Load new PC (to end on returning)  rti ; Return(%crash: bpt ; Fatal error "recovery"n,start: svtk$s #trpadr,#trplen ; Set up trapsG qiow$s #io.acr,#1,#2,,#iostat,,<#fidbuf,,,,#acc>; Gain readonly accessc; qiow$s #io.rvb,#1,#2,,,,<#buff,#len,,,#2> ; Read homeblock.7 mov buff+4,r0 ; Save index file bitmap address for QIOr+ mov r0,idxbas ; ...and to calculate IDXBAS4 tst buff+2 ; Disks larger than 65535 blocks are...0 bne crash ; ... (ahem) presently NOT supported< cmp buff,#1 ; Neither are disks with index file bitmaps...& bne crash ; ...larger than one block4 add buff,idxbas ; Get base address of index entriesC qiow$s #io.rvb,#1,#2,,,,<#buff,#len,,,r0> ; Read index file bitmap $; mov #buff,r0 ; Beginning of I.F.B.;1$: tst (r0)+ ; Test it +; bne 1$ ; If any bits set, check next oneb.; mov r0,r1 ; Save address of first zero word; mov #3,r2 ; Three times(;2$: tst (r0)+ ; Test for nonzero words.; bne 1$ ; If any, go back to regular testing; sob r2,2$ ; (Loop) ; mov r1,r2 ; Save valuex/; mul #10,r2 ; Maximum # of file headers in R2e ; tst -(r1) ; Last nonzero word#; bmi 3$ ; Sign (leftmost) bit seti; mov #40000,r3 ; Next bit over;;4$:/; dec r2 ; One less file header to worry abouto; bit r3,(r1) ; Is bit set?; bne 3$ ; Yes -- go on; asr r3 ; No -- test next bit ; br 4$ ; "0;3$: mov r2,files ; Save no. of headers to print; mov files,maxvbn; add idxbas,maxvbnw-; dec maxvbn ; Calculate maximum VBN to reads2 mov #4,r0 ; Beginning of index entries -- VBN #4+cont:; cmp r0,maxvbn ; Highest VBN reached? <; bhis end ; Yes -- exit before QIOing to avoid Exec. errs.E qiow$s #io.rvb,#1,#2,,#iostat,,<#buff,#len,,,r0>; Read virtual blockn& bcs end ; Abort on directive failure+ tstb iostat ; End of file or other error?g bmi end ; Yes -- end mov r0,r1 ; Get VBN;% sub #4,r1 ; Block relative to VBN 4d add idxbas,r1 ; Get LBNF qiow$s #io.rlb,#1,#2,,#iostat,,<#buff2,#len,,,r1>; Read logical block clr r3m11$: cmp buff(r3),buff2(r3)x, bne end ; If LBN and VBN don't agree, exit tst (r3)+ cmp r3,#776 blos 11$ ' jsr pc,disfil ; No -- display filename bcc 1$ ; Branch if no error,* qiow$s #io.wvb,#5,#2,,,,<#errmsg,#errmsl>+ mov r0,r5 ; Get current VBN of index filet jsr pc,dump ; Dump itr br end ; Exitd1$:e* qiow$s #io.wvb,#5,#2,,,,<#lbnmsg,#lbnmsl># mov ,r5 ; Get file's LBNi jsr pc,dump ; Dump its value* qiow$s #io.wvb,#5,#2,,,,<#idxlbm,#idxlbl>% mov r1,r5 ; Load LBN of index entry( jsr pc,dump ; Dump it 2$: inc r0 ; Next block jmp cont ; Continuec end: exit$sbdisfil: mov r0,-(sp) mov r5,-(sp)l+ cmpb buff+1,#56 ; Check offset of filename2 bne 20$ ; If nonstandard, don't try to print it.+ mov #radarg,r5 ; Address of arg. block to ,- jsr pc,r50asc ; Put ASCII filename in FILBUF$7 mov #,r0 ; Address of end of file extensionG*11$: movb (r0),1(r0) ; Move character over dec r0 ; Go back cmp r0,# ; Finished? bhis 11$ ; No -- continuer, add #1,r0 ; Position before file extension movb #'.,(r0) ; Insert period* add #4,r0 ; Move over to end of filename5 movb #';,(r0)+ ; Insert semicolon for version number9 mov buff+66,r5 ; Prepare to dump value of version number#H qiow$s #io.wvb,#5,#2,,,,<#filmes,<#filbfs+filmsz>> ; Type out fnam,ext,% jsr pc,dump ; ...and version numberA mov (sp)+,r5f mov (sp)+,r0G clc ; No errorr 21$: returnr20$: sec ; Error br 21$ ; Return, .end start;