home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol096 / d.a86 < prev    next >
Text File  |  1984-04-29  |  17KB  |  938 lines

  1.  
  2. ;                         D.A86 Version 2.1
  3. ;                 Restricted Directory List Program
  4. ;        Originally written for CP/M-80, by Ward Christensen
  5. ;                   (Revised from D.ASM 05/17/82)
  6. ; This  program produces a directory listing.   It also maintains a 
  7. ; list of names not to display.   Thus it can be used to keep track 
  8. ; of  the "non standard" files on a disk.   CP/M attribute bits are 
  9. ; not considered part of the file name for comparison purposes.
  10. ;                           - Examples -
  11. ; D *.*<cr>      Prints all names, 5 across
  12. ; D *.A86<cr>    Prints selected files just like DIR
  13. ; D  SET<cr>     Builds a table (in D.CMD) of all names  currently 
  14. ;                on the disk
  15. ; D  SET  <date><cr>     Adds the date for printing whenever  D  is 
  16. ; called by 'A>D<cr>' with no options.   If the date field is  left 
  17. ; blank,  it  will  be  ignored.    Note that the date  must  be  8 
  18. ; characters or less.
  19. ; D  ADD  fn.ft<cr>  Adds a name to the table in  D.CMD,  so  fn.ft 
  20. ; won't be listed by the 'D' command
  21. ; D  DEL fn.ft<cr>  Deletes a name from the table in D.CMD,  so  if 
  22. ; fn.ft is in the directory, it will be listed by 'D'
  23. ; D<cr>     Lists the directory 5 across,  listing only those files 
  24. ; not in D.CMD, as put there by 'D SET' or 'D ADD fn.ft' command
  25. ;              - Special Notes For Remote System Use -
  26. ; If  you  keep a dedicated copy of this program on each  drive  of 
  27. ; your remote system,  you can 'dedicate' each copy of this program 
  28. ; to  a drive by filling in the byte at 104h with the drive number.  
  29. ; This prevents such things as:
  30. ; A>D B:<cr>
  31. ; or
  32. ; B>A:D<cr>
  33. ; Do this by using the command:
  34. ; A>D LOK A:<cr>    To lock to a drive
  35. ; or
  36. ; A>D LOK<cr>     To unlock
  37. ; If the conditional 'NOSYS' is set true,  $SYS files in CP/M  will 
  38. ; be  ignored in both directory listings and when the "ADD"  option 
  39. ; is invoked,  unless the override char is specified.   This allows 
  40. ; D.CMD  to  be used as a "what's new" program for  remote  CP/M-86 
  41. ; systems, where the $SYS files must not be listed.
  42. ;                           - Examples -
  43. ; A>D *.* S<cr>     Displays everything
  44. ; A>D SET S<cr>     Puts all files in table
  45. ; A>D  SET 05/17/82<cr>     Sets date for reference (if you use  'D 
  46. ; SET S<cr>', you lose the date option....sorry about that).
  47. ; If you use this program on a remote system,  you will likely want 
  48. ; to  change the commands (ADD,  DEL,  and SET) for security.   You 
  49. ; will  also want to change the $SYS suppress  override  character.  
  50. ; You  may also want to change the name of the program to make  the 
  51. ; name itself more informative (e.g. "WHATSNEW.CMD").
  52. ; If  you  want the program to be 'tag'ed after every D SET (so  it 
  53. ; cannot  be taken by xmodem),  see the note at label "WRBACK"  for 
  54. ; setting the F1 bit in the filename itself.
  55. ; Note  that  this  program defines its  own  name  for  write-back 
  56. ; purposes under the label "WRBACK".
  57. ;                     - Modification History -
  58. ; 05/17/82:  Revised and translated for CP/M-86 operation, by Kelly 
  59. ; Smith.
  60. ; 12/23/80:  Changed  sign-on message,  revised  documentation,  by 
  61. ; Keith Petersen, W8SDZ.
  62. ; 12/22/80:  Fixed stack and file extent problems.   Fully expanded 
  63. ; macros  so  ASM may be used.   Fixed problem in LOK  routine,  by 
  64. ; Keith Petersen, W8SDZ.
  65. ; 12/07/80:  Added  drive  select byte and expanded move  macro  in 
  66. ; WRBACK routine.  Also added "LOK" command, by Ron Fowler.
  67. ; 12/02/80:  Added "NOSYS" equate to ignore system files,  code  to 
  68. ; strip attributes from files for CP/M 2.x,  added date display and 
  69. ; print options.  fixed up display format, by Ron Fowler.
  70. ; 12/01/80:  Added  "files  not found" feature of updated D.ASM  of 
  71. ; Ward Christensen.  By Ron Fowler.
  72. ; 11/23/78: Originally written by Ward Christensen.
  73. ;
  74. false    EQU    0
  75. true    EQU    not false
  76. ; bdos equates
  77. rdcon    EQU    1
  78. print    EQU    9
  79. const    EQU    11
  80. close    EQU    16
  81. srchf    EQU    17
  82. srchn    EQU    18
  83. erase    EQU    19
  84. read    EQU    20
  85. write    EQU    21
  86. make    EQU    22
  87. curdsk    EQU    25
  88. setdma    EQU    26
  89. bdos    EQU    5
  90. fcb    EQU    5ch
  91. fcbrno    EQU    fcb+32
  92. ;
  93. g_form        EQU    80h    ; base of group descriptor for D.CMD file
  94. g_length    EQU    81h    ; group length
  95. g_min        EQU    85h    ; group minimum size
  96. ;
  97. M    EQU    Byte Ptr 0[BX]
  98. ;
  99. cr    EQU    13            ; carriage return
  100. lf    EQU    10            ; line feed
  101. nosys    EQU    false            ; set true to ignore system files
  102. fence    EQU    ':'            ; filename separator
  103. npl    EQU    5            ; names per line
  104. sysok    EQU    'S'            ; override char for sys suppression
  105.     ORG    100h
  106. dentry:    JMPS    around
  107. drive    DB    0            ; <---drv # is put here if dedicated
  108. ; init local stack
  109. around:    CALL    start
  110. ;
  111.     DB    'D Version 2.1',cr,lf,'$'
  112. ; print id message
  113. start:    POP    DX            ; get id address
  114.     MOV    CL,print        ; get print fnc
  115.     INT    224            ; print id msg
  116. ; set file control block
  117.     MOV    AL,Byte Ptr drive
  118.     OR    AL,AL            ; non-dedicated?
  119.     JZ    nond            ; jump if so
  120.     MOV    Byte Ptr .fcb,AL
  121. nond:    MOV    AL,Byte Ptr .fcb+17    ; get sys override char
  122.     MOV    Byte Ptr systoo,AL    ; save for later
  123. ; see if request to add name to list
  124.     MOV    BX,fcb+1
  125.     CALL    addcm2
  126. addcm    DB    'ADD        '
  127. addcm2:    POP    DX            ; get to
  128.     MOV    CX,(Offset addcm2)-(Offset addcm)
  129.     CALL    compr
  130.     JNZ    noadd
  131. ; got request to add name to table
  132.     CALL    delnam            ; first, delete the name
  133.     CALL    findff            ; find end of table
  134.     XCHG    BX,DX            ; addr to de
  135. ; move name to table
  136.     MOV    BX,fcb+17
  137.     MOV    CX,11
  138.     CALL    mover
  139.     MOV    AL,0ffh
  140.     MOV    SI,DX            ; set new end
  141.     MOV    [SI],AL
  142.     JMP    wrback            ; write program back
  143. ; see if request to lock D.CMD to a drive
  144. noadd:    MOV    BX,fcb+1
  145.     CALL    noadd3
  146. noadd2    DB    'LOK        '
  147. noadd3:    POP    DX            ; get to
  148.     MOV    CX,(Offset noadd3)-(Offset noadd2)
  149.     CALL    compr
  150.     JNZ    nolok
  151. ; got request to lock
  152.     MOV    AL,Byte Ptr .fcb+16
  153.     MOV    Byte Ptr drive,AL
  154.     MOV    Byte Ptr .fcb,AL
  155.     JMP    wrback
  156. ; see if request to del name from list
  157. nolok:    MOV    BX,fcb+1
  158.     CALL    nolok3
  159. nolok2    DB    'DEL        '
  160. nolok3:    POP    DX            ; get to
  161.     MOV    CX,(Offset nolok3)-(Offset nolok2)
  162.     CALL    compr
  163.     JNZ    nodel
  164. ; got request to delete a name from the file
  165.     CALL    delnam            ; delete the name
  166.     JNAE    L_3    
  167.     JMP    wrback            ; write back if ok
  168. L_3:
  169.     CALL    msgxit
  170.     DB    '++Name Not In Table++$'
  171. ; see if request to setup table from directory
  172. nodel:    MOV    BX,fcb+1
  173.     CALL    nodel3
  174. nodel2    DB    'SET        '
  175. nodel3:    POP    DX            ; get to
  176.     MOV    CX,(Offset nodel3)-(Offset nodel2)
  177.     CALL    compr
  178.     JNZ    noset
  179. ; got request to setup table.  move the date (may be blank).
  180.     MOV    BX,fcb+17
  181.     MOV    DX,(Offset date)
  182.     MOV    CX,8
  183.     CALL    mover
  184.     MOV    AL,1            ; turn on..
  185.     MOV    Byte Ptr setflg,AL    ; ..set flag
  186.     MOV    AL,0ffh            ; clear..
  187.     MOV    Byte Ptr names,AL    ; ..names table
  188.     CALL    fillq            ; make fcb '????????.???'
  189. noset:    MOV    AL,Byte Ptr .fcb+1
  190.     SUB    AL,' '
  191.     MOV    Byte Ptr prtflg,AL
  192.     LAHF
  193.     XCHG    AL,AH
  194.     PUSH    AX
  195.     JNZ    L_4    
  196.     CALL    head1
  197. L_4:
  198.     POP    AX
  199.     XCHG    AL,AH
  200.     SAHF
  201.     JNZ    gotnam
  202.     CALL    fillq            ; make name ????????.???
  203. gotnam:    MOV    AL,Byte Ptr .fcb
  204.     OR    AL,AL
  205.     JZ    nodisk
  206.     DEC    AL
  207.     MOV    DL,AL
  208.     MOV    CL,0eh
  209.     INT    224
  210. nodisk:    MOV    CH,npl            ; names per line
  211.     CALL    linmrk
  212.     MOV    CL,srchf
  213.     JMPS    callit
  214. line:    MOV    CH,npl            ; names per line
  215.     CALL    linmrk
  216. next:    MOV    CL,srchn
  217. callit:    PUSH    CX
  218.     PUSH    CX
  219.     MOV    CL,const
  220.     INT    224
  221.     OR    AL,AL
  222.     POP    CX
  223.     JZ    L_5    
  224.     JMP    cexit
  225. L_5:
  226.     MOV    DX,fcb
  227.     INT    224
  228.     INC    AL
  229.     JNZ    L_6    
  230.     JMP    cknone
  231. L_6:
  232.     DEC    AL
  233.     AND    AL,03h
  234.     MOV    BL,AL
  235.     MOV    BH,00h
  236.     SHL    BX,1
  237.     SHL    BX,1
  238.     SHL    BX,1
  239.     SHL    BX,1
  240.     SHL    BX,1
  241.     MOV    DX,81h
  242.     ADD    BX,DX
  243. ; check for $sys attribute, then clear all attributes
  244.     PUSH    BX
  245.     MOV    DX,9            ; sys att offset
  246.     ADD    BX,DX
  247.     MOV    AL,M
  248.     AND    AL,80h
  249.     MOV    Byte Ptr sysflg,AL
  250.     POP    BX            ; retrieve filename ptr
  251.     PUSH    BX
  252.     MOV    DL,11            ; 11 chars in filename
  253. attlp:    MOV    AL,M            ; pick up char
  254.     AND    AL,7fh            ; kill attribute
  255.     MOV    M,AL            ; put back down
  256.     INC    BX
  257.     DEC    DL
  258.     JNZ    attlp
  259.     POP    BX
  260. ; see if name is to be printed
  261.     XCHG    BX,DX            ; name pointer to de
  262.     MOV    AL,Byte Ptr setflg    ; request to setup table?
  263.     OR    AL,AL
  264.     JZ    L_7    
  265.     JMP    setup            ; go set entry into table
  266. L_7:
  267.     MOV    AL,Byte Ptr prtflg
  268.     OR    AL,AL
  269.     JNZ    goprnt            ; explicit request for all
  270.     PUSH    DX
  271.     MOV    BX,(Offset names)
  272. cknext:    POP    DX            ; get name pointer
  273.     POP    CX
  274.     PUSH    CX
  275.     MOV    AL,M            ; end of table?
  276.     INC    AL            ; was it 0ffh?
  277.     JZ    goprnt
  278.     MOV    CH,0
  279.     MOV    CL,11            ; name length
  280.     PUSH    DX
  281. cklp:    MOV    SI,DX
  282.     MOV    AL,[SI]
  283.     CMP    AL,M
  284.     JNZ    nomach
  285.     INC    DX
  286.     INC    BX
  287.     DEC    CL
  288.     JNZ    cklp            ; loop for 11 chars
  289. ; got match, mark it found and don't print it
  290.     MOV    DX,-11            ; point back to name
  291.     ADD    BX,DX
  292.     MOV    M,0            ; mark it found
  293.     POP    DX            ; pop pointer
  294.     POP    CX
  295.     JMP    next            ; skip the name
  296. ; name didn't match, try next
  297. nomach:    ADD    BX,CX            ; point to next name
  298.     JMPS    cknext
  299. ; print the name
  300. goprnt:
  301.     if    nosys
  302.     MOV    AL,Byte Ptr systoo
  303.     CMP    AL,sysok
  304.     JZ    doname
  305.     MOV    AL,Byte Ptr sysflg
  306.     RCL    AL,1
  307.     POP    CX
  308.     JNB    L_8    
  309.     JMP    next
  310. L_8:
  311.     PUSH    CX
  312.     endif
  313. doname:    MOV    AL,1            ; say we got one
  314.     MOV    Byte Ptr gotflg,AL
  315.     MOV    CL,8
  316.     XCHG    BX,DX            ; name back to hl
  317. namelp:    MOV    AL,M
  318.     CALL    display
  319.     LAHF
  320.     INC    BX
  321.     SAHF
  322.     DEC    CL
  323.     JNZ    namelp
  324.     MOV    AL,'.'
  325.     CALL    display
  326.     MOV    CL,3
  327. nlp2:    MOV    AL,M
  328.     CALL    display
  329.     LAHF
  330.     INC    BX
  331.     SAHF
  332.     DEC    CL
  333.     JNZ    nlp2
  334.     POP    CX
  335.     MOV    AL,' '
  336.     CALL    display
  337.     MOV    AL,fence
  338.     DEC    CH
  339.     LAHF
  340.     XCHG    AL,AH
  341.     PUSH    AX
  342.     XCHG    AL,AH
  343.     JZ    L_9    
  344.     CALL    display
  345. L_9:
  346.     MOV    AL,' '
  347.     CALL    display
  348.     POP    AX
  349.     XCHG    AL,AH
  350.     SAHF
  351.     JZ    L_10    
  352.     JMP    next
  353. L_10:
  354.     CALL    crlf
  355.     JMP    line
  356. cknone:    MOV    AL,Byte Ptr gotflg
  357.     OR    AL,AL
  358.     JNZ    notfnd
  359.     MOV    AL,Byte Ptr prtflg
  360.     OR    AL,AL
  361.     JNZ    notfnd
  362.     MOV    DX,(Offset nonmsg)    ; print "none"
  363.     MOV    CL,print
  364.     INT    224
  365. ; print the files not found
  366. notfnd:    MOV    AL,Byte Ptr setflg    ; is this 'd set'?
  367.     OR    AL,AL
  368.     JZ    L_11    
  369.     JMP    fini            ; done if so
  370. L_11:
  371.     MOV    AL,Byte Ptr prtflg    ; are we printing?
  372.     OR    AL,AL
  373.     JZ    L_12    
  374.     JMP    cknon2            ; done if not
  375. L_12:
  376. ; if this D.CMD is dedicated ("drive" is non-zero),
  377. ; then be sure to print the "files not found"
  378.     MOV    AL,Byte Ptr drive
  379.     OR    AL,AL
  380.     JNZ    nochk
  381.     MOV    AL,Byte Ptr .fcb    ; drive specified?
  382.     OR    AL,AL
  383.     JZ    L_13    
  384.     JMP    fini            ; skip not found if so
  385. L_13:
  386. nochk:    CALL    head2            ; print not fnd header
  387.     MOV    BX,(Offset names)    ; start of table
  388.     MOV    DX,11
  389. line2:    CALL    linmrk
  390.     MOV    CL,npl
  391. next2:    MOV    AL,M            ; first char of name
  392.     OR    AL,AL            ; marked found?
  393.     JZ    noprnt            ; jump if so
  394.     INC    AL            ; check for table end
  395.     JNZ    L_14    
  396.     JMP    cknon2            ; jump if end
  397. L_14:
  398.     MOV    AL,1
  399.     MOV    Byte Ptr gotnf,AL
  400.     MOV    CH,8
  401. namlp2:    MOV    AL,M
  402.     CALL    display
  403.     LAHF
  404.     INC    BX
  405.     SAHF
  406.     DEC    CH
  407.     JNZ    namlp2
  408.     MOV    AL,'.'
  409.     CALL    display
  410.     MOV    CH,3
  411. nlp3:    MOV    AL,M
  412.     CALL    display
  413.     LAHF
  414.     INC    BX
  415.     SAHF
  416.     DEC    CH
  417.     JNZ    nlp3
  418.     MOV    AL,' '
  419.     CALL    display
  420.     MOV    AL,fence
  421.     DEC    CL
  422.     LAHF
  423.     XCHG    AL,AH
  424.     PUSH    AX
  425.     XCHG    AL,AH
  426.     JZ    L_15    
  427.     CALL    display
  428. L_15:
  429.     MOV    AL,' '
  430.     CALL    display
  431.     POP    AX
  432.     XCHG    AL,AH
  433.     SAHF
  434.     JNZ    next2
  435.     CALL    crlf
  436.     JMPS    line2
  437. noprnt:    ADD    BX,DX
  438.     JMPS    next2
  439. ; print header
  440. head1:    MOV    DX,(Offset newmsg)
  441.     JMPS    hedprt
  442. head2:    MOV    DX,(Offset delmsg)
  443. hedprt:    MOV    CL,print
  444.     INT    224
  445.     MOV    AL,Byte Ptr date
  446.     CMP    AL,' '
  447.     JZ    nodate
  448.     CMP    AL,sysok
  449.     JZ    nodate
  450.     MOV    DX,(Offset asof)
  451.     MOV    CL,print
  452.     INT    224
  453. nodate:    MOV    AL,':'
  454.     CALL    display
  455.     JMPS    crlf
  456. cknon2:    MOV    AL,Byte Ptr gotnf
  457.     OR    AL,AL
  458.     JZ    L_16    
  459.     JMP    fini            ; jmp if got no 'not found's
  460. L_16:
  461.     MOV    AL,Byte Ptr prtflg
  462.     OR    AL,AL
  463.     JZ    L_17    
  464.     JMP    fini
  465. L_17:
  466.     MOV    DX,(Offset nonmsg)
  467.     MOV    CL,print        ; else print 'none'
  468.     INT    224
  469.     JMP    fini
  470. ; set up the name in the table
  471. setup:
  472.     if    nosys
  473.     MOV    AL,Byte Ptr systoo
  474.     CMP    AL,sysok
  475.     JZ    setu2
  476.     MOV    AL,Byte Ptr sysflg
  477.     RCL    AL,1
  478.     JB    setskp
  479.     endif
  480. setu2:    CALL    findff            ; find end of table
  481.     XCHG    BX,DX            ; setup for move
  482. ; (hl = name, de = end of table)
  483.     MOV    CX,11
  484.     CALL    mover
  485.     MOV    AL,0ffh            ; get table end flag
  486.     MOV    SI,DX            ; store it
  487.     MOV    [SI],AL
  488. setskp:    POP    CX            ; delete stack garbage
  489.     JMP    next            ; get next entry
  490. crlf:    MOV    AL,cr
  491.     CALL    display
  492.     MOV    AL,lf
  493. display:
  494. ;
  495.     PUSH    CX
  496.     PUSH    DX
  497.     PUSH    BX
  498.     MOV    DL,AL
  499.     MOV    CL,02h
  500.     INT    224
  501.     POP    BX
  502.     POP    DX
  503.     POP    CX
  504.     RET
  505. ; move routine
  506. mover:    MOV    AL,M
  507.     MOV    SI,DX
  508.     MOV    [SI],AL
  509.     INC    DX
  510.     INC    BX
  511.     DEC    CX
  512.     MOV    AL,CH
  513.     OR    AL,CL
  514.     JNZ    mover
  515.     RET
  516. ; compare routine
  517. compr:    MOV    SI,DX
  518.     MOV    AL,[SI]
  519.     CMP    AL,M
  520.     JZ    L_18
  521.     RET
  522. L_18:
  523.     INC    DX
  524.     INC    BX
  525.     DEC    CX
  526.     MOV    AL,CH
  527.     OR    AL,CL
  528.     JNZ    compr
  529.     RET                ; equal
  530. ; routine to find 0ffh at end of table
  531. findff:    MOV    BX,(Offset names)
  532. findlp:    MOV    AL,M
  533.     LAHF
  534.     INC    BX
  535.     SAHF
  536.     INC    AL            ; 0ffh?
  537.     JNZ    findlp
  538.     LAHF                ; back up to table end
  539.     DEC    BX
  540.     SAHF
  541.     RET
  542. ; delete the name from the table
  543. delnam:    MOV    BX,(Offset names)
  544. dellp:    MOV    AL,M
  545.     CMP    AL,0ffh
  546.     STC
  547.     JNZ    L_19    
  548.     RET                ; not found
  549. L_19:
  550.     MOV    DX,fcb+17
  551.     MOV    CX,11
  552.     CALL    compr
  553.     JZ    delete
  554.     ADD    BX,CX            ; calc next
  555.     JMPS    dellp
  556. ; delete the name
  557. delete:    XCHG    BX,DX            ; next name to de
  558.     MOV    BX,-11            ; to back up..
  559.     ADD    BX,DX            ; ..to name to del
  560. delch:    MOV    SI,DX
  561.     MOV    AL,[SI]
  562.     MOV    M,AL
  563.     INC    BX
  564.     INC    DX
  565.     INC    AL            ; moved the 0ffh?
  566.     JNZ    delch
  567.     OR    AL,AL            ; show found
  568.     RET
  569. ; fill fcb with all '?'
  570. fillq:    MOV    BX,fcb+1
  571.     MOV    CH,8+3
  572.     MOV    AL,'?'
  573. qmloop:    MOV    M,AL
  574.     LAHF
  575.     INC    BX
  576.     SAHF
  577.     DEC    CH
  578.     JNZ    qmloop
  579.     RET
  580. ; write back the program - note that you may set any of the
  581. ; cp/m 2.x attribute bits in the file name (be sure to define
  582. ; all 11 characters of the name).
  583. wrback:    MOV    DX,fcb+1
  584.     CALL    wrbk2
  585. wrbk1    DB    'D'            ; <--put 'd'+80h here to set tag
  586.     DB    '       CMD'        ; see comment above
  587.     DB    0            ; extent number
  588. wrbk2:    POP    BX
  589.     MOV    CX,(Offset wrbk2)-(Offset wrbk1)
  590.     CALL    mover
  591.     MOV    CL,erase
  592.     MOV    DX,fcb
  593.     INT    224
  594.     XOR    AL,AL            ; get 0
  595.     MOV    Byte Ptr setflg,AL    ; clear the flags..
  596.     MOV    Byte Ptr gotflg,AL
  597.     MOV    Byte Ptr gotnf,AL
  598.     MOV    Byte Ptr systoo,AL
  599.     MOV    Byte Ptr .fcbrno,AL    ; zero record number
  600.     MOV    CL,make
  601.     MOV    DX,fcb
  602.     INT    224
  603. ;
  604. ; clear group descriptor
  605. ;
  606.     CALL    clr_grp
  607. ; before writing back, find end of table
  608.     CALL    findff
  609.     MOV    CH,BH            ; b=end page
  610.     INC    CH            ; for compare
  611. ;
  612. ; convert page value to paragraph value
  613. ;
  614.     MOV    BH,CH            ; back to whence we came
  615.     MOV    BL,0            ; clear low byte
  616.     SHR    BX,1            ; /2
  617.     SHR    BX,1            ; /4
  618.     SHR    BX,1            ; /8
  619.     SHR    BX,1            ; /16
  620. ;
  621. ; initialze G-FORM, G-LENGTH, G-MIN
  622. ;
  623.     MOV    Word Ptr .g_length,BX
  624.     MOV    Word Ptr .g_min,BX
  625.     MOV    Byte Ptr .g_form,1    ; make G-FORM = Code Group
  626. ;
  627. ; set starting address at base of group descriptor
  628. ;
  629.     MOV    DX,g_form        ; set starting address
  630.     CALL    wrt_grp            ; write first group
  631.     CALL    clr_grp            ; clear group descriptor
  632.     CALL    wrt_grp            ; write second group (all zeros)
  633.     CALL    wrt_grp            ; write third group (all zeros)
  634. ;
  635. ; group descriptor header written, now do the code segment
  636. ;
  637.     MOV    DX,100h            ; set starting address
  638. wrlp:    PUSH    CX
  639.     PUSH    DX
  640.     PUSH    BX
  641.     MOV    CL,setdma
  642.     INT    224
  643.     MOV    CL,write
  644.     MOV    DX,fcb
  645.     INT    224
  646.     POP    BX
  647.     POP    DX
  648.     POP    CX
  649.     OR    AL,AL            ; successful write?
  650.     JNZ    wrerr            ; ..no
  651.     MOV    BX,80h            ; point to..
  652.     ADD    BX,DX            ; ..next block
  653.     XCHG    BX,DX            ; addr to de
  654.     MOV    AL,DH            ; get page
  655.     CMP    AL,CH            ; past table end?
  656.     JB    wrlp            ; loop until done
  657.     MOV    CL,close
  658.     MOV    DX,fcb
  659.     INT    224
  660.     INC    AL            ; successful close?
  661.     JZ    badcls            ; ..no, print err msg
  662.     CALL    msgxit            ; ok, exit w/msg
  663. ;
  664.     DB    '++Done++$'
  665. wrerr:    CALL    msgxit
  666. ;
  667.     DB    '++Write Error++$'
  668. badcls:    CALL    msgxit
  669. ;
  670.     DB    '++Bad Close, D.CMD Clobbered!!++$'
  671. cexit:    MOV    CL,rdcon        ; clear keyboard char
  672.     INT    224
  673.     JMPS    exit            ; then exit
  674. ; finished.  if building table, write back
  675. fini:    MOV    AL,Byte Ptr setflg
  676.     OR    AL,AL
  677.     JZ    exit            ; not writing
  678.     JMP    wrback
  679. ; exit with message (error or informational)
  680. msgxit:    POP    DX            ; get msg
  681.     MOV    CL,print
  682.     INT    224
  683. ; exit, via warm boot...
  684. exit:    MOV    CL,0            ; warm boot CP/M-86 to return
  685.     MOV    DL,0
  686.     INT    224
  687. ;
  688. ; initialize group descriptor for D.CMD with proper file information
  689. ;
  690. clr_grp:
  691. ;
  692.     PUSH    CX            ; save registers
  693.     PUSH    DX
  694.     PUSH    BX
  695.     MOV    BX,g_form        ; point to base of group descriptor
  696.     MOV    CH,128            ; need to clear 128 bytes
  697.     MOV    AL,0            ; clear with 0's
  698. ;
  699. clr_grp_loop:
  700. ;
  701.     MOV    M,AL            ; zero a byte
  702.     LAHF
  703.     INC    BX            ; bump pointer to next byte
  704.     SAHF
  705.     DEC    CH            ; de-bump count of bytes
  706.     JNZ    clr_grp_loop        ; loop until done
  707.     POP    BX            ; restore registers
  708.     POP    DX
  709.     POP    CX
  710.     RET                ; return from 'clr_grp'
  711. ;
  712. ; write 128 bytes of group descriptor with header information
  713. wrt_grp:
  714. ;
  715.     PUSH    CX
  716.     PUSH    DX
  717.     PUSH    BX
  718.     MOV    CL,setdma
  719.     INT    224
  720.     MOV    CL,write
  721.     MOV    DX,fcb
  722.     INT    224
  723.     POP    BX
  724.     POP    DX
  725.     POP    CX
  726.     OR    AL,AL            ; successful write?
  727.     JNZ    wrerr            ; ..no
  728.     RET                ; return from 'wrt_grp'
  729. linmrk:    PUSH    CX
  730.     PUSH    DX
  731.     PUSH    BX
  732.     MOV    AL,Byte Ptr .fcb    ; get drive name from fcb
  733.     OR    AL,AL            ; any there?
  734.     JNZ    gotdrv            ; yes, go print it
  735.     MOV    CL,curdsk        ; else get current disk
  736.     INT    224
  737.     INC    AL            ; make 'a'=1
  738. gotdrv:    ADD    AL,40h            ; make ascii
  739.     CALL    display            ; print drive name
  740.     CALL    gotdr2            ; then ': '
  741.     DB    ': $'
  742. gotdr2:    POP    DX            ; get msg adr
  743.     MOV    CL,print        ; print it
  744.     INT    224
  745.     POP    BX
  746.     POP    DX
  747.     POP    CX
  748.     RET
  749. L_20    EQU    $
  750.     DSEG
  751.     ORG    Offset L_20
  752. newmsg    DB    cr,lf,'-->New Files$'
  753. delmsg    DB    cr,lf,cr,lf,'-->Deleted Files$'
  754. ;
  755. ;
  756. gotflg    DB    0
  757. gotnf    DB    0
  758. systoo    DB    0
  759. nonmsg    DB    '++None++',cr,lf,'$'
  760. asof    DB    ' since '
  761. date    DB    '        '
  762.     DB    '$'
  763. setflg    DB    0            ; 1 => setup table
  764. prtflg    DB    0            ; print only some
  765. sysflg    DB    0            ; $sys attrib indicator
  766. ; note the names are initially built by: D SET<cr>
  767. names    DB    0ffh            ; end of table, for filenames
  768.     rs    02000h            ; reserve a bunch
  769.     db    0            ; mark the end for GENCMD
  770. ;
  771.     END
  772.