DRGET.MAC;32/au/-bf=[13,10]DRGET.MAC;1 -34,,/;DLE001/ $idata buf: .blkw 8. ; dummy file name buffer -62,62,/;DLE001/ ; R1=ADDRESS OF RECORD (will be buf) -69,81,/;DLE001/ mov #buf,r0 mov #8.,r3 1$: clr (r0)+ ; Make like we did not get anything (null fid) sob r3,1$ ; ... and etc .... MOV .FCBAD,R3 tst f.dlar(r3) ; Null record number? (first time here?) beq 4$ mov f.dvbo(r3),r0 ; Point to old block number beq 4$ ; If null then need to do somthing rash cmp (sp),f.dlar(r3) ; How does requested compare to the last record? bhis 5$ ; If higher or same then we can scan 4$: ; else Force to start at beginning if lt mov #1,r0 ; Point to first VBN mov r0,f.dlar(r3) ; Set the first record as last record found 2$: ; possible entry point for next blocks... clr f.doff(r3) ; Reset since we are going to begin a new ; ...scan 5$: mov r0,f.dvbo(r3) ; Set new/old logical block number CALL .DRVLB ; CONVERT VBN TO LBN ; r2,r3 point to lbn here bcc 6$ ; BRANCH IF BEYOND EOF jmp 60$ 6$: -91,99,/;DLE001/ MOV R3,R0 ; COPY LOW WORD OF DESIRED LBN MOV R2,-(SP) ; COPY HIGH WORD OF DESIRED LBN SUB (R1)+,(SP) ; CALC DIFF BETWEEN LBN HIGH WORDS SUB (R1)+,R0 ; CALC DIFF BETWEEN LBN LOW WORDS SBC (SP)+ ; UDPATE DIFF BETWEEN LBN HIGH WORDS BNE 10$ ; IF NE THEN BLOCK NOT IN MEMORY CMP R0,.DRNLB ; COMPARE LBN DIFFERENCE W/ # OF .DRNLB ; BLOCKS CURRENTLY IN BUFFER BLO 40$ ; IF LO BLOCK IS IN BUFFER -103,103,/;DLE001/ 10$: MOV #.DRUCB,R1 -107,128,/;DLE001/ MOV #.DRBUF,R1 ;BOC GET ADDR DIR BUF - NOT CONTIG .DRUCB MOV #1,(R1) ; ASSUME ONLY ONE BLOCK CAN BE READ MOV .FCBAD,R0 ; GET FCB ADDRESS ASSUME UC.CON,200 TSTB F.UCHA(R0) ; IS THE DIRECTORY FILE CONTIGUOUS BPL 20$ ; IF PL NO ASSUME .VBSIZ,1000 MOV #<<<.DRENB-.DRBUF>&177000>/.vbsiz>,(R1) ;ASSUME ... ; MAX BLOCKS CAN BE READ mov f.dvbo(r0),-(sp); for calculation MOV F.DREF(R0),R0 ; GET VBN OF FILE END INC R0 ; INSURE RESULT BEGINS AT ONE sub (sp)+,r0 ; Calculate number of blocks in .. ; FILE BETWEEN DESIRED VBN AND EOF CMP (R1),R0 ; IS RESULT AT LEAST DRMAX? BHIS 30$ ; IF HIS YES -- READ THAT MANY BLOCKS 20$: MOV (R1),R0 ; ELSE, SPECIFY READ FEWER BLOCKS 30$: MOV R0,.DRNLB ; SAVE NUMBER OF BLOCKS TO READ SWAB R0 ; MULTIPLY IT BY 1000 OCTAL ASL R0 ; CALL .RDNLB ; READ THE BLOCKS IN MOV .UCBAD,.DRUCB ; BUFFER IS NOW VALID -132,155,/;DLE001/ ; 0(SP)=RECORD NUMBER OF DESIRED RECORD ; 40$: ; Scan the buffer looking for the record number mov .fcbad,r3 ; Point to fcb mov f.doff(r3),r0 ; Point to old offset 43$: cmp (sp),f.dlar(r3) ; Found the record? (saved r0 from call) beq 45$ ; Yep mov r0,r2 ; Save r0 for block overflow check add #.vbsiz,r2 ; Bump to next block size bic #.vbsiz-1,r2 ; Don't add in the lower bits add .drbuf(r0),r0 ; Point to next record tst (r0)+ ; bump for byte count position inc f.dlar(r3) ; If the blocks are even count then we will overflow the offset count. ; a check for this condition is done here cmp r0,r2 ; is r0 bigger then r2 (next block address)? bhis 44$ ; If it is then we overflowed the block tst .drbuf(r0) ; end of file or block bpl 43$ ; Do another record ; This is the end of this block (or a overflow condition) 44$: dec f.dlar(r3) ; we did not get a record yet inc f.dvbo(r3) ; Point to next logical block ; r3 contains the new block number test mov r2,r0 ; Point to new offset (next block) swab r2 ; Fetch block number asr r2 ; Correct for bytes cmp r2,.drnlb ; Have we more blocks? blo 43$ ; More blocks are available if lower ; The same means we have overflowed mov f.dvbo(r3),r0 ; Get next logical block br 2$ ; Go back and fetch some new blocks ; r0 points to record via offset ; f.dlar is the record number 45$: mov r0,f.doff(r3) ; save the offset add #.drbuf+6,r0 ; Real address of file name clr r1 ; Stop on period call $cat5b ; Convert the character mov r1,buf+6 ; set it cmpb #'.,r2 ; Done? beq 55$ clr r1 call $cat5b mov r1,buf+8. cmpb #'.,r2 beq 55$ clr r1 call $cat5b mov r1,buf+10. cmpb #'.,r2 ; End? beq 55$ ; Nope need to scan for '. ; We need to check against the character counter for the period 57$: cmpb #'.,(r0)+ ; Period here? bne 57$ 55$: clr r1 ; Now for the ext call $cat5b mov r1,buf+12. mov f.doff(r3),r0 ; Point to offset of this data add #.drbuf+5,r0 ; Point to character counter movb (r0)+,r1 ; Fetch character counter inc r1 ; Round up bic #1,r1 add r1,r0 ; Point to file data mov (r0)+,buf+14. ; Set file version number mov #buf,r2 ; Point to beginning of buf mov (r0)+,(r2)+ ; Fetch file id number mov (r0)+,(r2)+ ; Fetch file seq number mov (r0)+,(r2)+ ; Fetch file revision info ; Exit from all this (it needs to be cleaned up a bit) br 50$ 60$: sec ; End of the directory, set carry mov .fcbad,r3 ; Point 50$: mov f.dvbo(r3),r2 ; Reset vbn to r2 mov #buf,r1 ; We made this null at start mov (sp)+,r0 ; Return with r0 ok return -159,159,/;DLE001/ /