



















                                     MON86

                                       A
                             Software Debug Monitor

                                  For the 8086










                          Dunfield Development Systems
                          ----------------------------
                             High quality tools for
                              Embedded Development
                                 at low prices.

                      https://dunfield.themindfactory.com


                       ?COPY.TXT 1991-2020 Dave Dunfield
                              **See COPY.TXT**



                                     MON86

                               TABLE OF CONTENTS


                                                                         Page

     1. INTRODUCTION                                                        1


     2. USING MON86                                                         2

        2.1 Operand format                                                  2
        2.2 Monitor Commands                                                2
        2.3 Disassembler output format                                      5
        2.4 Display Scrolling                                               6
        2.5 Interrupts                                                      6
    MON86                                                            Page: 1


    1. INTRODUCTION

          MON86 is an interactive software  debugger  and  machine  language
       monitor for the Intel 8086 family  of  microprocessors.  It  contains
       display/alter memory/register facilities,  as well  as  a  full  8086
       disassembler, breakpoint,  and software single step functions.  MON86
       is designed to run on bare hardware,  and does not require any  other
       operating system or executive to be present.

          MON86  requires  no  hardware  assist,  all  functions   including
       single-step are implemented in the MON86 firmware. MON86 communicates
       with the user via a single serial port.

          MON86 requires approximatly 160 bytes of RAM memory for its  stack
       and variable storage.  The monitor code occupies about 4500 bytes  of
       ROM memory for the program.  If MON86 is placed in  an  8K  (2764  or
       compatable) rom,  this will leave over 3K bytes of space for user I/O
       routines.

          Except for the memory requirements listed above,  MON86  preserves
       the entire state of the processor when passing control back and forth
       to the user program. This allows the user program to operate as if it
       were running "standalone" without conflicting with MON86.

          When running on bare hardware,  the MON86 ROM should be positioned
       at the top  of  the  8086  memory  map,  and  should  contain  a  JMP
       instruction at address  FFFF:0000  which  transfers  control  to  the
       beginning of the monitor.
    MON86                                                            Page: 2


    2. USING MON86

       2.1 Operand format

        Anywhere that MON86 expects an 8 bit value, you may use:

            Two HEX digits                              Eg: 1F
            A QUOTE followed by an ASCII character      Eg: 'a

        Anywhere that MON86 expects a 16 bit value, you may use:

            Four HEX digits                             Eg: 09AB
            ASCII characters preceeded by quotes        Eg: 'a'b

       2.2 Monitor Commands

             The following commands are implemented in the monitor:

               B <breakpoint#> [S<segment>:]<address>

                  Set  breakpoint  at  specified  address.  The  users  CODE
                  segment  (CS)  is assumed if none is given.  Breakpoint is
                  removed if address is 0000:0000.  There can be up to eight
                  breakpoints, which are referenced by the numbers 0-7.

               CR <register> <value>

                  Changes 8086 registers values:

                  CS,DS,ES,SS     - Set 16 bit segment register
                  AX,BX,CX,DX     - Set 16 bit general register
                  AH,BH,CH,DH     - Set HIGH 8 bits of general register
                  AL,BL,CL,DL     - Set LOW  8 bits of general register
                  SI,DI           - Set 16 bit index register
                  BP              - Set 16 bit base pointer
                  SP              - Set 16 bit stack pointer
                  PC              - Set 16 bit Program counter
                  FX              - Set 16 bit FLAGS register
                  FH,FL           - Set HIGH/LOW 8 bits flags register

               DB

                  Displays the current breakpoint settings.

               DI [S<segment>:]<start>,<end>

                  Displays  memory  in  disassembly  format,   starting   at
                  indicated address.  The user CODE segment (CS)  is assumed
                  if none is given. If SPACE is entered for <start> address,
                  assumes user PC.  If <space> is entered for <end> address,
                  assumes FFFF.  Disassembly output contains address, opcode
                  bytes,  ASCII  equivalent  of  opcode  bytes,  instruction
                  mnemonic, and operands to instruction.  Instruction syntax
                  is the same as with our ASM86 assembler.
    MON86                                                            Page: 3


               DM [S<segment>:]<start>,<end>

                  Displays memory, in HEX/ASCII dump format, starting at the
                  indicated address.  The user DATA segment (DS)  is assumed
                  if none is given. If a SPACE is entered for <end> address,
                  assumes FFFF.

               DR

                  Displays the current values of the user 8086 registers.

               E [S<segment:]<address>

                  Edit's memory.  The user DATA segment  (DS)  is assumed if
                  none is given. Address and contents are displayed, any new
                  8 bit value may be entered to replace  the  contents,  and
                  proceed to the next address.  Entering SPACE skips to  the
                  next location, BACKSPACE backups to the previous location.
                  CARRIAGE RETURN terminates the edit command.

               FM [S<segment>:]<start>,<end> <value>

                  Fill's memory from <start> to <end> with the byte <value>.
                  The user DATA segment (DS) is assumed if none is given.
    MON86                                                            Page: 4


               G [S<segment>:]<address>

                  Begins execution at the indicated address.  The user  CODE
                  segment  (CS)  is assumed if none is given.  If a SPACE is
                  entered instead of an address,  begins  execution  at  the
                  address in the 8086 program counter (PC).

               I <port>

                  Reads and displays a byte from the specified I/O port.

               L

                  Downloads data from the console  port,  which  may  be  in
                  either MOTOROLA or INTEL hex format. The data is placed in
                  the user CODE segment (CS).

                  If you accidently enter this command, you may enter either
                  'S9'  or ':00'  to signify a null download file and return
                  to the command prompt.

               MM [S<segment>:]<start>,<end> [S<segment>:]<dest>

                  Moves (copies)  the memory block from <start> to <end> and
                  places it at  <dest>.  The user DATA The user DATA segment
                  (DS) is assumed if none is given.

               O <port> <value>

                  Write the specified byte value to the indicated I/O port.

               S

                  Single-Steps one instruction from the current 8086 Program
                  Counter address  (CS:PC).  Disassembly of the  instruction
                  stepped is displyed on the console.

               + <value>+<value>

                  Performs 16 bit addition of the values,  and displays  the
                  result.

               - <value>-<Value>

                  Performs 16 bit subtraction of the  values,  and  displays
                  the result.

               ?

                  Displays a short help summary of the commands.
    MON86                                                            Page: 5


       2.3 Disassembler output format

             The output from MON86's disassembler has the following format:

                Seg:Offset Hexdata Ascii Instruction [operands]

             "Seg:Offset" is the memory address being disassembled.

             "Hexdata"  is the HEX opcode bytes that make up the instruction
          shown on this line.

             "ASCII"  is the character representation of the Hexdata values.
          Although not normally  applicable  to  instruction  opcodes,  this
          field is useful because it makes it obvious when you  are  looking
          at text data,  and also provides a quick translation of  immediate
          character operand values.

             "Instruction"  is the instruction mnemonic for the opcode which
          is present  in  memory  at  this  address.  If  the  data  at  the
          Seg:Offset location does not represent a valid  8086  instruction,
          this field is shown as "???".

             "Operands"  are  any  operands  which  are  applicable  to  the
          instruction.

             The "Instruction" and "Operands"  fields are produced in a form
          which is compatible with our ASM86 cross assembler, which like all
          of our assemblers,  uses a  "Motorola"  style  syntax.  Users  not
          familier with this assembler should note the following differences
          from Intel/Microsoft source code format:

             The '#'  character is used to indicate an immediate value.  Any
          value not preceeded by  '#'  is a memory address or other type  of
          absolute operand.

             The characters '<'  and '>'  are used to indicate BYTE and WORD
          operands. MON86 only inserts these characters when the size of the
          operand is not obvious from the rest of the instruction.

             The  '<'  and  '>'  operators also have  special  meaning  with
          operands to 'JMP' and 'CALL' instructions.  The '<' operator means
          a SHORT jump,  and the '>'  operator indicates an INDIRECT jump or
          call.

        Examples:

            Microsoft/Intel                             MON86/XASM
            ------------------------------------------------------------
            MOV     AX,1234                             MOV     AX,#1234
            MOV     AX,[1234]                           MOV     AX,1234
            INC     BYTE PTR 1234                       INC     <1234
            JMP     SHORT 1234                          JMP     <1234
            CALL    [1234]                              CALL    >1234
    MON86                                                            Page: 6


    2.4 Display Scrolling

        In order to maintain the maximum amount of data on the terminal screen
    during the debugging session, MON86 has been designed to minimize the number
    of screen lines in any display. All commands which output only one line of
    data (such as 'S'), will do so on the same line on which the command is
    issued (To the right of the command).

        For commands which output larger amounts of data (such as 'DI', 'DM'),
    pressing the SPACE key during the display will halt the display on the
    next line. Each subsequent SPACE entered will cause one more line of
    data be displayed. Pressing CARRIAGE RETURN will allow the display to
    continue at full speed.

        The escape key may be used to cancel command output, and return to the
    '*' prompt.

    2.5 Interrupts

        MON86 hooks two interrupts to enable it to regain control at breakpoints,
    and during single stepping. The interrupts are:

                  Int 1 - 0004 - Single-Step (TRAP) interrupt
                  Int 3 - 000C - Breakpoint interrupt

             All other interrupts are available for use by the user program.
