.title GETFILNAM .ident 'X01-000' ;++ ; Routine GETFILNAM will return the name of a file, given the ; address of the file ID, and the device the file is on. The file ; name is appended to the device name, thus giving the calling ; program a complete file name. ; ; 4(AP) address of a 6 byte file ID ; 8(AP) address of a descriptor for file's device, ; file name will be appended to this string. ;-- .library "sys$library:lib.mlb" $fibdef ;define fib block offsets $atrdef ;file attributes ; stack offsets for getnam variables opf$l_chan = -4 ;channel number opf$q_iosb = opf$l_chan-8 ;io status block opf$l_attadr = opf$q_iosb-4 ;address of attrib. item list opf$c_attlst = opf$l_attadr-12 ;item list opf$q_fibdesc = opf$c_attlst-512 ;descriptor for item list .psect opfcod pic,quad,usr,con,rel,gbl,shr,exe,rd,nowrt,novec .entry getfilnam,^m subl #1024,sp ;this should be plenty of room moval opf$c_attlst(fp),opf$l_attadr(fp) ;addr of item list... movw #atr$s_file_spec,opf$c_attlst(fp) ;size movw #atr$c_file_spec,opf$c_attlst+2(fp) ;return file spec movq @8(ap),r7 ;desc to r7/r8 movl r8,opf$c_attlst+4(fp) ;addr to item list clrl opf$c_attlst+8(fp) ;mark end of item list movl #fib$w_fid+10,opf$q_fibdesc(fp) ;max len of fib we need moval opf$q_fibdesc+8(fp),opf$q_fibdesc+4(fp) ;fix up desc movc5 #0,#0,#0,#fib$w_fid+10,@opf$q_fibdesc+4(fp) ;start clean movl 4(ap),r0 ;addr of ID to r0 movl (r0)+,opf$q_fibdesc+8+fib$w_fid(fp) ;move 1st part movw (r0),opf$q_fibdesc+8+fib$w_fid+4(fp) ;move last part $assign_s - ;assign output device channel chan = opf$l_chan(fp),- ;this channel devnam = @8(ap) ;this device blbc r0,out ;ok? $qiow_s func = #io$_access,- ;access file attributes function iosb = opf$q_iosb(fp),- ;let's use an iosb chan = opf$l_chan(fp),- ;chan parameter p1 = opf$q_fibdesc(fp),- ;file information block p5 = opf$l_attadr(fp) ;attribute request block blbc r0,out ;ok? movq opf$q_iosb(fp),r0 ;iosb to r0, for possible exit status blbc r0,out ;really ok? movzwl (r8),@8(ap) ;file spec length to desc movc3 (r8),2(r8),(r8) ;back up over the count word... ;...while storing result out: $dassgn_s - ;let channel go when we are done chan = opf$l_chan(fp) ret ;get back .end