dirfnd.mac;40/au/-bf=[50,10]dirfnd.mac;1 -86,93,/;DLE001/ MOVB (R2)+,R4 ; Get the initial character CMPB #'[,R4 ; Possible square brackets BEQ 5$ ; If EQ yes CMPB #'<,R4 ; Possible angle brackets BNE 8$ ; If NE no (dirty relay) 5$: MOV R2,R5 ; Compute address of right bracket... cmpb -(r3),-(r3) ; ...and correct the character count -97,98,/;DLE001/ BNE 8$ ; If NE no (dirty relay) tst r3 ; Test character count if... bne 42$ ; Zero then it's an error 8$: ; Ref label for relay to 40$ jmp 40$ 42$: ; Ref label -101,,/;DLE001/ ; At this point we have some kind of a directory string. ; Init the scratch area for the directory names, init the mfd ; fid and then scan for the directorys. ; bit #nb.dir,n.stat(r1) ; Explicit directory string? beq 300$ ; If off then default directory ; Make like it is initial directory ; Test for a directory of [.xxxx] or [.] cmpb #'.,(r2) ; Period next character? beq 10$ ; If it is then we are off to see the wizard cmpb #'-,(r2) ; Do we want to decrement it? beq 10$ ; More wizard stuff clr fidptr ; Force fresh start ; 300$: ; Well he want's to start from scratch... ; Maybe we have been here before so... ; We need some kind of test to determine if the default directory ; is being used or some other stuff? ; If the default flag is on then we got the string from the default ; directory area. Lets just fetch the last fid and exit. ; Have to add a couple of checks here for unit and etc from ; The pointer table. If we have changed devices then no go ; This means we have to save the device and unit info ; in the push pop table. mov fidptr,r4 ; Anything in table? beq 99$ ; Nope do normal processing cmp 16.(r4),n.dvnm(r1) ; This table entry same? bne 99$ cmp 18.(r4),n.unit(r1) ; How abou unit bne 99$ mov #tabst,r5 mov r4,(r5)+ ; Dummy up for later test clr (r5)+ ; This is a [.] br 220$ 99$: ; A routine to init the directory table and to set up the mfd of [0,0] mov #tabend,r4 ; Set a pointer to the directory push table mov #/2,r3 ; Set a counter 100$: clr -(r4) sob r3,100$ ; Clear out the table ; The fid is set for storing the fids ; Maybe we should use -1,-1 since the fcp knows -1,-1 = dev:[0,0] mov #4,n.did(r1) ; Preset the mfd file id mov #4,n.did+2(r1) clr n.did+4(r1) ; save r5 here , r4 is broke in call to gggmmm -109,122,/;DLE001/ BNE 8$ ;relay to 40$; If NE then bad directory syntax MOV #6,R3 ; Length of string to convert MOV R1,R2 ; Recover start of ASCII string mov #tabst,r5 ; Preset to the directory table mov r2,(r5)+ ; Set up for conversion mov r3,(r5)+ ; And the character counter BR 220$ ; Join common RAD50 conversion code ; Then it must be in the form [name]. Validate it and convert to RAD50 ; ...or [name.name], or [.name] or [-name] or others... 10$: ; At this point we need to search for "."'s in the directory string ; Every time we find one set up a new directory pointer with count mov (sp),r2 ; Fetch pointer to directory string mov (r2)+,r3 ; Fetch length mov (r2),r2 ; And where it's at cmpb -(r3),-(r3) ; Decrement count for "[]" inc r2 ; Point ot text mov #tabst,r5 ; Point to output table mov r2,(r5)+ ; Set where string starts clr (r5) ; Clear counter position 110$: cmpb #'-,(r2) ; Is it a -? bne 115$ ; Yes then pop a directory inc r2 dec (r5) ; Set flag for "-" br 103$ 115$: cmpb #'.,(r2)+ ; Is it a period? bne 120$ ; No keep searching 103$: tst (r5)+ ; Point to next directory stuff cmp r5,#taben ; Overflow in directory count (10+) bhis 40$ ; Yes then error in directory spec mov r2,(r5)+ ; Place new start in table clr (r5) ; Clear counter br 130$ 120$: inc (r5) ; Count this character 130$: sob r3,110$ ; Count all the characters tst (r5)+ ; Point to next 220$: clr (r5) ; Place table stopper mov #tabst,r5 ; Put to start 200$: clc ; Just in case we exit MOV (R5)+,R2 ; Get address of string... beq 60$ ; If null then end of table MOV (R5)+,R3 ; ...and length of string ; Count period and test for ".]" or "-]" bgt 105$ ; We have something here or maybe there ; We get here due to these formats: ; [.], [name.], [.name.] ; Here we have a push or pop beq 107$ sub #20.,fidptr ; Down the pointer cmp fidptr,#fidtab ; underflow? bhis 107$ clr fidptr ; Reset table 107$: mov fidptr,r2 ; Ok, let's fetch this fid beq 390$ ; If clear then just ignore mov r1,r4 ; Point to fnb mov #/2,r3 ; Clear for this many characters 106$: clr (r4)+ ; Clear out the fnb sob r3,106$ mov @#.fsrpt,r3 ; Change default directory fid add #a.dfdr,r3 tst (r3) ; There? bgt 415$ mov r4,r3 ; Dummy for next sub #d.dfid,r4 415$: add #d.dfid,r3 ; Point mov (r2),(r3)+ mov (r2)+,(r4)+ ; Move the... mov (r2),(r3)+ mov (r2)+,(r4)+ ; ... file id ... mov (r2),(r3)+ mov (r2)+,(r4)+ ; ... to the fnb br 390$ ; Finish up below 105$: CMP R3,#9. ; Is length valid? BHI 40$ ; If HI then too long or negative -126,126,/;DLE001/ 20$: mov r5,-(sp) ; Save r5 MOV R1,R4 ; Copy pointer to FNB -132,136,/;DLE001/ BCS 45$ ; If CS then syntax error MOV #^RDIR,N.FTYP(R1) ; Fill in the rest of the directory MOV #1,N.FVER(R1) ; name, .DIR;1 -143,149,/;DLE001/ mov fidptr,r2 ; Point back to the save area bne 22$ ; If something there then ok mov #fidtab-20.,r2 ; Point to previous entry? 22$: add #20.,r2 ; Point to next entry cmp r2,#fidend ; Overflow? bhis 45$ ; If there was then error exit mov r2,fidptr ; Set for next call CLR (R5)+ ; Reset N.NEXT ASSUME N.DID,N.NEXT+2 mov #/2,r3 ; Set count 25$: MOV (R4),(R5)+ ; Copy directory FID to N.DID mov (r4),(r2)+ ; Copy to save area CLR (R4)+ ; and reset N.FID sob r3,25$ -153,160,/;DLE001/ MOV #/2,R3 ; Zero next five words 30$: mov (r4),(r2)+ ; Save Filename and etc... CLR (R4)+ ; N.FNAM, N.FNAM+2, N.FNAM+4 SOB R3,30$ ; N.FTYP, N.FVER mov (r5)+,(r2)+ ; Save device mov (r5)+,(r2)+ ; And unit ; Top of stack contains the pointer to ; the table entrys mov (sp)+,r5 ; Fetch back r5 390$: cmp r5,#taben ; End of table? blo 200$ ; No, fetch next directory (carry set here) ; If hi or same then carry clear br 60$ ; Exit away .ENDC 50$: clr (sp)+ ; Clear off r5 br 55$ 45$: clr (sp)+ ; Be sure stack is ok 500$: 40$: MOVB #IE.BDI,F.ERR(R0) ; Some sort of error in directory spec -164,170,/;DLE001/ 55$: CLR N.DID+2(R1) ; Trash the DID SEC ; Set carry 60$: mov n.did+2(r1),r2 ; Test if we have a file beq 61$ ; No if null mov (sp),r2 ; Restore r2 for a test of directory descriptor tst 2(r2) ; Address null? beq 61$ ; None if null, Don't need to make a directory call makdir 61$: MOV (SP)+,R2 ; Restore registers MOV (SP)+,R3 ; RETURN -247,248,/;DLE001/ ; This is a subroutine to make up a directory string for the ; directory function of pip ; We will scan the fidtbl and make up a string for the dir. ; Then we will move it to the other buffer and mod the ; csi4 blocks makdir: tst fidptr ; If null then ? beq 10$ mov r0,-(sp) ; Save some regs mov r1,-(sp) mov r2,-(sp) ; This is the data set descriptor mov #fidtab,r5 ; Point to start of fid table mov #dumdir,r0 ; We will make up some file names movb #'[,(r0)+ ; Start string 15$: mov 6(r5),r1 ; Fetch first file name beq 99$ ; Error call $c5ta ; Convert this part mov 8.(r5),r1 call $c5ta mov 10.(r5),r1 call $c5ta 20$: cmpb #40,-(r0) ; Space at end? beq 20$ ; Scan backwards till non null tstb (r0)+ ; fix cmp r5,fidptr ; Done bhis 30$ ; Do next part.. add #20.,r5 ; Point to next fid movb #'.,(r0)+ ; Add period br 15$ 30$: movb #'],(r0)+ ; Place right bracket mov r0,r5 ; Fetch count... sub #dumdir,r5 ; ...set count of directory string mov (sp),r2 ; Point to descripter cmp (r2)+,(r2)+ ; Point to file name descriptor mov (r2)+,r3 ; Set count beq 42$ ; If null then do not move it mov (r2),r2 ; Set pointer 40$: movb (r2)+,(r0)+ ; Move file name sob r3,40$ 42$: sub #dumdir,r0 ; Fetch length to dummy buffer mov (sp),r2 ; Fetch back mov r5,(r2)+ ; Set new count mov (r2),r2 ; Set pointer to output string mov #dumdir,r1 ; Point 50$: movb (r1)+,(r2)+ ; Move the data in sob r0,50$ mov (sp),r2 ; Last time tst 4(r2) ; Any file name? beq 99$ ; No, just exit add 2(r2),r5 ; Set address to file name mov r5,6(r2) ; set the new address to the file name 99$: mov (sp)+,r2 ; Restore regs mov (sp)+,r1 mov (sp)+,r0 10$: return ; Exit ; .psect $$fsr6,gbl,d,ovr,sav ..fsr6:: ; The table entries that follow are made if the directorys are found. ; If not then the last valid directory is in the table pointers tabptr: .word 0 ; Some places to save the table pointers ; The first word is the pointer into the table for this ; directory we are working on fidptr: .word 0 ; The 2nd word is the pointer to the file names and fids ; we are working on tabst: .rept 10. .blkw 1 ; Address of string for directory search .blkw 1 ; String length of directory name ; If zero then not used else contains the directory ; string length when used .endr taben: .blkw 1 ; A buffer just in case of overflow (10 directorys) ; ; The entries are formated... ; The character count of that text string ; The directory name in rad50 ; A fid that was found for the directory string (3 words) ; ; ; A table for the file ids and the names for the cases of the ; push down and pop listing ; fidtab: .rept </2>/2 ; This looks like the first part of a fnb .blkw 3 ; The directory fid .blkw 3 ; The directory name string in rad50 .blkw 2 ; The rest of the file name string .blkw 2 ; Device and unit number of this one .endr fidend: tabend: ; We clear out the table to here ; dumdir: .blkb 100. ; Make this long (10 dirs + .'s) /