home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3lib / wildex.mac < prev    next >
Encoding:
Text File  |  1994-09-02  |  1.5 KB  |  110 lines

  1. ;WILDEX - wildcard expansion module
  2. ; S. Kluger  04/15/84
  3. ;
  4. ; This module, for use with SYSLIB, can be used
  5. ; to expand a wildcard filename into a table of
  6. ; file names as found in current DU:
  7. ;
  8. ; ENTRY:
  9. ; HL = .buffer
  10. ; DE = .afn fcb
  11. ;
  12. ; EXIT:
  13. ; HL = number of files
  14. ; ACC= zero flag set if ok, else error
  15. ; the buffer contains (HL) file names of 16 char each
  16. ; Char 0 contains the user number!
  17. ;
  18. sfirst    equ    17
  19. snext    equ    18
  20. ;
  21.     extrn    bdos
  22. ;
  23.     public    wildex
  24. ;
  25. wildex:    shld    bufptr
  26.     lxi    h,0
  27.     shld    count
  28.     mvi    c,sfirst
  29.     call    bdos
  30.     cpi    0ffh
  31.     rz            ;nothing found -- error
  32.     call    moven        ;move name
  33. wloop:    mvi    c,snext        ;search for next
  34.     call    bdos
  35.     cpi    0ffh
  36.     jz    done        ;finished
  37.     call    moven
  38.     jmp    wloop
  39. ;
  40. done:    ora    a
  41.     lhld    count
  42.     ret
  43. ;
  44. moven:    push    d
  45.     lhld    bufptr
  46.     add    a
  47.     add    a
  48.     add    a
  49.     add    a
  50.     add    a
  51.     adi    80h
  52.     mov    c,a
  53.     mvi    b,0
  54.     mvi    d,16        ;move 16 chars
  55. movlp:    ldax    b
  56.     mov    m,a
  57.     inx    h
  58.     inx    b
  59.     dcr    d
  60.     jnz    movlp
  61.     shld    bufptr
  62.     pop    d
  63.     lhld    count
  64.     inx    h
  65.     shld    count
  66.     ret
  67. ;
  68. bufptr:    dw    0
  69. count:    dw    0
  70.     end
  71. n module
  72. ; S. Kluger  04/15/84
  73. ;
  74. ; This module, for use with SYSLIB, can be used
  75. ; to expand a wisearch for next
  76.     call    bdos
  77.     cpi    0ffh
  78.     jz    done        ;finished
  79.     call    moven
  80.     jmp    wloop
  81. ;
  82. done:    ora    a
  83.     lhld    count
  84.     ret
  85. ;
  86. moven:    push    d
  87.     lhld    bufptr
  88.     add    a
  89.     add    a
  90.     add    a
  91.     add    a
  92.     add    a
  93.     adi    80h
  94.     mov    c,a
  95.     mvi    b,0
  96.     mvi    d,16        ;move 16 chars
  97. movlp:    ldax    b
  98.     mov    m,a
  99.     inx    h
  100.     inx    b
  101.     dcr    d
  102.     jnz    movlp
  103.     shld    bufptr
  104.     pop    d
  105.     lhld    count
  106.     inx    h
  107.     shld    count
  108.     ret
  109. ;
  110. bufptr: