home *** CD-ROM | disk | FTP | other *** search
/ Lion Share / lionsharecd.iso / utils_mz / xdosman.zip / CHAPT11.DOC < prev    next >
Text File  |  1991-11-28  |  37KB  |  1,160 lines

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