home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / dosutils / xdosman.arj / CHAPT11.DOC < prev    next >
Encoding:
Text File  |  1991-11-28  |  36.2 KB  |  1,160 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                   Chapter 11.
  8.  
  9.  
  10.  
  11.                             The X-DOS DEBUG Program
  12.  
  13.      Introduction
  14.  
  15.           The DEBUG command is a highly technical tool and a basic
  16.           knowledge of assembly language would be advisable to gain the
  17.           most from the features provided by this program. This section
  18.           will cover all the features of DEBUG including several examples
  19.           but will not be a guide in hexadecimal arithmetic or the
  20.           programming of the 8088 microprocessor family, so if you are not
  21.           already familiar with assembly language and computer programming
  22.           you will certainly need third party literature covering these
  23.           subjects.
  24.  
  25.           Purpose:    This utility provides the user with a flexible
  26.                       environment for testing, modifying, viewing and
  27.                       creating executable programs (.COM and .EXE files)
  28.                       and binary files as well as a simple tool to view and
  29.                       modify disk data.
  30.  
  31.           Format:     DEBUG [d:][path][filename [parameters]]
  32.  
  33.           Where       [d:] is the drive from which to load a file into
  34.                       DEBUG.
  35.  
  36.                       [path] is the path to the file to load into DEBUG.
  37.  
  38.                       [filename] is the name of the file to load into
  39.                       DEBUG. If there is no existing file with the
  40.                       specified filename, DEBUG will display an error
  41.                       message.
  42.  
  43.                       [parameters] are any parameters needed by the file
  44.                       being loaded into DEBUG.
  45.  
  46.           Starting DEBUG
  47.  
  48.           You can start DEBUG in two ways. One way is to run DEBUG without
  49.           specifying a filename. In this case you either have to work with
  50.           the current contents of the memory, input your own data from the
  51.           keyboard or load data from the disk with the Load command, either
  52.           from the command line or from the menu.  The other way is to
  53.           specify a filename including any necessary parameters along with
  54.           the DEBUG command.  You can then immediately start to execute,
  55.           modify and display the contents of this file.  Here is a short
  56.           description of the two ways to start DEBUG:
  57.  
  58.           Starting DEBUG with No Command Line Parameters
  59.  
  60.  
  61.  
  62.  
  63.                                       11-1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.           To start DEBUG with no command line parameters you should type:
  70.  
  71.                       DEBUG
  72.  
  73.           This will load DEBUG and display the DEBUG screen which is a
  74.           full-screen split into four window areas.  The lower window shows
  75.           the command prompt which looks like this:
  76.  
  77.                       Command : _
  78.  
  79.           This is where you enter your commands to DEBUG.  You did not
  80.           specify a filename when you loaded DEBUG so you can not
  81.           immediately run a program from within DEBUG.  There are several
  82.           things you can do at this stage though.  You can display and/or
  83.           modify the contents of memory or disks; you can type an assembly
  84.           program directly into DEBUG, run it and/or save it to disk; you
  85.           can load a file into DEBUG with the L command to give just a few
  86.           examples.
  87.  
  88.           Starting Debug with Command Line Parameters
  89.           To start DEBUG with command line parameters you should use the
  90.           following format:
  91.  
  92.                       DEBUG filename [parameters]
  93.  
  94.           This will load both DEBUG and the specified file into memory.
  95.           The DEBUG display will look similar to the display of DEBUG when
  96.           loaded without any parameters except that the information shown
  97.           in the windows now reflects information about the loaded file.
  98.           An example of loading a file including parameters into DEBUG from
  99.           the command line would be:
  100.  
  101.                       DEBUG FORMAT.EXE A: /360
  102.  
  103.           It is important to note that the filename of the file you want to
  104.           load into DEBUG must be specified including the extension.  If
  105.           the file does not reside in the current directory, you will have
  106.           to specify a drive specification and path name to the file.
  107.  
  108.           When you load a file into DEBUG, the registers and flags are set
  109.           to the following values:
  110.  
  111.           * The Instruction Pointer (IP) is set to HEX 0100 for COM files
  112.              and to the starting CS:IP for EXE files.
  113.           * The Stack Pointer (SP) is set to the bottom of the transient
  114.              portion of the program loader or the end of the segment,
  115.              depending on which one has the lowest value for COM files , or
  116.              to the value available in the EXE header for EXE files.
  117.           * The segment registers CS, DS, ES and SS are set to the segment
  118.              right after the DEBUG program for COM files. For EXE files, DS
  119.              and ES are set to the PSP segment.
  120.           * The other registers AX, BX, CX, DX, BP, SI and DI are all set
  121.  
  122.  
  123.  
  124.  
  125.                                       11-2
  126.  
  127.  
  128.  
  129.  
  130.  
  131.              to HEX 0000.
  132.           * The flags are always set to the values; Nv, Up, Ei, Pl, Nz, Na,
  133.              Po and Nc.
  134.      The DEBUG Screen
  135.  
  136.           The X-DOS DEBUG command is a full-screen program with distinct
  137.           windows for different functions. The display will enable you to
  138.           monitor the debugging process with very little effort and
  139.           contains all functions available with DEBUG. By typing the
  140.           function key corresponding to the menu name,or by clicking on the
  141.           menu name with a mouse, you will get a pull down menu with
  142.           functions related to each of the menu listed in the menu bar.
  143.  
  144.           The upper-left window is the Assemble/Unassemble window.  This is
  145.           the area where unassembled code is displayed.
  146.  
  147.           The upper-right window is the Registers/Flags window.  This area
  148.           always shows the current status of the Registers and Flags. The
  149.           registers can be changed manually.
  150.  
  151.           The middle window is the Dump area which displays the contents of
  152.           a portion of memory.  The Dump area is split in two sections; the
  153.           left section shows the memory contents in hexadecimal and the
  154.           right section shows the memory contents as ASCII characters.
  155.           Alternatively, when using the Assemble command this window is the
  156.           area where you can input assembler codes directly.
  157.  
  158.           The lower window is the Command window where the user types in
  159.           commands to DEBUG. Each command must be followed by the [Enter]
  160.           key in order to be executed. All commands typed in the command
  161.           line are remembered by DEBUG in a circular buffer similar to the
  162.           DOS prompt and can be recalled by using the up and down arrow. If
  163.           you wish to cancel a command typed in, just press the [ESC] key.
  164.  
  165.      Quick  Reference Guide of Debug Commands
  166.  
  167.      A [start-address]Assemble
  168.  
  169.      The Assemble command places the user in the middle DEBUG window and
  170.  
  171.      allows the user to assemble mnemonics directly into memory.
  172.  
  173.  
  174.  
  175.      BC  [n] - Break-point Clear
  176.  
  177.      The BC command lets you clear a break point and thus free one of the
  178.  
  179.      10 places reserved for break points.
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.                                       11-3
  188.  
  189.  
  190.  
  191.  
  192.  
  193.      BP  [Start-address] ┼ Break Point
  194.  
  195.      The BP command lets you specify up to 10 break points in memory.
  196.  
  197.  
  198.  
  199.      BE  [n] - Break-point Enable
  200.  
  201.      The BE command lets you enable a break point that was previously
  202.  
  203.      disabled with the BD command.
  204.  
  205.  
  206.  
  207.      BD  [n] - Break-point Disable
  208.  
  209.      The BD command lets you disable a break point temporarily in case you
  210.  
  211.      wish to keep it in memory but not activated. It can be later
  212.  
  213.      reactivated with the BE command.
  214.  
  215.  
  216.  
  217.      C start-address  end address  destination ┼ Compare
  218.  
  219.      The Compare command compares two portions of memory.
  220.  
  221.  
  222.  
  223.      D  [start-address] - Dump
  224.  
  225.      The Dump command displays 128 bytes from the optional starting
  226.  
  227.      address.
  228.  
  229.  
  230.  
  231.      E  [start-address] - Edit Memory
  232.  
  233.      The Edit Memory command places the user in the Dump window.  Here the
  234.  
  235.      user can change the byte values of memory either in hexadecimal or in
  236.  
  237.      ASCII.
  238.  
  239.  
  240.  
  241.      F  start-address end-address values - Fill
  242.  
  243.      The Fill command will fill a specified part of memory with a
  244.  
  245.  
  246.  
  247.  
  248.  
  249.                                       11-4
  250.  
  251.  
  252.  
  253.  
  254.  
  255.      hexadecimal value.
  256.  
  257.  
  258.  
  259.      G  [= start-address] - Go
  260.  
  261.      The Go command will execute a program in memory and stop execution at
  262.  
  263.      up to 10 different break points.
  264.  
  265.  
  266.  
  267.      H  hexnumber1 hexnumber2 - Hex Calc
  268.  
  269.      The Hex Calc command will return the sum and difference between two
  270.  
  271.      hexadecimal numbers.
  272.  
  273.  
  274.  
  275.      I  port  - Input
  276.  
  277.      The Input command fetches one word/byte from the specified port.
  278.  
  279.  
  280.  
  281.      L  address filename - Load
  282.  
  283.      The Load command loads a file into memory.
  284.  
  285.  
  286.  
  287.      M  start-address end-address destination - Move
  288.  
  289.      The Move command moves a block of memory to a different address in
  290.  
  291.      memory.
  292.  
  293.  
  294.  
  295.      O  port value - Output
  296.  
  297.      The Output command sends a one word/byte value to the specified port.
  298.  
  299.  
  300.  
  301.      P  [=address] [value] - Process
  302.  
  303.      The Process command enables the user to execute a repeat string
  304.  
  305.      instruction, a loop instruction, a subroutine, or an interrupt before
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                       11-5
  312.  
  313.  
  314.  
  315.  
  316.  
  317.      stopping program execution.
  318.  
  319.  
  320.  
  321.      Q - Quit
  322.  
  323.      The Quit command terminates the DEBUG session and returns the user to
  324.  
  325.      the X-DOS prompt.
  326.  
  327.  
  328.  
  329.      R  register - Register
  330.  
  331.      The Register command let you change the value of each register. The
  332.  
  333.      default value is given in the register window.
  334.  
  335.  
  336.  
  337.      RS - Segment
  338.  
  339.      The Segment command let you change the value of each segment. The
  340.  
  341.      default value is given in the segment window.
  342.  
  343.  
  344.  
  345.      RF - Flags
  346.  
  347.      The Flags command let you change the value of each individual flag by
  348.  
  349.      choosing 'S' for flag SET and 'R' for flag RESET.
  350.  
  351.  
  352.  
  353.      S   start-address end-address values string - Search
  354.  
  355.      The Search command will search a range of memory for one or more
  356.  
  357.      hexadecimal values.
  358.  
  359.  
  360.  
  361.      T - Trace
  362.  
  363.      The Trace command executes a program one instruction at a time and
  364.  
  365.      return to the debug screen at each program step.
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.                                       11-6
  374.  
  375.  
  376.  
  377.  
  378.  
  379.      U  [start-address] - Unassemble
  380.  
  381.      The Unassemble command disassembles the information in memory into
  382.  
  383.      corresponding mnemonics.
  384.  
  385.  
  386.  
  387.      W address length [filename] - Write
  388.  
  389.      The Write command writes a file or range of memory to a disk.
  390.  
  391.  
  392.  
  393.      Command Parameters
  394.  
  395.      Following is a description of the different parameters.
  396.  
  397.           Address
  398.           refers to a specific location in memory.  An address is a
  399.           combination of a segment part and an offset part.  The segment
  400.           part of an address can be omitted in which case the default Data
  401.           Segment (DS) is assumed except for the Break Point (BP), Load
  402.           (L), Unassemble (U) and Write (W) commands.  Both the segment and
  403.           offset part are made up of four hexadecimal digits but the
  404.           segment part can be referenced with the Segment Register letters
  405.           (i.e. CS).  When specifying both a segment and offset part of an
  406.           address, the two parts must always be separated by a colon (:).
  407.           Leading zeros can be omitted in the address specification.  The
  408.           following two addresses are therefore equivalent:
  409.  
  410.                       0054:0100 and 54:100
  411.  
  412.           The specified address must always be a valid address or otherwise
  413.           unpredictable results may occur.
  414.  
  415.           Note also, that the X-DOS debugger lets you replace an
  416.           hexadecimal address by a segment and/or a register name.
  417.  
  418.           Break-point
  419.           is a specified address where program execution will stop.
  420.  
  421.           Destination
  422.           the address to which the Move (M) command moves a range of data,
  423.           or the beginning address at which the Compare (C) command
  424.           compares a specified range of memory.
  425.  
  426.           Drive
  427.           is a one digit value describing a logical drive letter.  0=A:,
  428.           1=B:, 2=C: and so on.
  429.  
  430.           Filename
  431.  
  432.  
  433.  
  434.  
  435.                                       11-7
  436.  
  437.  
  438.  
  439.  
  440.  
  441.           is any valid filename including extension.  Include a drive
  442.           specification and path in front of the filename if necessary.
  443.  
  444.           Hexnumber
  445.           is any valid hexadecimal number consisting of up to 4 digits.
  446.  
  447.           Port
  448.           specifies an 8 or 16-bit port address and can consist of from one
  449.           to four hexadecimal digits.
  450.  
  451.           Register
  452.           is any valid register specification.  The register specifications
  453.           are; AX, BX, CX, DX, BP, SP, SI, DI, IP, CS, DS, ES and SS.
  454.  
  455.           String
  456.           is a range of ASCII characters enclosed in double quotes or HEXA
  457.           characters with no quotes. For instances, the strings "HELLO" and
  458.           48454C4C4F are similar and valid.
  459.  
  460.           Value
  461.           is a single byte value in hexadecimal notation.
  462.  
  463.      Special Function Keys
  464.  
  465.           The X-DOS debugger has defined the function keys as follow :
  466.  
  467.                     F1  will display a global help on the DEBUG commands
  468.                     F2  will display the File functions menu
  469.                     F3  Will display the Disk functions menu
  470.                     F4  Will display the Memory/Flag/Segment/IO functions
  471.                     menu
  472.                     F5  Will display the Break Point functions menu
  473.                     F6  is similar to the G command
  474.                     F7  Is similar to the T command
  475.                     F8  is similar to the P command
  476.                     F9  output DEBUG screen to alternate screen if
  477.                     connected
  478.                     F10 will swap the user/debug screen
  479.  
  480.      Advanced Menu Commands
  481.  
  482.           Some of the commands in the DEBUG utility can only be activated
  483.           by the Menu bar and not at the command line. These functions
  484.           concern disk access and are summarized as follows:
  485.  
  486.           Change Drive
  487.           The user can change the default drive that will be needed when
  488.           loading Sectors, Clusters ... from disk. Simply type in the drive
  489.           number. No network drives can be typed in.
  490.  
  491.            Load Sector
  492.           Users can load a sector of the current drive in memory by
  493.  
  494.  
  495.  
  496.  
  497.                                       11-8
  498.  
  499.  
  500.  
  501.  
  502.  
  503.           specifying the start and end sectors as well as the loading
  504.           address. Here the sectors are the logical partitions sectors,
  505.           starting at sector 0.
  506.  
  507.           Write Sectors
  508.           Users can write a portion of memory to logical sectors on the
  509.           disk. Remember that the writing will allways take place as full
  510.           sectors. It is not possible to write half of a sector only.
  511.  
  512.           Load Boot
  513.           The boot is the first sector of the disk. This function is
  514.           equivalent to loading the sector 0 from the disk by using the
  515.           Load Sector function. It is provided as a separate command for
  516.           convenience.
  517.  
  518.           Write Boot
  519.           It is also possible to write the boot record from a memory
  520.           location. If you wish to change the boot ID, just load the boot
  521.           at address 100 for instance, edit the memory with new values and
  522.           rewrite the boot again.
  523.  
  524.           Load the File Allocation Table (FAT)
  525.           The FAT is the area where the file cluster chains are kept. It
  526.           follows the boot record in the disk format. This commands loads
  527.           the entire FAT in memory. You do not have to specify a length.
  528.  
  529.           Write the FAT
  530.           For some reason, you wish to edit manually the FAT, load it first
  531.           with the Load FAT command, make the necessary modifications, and
  532.           rewrite it. There is no need to specify sector number or length.
  533.  
  534.           Load Root Dir
  535.           This function is similar to the Load FAT but reads the Root
  536.           Directory.
  537.  
  538.           Write Root Dir
  539.           This function is similar to the Write FAT but writes the Root
  540.           directory.
  541.  
  542.           Load Cluster
  543.           A cluster is the smallest allocation unit for a file. It can
  544.           contain one or more sectors. The cluster number always starts at
  545.           2. When loading a cluster, just specify the first and the end
  546.           cluster as well as the location where they should be loaded.
  547.  
  548.           Write Cluster.
  549.           This function helps you write clusters to disk after being
  550.           modified.
  551.  
  552.           Search Sector for Text
  553.           This function will search the specified region of disk for a
  554.           matching string of characters either in Hexadecimal or in ASCII.
  555.  
  556.  
  557.  
  558.  
  559.                                       11-9
  560.  
  561.  
  562.  
  563.  
  564.  
  565.           Characters entered in hexadecimal should not be separated by
  566.           space as this would represent the end of the string. For instance
  567.           if you wish to find the characters 123 in the disk, you would
  568.           input 313233 as a string to search. If you wish to input text in
  569.           ASCII form, you will put it as "123".
  570.  
  571.      Command Reference
  572.  
  573.           A detailed reference to all the DEBUG commands which can be
  574.           direclty entered in DEBUG is given on the following pages.
  575.  
  576.      A - Assemble Command
  577.  
  578.           The Assemble Command assembles 8086/8088 mnemonics into memory
  579.           without needing to recompile a program before running it.
  580.           The format of the Assemble Command is:
  581.  
  582.                       A [start-address]
  583.  
  584.           You will be placed in the Data/Dump window which will now look
  585.           similar to this:
  586.  
  587.                       2DD1:0100 _
  588.  
  589.           DEBUG displays the starting address with both segment and offset
  590.           part.  Now you can enter your assembler mnemonics and press <>
  591.           after every instruction and DEBUG will show the next address.  If
  592.           you type a mistake, DEBUG displays the error message Syntax Error
  593.           and returns to the same address. When you have entered all
  594.           desired mnemonics just press <> on an empty line and DEBUG will
  595.           return you to the Command window.
  596.  
  597.           When you have entered enough lines of mnemonics to fill the
  598.           window, DEBUG scrolls the Assemble display up one line at a time
  599.           when you add new lines.
  600.  
  601.           There are several things to note when entering mnemonics directly
  602.           in DEBUG since some situations differ from using an assembler.
  603.           In DEBUG you must enter all numeric values in hexadecimal.
  604.           * Word memory locations and byte memory locations can not be
  605.              distinguished by DEBUG so you must clearly state the data type
  606.              with a prefix which can be either WORD PTR or BYTE PTR.
  607.           In * DEBUG you must specify the address for jumps and calls.
  608.           *  You must use square brackets ⌐[ ]¬ to refer to memory
  609.              locations since DEBUG can not distinguish memory locations
  610.              from immediate operands.
  611.           Example:
  612.           The following sample program will blank the screen when you run
  613.           it and restore the screen again when you press a key.  Try to
  614.           type it in and run it to get a feel of the use of the Assemble
  615.           command.  Note however that if you have a monochrome system you
  616.           will need to change the first line of the sample program to MOV
  617.  
  618.  
  619.  
  620.  
  621.                                      11-10
  622.  
  623.  
  624.  
  625.  
  626.  
  627.           AX,B000.  First type :
  628.  
  629.                       A 100
  630.  
  631.           to go into assemble mode and access the Assemble/Unassemble
  632.           window.  Then type in the following program:
  633.  
  634.                       MOV AX,B800
  635.  
  636.                       MOV DS,AX
  637.  
  638.                       MOV CX,07D0
  639.  
  640.                       MOV BX,1
  641.  
  642.                       MOV BYTE PTR[BX],0
  643.  
  644.                       ADD BX,2
  645.  
  646.                       LOOP 010B
  647.  
  648.                       MOV AH,1
  649.  
  650.                       INT 16
  651.  
  652.                       JZ 0113
  653.  
  654.                       MOV CX,07D0
  655.  
  656.                       MOV BX,1
  657.  
  658.                       MOV BYTE PTR[BX],7
  659.  
  660.                       ADD BX,2
  661.  
  662.                       LOOP 011F
  663.  
  664.                       RET
  665.  
  666.  
  667.  
  668.           After typing in these 16 lines press <> on an empty line to
  669.           return to the Command window.  Now you should give the program a
  670.           name and save it to disk.
  671.  
  672.           To give the program the name BLANK.COM, type:
  673.  
  674.                       W 100 28 BLANK.COM
  675.  
  676.           Leave DEBUG with the Quit (Q) command and test the BLANK.COM
  677.           command by entering:
  678.  
  679.  
  680.  
  681.  
  682.  
  683.                                      11-11
  684.  
  685.  
  686.  
  687.  
  688.  
  689.                       BLANK
  690.  
  691.           Your screen should blank.
  692.  
  693.      B - Break Point Command
  694.  
  695.           The Break Point command lets you specify one of 10 break points
  696.           that can be set simultaneously by DEBUG, enable, disable or reset
  697.           a break point. 3 commands are available to manage break points :
  698.           BC, BP, BE, BD.
  699.  
  700.           The format of the Break Point command is:
  701.           BP [address]
  702.  
  703.           When you press the G command to activate your program and the
  704.           processor reaches the address where the break point is set, it
  705.           will break and return to the DEBUG screen. Note that the break
  706.           point is still valid if set with the BP command.
  707.  
  708.           The format of the BE,BC,BD commands are:
  709.           Bx [break point number]
  710.  
  711.           Where x is either E, C or D and the breakpoint number is from 1
  712.           to 10.
  713.           C  Compare Command
  714.  
  715.      C - Compare Command
  716.  
  717.           The Compare command compares one memory section with another
  718.           equal size memory section.
  719.  
  720.           The format of the Compare command is:
  721.           COMPARE start-address end-address destination
  722.  
  723.           If the contents of the two memory sections are identical, DEBUG
  724.           will just return the cursor to the normal command position and
  725.           wait for another command.  If, however, there are differences in
  726.           the two memory sections, DEBUG will display information on the
  727.           first occurrence of differences in a window.
  728.  
  729.           If you do not enter a segment when specifying the start-address
  730.           and destination, DEBUG will assume the segment value as the
  731.           current value of the DS register.
  732.  
  733.      D - Dump Command
  734.  
  735.           The dump command can display the contents of the memory in steps
  736.           of 128 bytes.
  737.  
  738.           The format of the Dump command is:
  739.           D [start-address]
  740.  
  741.  
  742.  
  743.  
  744.  
  745.                                      11-12
  746.  
  747.  
  748.  
  749.  
  750.  
  751.           The Dump window is located just below the Assemble/- Unassemble
  752.           window and is separated into two areas; a hexadecimal display
  753.           area and an ASCII display area.  The ASCII display area will not
  754.           show non-printable characters. Non-printable characters will be
  755.           substituted with a period (.).
  756.  
  757.           If you do not specify a start-address for the Dump display, DEBUG
  758.           will assume the start-address DS:0100.  Subsequently issuing the
  759.           D command will advance the Dump display in steps of 128 bytes.
  760.  
  761.      E - Edit Memory Command
  762.  
  763.           The Edit Memory command lets the user enter values into memory in
  764.           either hexadecimal or ASCII format.
  765.  
  766.           The format of the Edit Memory command is:
  767.           E start-address
  768.  
  769.           When you issue the Edit command, you will be placed in the Dump
  770.           window in the hexadecimal area at your specified starting
  771.           address. To change any of the memory locations just highlight
  772.           them and type in the new values.  Any changes in the hexadecimal
  773.           Dump area will immediately be reflected in the ASCII area and
  774.           vice versa. You can use the following keys to move around the
  775.           area:
  776.  
  777.           Cursor Up    - move 16 bytes above current location
  778.           Cursor Down  - move 16 bytes below current location
  779.           Cursor Right - move 1 byte to the right
  780.           Cursor Left  - move 1 byte to the left
  781.           PgUp         - move 128 bytes above current location
  782.           PgDn         - move 128 bytes below current lcoation
  783.  
  784.           If you want to access the corresponding ASCII display area just
  785.           press the <> key which can be used to switch between the
  786.           hexadecimal and ASCII areas. When you have made your changes just
  787.           press the <> key to return to the command window.
  788.  
  789.      F - Fill Command
  790.  
  791.           The Fill command will fill a specified range of memory with one
  792.           hexadecimal.
  793.  
  794.           The format of the Fill command is:
  795.           F start-address end-address value
  796.  
  797.           This command can be used to reset an area of memory to 0 for
  798.           instance. The value parameter can only be a byte in hexadecimal.
  799.      G - Go Command
  800.  
  801.           The Go command executes the current program in memory. The format
  802.           of the Go command is:
  803.  
  804.  
  805.  
  806.  
  807.                                      11-13
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.           G [=start-address] [break-point]
  815.  
  816.           When program execution is finished, DEBUG displays the message
  817.           Program terminated normally.  When you encounter this message you
  818.           will have to reload the program before running it again.
  819.  
  820.           Issuing the Go command without any parameters will run the
  821.           program currently in memory from the address generated with the
  822.           CS and IP registers (CS:IP) without any interruptions as if it
  823.           had been run from the DOS prompt. To issue the Go command in this
  824.           manner just type:
  825.  
  826.                       G
  827.  
  828.           You can also force DEBUG to execute a program from another
  829.           starting point than the CS:IP address by specifying the =start-
  830.           address parameter which is the offset part of the address.  The
  831.           segment part of the address will still be the contents of the CS
  832.           register.  An example of this type of program execution is:
  833.  
  834.                       G=200
  835.  
  836.           which will force DEBUG to start program execution at the CS:0200
  837.           address in memory.
  838.  
  839.           It is also possible to use break-points to stop program execution
  840.           when DEBUG reaches a specific address in a program. The Go
  841.           command accepts a break-point as a parameter. This break point is
  842.           different from the Break points set with the BP command in that
  843.           it is discarded once this Break point is reached, while the
  844.           traditional break points remain enabled. DEBUG will stop program
  845.           execution when it reaches either the specified break-point or the
  846.           ones enabled.
  847.           An example of starting a program with a specified break point
  848.           address is:
  849.  
  850.                       G 0133
  851.  
  852.           DEBUG would stop program execution if it encountered any of the
  853.           three break-point addresses.  If none of the specified break-
  854.           addresses are encountered, the program execution would continue
  855.           until the program terminates.
  856.  
  857.      H - Hex Calc Command
  858.  
  859.           The hex calc command returns the sum and difference between two
  860.           hexadecimal numbers.
  861.  
  862.           The format of the Hex Calc command is:
  863.           H hexnumber1 hexnumber2
  864.  
  865.  
  866.  
  867.  
  868.  
  869.                                      11-14
  870.  
  871.  
  872.  
  873.  
  874.  
  875.           This command takes two hexadecimal parameters each of up to four
  876.           digits.  Then it adds the parameters and subtracts the second
  877.           parameter from the first parameter and displays the sum and
  878.           difference in a window.
  879.           Example:    If you type:
  880.  
  881.                       H 100 AB
  882.  
  883.  
  884.  
  885.           DEBUG will display the result:
  886.           Sum is        01AB  Difference is 0055
  887.           where the result 01AB is the sum of the two parameters and the
  888.           result 0055 is the difference between the two parameters.
  889.      I - Input Command
  890.  
  891.           The Input command retrieves one or two byte from a specified port
  892.           and displays it in the Command window.
  893.           The format of the Input command is:
  894.                       I port
  895.  
  896.           Example:    If you type
  897.  
  898.                       I 0B
  899.  
  900.           you will read the contents of port 0B HEX.  If we suppose that
  901.           the contents of port 0B HEX is 43 HEX then DEBUG would read this
  902.           byte and display the following in a window:
  903.                       [43]
  904.  
  905.  
  906.  
  907.      L - Load Command
  908.  
  909.           The Load command loads a file   into memory for further
  910.           manipulation.
  911.           The format of the Load command is:
  912.           L filename [address]
  913.  
  914.           When a file is loaded into memory in this manner it is always
  915.           loaded beginning from the address defined by CS:0100 if it is a
  916.           COM file or at the starting CS:IP for an EXE file. If you want to
  917.           load a file that is not a .COM or .EXE file you have to specify
  918.           the address.
  919.           Suppose you want to load the COMMAND.COM file at address 100, you
  920.           would type the command :
  921.  
  922.                       L 100 COMMAND.COM
  923.  
  924.      M - Move Command
  925.  
  926.           The Move command moves a specified block of memory to a different
  927.  
  928.  
  929.  
  930.  
  931.                                      11-15
  932.  
  933.  
  934.  
  935.  
  936.  
  937.           location in memory.
  938.  
  939.           The format of the Move command is:
  940.           M start-address end-address destination
  941.  
  942.           The Move can command move data accross segment to another area.
  943.           If no segment part of an address is specified, the DS segment is
  944.           automatically assumed. If the end and destination segment address
  945.           are not specified, they will have the value of the start address.
  946.  
  947.           Examples:   The following example moves data from address
  948.                       4000:300 trough address 8000:600 to the memory
  949.                       location beginning from address CS:AAAA:
  950.  
  951.                       M 4000:300 8000:600 CS:AAAA
  952.  
  953.                       To see the moved data you just type:
  954.  
  955.                       D CS:AAAA
  956.  
  957.  
  958.  
  959.      O - Output port Command
  960.  
  961.           The Output to port command sends a byte or a word to the defined
  962.           IO port.
  963.  
  964.           The format of the Output port command is:
  965.           O port value
  966.  
  967.           Example:    If you type:
  968.  
  969.                       O A03 3F
  970.  
  971.           you will send the hexadecimal byte 3F to port A03 HEX.
  972.  
  973.      P - Process Command
  974.  
  975.           The Process command enables the user to execute a repeat string
  976.           instruction, a loop instruction, a subroutine, or an interrupt
  977.           before stopping program execution.
  978.  
  979.           The format of the Process command is:
  980.           P
  981.           The Process command works similar to the Trace (T) command.  It
  982.           singles steps through instructions until it encounters a
  983.           subroutine, a loop instruction, a repeat string instruction or an
  984.           interrupt in which case it finishes the execution of one of these
  985.           before handing over control to the user.
  986.  
  987.           The program execution will start at the current CS:IP.
  988.  
  989.  
  990.  
  991.  
  992.  
  993.                                      11-16
  994.  
  995.  
  996.  
  997.  
  998.  
  999.      Q - Quit Command
  1000.  
  1001.           The Quit command exits DEBUG and returns to the X-DOS command
  1002.           line.
  1003.           The format of the Quit command is:
  1004.  
  1005.           Q
  1006.           The Quit command does not save the file you are currently working
  1007.           with when you exit DEBUG so you will have to remember to save any
  1008.           valid data before using the Quit command.
  1009.  
  1010.      R - Register/flag/segment Command
  1011.  
  1012.           The Register/flag/segment command lets the user modify the
  1013.           contents of any of the registers, flags and segments.
  1014.  
  1015.           The format of the Register/flag/segment command is:
  1016.           R for modifying registers RF for modifying flags RS for modifying
  1017.           segments
  1018.  
  1019.           The Register/flag/segment commands places the user in the
  1020.           appropriate  Register/flag/segment window.  Here the user can
  1021.           type in a new value for the specified register.  The registers
  1022.           and segments are classified as follows:
  1023.           AX, BX, CX, DX are the normal data registers.
  1024.           SP is the Stack Pointer.
  1025.           BP is the Base Pointer.
  1026.           IP is the Instruction Pointer.
  1027.           SI is the Source Index.
  1028.           DI is the Destination Index.
  1029.           CS is the Code Segment.
  1030.           DS is the Data Segment.
  1031.           SS is the Stack Segment.
  1032.           ES is the Extra Segment.
  1033.  
  1034.           The flags are classified as shown in the table on the next page.
  1035.           FLAG DESCRIPTION              SET     CLEAR
  1036.           The Overflow flag             OV      NV
  1037.           The Direction flag            DN      UP
  1038.           The Interrupt flag            EI      DI
  1039.           The Sign flag                 NG      PL
  1040.           The Zero flag                 ZR      NZ
  1041.           The Auxiliary carry flag      AC      NA
  1042.           The Parity flag               PE      PO
  1043.           The Carry flag                CY      NC
  1044.  
  1045.           In order to change a flag to either Set or Reset, specify the
  1046.           value S or R to which ever level you wish for each individual
  1047.           flag.
  1048.  
  1049.      S - Search Command
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.                                      11-17
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.           The Search command will search a range of memory for one or more
  1062.           hexadecimal values or ASCII characters.
  1063.           The format of the Search command is:
  1064.  
  1065.           S start-address end-address string
  1066.  
  1067.           The Search command searches through memory for both hexadecimal
  1068.           values and character strings or any combination of both.
  1069.           Character strings must be included in double quotes.
  1070.  
  1071.           If you do not enter a segment part of the start-address, DEBUG
  1072.           assumes the Data Segment (DS).
  1073.  
  1074.           Examples:   If you want to search through the area CS:100 to 500
  1075.                       for the three hexadecimal numbers 3A 06 7E, you
  1076.                       should type:
  1077.  
  1078.                       S CS:100 500 3A067E
  1079.  
  1080.                       If you want to search for the ASCII characters XYZ in
  1081.  
  1082.                       the memory range DS:100 to DS:FFFF, you should type:
  1083.  
  1084.  
  1085.  
  1086.                       S 100 FFFF "XYZ"
  1087.  
  1088.  
  1089.  
  1090.      T - Trace Command
  1091.  
  1092.           The Trace command executes a program one instruction at a time.
  1093.           The format of the Trace command is:
  1094.  
  1095.           T
  1096.           The Trace command starts program execution from the address
  1097.           contained in CS:IP. It will break every time a 8086 instruction
  1098.           is executed and return to the DEBUG screen afterwards. While the
  1099.           instruction is being executed, the screen will swap to the user's
  1100.           screen.
  1101.  
  1102.      U - Unassemble Command
  1103.  
  1104.           The Unassemble command disassembles the information in memory
  1105.           into corresponding mnemonics.
  1106.  
  1107.           The format of the Unassemble command is:
  1108.           U [start-address]
  1109.  
  1110.           When you issue the Unassembly command, the unassembled code is
  1111.           shown in the Assembly/Unassembly window in the upper-left corner
  1112.           of your screen.
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                      11-18
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.           Issuing the Unassembly command repeatedly will continue to
  1125.           display new windows of unassembled code.
  1126.  
  1127.           If you do not specify a start-address for the unassembling, DEBUG
  1128.           will assume the current CS:IP.
  1129.  
  1130.           Example:    If you want to Unassemble code starting from the
  1131.                       default address CS:IP, you only need to type:
  1132.                       U
  1133.  
  1134.                       If you want to unassemble code starting from address
  1135.  
  1136.                       CS:200, you should type:
  1137.  
  1138.                       U 200
  1139.  
  1140.  
  1141.  
  1142.      W - Write Command
  1143.  
  1144.      The Write command writes a file to a disk.
  1145.  
  1146.  
  1147.  
  1148.      The format of the Write command is:
  1149.  
  1150.      W filename [address length]
  1151.  
  1152.  
  1153.  
  1154.      The Write command will write the content of the memory to a file by
  1155.  
  1156.      the name given in the command line. This file will be overwritten. The
  1157.  
  1158.      user must specify the size and the address of the file to be written.
  1159.  
  1160.      Note that .EXE files cannot be written.
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.                                      11-19
  1180.  
  1181.