home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / ZCNFG21.LZH / CFGLIB.LZH / PUTZFS.Z80 < prev    next >
Text File  |  1992-11-03  |  2KB  |  84 lines

  1. ;    PUTZFS - Deparse FCB to DU:FN.FT
  2.  
  3. ;Translates FCB preceded by a byte containing the user
  4. ;number into the standard FileSpec format, DU:FN.FT .
  5. ;PUTZDU sends DU: to a 3-byte destination
  6. ;PUTZFN sends FN.FT to a 12 byte buffer
  7. ;PUTZFS sends DU:FN.FT to a 15 byte buffer
  8. ;Spaces in FN are moved to the end of dest buffer.
  9. ;The space count returned in C excludes terminal
  10. ;spaces in FT, so that FT will not be shortened by
  11. ;justification
  12.  
  13. ;entry-    HL -> FCB+1 (FILENAME field)
  14. ;    DE -> destination buffer
  15. ;exit-    AF = 0,Z,NC (no error)
  16. ;    AF = ?,?,C on error
  17. ;    C = number of fill spaces at buffer end
  18. ;    DE -> next unused buffer location
  19. ;    HL -> FCB+12
  20.  
  21.     EXT    MAFDC        ;from SYSLIB
  22.     PUBLIC    PUTZFS,PUTZDU,PUTZFN
  23.  
  24. PUTZFS:    CALL    PUTZDU
  25.     RET    C        ;DU range error
  26.     LD    A,':'        ;send the colon separator
  27.     LD    (DE),A
  28.     INC    DE
  29. PUTZFN:    LD    BC,080BH    ;b=max fn char, c=max fn+ft char
  30.     CALL    PUTFS1        ;hl-> ft field
  31.     LD    A,'.'        ;send the fn terminator
  32.     LD    (DE),A
  33.     INC    DE
  34. ;send the file type (FT)
  35.     LDI
  36.     LDI
  37.     LDI
  38.     INC    C
  39.     DEC    C        ;zero?
  40.     RET    Z        ;return if so, else...
  41.     LD    B,C        ;put the count in B, and..
  42.     LD    A,' '
  43. FILL:    LD    (DE),A        ;fill remainder of dest with blanks
  44.     INC    DE        ;and return to caller
  45.     DJNZ    FILL
  46.     XOR    A        ;no error
  47.     RET
  48.  
  49. ;send b bytes, ignoring spaces
  50. PUTFS1:    LD    A,(HL)        ;get the byte
  51.     INC    HL        ;-> next byte
  52.     CP    ' '        ;space?
  53.     JR    Z,PUTFS2    ;skip if yes
  54.     LD    (DE),A
  55.     DEC    C        ;count characters transferred
  56.     INC    DE
  57. PUTFS2:    DJNZ    PUTFS1
  58.     RET
  59.  
  60. PUTZDU:    PUSH    HL
  61.     DEC    HL
  62.     LD    A,(HL)
  63.     DEC    A
  64.     CP    16
  65.     CCF
  66.     JR    C,PTZDUX    ;error - range exceded
  67.     ADD    'A'        ;convert to (A..P)
  68.     LD    (DE),A
  69.     INC    DE        ;send the Drive letter
  70.     DEC    HL        ;-> user number
  71. ;convert the user number to ASCII decimal & send
  72.     LD    A,(HL)
  73.     CP    32        ;max user +1
  74.     CCF
  75.     JR    C,PTZDUX    ;error - range exceded
  76.     CALL    MAFDC        ;convert to ascii at DE
  77. ;send the file name (FN)
  78.     XOR    A        ;no error
  79.     LD    C,A        ;no trailing spaces??
  80. PTZDUX:    POP    HL        ;-> FCB+1 (file name field)
  81.     RET
  82.  
  83. ;=================================================
  84.