home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / BBS / CRASH.ZIP / CRASH.DOC < prev    next >
Text File  |  1989-07-03  |  41KB  |  1,261 lines

  1.                                    C R A S H
  2.                                  Documentation
  3.                                 PROGRAM EXCHANGE
  4.                                  (303) 440-0786
  5.                                   July 3, 1989
  6.                                Richard B. Johnson
  7.  
  8.                                   INTRODUCTION
  9.  
  10.           How many times have you come home from work or school and
  11.           found that your BBS system computer has crashed so the sys-
  12.           tem was "down" all day? Usually it's a disk-error and you
  13.           are left with the "Abort Retry Ignore" prompt and nobody is
  14.           there to hit the key.
  15.  
  16.           If you have a computer that functions as a file-server in a
  17.           LAN, you've probably been greeted with "The Network's
  18.           down.." just as you walked into work.
  19.  
  20.           Since most BBS systems and file-servers are set up so the
  21.           AUTOEXEC.BAT mechanism will get the software started upon
  22.           boot-up. Wouldn't it be nice if, upon detecting a fatal
  23.           error, the system just re-booted? Just like a VAX! If there
  24.           was a bad file that kept causing the crash, the system oper-
  25.           ator could fix that later. At least the system would be "on-
  26.           the-air" and callers would be able to do everything else
  27.           except download the bad file.
  28.  
  29.           Sometimes the system will crash for no particular reason at
  30.           all. It just goes off into "hyperspace" and you are left
  31.           with a screen full of blinking characters. This is usually
  32.           caused by a stack-overflow. Often the system just "locks-up"
  33.           for no apparent reason at all. This could be caused by poor
  34.           timing in an interrupt-service routine of even a cosmic ray.
  35.           There are just so many things that can go wrong with a sys-
  36.           tem that is supposed to be "on-the-air" 24 hours a day, all
  37.           year long, that its surprising that so many are able to
  38.           continue in operation as well as they do!
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                      - 1 -
  64.  
  65.  
  66.  
  67.                                 What CRASH does
  68.  
  69.           CRASH was written to reboot the system if it detects that
  70.           something is not right. CRASH has some limitations of its
  71.           own which will be discussed first.
  72.  
  73.           o     CRASH is an interrupt-service routine. If the inter-
  74.           rupt table gets corrupted, CRASH won't ever get a chance to
  75.           do its thing.
  76.  
  77.           o     CRASH doesn't know everything there is to know about
  78.           every program being executed. Sometimes it can't detect if
  79.           data is being executed instead of program code. It tries to
  80.           find out, but it's not 100 percent sure of anything.
  81.  
  82.           o     CRASH doesn't fix anything. When it detects an error,
  83.           it just re-boots the system. This is usually good enough to
  84.           keep a BBS system "on-the-air", but if the same bad thing
  85.           happens again, CRASH will reboot the system again. For in-
  86.           stance, if you have a bad sector in a file that is always
  87.           opened by your BBS software, the system will crash over and
  88.           over again until you get home to abort the operation.
  89.  
  90.           o     Only properly-written programs will execute within the
  91.           CRASH environment. Most all programs that use well-known C,
  92.           Pascal, BASIC, FORTRAN, and other high-level language com-
  93.           pilers will execute properly. Beware of programs written in
  94.           Assembly. Many of these programs are not written correctly
  95.           and will immediately crash! In particular, some amateur
  96.           programs execute software-interrupts to see if they have
  97.           been initialized! This is like putting a gun to your head
  98.           and pulling the trigger just to check if it was loaded!
  99.  
  100.           The correct way, of course, to determine if a TSR that uses
  101.           interrupts has been loaded is to check the code pointed to
  102.           by the interrupt-table. It is NOT to execute the interrupt
  103.           to see what happens! Some persons who get paid for laying
  104.           code and call themselves programmers don't know this. There-
  105.           fore some "extra-memory" boards can't be used with CRASH,
  106.           nor can some device-drivers.
  107.  
  108.           Programs are also not allowed to execute code within 32
  109.           bytes of the end of the code-segment. The stack is not
  110.           allowed to wrap around the end of the stack-segment, etc.
  111.           These things are normally known, but, there is code out
  112.           there that will crash the system!
  113.  
  114.           Note that CRASH is written to execute on an IBM-PC/XT/AT or
  115.           true clone. If your machine is not a true clone, it is
  116.           possible that some of the information presented in the
  117.           crash-dump listing will be incorrect.
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                      - 2 -
  127.  
  128.  
  129.  
  130.           That's the bad stuff about CRASH. Now the good stuff.
  131.  
  132.           o     At every tick of the system clock, CRASH checks the
  133.           following things:
  134.  
  135.                 (1) Is the stack still in writable memory?
  136.                 (2) Has the stack overflowed?
  137.                 (3) Is the program in the correct place in memory?
  138.                 (4) Are correct opcodes being executed?
  139.                 (5) Are we attempting to execute data?
  140.  
  141.           o     Every time a disk read or write is made, CRASH keeps
  142.           track of any errors. If there are more than four consecutive
  143.           read, write or verify errors, CRASH will re-boot the system.
  144.           This will prevent the "Abort Retry Ignore" syndrome.
  145.  
  146.           o     If "runaway" code attempts to execute any software-
  147.           interrupts that it hasn't initialized, CRASH will re-boot
  148.           the system. Every location on the interrupt table that is
  149.           not dedicated to some "standard" purpose points to code
  150.           within CRASH that will re-boot the machine. Any program
  151.           using these interupts must initialize them first.
  152.  
  153.           o     If an attempt is made to execute RAM that has never
  154.           contained program or data since boot-up, the system will
  155.           also be re-booted. This will help constrain a runaway pro-
  156.           gram counter. This was added in version V1.02
  157.  
  158.           o     If there's a memory parity-error. The system will also
  159.           be re-booted. This was added at version V1.03.
  160.  
  161.           o     If BBS monitoring is enabled, CRASH monitors the modem
  162.           ring-indicator. Should the BBS system fail to answer the
  163.           modem after ten rings, CRASH will reboot the system. This
  164.           will help prevent "hung" BBS software from keeping the BBS
  165.           system "off-the-air". This was added in version V1.15
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.                                      - 3 -
  190.  
  191.  
  192.  
  193.                                 Installing CRASH
  194.  
  195.  
  196.           Note:
  197.           Version V1.19 provides a new feature that will allow it to
  198.           run on "stubborn" machines with many foreign attachments.
  199.  
  200.           Place the file CRASH.CFG in your top directory of the boot-
  201.           drive (i.e. C:\ ). This configuration file is used to tell
  202.           CRASH which interrupt vectors to intercept. For CRASH to
  203.           have maximum effectiveness, it is necessary for it to inter-
  204.           cept all the unused interrupt vectors in your machine. You
  205.           do not have to figure anything out, the machine will do it
  206.           for you.
  207.  
  208.           Boot your machine and load all your usual TSRs. Then, with a
  209.           printer connected to the machine, execute CRASH. It is like-
  210.           ly that CRASH will immediately crash and write a listing to
  211.           the screen and the printer. You can stop the printer after
  212.           the first few lines by turning it "off", yes the POWER
  213.           switch, this will allow CRASH to quickly reboot your machine
  214.           while you look at the listing. The listing will likely say,
  215.           near the 6th line:
  216.  
  217.           CRASH-F-UNEXINT, Unexpected interrupt, INT HH
  218.  
  219.           ... Where HH are two hexadecimal digits representing the
  220.           interrupt number.
  221.  
  222.           Edit the data-file, CRASH.CFG with an ASCII (plain-text)
  223.           editor and place a  semicolon ";" at the beginning of the
  224.           line containing the interrupt number you wish to prevent
  225.           CRASH from attaching. If you look at the contents of
  226.           CRASH.CFG, you will see that this is all very simple and
  227.           self-explanatory.
  228.  
  229.           After you have edited the configuration file, execute CRASH
  230.           again. CRASH may or may-not crash. If CRASH crashes, simply
  231.           look at the interrupt number causing this crash and edit it
  232.           out of the configuration file. Eventually, CRASH will load
  233.           without crashing your system.
  234.  
  235.           Now; Load your BBS software and execute all "doors", ex-
  236.           ternal protocols, and utilities that you normally use for
  237.           BBS operation. If CRASH does not CRASH, you have got it
  238.           installed! Otherwise, continue to edit the data-file until
  239.           NORMAL BBS operation does not cause a crash.
  240.  
  241.           In your AUTOEXEC.BAT file, BEFORE any other TSR are instal-
  242.           led, insert the CRASH filename. If a path has not yet been
  243.           established, use the complete path so MS-DOS can find the
  244.           file. It is recommended that you use a program that waits a
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.                                      - 4 -
  253.  
  254.  
  255.  
  256.           few seconds after booting before you install CRASH. This
  257.           will allow you to control-C out of the batch file if there
  258.           is a continuous fatal error. The PROGRAM EXCHANGE
  259.           AUTOEXEC.BAT file looks like this:
  260.  
  261.           ------------------------------------------------------------
  262.           @ECHO OFF
  263.           REM * AUTOEXEC.BAT *
  264.           BREAK=ON
  265.           VERIFY=OFF
  266.           PROMPT $p$g $
  267.           Set COMSPEC=C:\DOS\COMMAND.COM
  268.           Set PCPLUS=C:\PCPLUS
  269.           Set TELIX=C:\TELIX
  270.           Set LOGFILE=D:\WILDCAT
  271.           Set JMODEM=SHUTUP
  272.           PATH=C:\DOS;C:\TOOLS;C:\XY;C:\NORTON;C:\TELIX;D:\WILDCAT;D:\
  273.           WILDCAT\EXE
  274.           C:\TOOLS\AUTOTIME             < Set system clock
  275.           C:\TOOLS\WAIT 00:00:05        < Wait 5 seconds
  276.           C:\TOOLS\CRASH /NOPROG        < Load CRASH
  277.           .                             < Continue .... other commands
  278.           .
  279.           ------------------------------------------------------------
  280.           The following commands may be entered on the command-line to
  281.           disable certain functions.
  282.  
  283.           NOTIME        Does not print the time-stamp every hour.
  284.           NOPROGRAM     Does not show the program being executed.
  285.           NODUMP        Does not produce a crash-dump with
  286.                         Ctrl-Alt-Del.
  287.           NOTABLE       Does not print the interrupt-table contents.
  288.           NOMASK        Does not print the interrupt-controller mask.
  289.           NOSTACK       Does not print the stack contents
  290.           NOREGISTERS   Does not print the register contents
  291.           NOPOWER       Does not monitor power-failure.
  292.           NOBBS         Dos not monitor BBS operation.
  293.  
  294.           CRASH/NOTIM/NOPRO/NODUM/NOTAB/NOMAS/NOSTAC/NOREG/NOPOW/NOBBS
  295.           ... will disable all the printing while still allowing CRASH
  296.           to monitor the system and reboot if it finds something is
  297.           wrong. Note that you may abbreviate the commands. If NOPOWER
  298.           or NOBBS is entered on the command line, CRASH does NOT
  299.           monitor any BBS operation or power failure. These two com-
  300.           mands not only disable printing, but disable monitoring as
  301.           well.
  302.  
  303.  
  304.           CRASH V1.00 was not intended for use by an interactive user.
  305.           It never told you what went wrong so an interactive user
  306.           didn't know why his system re-booted! Later versions now
  307.           give some helpful information.
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.                                      - 5 -
  316.  
  317.  
  318.  
  319.  
  320.           Version 1.01 writes a message to the screen, telling what
  321.           went wrong. It waits about 5 seconds before re-booting.
  322.  
  323.           CRASH V1.06 Brings some additional features.
  324.  
  325.           o     The prompts after a crash have modified to follow the
  326.           same format as VAX/VMS. In addition to looking "cute", the
  327.           messages confirm what facility produced the error messages.
  328.  
  329.           o     If you have a printer attached, the "crash-dump" will
  330.           now be sent to the printer as well as the screen.
  331.  
  332.           o     The complete contents of all the registers are now
  333.           displayed except if there was a disk-error causing the
  334.           crash.
  335.  
  336.           o     If a disk error caused the crash, the drive, head,
  337.           cylinder, and sector that caused the crash will be displayed
  338.           as well as the kind of error (CRC, Bad seek, etc.)
  339.  
  340.           o     The time of the crash is displayed.
  341.  
  342.           o     If an attempt is made to low-level FORMAT a hard-disk,
  343.           the system will CRASH and re-boot without touching the hard-
  344.           disk(s). Floppies are ignored.
  345.  
  346.           These are examples of the new error messages.
  347.  
  348.                 A Disk error causes this crash-dump.
  349.  
  350.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.023
  351.           CRASH-I-DISKERR, Disk error, Record not found
  352.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  353.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  354.           CRASH-I-DISKPARM, disk parameters : (hex)
  355.            Physical drive : 81
  356.                  Cylinder : 010A
  357.                      Head : 04
  358.                    Sector : 0A
  359.           SYSTEM-F-FATAL, Fatal bugcheck.
  360.           CRASH-I-REBOOT, Rebooting.
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.                                      - 6 -
  379.  
  380.  
  381.  
  382.  
  383.                 Any attempt to FORMAT a hard-disk causes this crash-
  384.           dump. Floppy disks are allowed to be formatted.
  385.  
  386.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.182
  387.           CRASH-I-FORMAT,  Attempt to low-level format fixed disk.
  388.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  389.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  390.           CRASH-I-DISKERR, Disk error, No error occurred.
  391.           CRASH-I-DISKPARM, disk parameters : (hex)
  392.            Physical drive : 80
  393.                  Cylinder : 0100
  394.                      Head : 00
  395.                    Sector : 01
  396.           SYSTEM-F-FATAL, Fatal bugcheck.
  397.           CRASH-I-REBOOT, Rebooting.
  398.  
  399.  
  400.                 A runaway program-counter causes this crash-dump.
  401.  
  402.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.231
  403.           CRASH-I-RUNAWAY, Runaway program-counter.
  404.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  405.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  406.           CRASH-I-REGDMP, Register dump:
  407.           AX = 0AF0
  408.           BX = 10AA
  409.           CX = 001A
  410.           DX = 0B00
  411.           SI = 0010
  412.           DI = 0FF0
  413.           BP = 0300
  414.           DS = 0CA0
  415.           ES = 0CA0
  416.           CS = B800
  417.           IP = 1FA0
  418.           SS = 0102
  419.           SP = FFE0
  420.           CRASH-I-STKDMP, Stack dump:
  421.           FFFE = 0000
  422.           FFFC = B80A
  423.           FFFA = FFFA
  424.           FFF8 = 00A0
  425.           FFF6 = 0000
  426.           FFF4 = 0000
  427.           FFF2 = EEA0
  428.           FFF0 = EE0A
  429.           FFEE = A70B
  430.           FFEC = 1283
  431.           FFEA = 0000
  432.           FFE8 = 0000
  433.           FFE6 = F202
  434.           FFE2 = B800
  435.           FFE0 = 0102
  436.           SYSTEM-F-FATAL, Fatal bugcheck.
  437.           CRASH-I-REBOOT, Rebooting.
  438.  
  439.  
  440.  
  441.                                      - 7 -
  442.  
  443.  
  444.  
  445.  
  446.  
  447.                 A spurious interrupt causes this crash-dump.
  448.  
  449.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.982
  450.           CRASH-I-UNEXINT, Unexpected interrupt.
  451.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  452.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  453.           CRASH-I-REGDMP, Register dump:
  454.           AX = 0AF0
  455.           BX = 10AA
  456.           CX = 001A
  457.           DX = 0B00
  458.           SI = 0010
  459.           DI = 0FF0
  460.           BP = 0300
  461.           DS = 0CA0
  462.           ES = 0CA0
  463.           CS = B800
  464.           IP = 1FA0
  465.           SS = 0102
  466.           SP = FFE0
  467.           CRASH-I-STKDMP, Stack dump:
  468.           FFFE = 0000
  469.           FFFC = B80A
  470.           FFFA = FFFA
  471.           FFF8 = 00A0
  472.           FFF6 = 0000
  473.           FFF4 = 0000
  474.           FFF2 = EEA0
  475.           FFF0 = EE0A
  476.           FFEE = A70B
  477.           FFEC = 1283
  478.           FFEA = 0000
  479.           FFE8 = 0000
  480.           FFE6 = F202
  481.           FFE2 = B800
  482.           FFE0 = 0102
  483.           SYSTEM-F-FATAL, Fatal bugcheck.
  484.           CRASH-I-REBOOT, Rebooting.
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.                                      - 8 -
  505.  
  506.  
  507.  
  508.  
  509.           Incorrect program or stack location causes this crash-dump.
  510.  
  511.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.283
  512.           CRASH-I-PROGRAM, Program counter at B800:24B8.
  513.           CRASH-I-STACK, Stack at 1A51:FFE8
  514.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  515.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  516.           CRASH-I-REGDMP, Register dump:
  517.           AX = 0AF0
  518.           BX = 10AA
  519.           CX = 001A
  520.           DX = 0B00
  521.           SI = 0010
  522.           DI = 0FF0
  523.           BP = 0300
  524.           DS = 0CA0
  525.           ES = 0CA0
  526.           CS = B800
  527.           IP = 24B8
  528.           SS = 0102
  529.           SP = FFE0
  530.           CRASH-I-STKDMP, Stack dump:
  531.           FFFE = 0000
  532.           FFFC = B80A
  533.           FFFA = FFFA
  534.           FFF8 = 00A0
  535.           FFF6 = 0000
  536.           FFF4 = 0000
  537.           FFF2 = EEA0
  538.           FFF0 = EE0A
  539.           FFEE = A70B
  540.           FFEC = 1283
  541.           FFEA = 0000
  542.           FFE8 = 0000
  543.           FFE6 = F202
  544.           FFE2 = B800
  545.           FFE0 = 0102
  546.           SYSTEM-F-FATAL, Fatal bugcheck.
  547.           CRASH-I-REBOOT, Rebooting.
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.                                      - 9 -
  568.  
  569.  
  570.  
  571.  
  572.                 A memory parity error causes this crash-dump.
  573.  
  574.           CRASH-I-TIM, time  28-MAR-1989  13:08:29.003
  575.           CRASH-I-MEMPAR, Memory parity error at 8000:0FE0
  576.           SYSTEM-I-EXEPROC, Executing process: C:\CRASH\TEXT.EXE
  577.           CRASH-I-DOSFUNC, Last DOS function: 4B  (Exec prog)
  578.           CRASH-I-REGDMP, Register dump:
  579.           AX = 0000
  580.           BX = 10F0
  581.           CX = 0001
  582.           DX = 0000
  583.           SI = 0010
  584.           DI = 01A0
  585.           BP = 0210
  586.           DS = 0CA0
  587.           ES = 0CA0
  588.           CS = 0CA0
  589.           IP = 0102
  590.           SS = 0CA0
  591.           SP = FFE0
  592.           CRASH-I-STKDMP, Stack dump:
  593.           FFFE = 0000
  594.           FFFC = B80A
  595.           FFFA = FFFA
  596.           FFF8 = 00A0
  597.           FFF6 = 0000
  598.           FFF4 = 0000
  599.           FFF2 = EEA0
  600.           FFF0 = EE0A
  601.           FFEE = A70B
  602.           FFEC = 1283
  603.           FFEA = 0000
  604.           FFE8 = 0000
  605.           FFE6 = F202
  606.           FFE2 = B800
  607.           FFE0 = 0102
  608.           SYSTEM-F-FATAL, Fatal bugcheck.
  609.           CRASH-I-REBOOT, Rebooting.
  610.  
  611.           Version V1.08 added routines to send a time-stamp to the
  612.           printer once every hour. This will help you find the time
  613.           the system crashed even if CRASH was unable to reboot be-
  614.           cause it got clobbered. The time-stamp goes only to the
  615.           printer. The time-stamp is set by the DOS clock when CRASH
  616.           is installed. from then on, CRASH keeps it's own time, inde-
  617.           pendent of the DOS clock. It understands day and month roll-
  618.           over. It even knows about leap-years. It is more accurate
  619.           than the DOS time and displays the time to within one mil-
  620.           lisecond.
  621.  
  622.           This version also added routines to detect a power-failure.
  623.           Obviously, if the power fails to the computer itself, the
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.                                      - 10 -
  631.  
  632.  
  633.  
  634.           computer will not function. If you have a non-interruptible
  635.           power supply, you should connect your printer and computer
  636.           to this supply. Connect your modem to a power source that
  637.           will fail.
  638.  
  639.           When CRASH is first installed, it looks at every possible
  640.           communications adapter port to determine if anything is con-
  641.           nected that has it's DSR lead high (anything that's turned
  642.           on). If CRASH finds something there, usually a modem, it
  643.           will check this once-per-second after its installed. If it
  644.           finds that the DTR lead is no longer high, it sends a power-
  645.           failure warning to both the screen and the printer. It does
  646.           NOT reboot the machine. It only sends a warning with the
  647.           time of the failure. When the power is restored, CRASH sends
  648.           information about the time it was restored to both the
  649.           printer and the screen.
  650.  
  651.           Since CRASH checks the communications adapter ports starting
  652.           at the first one, if you wish to not hang-up on a caller
  653.           when the power fails, you connect you modem to COM2 or above
  654.           and to a source of non-interruptible power. You connect COM1
  655.           to a small "plug-in" DC power supply of the kind you get for
  656.           running shirt-pocket radios (Radio Shack has them). You con-
  657.           nect the negative (-) lead to pin seven (7) and the positive
  658.           lead to pin six (6) of the DB-25 connector. This power-sup-
  659.           ply is plugged into interruptible power. When power fails,
  660.           pin 6 will go low, producing a power-failure warning with
  661.           the time of the failure. When power is restored, that fact
  662.           will be logged along with the time also. Any power supply
  663.           voltage from about 5 volts to 20 volts will work fine. These
  664.           connections do not affect hardware flow-control which is
  665.           handled through pins 4, 5, and 20.
  666.  
  667.           V1.09 Adds routines to produce a stack-dump as well as the
  668.           register-dump. The depth of the stack-dump is limited to 80
  669.           words to save printer paper. It would not be practical to
  670.           trace a stack-overflow condition from the stack contents and
  671.           this is about all that could cause such a large stack.
  672.  
  673.           The printer-output routine is located within the TSR. It
  674.           does NOT use any of the built-in functions so it should not
  675.           get clobbered during a crash. In the event that the printer
  676.           is not turned on or is not connected, the messages will
  677.           still be printed to the screen. If the printer is powered
  678.           on, but is left off-line, the screen message will be printed
  679.           VERY slowly (about one-second per character).
  680.  
  681.           The date and time are kept within the CRASH code. This is
  682.           because, in the event of a crash, it is likely that the DOS
  683.           system time and date will not be usable. The date and time
  684.           are set to system time when CRASH is first installed. From
  685.           then on, CRASH maintains its own time and date. The internal
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.                                      - 11 -
  694.  
  695.  
  696.  
  697.           date-time routines "know" about day, month, and year roll-
  698.           over and are thus more accurate than DOS's internal time.
  699.           Leap-years are even accounted for.
  700.  
  701.           Version V1.12 added code to show the program (process) being
  702.           executed during a crash. It also now shows the last DOS
  703.           function called by the executing routine. Since there is so
  704.           much data now available to dump to a printer, its possible
  705.           that most users will want to turn some of it off. Therefore,
  706.           now you can select what does get printed!
  707.  
  708.           CRASH/notime/noprogam/nodump/notable/nomask/nostack/noregist
  709.           ers/nopower...
  710.  
  711.           ...is now a legitimate command-line! This will just print
  712.           that a crash occurred and then re-boot the system.
  713.  
  714.           The following "no" commands are implemented:
  715.  
  716.           NOTIME        Does not print the time-stamp every hour.
  717.           NOPROGRAM     Does not show the program being executed.
  718.           NODUMP        Does not produce a crash-dump with
  719.                         Ctrl-Alt-Del.
  720.           NOTABLE       Does not print the interrupt-table contents.
  721.           NOMASK        Does not print the interrupt-controller mask.
  722.           NOSTACK       Does not print the stack contents
  723.           NOREGISTERS   Does not print the register contents
  724.           NOPOWER       Does not monitor power-failure.
  725.           NOBBS         Dos not monitor BBS operation.
  726.  
  727.           These commands, entered on the command-line, do not have to
  728.           be separated with any delimiters. A space or a "/" is
  729.           required after the word CRASH, but everything else may be
  730.           jumbled together if you like. The commands may also be
  731.           abbreviated.
  732.  
  733.           "CRASH notimenoprogramnostacknopower" Is hard to read, but
  734.           CRASH will understand perfectly. You may separate the com-
  735.           mands with anything you like.
  736.  
  737.           "CRASH [noti](nopro) {nosta} !!nopow!!" would work just fine
  738.           also  (marvels of assembly-language, anything goes).
  739.  
  740.           If you have the default printer messages enabled, you can
  741.           keep your printer turned off with no affect upon system per-
  742.           formance. However, if you have the printer power ON, but the
  743.           printer is "off-line" or out-of-paper, there will be a very
  744.           long pause in system operation during the time that a mes-
  745.           sage would be sent to the printer! Therefore, if you wish to
  746.           keep all the messages enabled, but you don't wish to have
  747.           them printed continuously, turn the printer power-switch off
  748.           to disable printing.
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.                                      - 12 -
  757.  
  758.  
  759.  
  760.  
  761.           Version V1.15 Added pagination and headings to the listing
  762.           file. This keeps the listing much neater. The top-of-form is
  763.           set with a form-feed so if you print anything to the printer
  764.           while CRASH is logging, a maximum of one page will be out-
  765.           of-sequence.
  766.  
  767.           Version V1.19 added code to read a configuration file,
  768.           CRASH.CFG during installation. This should allow operation
  769.           on many different kinds of clones with many foreign
  770.           attachments.
  771.  
  772.           Additional notes:
  773.           It is VERY IMPORTANT to load CRASH as the FIRST TSR! If you
  774.           load it after some other TSR programs, the system may im-
  775.           mediately crash and re-boot! This is because CRASH initial-
  776.           izes every location in the interrupt table that is not used
  777.           by DOS to point to itself. Any program or TSR may use inter-
  778.           rupt locations above 60H for its own use. If a TSR has
  779.           claimed one of these locations, you don't want CRASH to take
  780.           it away. Instead, you load CRASH first, then the other TSR
  781.           will take an interrupt-table location away from CRASH, not
  782.           the other way around!
  783.  
  784.           It is assumed that CRASH will be installed in a computer
  785.           that is executing application programs that have been de-
  786.           bugged. Therefore any attempt to low-level FORMAT any hard
  787.           disks is also trapped and will cause a crash-dump and re-
  788.           boot. This does NOT prevent the DOS FORMAT which consists of
  789.           a long READ of the disk to find any bad sectors, followed by
  790.           a WRITE to the directory and FAT.
  791.  
  792.           I'm still looking for additional things to check to deter-
  793.           mine if the system has crashed! It is still possible to have
  794.           an undetected crash which means your system just sits there
  795.           staring into hyperspace until you hit the boot-switch. If
  796.           you can think of anything else to "look at" 18 times-per-
  797.           second that could detect a crash, please contact me at the
  798.           PROGRAM EXCHANGE and I'll add it to the code.
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.                                      - 13 -
  820.  
  821.  
  822.  
  823.                           Using CRASH to find problems
  824.  
  825.           If you've installed CRASH and all your BBS or network pro-
  826.           grams execute properly without invoking a CRASH-reboot, then
  827.           you've got a properly-configured system that is executing
  828.           stable code.
  829.  
  830.           Sometimes this is not the case. You can use CRASH to find
  831.           what program is causing problems. This program is very like-
  832.           ly the culprit that has been causing your system to go off
  833.           into hyperspace on occasion.
  834.  
  835.           (1)   Put a copy of CRASH.COM on a bootable floppy disk.
  836.  
  837.           (2)   Boot the machine from this disk with no AUTOEXEC.BAT
  838.           file and no CONFIG.SYS file.
  839.  
  840.           (3)   Set the system time is you have an XT or PC.
  841.  
  842.           (4)   Execute CRASH. CRASH should sign-on with no problems.
  843.  
  844.           (5)   Change default to your hard-disk.
  845.  
  846.           (6)   Type your AUTOEXEC.BAT file to the screen.
  847.  
  848.           (7)   Enter each if the commands in your AUTOEXEC.BAT file
  849.           until you find the one that crashes the machine.
  850.  
  851.           (8)   Reboot the machine from the floppy.
  852.  
  853.           (9)   Edit the AUTOEXEC.BAT file to remove the bad command
  854.           by inserting a "Rem " before it.
  855.  
  856.           (10) Again, execute each command in the AUTOEXEC.BAT file
  857.           until you cause another crash.
  858.  
  859.           (11) Continue until you have removed all the bad commands
  860.           from your AUTOEXEC.BAT file. You have now isolated the pro-
  861.           grams or TSRs that cause problems.
  862.  
  863.           (12) Copy your AUTOEXEC.BAT file to the floppy.
  864.  
  865.           (13) Copy your CONFIG.SYS file to the floppy-disk. Copy any
  866.           device-drivers that the CONFIG.SYS might attempt to install.
  867.  
  868.           (14) Reboot from the floppy. If the machine crashes, then
  869.           there's something in the CONFIG.SYS file you have to remove.
  870.  
  871.           (15) Continue in this manner until you have isolated the
  872.           programs, device, drivers, or TSRs that cause problems.
  873.  
  874.           (16) Execute your BBS software.
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.                                      - 14 -
  883.  
  884.  
  885.  
  886.  
  887.           (17) Log-in from a remote terminal and execute all the
  888.           external protocols, "windows", and "doors".
  889.  
  890.           (18) If your BBS system works correctly, this is the con-
  891.           figuration that you should be using when you are using your
  892.           system as a BBS.
  893.  
  894.           If you insist in using the defective software that you have
  895.           located, then use it only when your system is being used for
  896.           interactive use and CRASH is not installed. You can always
  897.           make two (or more) ".BAT" files that configure your system
  898.           any way you wish. The default ".BAT" file should be the run
  899.           the executes the BBS or network software.
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.                                      - 15 -
  946.  
  947.  
  948.  
  949.                      Finding the reason for a system crash
  950.  
  951.           After you've had your system up for a few days, you may find
  952.           that CRASH did its job and re-booted after there was some
  953.           kind of error. You can look at the listings and determine
  954.           what the possible cause was. Here are some hints.
  955.  
  956.           CRASH-I-MEMPAR, Memory parity error at 8000:0FE0
  957.  
  958.           An attempt was made to access memory that was defective. The
  959.           memory location causing the problem is shown. The segment-
  960.           value is always of the form "X000" to make it easy to find
  961.           the defective memory-bank in the machine.
  962.  
  963.           In the event that CRASH was unable to find the failing mem-
  964.           ory location, the location will not be shown. Memory parity
  965.           errors are most common in "turbo-clones" where memory access
  966.           times are severely limited by the high-speed clock. Some
  967.           hobbiest TSR programs disable memory-parity checking so that
  968.           "souped-up" clones seem to work. Using these programs can
  969.           easily destroy your hard-disk contents.
  970.  
  971.           CRASH-F-UNEXINT, Unexpected interrupt, 1F
  972.  
  973.           The program code executed an interrupt that it had not in-
  974.           itialized. This could be caused by a "general-crash" in
  975.           which the program got corrupted. Most likely, it is caused
  976.           by incorrectly-written software. You can verify the software
  977.           that was executed by checking the executing process name in
  978.           the listing. The interrupt number, 1F in this case, is shown
  979.           on the listing.
  980.  
  981.           CRASH-F-PROGRAM,  Program counter at 0000:0380
  982.  
  983.           The program attempted to execute code in low memory. There
  984.           is no code to be executed below segment 0040H in IBM-compat-
  985.           ible computers. This is all data and stack space. You can
  986.           verify the software that was executed by checking the exe-
  987.           cuting process name in the listing.
  988.  
  989.           CRASH-F-STACK,  Stack at 000F:0001
  990.  
  991.           The stack was below the area used for stack-space. The
  992.           stack-segment is never below 40H in IBM-compatible com-
  993.           puters. These errors are also displayed when the stack is
  994.           not in writeable memory.
  995.  
  996.           CRASH-F-RUNAWAY, Runaway program counter.
  997.  
  998.           The program attempted to execute screen memory or executed
  999.           memory that it did not "own". This could be caused by a
  1000.           stack-overflow but is usually caused by a program leaving
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.                                      - 16 -
  1009.  
  1010.  
  1011.  
  1012.           "hot" interrupt vectors when it exits because of some error.
  1013.           In this case, the program that executed before the current
  1014.           one is usually the culprit. Most communications programs use
  1015.           interrupts when they execute. If they properly terminate,
  1016.           they usually put back the original vectors and mask off the
  1017.           interrupt controller. However, should the program exit be-
  1018.           cause of a disk-error, or an operator Ctrl-Break, many pro-
  1019.           grams, which do not trap these exit vectors, will terminate
  1020.           without restoring vectors. The very next program to be exe-
  1021.           cuted will likely cause a crash.
  1022.  
  1023.           The crash-dump produces a figure of the interrupt-controller
  1024.           mask. By viewing this mask, you can determine which hard-
  1025.           ware-interrupts were enabled during the crash.
  1026.  
  1027.           An interrupt is enabled when there is a "0" in the mask and
  1028.           it is disabled when there is a "1".
  1029.  
  1030.           CRASH-I-ICTLMSK,  Interrupt  mask: 10101100
  1031.                                              ||||||||__ IRQ0 (INT 08H)
  1032.                                              |||||||___ IRQ1 (INT 09H)
  1033.                                              ||||||____ IRQ2 (INT 0AH)
  1034.                                              |||||_____ IRQ3 (INT 0BH)
  1035.                                              ||||______ IRQ4 (INT 0CH)
  1036.                                              |||_______ IRQ5 (INT 0DH)
  1037.                                              ||________ IRQ6 (INT 0EH)
  1038.                                              |_________ IRQ7 (INT 0FH)
  1039.  
  1040.  
  1041.           In this case, you can see that the following hardware-
  1042.           interrupts were enabled:
  1043.  
  1044.                         IRQ0    (INT 08H)
  1045.                         IRQ1    (INT 09H)
  1046.                         IRQ4    (INT 0CH)
  1047.                         IRQ6    (INT 0FH)
  1048.  
  1049.           INT 08 = 1599:001C   IRQ0 (clock tick)  (*)
  1050.           INT 09 = 1244:0A75   IRQ1 (keyboard)
  1051.           INT 0A = F000:FF23   IRQ2 (Reserved)
  1052.           INT 0B = F000:FF23   IRQ3 (COM2)
  1053.           INT 0C = 21A0:1254   IRQ4 (COM1)
  1054.           INT 0D = C800:016D   IRQ5 (hard disk)
  1055.           INT 0E = F000:EF57   IRQ6 (floppies)
  1056.           INT 0F = 0070:0756   IRQ7 (parallel port)
  1057.  
  1058.           From the interrupt table above, we can verify the following:
  1059.  
  1060.           IRQ0  Points to code at 1599:001C. It is pointing to code
  1061.           within CRASH because there is a "(*)" in the description
  1062.           column. CRASH displays the "(*)" for every interrupt that
  1063.           points to CRASH code.
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.                                      - 17 -
  1072.  
  1073.  
  1074.  
  1075.  
  1076.           IRQ1  Points to code at 1244:0A75. This is the keyboard
  1077.           interrupt. Normally the keyboard code is in ROM, starting at
  1078.           address F000:XXXX, but in this case there is a TSR that has
  1079.           intercepted the vector so it points to itself.
  1080.  
  1081.           IRQ2  Points to ROM-BIOS code at F000:FF23. This is the
  1082.           default. This interrupt has never been used since the system
  1083.           was booted. If you disassemble the code at this location
  1084.           with DEBUG, you will notice that is resets the hardware
  1085.           controller and returns with an IRET.
  1086.  
  1087.           IRQ3  Points to the same code since it has never been used.
  1088.  
  1089.           IRQ4  Points to code at 21A0:1254. This is presumably a com-
  1090.           munications program that is using IRQ4 to communicate with
  1091.           the communications adapter, COM1.
  1092.  
  1093.           IRQ5  Points to C800:016D. This is code within the hard-disk
  1094.           controller.
  1095.  
  1096.           IRQ6  Points to BIOS-ROM code at F000:EF57. This is a flop-
  1097.           py-disk interrupt vector.
  1098.  
  1099.           IRQ7  Points to code at 0070:0756. This interrupt was en-
  1100.           abled when the DOS "print" command loaded a printer-driver.
  1101.  
  1102.           A complete listing of all the entries in the interrupt table
  1103.           is provided in the crash-dump. Some hints about the usual
  1104.           use of the hardware and software interrupts is also provided
  1105.           in the right-hand column of the list.
  1106.  
  1107.           A dump of the stack contents is also provided. The stack-
  1108.           dump normally starts at the first WORD at the top of the
  1109.           stack-segment. This is hex FFFE, an even address. Should the
  1110.           stack be greater in depth than 80 words, the message;
  1111.  
  1112.           "CRASH-I-DUMTERM, Dump terminated at 80-word depth."
  1113.  
  1114.           is printed followed by the last 10 WORDS before the stack-
  1115.           pointer. By checking this stack, it is possible to determine
  1116.           the history leading up to the crash.
  1117.  
  1118.           If the stack happens to be on an ODD address, a message
  1119.           warning that the stack is on a BYTE boundary is also print-
  1120.           ed. If the program being executed was produced by a high-
  1121.           level language compiler, this generally means that memory
  1122.           got corrupted so the stack-contents are invalid. Many assem-
  1123.           bly-language programs are written with the stack placed on
  1124.           odd boundaries and they still work okay (although slower
  1125.           than they could be). It takes two memory-accesses to fetch a
  1126.           word from an odd boundary so it certainly is not good prac-
  1127.           tice to put the stack-pointer just-anywhere.
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.                                      - 18 -
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.                                      - 19 -
  1198.  
  1199.  
  1200.  
  1201.                               D I S C L A I M E R
  1202.  
  1203.           CRASH is provided with no warranty whatsoever. The source-
  1204.           code is provided so that users may determine for themselves
  1205.           if it provides a useful purpose. It is possible to corrupt
  1206.           many files on a hard-disk drive if they are not properly
  1207.           closed during a fatal system error. CRASH does not close any
  1208.           files because it has no way of knowing if the disk-operating
  1209.           system has been corrupted during the crash. It does the
  1210.           exact same thing as a power-off re-boot. CRASH is in use by
  1211.           the PROGRAM EXCHANGE BBS system. The PROGRAM EXCHANGE does
  1212.           daily backups of files.
  1213.  
  1214.                 - finis -
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.                                      - 20 -
  1261.