home *** CD-ROM | disk | FTP | other *** search
/ Power Utilities / Power Utilities.iso / utility / pro22 / dermon.asm < prev    next >
Encoding:
Assembly Source File  |  1990-04-30  |  20.2 KB  |  830 lines

  1.    title  DERMON - Disk Error Monitor 1.1
  2.    page 60,132
  3.  
  4. ;
  5. ; DERMON - Disk Error Monitor
  6. ;
  7. ; This program is a TSR that records the last several disk errors
  8. ; and reports them on demand.
  9. ;
  10. ; Copyright 1990 Samuel H. Smith; All rights reserved.
  11. ;
  12. ;------------------------------------------------
  13. ;
  14. ;                                  LICENSE
  15. ;                                  =======
  16. ;  SourceWare: What is it?
  17. ;  -----------------------
  18. ;
  19. ;  SourceWare is my name for a unique concept in user supported
  20. ;  software.
  21. ;
  22. ;  Programs distributed under the SourceWare concept always offer source
  23. ;  code.
  24. ;
  25. ;  This package can be freely distributed so long as it is not modified
  26. ;  or sold for profit.  If you find that this program is valuable, you
  27. ;  can send me a donation for what you think it is worth.  I suggest
  28. ;  about $10.
  29. ;
  30. ;  Send your contributions to:
  31. ;     Samuel H. Smith                 The Tool Shop BBS
  32. ;     5119 N. 11th Ave., #332         (602) 264-3969 (2400) - Free node
  33. ;     Phoenix AZ 85013                (602) 279-0230 (HAYES 9600)
  34. ;                                     (602) 279-2673 (HST 9600)
  35. ;
  36. ;  Why SourceWare?
  37. ;  ---------------
  38. ;  Why do I offer source code?  Why isn't the donation manditory?  The
  39. ;  value of good software should be self-evident.  The source code is
  40. ;  the key to complete understanding of a program.  You can read it to
  41. ;  find out how things are done.  You can also change it to suit your
  42. ;  needs, so long as you do not distribute the modified version without
  43. ;  my consent.
  44. ;
  45. ;
  46. ;  Copyright
  47. ;  ---------
  48. ;  If you modify this program,  I would appreciate a copy of the new
  49. ;  source code.  I am holding the copyright on the source code,  so
  50. ;  please don't delete my name from the program files or from the
  51. ;  documentation.
  52. ;
  53. ;                               DISCLAIMER
  54. ;                               ==========
  55. ;  I make no warranty of any kind, express or implied, including without
  56. ;  limitation, any warranties of merchantability and/or fitness for a
  57. ;  particular purpose.  I shall not be liable for any damages, whether
  58. ;  direct, indirect, special or consequential arising from a failure of
  59. ;  this program to operate in the manner desired by the user.  I shall
  60. ;  not be liable for any damage to data or property which may be caused
  61. ;  directly or indirectly by the use of this program.
  62. ;
  63. ;  IN NO EVENT WILL I BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY
  64. ;  LOST PROFITS,  LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL
  65. ;  DAMAGES ARISING OUT OF YOUR USE OR INABILITY TO USE THE PROGRAM, OR
  66. ;  FOR ANY CLAIM BY ANY OTHER PARTY.
  67. ;
  68. ;
  69.  
  70. ;------------------------------------------------
  71. ; macro- clear register
  72. ;
  73. clr macro reg
  74.         xor reg,reg
  75. endm
  76.  
  77.  
  78. ;------------------------------------------------
  79. ; macro- dos function call
  80. ;
  81. dosDispc       = 02h
  82. dosDisplay     = 09h
  83. dosSetvec      = 25h
  84. dosGetvers     = 30h
  85. dosGetvec      = 35h
  86. dosFreemem     = 49h
  87. dosExit        = 4ch
  88. dosErrinfo     = 59h
  89.  
  90. msdos   macro funct,param
  91.         ifb <param>
  92.            mov ah,funct
  93.         else
  94.            mov ax,(funct*100h)+param
  95.         endif
  96.         int 21h
  97. endm
  98.  
  99. ;------------------------------------------------
  100. ; macro- get vector
  101. ; exit: vector stored in 'dword ptr ds:dest'
  102. ;
  103. getvect macro vectnum,dest
  104.         msdos dosGetvec,vectnum
  105.         mov word ptr dest,bx
  106.         mov word ptr dest+2,es
  107. endm
  108.  
  109. ;------------------------------------------------
  110. ; macro- set vector
  111. ;
  112. setvect macro vectnum,handler
  113.         lea dx,handler
  114.         msdos dosSetvec,vectnum
  115. endm
  116.  
  117. ;------------------------------------------------
  118. ; macro- restore original vector
  119. ;
  120. revect macro vectnum,ohandler
  121.         lds dx,es:ohandler
  122.         msdos dosSetvec,vectnum
  123. endm
  124.  
  125. %newpage
  126. ;------------------------------------------------
  127. ; program segment prefix
  128. ;
  129. code segment
  130.         assume cs:code, ds:nothing, es:nothing, ss:nothing
  131.  
  132.         org 02ch
  133. envseg  dw      ?       ;environment segment number
  134.  
  135.         org 80h
  136. tailLen db      ?       ;command tail length
  137. tail    db      ?
  138.  
  139.         org 100h
  140. entry:
  141.         jmp entryPoint
  142.  
  143.  
  144. ;------------------------------------------------
  145. ; working storage
  146. ;
  147. signature       db 00,10,'Disk Error Monitor v1.1 ',??DATE
  148.                 db 13,10,'Copyright 1990 Samuel H. Smith; ALL RIGHTS RESERVED'
  149.                 db 13,10
  150. crlfs           db 13,10,'$'
  151.  
  152. ;program activity flag
  153. active db 0      
  154.  
  155. ; vector for old interrupt
  156. old_int13  dd 0
  157.  
  158. ;error result log
  159. maxEntries = 50         ;maximum number of error log entries
  160. logNext         dw 0    ;index to next log table entry
  161.  
  162. logAx           dw maxEntries dup(0)
  163. logCx           dw maxEntries dup(0)
  164. logDx           dw maxEntries dup(0)
  165. logResult       dw maxEntries dup(0)    ;0=unused table entry
  166.  
  167. ;total number of disk errors
  168. errorCount     dw 0
  169.  
  170.  
  171. ;========================================
  172. ; new disk interrupt service
  173. ;----------------------------------------
  174. int13_handler proc far
  175.  
  176.    cmp active,0              ;already active(recursion)
  177.    jnz useold
  178.  
  179.    cmp ah,02h   ;read
  180.    jz usenew
  181.    cmp ah,03h   ;write
  182.    jz usenew
  183.    cmp ah,04h   ;verify
  184.    jz usenew
  185.    cmp ah,0ah   ;long read
  186.    jz usenew
  187.    cmp ah,0bh   ;long write
  188.    jz usenew
  189.    cmp ah,0ch   ;seek to cylinder
  190.    jz usenew
  191.  
  192. useold:
  193.    jmp old_int13             ;jump to the real DOS handler
  194.  
  195. usenew:
  196.    mov active,1              ;enter recursion
  197.  
  198.    push bx                   ;record current activity
  199.    mov bx,logNext
  200.    add bx,bx
  201.    mov logAx[bx],ax
  202.    mov logCx[bx],cx
  203.    mov logDx[bx],dx
  204.    mov word ptr logResult[bx],0
  205.    pop bx
  206.  
  207.    pushf
  208.    call old_int13            ;perform requested function
  209.    jnc noerror
  210.  
  211.    inc errorCount
  212.  
  213.    push bx                   ;record error result
  214.    mov bx,logNext
  215.    add bx,bx
  216.    mov logResult[bx],ax
  217.    mov bx,logNext
  218.    inc bx
  219.    cmp bx,maxEntries
  220.    jl advance
  221.  
  222.    clr bx
  223.  
  224. advance:
  225.    mov logNext,bx
  226.    pop bx
  227.  
  228. noerror:
  229.    mov active,0              ;return from recursion
  230.    ret 2                     ;exit interrupt handler, drop caller's flags
  231.  
  232. int13_handler endp
  233.  
  234. %newpage
  235. ; =============================================
  236. ; end of resident portion of code
  237. ;
  238. resident:
  239.  
  240. ; calculate size of resident portion in bytes and segments
  241.  
  242. TSRsize = (offset(resident)-offset(entry))
  243. TSRsegs = (TSRsize / 16)
  244.  
  245.  
  246. ; initialization messages
  247.  
  248. license         db 'This program can be freely distributed so long as it is not modified',13,10
  249.                 db 'or sold for profit.  If you find that this program is valuable, you',13,10
  250.                 db 'can send me a donation for what you think it is worth.  I suggest',13,10
  251.                 db 'about 10 dollars.',13,10
  252.                 db 13,10
  253.                 db 'Send your registrations to:        The Tool Shop BBS',13,10
  254.                 db '   Samuel H. Smith                 (602) 264-3969 (2400) - Free node',13,10
  255.                 db '   5119 N. 11th Ave., #332         (602) 279-2673 (HST 9600)',13,10
  256.                 db '   Phoenix AZ 85013                (602) 279-0230 (HAYES 9600)',13,10
  257.                 db 13,10
  258.                 db 'IN NO EVENT WILL I BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY',13,10
  259.                 db 'LOST PROFITS,  LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL',13,10
  260.                 db 'DAMAGES ARISING OUT OF YOUR USE OR INABILITY TO USE THE PROGRAM, OR',13,10
  261.                 db 'FOR ANY CLAIM BY ANY OTHER PARTY.',13,10
  262.                 db 13,10
  263.  
  264. usages          db 'Usage:  DERMON/I     ;install in memory.',13,10
  265.                 db '        DERMON/U     ;un-install.',13,10
  266.                 db '        DERMON/C     ;display disk error counters.',13,10
  267.                 db '        DERMON/Z     ;zero error counters.',13,10
  268.                 db '$'
  269.  
  270. ermonLoaded     db 'DERMON installed.',13,10,'$'
  271. ermonRemoved    db 'DERMON unInstalled.',13,10,'$'
  272. othersLoaded    db 'Other programs loaded after DERMON -- cannot unInstall.',13,10,'$'
  273. alreadyLoaded   db 'Already loaded!',13,10,'$'
  274. notLoaded       db 'DERMON is not resident.  Use DERMON/I first.',13,10,'$'
  275.  
  276.  
  277. ; ---------------------------------------------
  278. ; program entry point
  279. ;
  280. entryPoint proc near
  281.         push cs
  282.         pop ds
  283.         assume ds:code
  284.  
  285.         mov byte ptr signature,13       ;this keeps cache and non-active
  286.                                         ;copies from returning the correct
  287.                                         ;signature pattern
  288.         lea si,tail
  289. checkTail:
  290.         lodsb
  291.         cmp al,13
  292.         jz usage
  293.  
  294.         cmp al,'/'
  295.         jz checkOption
  296.         cmp al,'-'
  297.         jz checkOption
  298.         jmp short checkTail
  299.  
  300. checkOption:
  301.         lodsb
  302.         and al,0ffh-20h         ;map to upper case
  303.  
  304.         cmp al,'Z'
  305.         jnz checkC
  306.  
  307.         call zeroStats
  308.         jmp short exitProgram
  309.  
  310. checkC:
  311.         cmp al,'C'
  312.         jnz checkU
  313.  
  314.         call reportStats
  315.         jmp short exitProgram
  316.  
  317. checkU:
  318.         cmp al,'U'
  319.         jnz checkI
  320.  
  321.         call unInstall
  322.         jmp short exitProgram
  323.  
  324. checkI:
  325.         cmp al,'I'
  326.         jnz usage
  327.         jmp short newInstall
  328.  
  329.  
  330. ; ---------------------------------------------
  331. ; DERMON/? - display license and usage messages
  332. ;
  333. usage:
  334.         lea dx,signature
  335.         call disps
  336.  
  337.         mov al,tailLen
  338.         cmp al,0
  339.         lea dx,usages
  340.         jnz exitWithMessage
  341.  
  342.         lea dx,license
  343. ;       jmp short exitWithMessage
  344.  
  345.  
  346. ; ---------------------------------------------
  347. exitWithMessage:
  348.         call disps
  349.  
  350. exitProgram:
  351.         mov byte ptr cs:signature,10    ;this keeps cache and non-active
  352.                                         ;copies from returning the correct
  353.                                         ;signature pattern
  354.         msdos dosExit,0
  355.  
  356.  
  357. ; ---------------------------------------------
  358. ; DERMON/I - new installation - hook vectors and go resident
  359. ;
  360. newInstall:
  361.         lea dx,signature
  362.         call disps
  363.  
  364.         call checkPresent
  365.         lea dx,alreadyLoaded
  366.         jz installExit
  367.  
  368.         getvect 13h,old_int13           ;save original handler vectors
  369.  
  370.         setvect 13h,int13_handler       ;install new handlers
  371.  
  372.         mov es,envseg
  373.         msdos dosFreemem                ;dealloc the tsr's environment segment
  374.  
  375.         lea dx,ermonLoaded
  376.         call disps
  377.  
  378.         lea dx,resident                 ;terminate and stay resident
  379.         int 27h
  380.  
  381. installExit:
  382.         jmp short exitWithMessage
  383. entryPoint endp
  384.  
  385.  
  386. ; =============================================
  387. ; check if dermon is already present
  388. ;
  389. ; exit: Z       DERMON is present,
  390. ;               es-> resident code segment
  391. ;
  392. ;       NZ      not present
  393. ;
  394. checkPresent proc near
  395.         mov ax,cs               ;start one segment below here
  396.         dec ax
  397.         mov es,ax
  398.  
  399. checkSegment:
  400.         lea bx,signature        ;cs:bx -> local signature
  401. checkNext:
  402.         mov al,ds:[bx]          ;get next byte from local message
  403.         cmp al,'$'              ;end of message?
  404.         jz checkExit            ;already present if so
  405.  
  406.         cmp al,es:[bx]          ;compare next byte to int13 handler
  407.         jnz checkFail           ;new installation if mismatch
  408.  
  409.         inc bx                  ;got a match, try the next char
  410.         jmp short checkNext
  411.  
  412. checkFail:
  413.         mov ax,es
  414.         dec ax                  ;try next lower segment
  415.         mov es,ax
  416.         jnz checkSegment
  417.  
  418.         inc ax                  ;not found, set NZ condition
  419. checkExit:
  420.         ret
  421. checkPresent endp
  422.  
  423.  
  424. ; ---------------------------------------------
  425. ; display message in code segment
  426. ;       DX=offset message
  427. ;
  428. disps proc near
  429.         push bx
  430.         push ds
  431.  
  432.         push cs
  433.         pop ds
  434.         msdos dosDisplay
  435.  
  436.         pop ds
  437.         pop bx
  438.         ret
  439. disps endp
  440.  
  441.  
  442. ; ---------------------------------------------
  443. ; dispc - display a character
  444. ;       AL=character to display
  445. ;
  446. dispc proc near
  447.         push dx
  448.         push bx
  449.  
  450.         mov dl,al
  451.         msdos dosDispc
  452.  
  453.         pop bx
  454.         pop dx
  455.         ret
  456. dispc endp
  457.  
  458.  
  459. ; ---------------------------------------------
  460. ; spaces - display a specified number of spaces
  461. ;       AX=number of spaces
  462. ;
  463. spaces proc near
  464.         push dx
  465.  
  466. spaceNext:
  467.         cmp ax,0
  468.         jz spaceExit
  469.  
  470.         push ax
  471.         mov al,' '
  472.         call dispc
  473.         pop ax
  474.  
  475.         dec ax
  476.         jmp short spaceNext
  477.  
  478. spaceExit:
  479.         pop dx
  480.         ret
  481. spaces endp
  482.  
  483.  
  484. ; ---------------------------------------------
  485. ; DERMON/u - uninstall and exit
  486. ;
  487. unInstall proc near
  488.         call checkPresent
  489.         lea dx,notLoaded
  490.         jnz unExit
  491.  
  492.         mov bx,es               ;bx->tsr code segment
  493.         mov ax,ds
  494.         sub ax,bx               ;calculate memory usage after DERMON tsr
  495.  
  496.         lea dx,othersLoaded
  497.         cmp ax,(TSRsegs+50)     ;amount of allowed overhead for DOS/PSP, etc.
  498.         jge unExit              ;insure that others are not loaded after
  499.  
  500.         assume ds:nothing
  501.         revect 13h,old_int13    ;unhook disk services interrupt
  502.  
  503.         msdos dosFreemem        ;dealloc the tsr's code segment
  504.  
  505.         push cs
  506.         pop ds
  507.         assume ds:code
  508.  
  509.         lea dx,ermonRemoved
  510. unExit:
  511.         call disps
  512.         ret
  513. unInstall endp
  514.  
  515.  
  516. ; ---------------------------------------------
  517. ; DERMON/C - report error counts
  518. ;
  519. reportPrefix    db 13,10,'Disk Error Monitor Status:$'
  520. errorCounts     db 'disk errors.',13,10,'$'
  521.  
  522. tablePrefix     db 13,10
  523.                 db 'Function  Drive  Head  Cylinder  Sector  Count    Error Description',13,10
  524.                 db '--------  -----  ----  --------  ------  -----  ---------------------------',13,10,'$'
  525.  
  526. reportStats proc near
  527.         call checkPresent
  528.         lea dx,notLoaded
  529.         jnz reportExit
  530.  
  531.         push es
  532.         pop ds
  533.         assume ds:code          ;ds->resident code segment
  534.  
  535.         lea dx,reportPrefix
  536.         call disps
  537.  
  538.         mov ax,errorCount
  539.         call decimal
  540.  
  541.         lea dx,errorCounts
  542.         cmp errorCount,0
  543.         jz reportExit
  544.  
  545.         call disps
  546.  
  547.         lea dx,tablePrefix
  548.         call disps
  549.  
  550.         clr bx
  551. reportNext:
  552.         cmp word ptr logResult[bx],0
  553.         jz reportSkip
  554.  
  555.         call reportFun          ;AH=function
  556.         call reportDrive        ;report drive/head/sector
  557.         call reportResult
  558.  
  559.         lea dx,crlfs
  560.         call disps
  561.  
  562. reportSkip:
  563.         inc bx
  564.         inc bx
  565.         cmp bx,(maxEntries*2)
  566.         jl reportNext
  567.         ret
  568.  
  569. reportExit:
  570.         call disps
  571.         ret
  572. reportStats endp
  573.  
  574.  
  575. ; ---------------------------------------------
  576. ; report disk function
  577. ;       AH=bios function
  578. ;
  579. funRead         db ' Read   $'
  580. funWrite        db ' Write  $'
  581. funVerify       db ' Verify $'
  582. funSeek         db ' Seek   $'
  583. funBad          db ' Unknown$'
  584.  
  585. reportFun proc near
  586.         mov ax,logAx[bx]
  587.  
  588.         lea dx,funRead
  589.         cmp ah,02h
  590.         jz outFun
  591.         cmp ah,0ah
  592.         jz outFun
  593.  
  594.         lea dx,funWrite
  595.         cmp ah,03h
  596.         jz outFun
  597.         cmp ah,0bh
  598.         jz outFun
  599.  
  600.         lea dx,funVerify
  601.         cmp ah,04h
  602.         jz outFun
  603.  
  604.         lea dx,funSeek
  605.         cmp ah,0ch
  606.         jz outFun
  607.  
  608.         lea dx,funBad
  609. outFun:
  610.         call disps
  611.         ret
  612. reportFun endp
  613.  
  614.  
  615. ; ---------------------------------------------
  616. ; report drive/head/track/sector
  617. ;       DH=drive
  618. ;       DL=head
  619. ;       CH=track
  620. ;       CL=sector
  621. ;       AL=sector count
  622. ;
  623. reportDrive proc near
  624.  
  625. ;display drive letter
  626.         mov ax,4
  627.         call spaces
  628.         mov dx,logDx[bx]
  629.         mov al,dl
  630.  
  631.         cmp al,7fh      ;floppy drives
  632.         jb notHard
  633.  
  634.         and al,7fh
  635.         add al,2        ;hard drives start with C
  636.  
  637. notHard:
  638.         add al,'A'
  639.         call dispc
  640.         mov al,':'
  641.         call dispc
  642.  
  643. ;display head number
  644.         mov ax,1
  645.         call spaces
  646.         mov dx,logDx[bx]
  647.         clr ah
  648.         mov al,dh
  649.         call decimal
  650.                                 
  651. ;display cylinder number
  652.         mov ax,3
  653.         call spaces
  654.         mov cx,logCx[bx]
  655.         clr ah
  656.         mov al,cl
  657.         shl ax,1
  658.         shl ax,1
  659.         mov al,ch               ;calculate 10 bit cylinder number
  660.         call decimal
  661.  
  662. ;display sector number
  663.         mov ax,2
  664.         call spaces
  665.         mov cx,logCx[bx]
  666.         clr ah
  667.         mov al,cl
  668.         and al,00111111b        ;isolate sector number
  669.         clr ah
  670.         call decimal
  671.  
  672. ;display sector count
  673.         mov ax,2
  674.         call spaces
  675.         mov ax,logAx[bx]
  676.         clr ah
  677.         call decimal
  678.         ret
  679. reportDrive endp
  680.  
  681.  
  682. ; ---------------------------------------------
  683. ; report error code
  684. ;       AH=error code
  685. ;
  686. resultTable db 001h,'Bad command$'
  687.             db 002h,'Address mark not found$'
  688.             db 003h,'Write attempted on write-protected disk$'
  689.             db 004h,'Sector not found$'
  690.             db 005h,'Reset failed$'
  691.             db 006h,'Diskette changed$'
  692.             db 007h,'Parameter act. failed$'
  693.             db 008h,'DMA overrun$'
  694.             db 009h,'DMA across 64K boundary$'
  695.             db 00Ah,'Bad sector detected$'
  696.             db 00Bh,'Bad track detected$'
  697.             db 00Ch,'Unsupported track$'
  698.             db 00Dh,'Invalid number of sectors on format$'
  699.             db 00Eh,'Control data address mark detected$'
  700.             db 00Fh,'DMA arbitration error$'
  701.             db 010h,'Bad CRC/ECC$'
  702.             db 011h,'Data ECC corrected$'
  703.             db 020h,'Controller failure$'
  704.             db 040h,'Seek failed$'
  705.             db 080h,'Time out$'
  706.             db 0AAh,'Drive not ready$'
  707.             db 0BBh,'Undefined error$'
  708.             db 0CCh,'Write fault$'
  709.             db 0E0h,'Status register error$'
  710.             db 0FFh,'Sense operation failed$'
  711.             db 000h,'Unknown error$'     ;must be last!
  712.             
  713. reportResult proc near
  714.         mov ax,3
  715.         call spaces
  716.  
  717.         lea si,resultTable
  718.         mov ax,logResult[bx]
  719.  
  720. checkResult:
  721.         cmp cs:[si],ah
  722.         jz foundResult
  723.         cmp byte ptr cs:[si],0
  724.         jz foundResult
  725.  
  726. findNext:
  727.         inc si
  728.         cmp byte ptr cs:[si],'$'
  729.         jnz findNext
  730.         inc si
  731.         jmp short checkResult
  732.  
  733. foundResult:
  734.         mov dx,si
  735.         inc dx
  736.         call disps
  737.         ret
  738. reportResult endp
  739.  
  740.  
  741. ; ---------------------------------------------
  742. ; convert number to decimal,
  743. ;       outputs 5 digits with leading spaces
  744. ;       ax  number to convert
  745. ;
  746. decBuf db '00000'
  747. decEnd db ' $'
  748.  
  749. decimal proc near
  750.         assume ds:nothing
  751.         push si
  752.         push bx
  753.         push cx
  754.         push dx
  755.  
  756.         lea bx,decBuf
  757.         mov cx,5
  758.         mov dl,' '
  759. decClear:
  760.         mov cs:[bx],dl
  761.         inc bx
  762.         loop decClear
  763.  
  764.         mov cx,5                ;convert 5 digits
  765.         mov si,10               ;divisor
  766.  
  767. decNext:
  768.         clr dx                  ;convert AX -> DX:AX
  769.  
  770.         div si                  ;divide number by 10. Remainder is in
  771.                                 ; DX--this is a one-digit decimal
  772.                                 ; number.  Number/10 is in AX
  773.  
  774.         add dl,'0'              ;convert remainder to a text character
  775.         dec bx                  ;put this digit in the string and
  776.         mov cs:[bx],dl          ;point to the location for the
  777.                                 ; next most-significant digit
  778.         cmp ax,0
  779.         jz decLast              ;stop when 0 is reached
  780.  
  781.         loop decNext
  782.  
  783. decLast:
  784.         lea dx,decBuf
  785.         call disps
  786.  
  787.         pop dx
  788.         pop cx
  789.         pop bx
  790.         pop si
  791.         ret
  792. decimal endp
  793.  
  794.  
  795. ; ---------------------------------------------
  796. ; DERMON/Z - zero error counts
  797. ;
  798. tableZeroed     db 'Error tables zeroed.',13,10,'$'
  799.  
  800. zeroStats proc near
  801.         call checkPresent
  802.         lea dx,notLoaded
  803.         jnz zeroExit
  804.  
  805.         push es
  806.         pop ds
  807.         assume ds:code  ;ds->resident code segment
  808.  
  809.         clr ax
  810.         mov errorCount,ax
  811.         mov logNext,ax
  812.  
  813.         mov bx,ax
  814. zeroNext:
  815.         mov word ptr logResult[bx],0
  816.         inc bx
  817.         inc bx
  818.         cmp bx,(maxEntries*2)
  819.         jl zeroNext
  820.  
  821.         lea dx,tableZeroed
  822. zeroExit:
  823.         call disps
  824.         ret
  825. zeroStats endp
  826.  
  827. code ends
  828.         end entry
  829.  
  830.