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 / CPM / TURBODSG / PD.MAC < prev    next >
Text File  |  2000-06-30  |  1KB  |  90 lines

  1. .request syslib
  2. sfirst    equ    17
  3. snext    equ    18
  4. ;
  5.     extrn    bdos,print,crlf,cout,phldc
  6. ;
  7. begin:    lxi    sp,stack
  8.     call    print
  9.     db    0dh,0ah
  10.     db    'Current disk:      (this may take a minute...)',0dh,0ah
  11.     db    '            ',0
  12.     MVI    C,25
  13.     CALL    BDOS
  14.     MVI    C,19
  15.     mov    e,a
  16.     call    50h
  17.     lxi    h,8
  18.     ani    0fh
  19.     dcr    a
  20. lp1:    dad    h
  21.     dcr    a
  22.     jnz    lp1
  23.     xchg
  24.     lxi    h,0
  25. lp2:    dad    d
  26.     dcr    c
  27.     jnz    lp2
  28.     call    phldc
  29.     call    print
  30.     db    ' total dir entries, ',0
  31.     lxi    d,5ch
  32.     push    d
  33.     mvi    a,'?'
  34.     mvi    b,12
  35. fill:    stax    d
  36.     inx    d
  37.     dcr    b
  38.     jnz    fill
  39.     pop    d
  40.     call    wildex
  41.     call    phldc
  42.     call    print
  43.     db    ' entries used.',0dh,0ah,0
  44.     rst    0
  45. ;
  46. wildex:    lxi    h,0
  47.     shld    count
  48.     mvi    c,sfirst
  49.     call    bdos
  50.     cpi    0ffh
  51.     rz            ;nothing found -- error
  52.     call    moven        ;move name
  53. wloop:    mvi    c,snext        ;search for next
  54.     call    bdos
  55.     cpi    0ffh
  56.     jz    done        ;finished
  57.     call    moven
  58.     jmp    wloop
  59. ;
  60. done:    ora    a
  61.     lhld    count
  62.     ret
  63. ;
  64. moven:    push    psw
  65.     add    a
  66.     add    a
  67.     add    a
  68.     add    a
  69.     add    a
  70.     adi    80h
  71.     mov    l,a
  72.     mvi    h,0
  73.     mov    a,m
  74.     cpi    0e5h
  75.     jz    nof
  76.     lhld    count
  77.     inx    h
  78.     shld    count
  79. nof:    pop    psw
  80.     lhld    tot
  81.     inx    h
  82.     shld    tot
  83.     ret
  84. ;
  85. count:    dw    0
  86. tot:    dw    0
  87.     ds    100
  88. stack    equ    $
  89.     end
  90.