home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol146 / whatsnew.a86 < prev    next >
Encoding:
Text File  |  1984-04-29  |  19.2 KB  |  1,033 lines

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