; PUTZFS - Deparse FCB to DU:FN.FT ;Translates FCB preceded by a byte containing the user ;number into the standard FileSpec format, DU:FN.FT . ;PUTZDU sends DU: to a 3-byte destination ;PUTZFN sends FN.FT to a 12 byte buffer ;PUTZFS sends DU:FN.FT to a 15 byte buffer ;Spaces in FN are moved to the end of dest buffer. ;The space count returned in C excludes terminal ;spaces in FT, so that FT will not be shortened by ;justification ;entry- HL -> FCB+1 (FILENAME field) ; DE -> destination buffer ;exit- AF = 0,Z,NC (no error) ; AF = ?,?,C on error ; C = number of fill spaces at buffer end ; DE -> next unused buffer location ; HL -> FCB+12 EXT MAFDC ;from SYSLIB PUBLIC PUTZFS,PUTZDU,PUTZFN PUTZFS: CALL PUTZDU RET C ;DU range error LD A,':' ;send the colon separator LD (DE),A INC DE PUTZFN: LD BC,080BH ;b=max fn char, c=max fn+ft char CALL PUTFS1 ;hl-> ft field LD A,'.' ;send the fn terminator LD (DE),A INC DE ;send the file type (FT) LDI LDI LDI INC C DEC C ;zero? RET Z ;return if so, else... LD B,C ;put the count in B, and.. LD A,' ' FILL: LD (DE),A ;fill remainder of dest with blanks INC DE ;and return to caller DJNZ FILL XOR A ;no error RET ;send b bytes, ignoring spaces PUTFS1: LD A,(HL) ;get the byte INC HL ;-> next byte CP ' ' ;space? JR Z,PUTFS2 ;skip if yes LD (DE),A DEC C ;count characters transferred INC DE PUTFS2: DJNZ PUTFS1 RET PUTZDU: PUSH HL DEC HL LD A,(HL) DEC A CP 16 CCF JR C,PTZDUX ;error - range exceded ADD 'A' ;convert to (A..P) LD (DE),A INC DE ;send the Drive letter DEC HL ;-> user number ;convert the user number to ASCII decimal & send LD A,(HL) CP 32 ;max user +1 CCF JR C,PTZDUX ;error - range exceded CALL MAFDC ;convert to ascii at DE ;send the file name (FN) XOR A ;no error LD C,A ;no trailing spaces?? PTZDUX: POP HL ;-> FCB+1 (file name field) RET ;=================================================