home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / buffers.lbr / PFNM.MZC / PFNM.MAC
Text File  |  1987-01-14  |  2KB  |  80 lines

  1.     extrn    .skipblks, .nextch, .lastch
  2. ;
  3. ; Parse the next field from the command line (de^) into fcb hl^.
  4. ; Drive id is set, name and type are parsed into fname and ftype,
  5. ; with any '*'s expanded into '?'s, and the fields are blank padded.
  6. ; At exit de points to the field terminating delimiter char, (a) is
  7. ; the count of '?' chars in fname & ftype fields, with flags set on
  8. ; it. Thus the Z flag on exit indicates no wild cards. (c) contains
  9. ; the drive specifier (if any), (b) holds 0 (default user).
  10. ; a,f,b,c,d,e,h,l
  11. .pfnm::    call    .skipblks
  12.     lxi    b,0ff00h;    default user and drive
  13.     inx    d
  14.     ldax    d
  15.     dcx    d
  16.     cpi    ':'
  17.     jnz    .pfnm1;        no drive spec
  18.     call    .nextch
  19.     sui    '@';        totally undiscriminating
  20.     mov    c,a
  21.     mov    m,a
  22. ;    "    "
  23. ; Entry here from .pfnmdu ONLY
  24. .pfnm1::
  25.     push    b
  26.     mvi    b,8
  27.     push    h
  28.     call    ldfld;        fill the name field
  29.     call    .lastch
  30.     cpi    '.'
  31.     cz    .nextch;    Absorb any name terminating '.'
  32.     mvi    b,3;         (else terminator blank fills)
  33.     call    ldfld;        fill the type field
  34.     mvi    b,3
  35. parse1:    inx    h
  36.     mvi    m,0
  37.     dcr    b
  38.     jnz    parse1;        zero ex, s2, s1 fields
  39.     lxi    b,11 shl 8;    b := 11, c := 0
  40.     pop    h
  41.     mvi    a,'?'
  42. parse2:    inx    h
  43.     cmp    m
  44.     jnz    parse3
  45.     inr    c
  46. parse3:    dcr    b
  47.     jnz    parse2;        count the '?'s in fname/ftype
  48.     mov    a,c
  49.     pop    b
  50.     inr    b;        map default user to 0
  51.     ora    a;        z flag for no wild cards
  52.     ret
  53. ;
  54. ; load up to (b) chars from (de)^ up to (hl+1)^ up.
  55. ; skip to delimiter.  Implement any wild cards on "*"
  56. ; blank fill if less than (b) chars available.
  57. ; Upshift any lower case characters.
  58. ; a,f,b,d,e,h,l
  59. ldfld:    call    .lastch;    on (de)^ and load it
  60.     jz    ldfld4;        delimiter
  61.     inx    h
  62.     cpi    '*'
  63.     jnz    ldfld1
  64.     mvi    m,'?';        expand '*'
  65.     jmp    ldfld2;        dont skip past it
  66. ldfld1:    mov    m,a
  67.     call    .nextch
  68. ldfld2:    dcr    b
  69.     jnz    ldfld
  70.     call    .lastch;    on (de)^ and load it
  71.     rz;            a delimiter
  72. ldfld3:    call    .nextch;    else skip to a delimiter
  73.     rz
  74.     jmp    ldfld3
  75. ldfld4:    inx    h
  76.     mvi    m,' ';        blank fill
  77.     dcr    b
  78.     jnz    ldfld4
  79.     ret
  80. Θt