Copyright: ® Reinhard Keil


Table of Contents

MON251.DLL for dScope

Introduction

Serial Connection

MCS 251 Parameters

DOS based Monitor-251

Overview

Hardware and Software Requirements

Starting Monitor-251

Control Keys

MON251 Terminal Control Codes

Serial Transmission Line

Utility Commands

Memory Commands

Addresses and Ranges

Breakpoint Commands

Execution Commands

Loading and Saving

Monitor-251 Configuration

ERROR Messages


Introduction

The driver MON251.DLL connects dScope for Windows to a target system, for example a MCB-251 board.  The driver can be loaded by either selecting it from the list of drivers in dScope's toolbar or by entering 'LOAD MON251.DLL' in the command window (do not enter a path for MON251.DLL).

After the driver has been loaded, dScope runs in target mode.  The title of dScope's main window changes to tScope.  Some features behave differently in target mode and some limitations are introduced in target mode.  For more details, see Differences: Simulation vs. Target Execution .


Serial Connection

MON251.DLL communicates with the target board via a serial channel which can be selected.  You should first connect the target system to a COM channel.  The COM channel and the baudrate used must be selected as described below.

♦	Connect the target system to a COM channel of the PC.  The COM channel can be selected via dialog after the DLL has been loaded.  The serial channel of the target system depends on the configuration of yout target system.

♦	Power on the target system and press the reset button.

♦	Invoke dScope and select the MON251.DLL driver.  The driver will try to establish serial communication.  This may fail when running the first time, since no settings are present in dScope's INI file (DSW51.INI in the Windows path).

♦	If the communication fails, the channel and baudrate setup dialog is displayed:

♦	Select the appropriate COM channel and baud rate first, then push the Try Again button.  After serial communication is established, MON251 displays the signon message along with target configuration information in dScope's command window:

On exit from dScope, the driver puts the values for COM and baudrate into dScope's INI file.  The next time you invoke dScope and MON251, the serial parameters used in the previous session will be used.  You can still change  the serial parameters using the Configuration dialog.


MCS 251 Parameters

You can query the target board cpu configuration by selecting CPU-Parameters from the Peripherals menu.  It shows the mode of operation and the interrupt frame size.  Note that these parameters cannot be changed since they are ROM based:

In order for a user program to run correctly, make sure that the mode of operation and interrupt frame size of the user program matches those from the target system.

related topics:

The Configuration Dialog

Differences: Simulation vs. Target Execution


The Configuration Dialog

With the Configuration dialog, you can change the serial channel and the baudrate:

The Apply  button is enabled only if either the baudrate or the port or both have changed.  Pressing Apply  then re-initializes the serial communication.

NOTE
In order for Apply to be successful, you should press the Reset button on your target system.  Otherwise the board may be in a state where it does not respond to the commands sent by the driver.

The Enable serial break  check box  serves the following purpose:

♦	If unchecked, you can enter characters within the serial window.  These characters are transferred to the running application.  On the other hand, you cannot stop the execution on the target board.

♦	If checked, you can stop program execution by pushing the Stop button or Stop menu entry in the debug window.  Characters entered in the serial window are not transferred to the application.

Note that after checking or unchecking the checkbox you can close the dialog.  It is not necessary to use the Apply  button in this case.

If you try to stop execution with serial break disabled, you will get a dialog which allows you to continue execution or abort the MON251 driver:

If you select the Abort driver  button, dScope kills the MON251 driver dll and the complete symbolic information from a previous load.  The state of dScope compares to the state directly after invocation


Differences: Simulation vs. Target Execution

Watch expressions are updated after each step or if a go command is terminated.  Since dScope cannot access the memory of the target system while a program is executed, dynamic update is not possible.

If execution is very slow and gives unpredicted results:  check the setting of the 'Record trace' item contained in the Commands menu of the debug window.  If it is checked, execution is performed with single steps rather than real time go.

Breakpoints behave differently in target mode:

♦	Address breakpoints:  Execution stops if the TRAP instruction at the break address is executed.  The original instruction at the break address will be executed with the next Step, Pstep or Go command.  Execution is in real time.

♦	Complex breakpoints:  Execution is done via single steps, the break expression is checked after each step.  This causes very slow execution and may lead to unpredicted results if serial I/O instructions of the monitor or application are stepped through.  An example of a complex breakpoint is 'DR8 >= 0xFFFF123 && R11==0x33'

♦	Access breakpoints: not supported by the driver.

Avoid single stepping through monitor code or serial I/O instructions of the application.  Doing so will confuse the serial protocol and finally break the communication.  If you run into this situation, do the following:

♦	Reset the target system

♦	Activate the Configuration dialog and select the baudrate already selected - this enables the Apply button.

♦	Select the Apply.  MON251 is completely reinitialized.

♦	In the command window, enter Reset.

The following dScope features are disabled in target mode:

Performance Analyzer and Code Coverage

Memory mapping

Access to target memory while executing a use program

Access to SFR's while executing a used program

The simulation engine is disabled.


Overview

Monitor-251 operates on an MCS®251 microcomputer board.  Monitor-251 performs the communication with the PC system over the serial interface. Therefore, the operation of the monitor requires the Monitor-251 interface program MON251.

The following commands are supported:

♦	Display the contents of the various 251 memory spaces in hexadecimal and ASCII format.

♦	Change memory contents interactively.

♦	Display and change register contents.

♦	Initialize the various 251 memory spaces with a constant value.

♦	Disassemble the code area in 251 mnemonics.

♦	In-line Assembler.

♦	Real-Time Go with up to 50 breakpoints.

♦	Control commands for up to 50 fixed breakpoints.

♦	Single step execution, alternatively with the possibility to execute a subroutine as one step.

♦	Down-load and up-load for Intel HEX and Object files.

♦	Command menu (help).


Hardware and Software Requirements

The following requirements must be satisfied in order to run the MON251 program correctly:

Hardware:

♦	IBM PC/XT/AT or compatible system

♦	640 KBytes RAM

♦	one Floppy-Disk drive

♦	one serial interface (COM1:)

Software:

♦	MS-DOS or PC-DOS operating system, version 5.0 or higher.

♦	A251 Macro Assembler for the generation of 251 programs (optional).

♦	C251 Compiler for the generation of 251 programs (optional).

Target hardware:

♦	MCS 251 CPU (i.e. 80C251SB)

♦	2 Kbyte EPROM starting at address 0 (loaded with Monitor-251 software)

♦	Min. 32 Bytes RAM (von Neumann wired, this means that write access and code fetches are possible)

♦	Serial interface for terminal communication.

Other Requirements

Monitor-251 requires the following hardware components of the 251 system:

♦	A serial interface.

♦	Additional 12 bytes stack space in the user program to be tested.

♦	32 bytes external (off-chip) data memory (RAM).

♦	2 Kbytes external code memory (EPROM).

♦	All other hardware components can be used by the application.


Starting Monitor-251

MON251 is invoked by entering its name: 'MON251'. The communication with the serial interface is performed with the hardware interrupt. Various parameters can be stated in the invocation line. These parameters change the working method of MON251.

The general syntax of the MON251 invocation is as follows:

MON251 parameter

Where:

MON251	is the program name.

parameter	is one or more of the following:

COM1:	use serial interface COM1: (Default). Abbreviation: "1".

COM2:	use serial interface COM2:. Abbreviation: "2".

COM3:	use serial interface COM3:. Abbreviation: "3".

COM4:	use serial interface COM4:. Abbreviation: "4".

INT14	the serial interface is called through the BIOS software interrupt 14H. No hardware interrupt is performed. The abbreviation of 	"INT14" is "I".

NOINT	the serial interface is "polled". No hardware interrupt system is necessary. The abbreviation of "NOINT" is "N".

BAUDRATE (bps )

allows the setting of the transfer baud rate. If this option is omitted, the baud rate 9600 bps is used. The value "(bps)" specifies the baud rate. Possible values are: "300", "600", "1200", "2400", "4800", "9600", "19200", "38400" and "57600". The abbreviation of "BAUDRATE" is "BR".

All invocation parameters of MON251 can also be executed through the system variable "MON251=", which can be installed with the help of the DOS command SET. If no parameters are stated in the invocation line, MON251 automatically operates with the parameters of this system variable. MON251 outputs the following message if the parameters of the system variable "MON251=" are used:

ENVIRONMENT STRING: MON251=<parameters>

Examples:

MON251
MON251 COM2: INT14
MON251 2
MON251 BAUDRATE (57600)
SET MON251=COM2: BAUDRATE (38400)
MON251

After invocation, MON251 signs-on with the message:

MS-DOS MON251 Vx.y
INSTALLED FOR PC/XT/AT (COM Line 1) USING HARDWARE INTERRUPT SERVICE
BAUDRATE: 9600 (DEFAULT)

  <Target identification message>
  <CPU, Mode, FrameSize = n>

Vx.y is the actual version number of the Monitor-251 software.  After MON251 has been invoked, it tries to 'talk' to the target board.  If MON251 does not get correct response from the target, it will first display the message below and exit to DOS:

*** Target system not found !
*** Please check the settings on your target system and Baudrates(s).

In this case you should check serial connections and baudrates settings on both the host and target system and retry.  If MON251 has successfully connected to target, it will display the target identification message which, for example looks as follows on the MCB251 board:

  MCB251SB USING EXTERNAL SIO
  MCS-251, Source-Mode, FrameSize = 4

Note that this message actually depends on the configuration of the monitor software of the target board.  The second line shows the mode of operation which can be either 'Source' or 'Binary' mode.  The framesize specifies the the size of the return address saved on interrupts.  It has the value 2 or 4.


Control Keys

Editing a Command Line

Controlling Console Output


Editing a Command Line

Command lines can be manipulated using the following control keys:

Keys	Function
Enter	Executes entire entry line.
Backspace	Deletes character in front of the cursor.
DEL, Ctrl+D	Deletes character below the cursor.
Ctrl+A	Deletes all characters  to the right of the cursor.
Ctrl+X	Deletes all characters to the left of the cursor.
Ctrl+Z	Deletes entire entry line.
Escape, Ctrl+C	Aborts entry and start new entry line.
Home	Positions cursor at the beginning of the entry line.
End	Positions cursor at the end of the entry line.
Insert	Toggles between insert/overwrite mode.
	Moves cursor one position to the left.
	Moves cursor one position to the right.
Cursor up	Assumes a prior entry line in the line editor.
Cursor down	Assumes a later entry line in the line editor.


Controlling Console Output

The following keys control the output on the console:

Keys	Function
CTRL-S	Stops output to the console and suspends the execution of the current command.
CTRL-Q	Cancels the effect of CTRL-S. Output to the console resumes.
CTRL-C,  ESC	Terminates the execution of a command and returns to the command line interpreter.


MON251 Terminal Control Codes

List of MON251 Terminal Control Codes:

Screen control codes	Function
00H	null
07H	bell
08H	backspace
09H	tab
0AH	line feed
0BH	cursor up
0CH	cursor right
0DH	carriage return
14H	cursor right
17H	erase to end of screen
18H	erase to end of line
1AH	clear screen and home
1CH	cursor down
1DH	cursor home
1EH	cursor up
1FH	cursor left
1BH  28H  (ESC '(')	highlight
1BH  29H  (ESC ')')	highlight off
1BH  30H  (ESC '0')	underline
1BH  31H  (ESC '1')	underline off
1BH  32H  (ESC '2')	cursor on
1BH  33H  (ESC '3')	cursor off
1BH  3DH  (ESC '=')	set cursor position (ADM-3A Mode)
1BH  41H  (ESC 'A')	cursor up
1BH  42H  (ESC 'B')	cursor down
1BH  43H  (ESC 'C')	cursor right
1BH  44H  (ESC 'D')	cursor left
1BH  45H  (ESC 'E')	clear screen and home
1BH  48H  (ESC 'H')	cursor home
1BH  4AH  (ESC 'J')	erase to end of screen
1BH  4BH  (ESC 'K')	erase to end of line
1BH  4CH  (ESC 'L')	insert line
1BH  4DH  (ESC 'M')	delete line
1BH  59H  (ESC 'Y')	set cursor position (VT-52 Mode)
1BH  62H  (ESC 'b')	erase to beginning of screen
1BH  6AH  (ESC 'j')	save cursor position
1BH  6BH  (ESC 'k')	restore cursor position
1BH  6CH  (ESC 'l')	delete line
1BH  6FH  (ESC 'o')	erase to beginning of line
1BH  70H  (ESC 'p')	reverse on
1BH  71H  (ESC 'q')	reverse off
1BH  76H  (ESC 'v')	scroll on
1BH  77H  (ESC 'w')	scroll off
1BH  7AH  (ESC 'z')	reset terminal


Serial Transmission Line

MON251 and Monitor-251 use a XON/XOFF protocol for the serial transmission. Therefore the only signals required from the V.24 (RS 232 respectively) serial interface are "TRANSMIT DATA", "RECEIVE DATA" and "SIGNAL GROUND". In most cases, however some connections are still necessary in the serial connectors, to enable the computer systems to transmit or receive respectively.

Please note that the transmission signals RxD and TxD should be connected such that RxD is connected to TxD. The connections of RxD and TxD are not standardized. Some manufactures have TxD on PIN 2 or PIN 3 (RxD respectively on opposite pins).

PIN connections of various computer systems

♦	IBM PC XT (DB-25 connector)
RxD	Pin 3	receive data
TxD	Pin 2	transmit data
Gnd	Pin 7	signal ground

♦	IBM PC AT (DB-9 connector)
RxD	Pin 2	receive data
TxD	Pin 3	transmit data
Gnd	Pin 5	signal ground
Connect	Pin 7 to Pin 8
Connect	Pin 1 to Pin 4 and Pin 6


Utility Commands

MON251 supports the following utility commands:

♦	Exit MON251 (Exit:  Exit MON251 and Return to DOS)

♦	Cmd from File (F2: Transmit the Contents of a File)

♦	Echo to File (F3: Protocol the Screen Output)

♦	Help (Help:  Display Command Menu)

♦	Comment lines (Comments (';'))

related topics:

F1: terminate MON251 and return to DOS

F2: Transmit the Contents of a File

F3: Protocol the Screen Output

Help:  Display Command Menu

Comments (';')

Exit:  Exit MON251 and Return to DOS


F1: terminate MON251 and return to DOS

After the entry of the F1 key or ALT+1, MON251 responds with the question

EXIT MON251 (y or [n])

MON251 is terminated if the 'y' or 'Y' is pressed, otherwise the EXIT command will be ignored.


F2: Transmit the Contents of a File

After the entry of the F2 key or ALT+2, MON251 responds with the question:

Input File:

The user can enter a file name. The content of this file is interpreted as MON251 Commands.

Example

Input File:         MYINIT.CMD <cr>

The content of the file MYINIT.CMD is interpreted as MON251 Commands.  If the file transfer should be stopped, the user can enter the key Ctrl+C during the running file transfer.


F3: Protocol the Screen Output

After the entry of the F3 key or ALT-3, MON251 responds with the question:

Output File:

The user can enter a file name. Each character which is displayed on the screen will be copied into this file.

Example

Output File:      DEBUG.PRN

The Screen Output is copied additionally into the file DEBUG.PRN.  If the protocol function should be stopped the user enters the F3 key or ALT+3. The program MON251 displays the question:

Quit output to file (y or [n])?

The answer 'y' or 'Y' terminates the protocol function. Otherwise the file protocol is continued.

If a file with the entered name already exists, the question -

Overwrite existing file (y or [n])?

is displayed. The answer 'y' or 'Y' deletes this file and creates a new file with this name. Otherwise the function F3 is aborted.


Help:  Display Command Menu

With the Help command a brief description of all MONITOR-251 commands is displayed.

Example

#HELP


Comments (';')

A line starting with ';' is a comment line.  A comment may also be inserted after a command.  The semi-colon instructs MONITOR-251 to ignore any text after the semi-colon. This is useful when a session is switched to a protocol file.

Example

#D C:0x4000    ; Show code at 0xFF4000


Exit:  Exit MON251 and Return to DOS

Syntax:  EXIT

EXIT closes all open files and returns to DOS.

Example

#EXIT


Memory Commands

MON251 supports display and change of memory with the following commands:

♦	D	Display Memory (DISPLAY: Display Memory)

♦	F	Fill Memory with constant (FILL: Fill Memory)

♦	E	Enter bytes or strings into memory (ENTER: Change Memory)

♦	U	Disassemble memory (Unassemble: Display Assembly Mnemonics)

♦	ASM	Assemble instructions into memory (ASM: Store CPU Instructions into Code Memory)

The memory commands use addresses and address ranges as parameters.  Refer to Addresses and Ranges for more information.


Addresses and Ranges

MON251 accepts numeric parameters in decimal and in hexadecimal form (allowed characters 0 .. 9, A .. F). If more than one parameter is required by a command the parameters can be separated by a blank (' ') or a comma (',').

Example

      #F C:0x4000, C:0x4FFF, 0     /* hex values */

or    #F C:8291, C:8295, 0         /* decimal values */

In the command description and in the help menu of the MONITOR-251 the following terms are used:

Term	Meaning
address	Address value with the range of the particular MCS 251 address space. For the various MCS 251 address spaces the following values are allowed: Bit Address:      B:0 .. B:0xFF Code-Address:  C:0x0000 .. C:0xFFFF Data-Address:   D:0x00 .. D:0xFF Edata-Address: ED:0x0000 .. ED:0xFFFF IData-Address:  I:0x00 .. I:0xFF XData-Address: X:0x0000 .. X:0xFFFF The memory space specifier 'C:' identifies segment 0xFF of the MCS 251 address space.  This is the default code segment.  If you want to specify a code segment other than 0xFF, you can't use the 'C:' prefix.  In this case, specify the full address, for example 0xFE0000.
range	Two address values which are interpreted as address range. The range includes the first and the last specified address. The two numbers are separated by comma (','). Example:  C:0x10,C:0x0FFF specifies the range from 0xFF0010 up to and including 0xFF0FFF.
value	The content of a memory location. The values allowed depend on the addressed MCS 251 memory. The content of a bit address can be 0 or 1. Any other MCS 251 address space allows byte values (0x00 .. 0xFF).
count	specifies the number of instructions executed by a Trace or Procedure-Step command. The count can be between 0x0000 and 0xFFFF.
bp	number of a breakpoint. The bp can be between 0 and 49.
breakadd	temporary breakpoint (address) in the code memory. The temporary breakpoint is only valid for the current active Go command.

The memory address or range is given by optional parameter(s).  MON251 manages the memory areas according to the MCS 251 architecture.  The selection of the actual memory space is specified by the numeric address.  An address consists of an optional memory space specifier followed by a colon and the numeric value, for example C:0x4000 specifies location 0x4000 in segment 0xFF which is the default code segment.  This address may also be written as 0xFF4000.  MON251 supports the following memory space specifiers:

C:	Code (0xFF0000 ... 0xFFFFFF)
D:	Data (0x00 .. 0x7F, SFR's 0x80 .. 0xFF)
I:	Idata (0x00 .. 0xFF)
ED:	Edata (0x0000 .. 0xFFFF)
X:	Xdata (0x0000 .. 0xFFFF)
B:	Bit/Ebit (0x00 .. 0xFF [0x20.0 .. 0xFF.7] )

With the memory space specifiers, you select a predefined segment or range.  If you want to specify an address not covered by the memory space specifiers, you must enter the physical address.  For example: 0x10000 specifies segment 1.

NOTE
Monitor-251 implements a write to the Code memory by a write operation into XData memory. This means, the Code memory can only be written to if it is mapped physically with the XData memory.  Monitor-251 checks after each write into the XData RAM if the same result is in the Code memory. If the contents differ a error message is displayed.

Note that some address spaces are fully or partially overlapped by some other space:

Idata 0x00 .. 0x7F is same as Data 0x00 .. 0x7F
Edata 0x00 .. 0xFF is same as Idata 0x00 .. 0xFF

related topics:

DISPLAY: Display Memory

ENTER: Change Memory

FILL: Fill Memory

Unassemble: Display Assembly Mnemonics

ASM: Store CPU Instructions into Code Memory

eXamine: Display Processor Registers


DISPLAY: Display Memory

Syntax:  D  startadr  [, endaddr]]

The address or address range contains the memory type to be displayed. If no address is entered the last address used by the display command is used. If no last address is available, then 64 bytes of code memory starting at C:0x0000 are displayed.

Examples

#D B:0,B:0x7F               ; Bit memory (0x20.0..0x2F.7)
#D C:0x0, 0x1FF             ; Code memory
#D D:0x30                   ; Data memory
#D I:0x80,0xFF              ; IData memory
#D X:200,0BFF               ; XData memory
#D ED:0x0, ED:0x1FF         ; EData memory


ENTER: Change Memory

Syntax:  E address = value [, ...]

The Enter command accepts a list of byte values and strings.

Examples

#E C:0x4000 = 1,2,0xFC,"Sound",13,10
#E X:0x5000 = 0x33,0xFF,0xAC,0x01


FILL: Fill Memory

Syntax:  F  startadr, endaddr, value

The FILL command changes memory.

Example

#F C:0x4000,C:0x7FFF, 0     ; clear code memory
#F D:0x20,0x7F, 0           ; clear range of data memory

Note: SFR range (0x80..0xFF) and bits can't be initialized by FILL.  Refer to Load Symbols:  Load SFR Definitions on how to change SFR values and SFR based bit values.


Unassemble: Display Assembly Mnemonics

Syntax:  U startadr [, endaddr]]

The Unassemble command displays the memory contents as assembler mnemonics.  The startaddr and endaddr parameters are optional.  If no parameters are given, then the last address used by a previous Unassemble commands is used.

Example

#U                       ; disassemble from 'current' address
#U C:0x4000, C:0x4FFF    ; disassemble given range
#U C:0x4000              ; disassemble 10 instructions


ASM: Store CPU Instructions into Code Memory

Syntax:  ASM  [address]

The ASM command allows in-line assembly language to be inserted into the current code memory image. This enables code patching or testing assembler instructions without having to write, assemble and link a program.

The address parameter can be omitted.  If it is, the last address used by a previous ASM command will be used.  After the ASM instruction is entered the instruction at the current code address is displayed. The following options can be used:

♦	RETURN

The current memory contents are not changed. The counter  goes to the next instruction.

♦	PERIOD

The ASM command is terminated. Control returns to the command level.

♦	INSTRUCTION

The previous instruction is replaced by the present instruction. An error message is issued if the instruction is invalid. The command must be repeated. The counter moves to the next instruction.

The inline assembler accepts both MCS 51 and MCS 251 instructions and creates opcodes according to the current mode of operation (source/binary).

Example

#ASM C:0x4000
C:0x4000  SJMP C:0x4010    > MOV DPTR,#4000
C:0x4002  NOP              > MOV R0,0xD1
C:0x4003  NOP              > MOV A,R1
C:0x4004  CLR A            >  Return     ; skip instruction
C:0x4005  CLR A            > MOVX A,@DPTR
C:0x4006  ANL 0x80,#12     > . Return    ; Terminate ASM mode.
#


eXamine: Display Processor Registers

Syntax:

X	/* show all regs */
registername [= value]	/* show/set one reg */

The X command without any parameter displays the current register contents in the following  format:

R0   R2   R4   R6   R8   R10  R12  R14     PC      A  B      PSW
FFFF:FF04 000F:0011 0000:0000 0000:0000    FF:5C64 00 00     ---R0---
WR16 WR18 WR20 WR22 WR24 WR26 WR28 WR30  DR56 DPTR DR60   SP PSW1
0000:0000 0000:0000 0000:0000 0000:0000  0001:0000 0000:0007 ---R0-Z-

To change the value of a register, enter it's name followed by an equal sign and the value.  If you want to change the value of the Accumulator, use R11.  In case of the B register, use R10.

To display or change a register value, the name of the register has to be specified.  MON251 supports the following register names:

Register Name	Meaning
R11	maps to Accumulator (DATA address 0E0H)
R10	maps to B register (DATA address 0F0H)
R0—R7	Standard register bank (work register)
R8 ... R15	MCS 251 registers
WR0, WR2, WR4, ... WR30	MCS 251 Word registers
DR0, DR4, DR8 ... DR28	MCS 251 Dword registers
DR56	Xdata segment and offset
DPTR	maps to low order word of DR56
DR60	MCS 251 Stack Pointer (Segment always zero)
PC	Program Counter
′

Examples

#X                            ; show all registers
#DR56 = 0x21234               ; Xseg = 2, DPTR = 0x1234
#DR56                         ; display DR56 content
#R11 = 'a'                    ; change Accu
#R10 = 1                      ; change B-register


Breakpoint Commands

When debugging programs it is sometimes necessary to stop program execution in order to check the system and eventually to correct any errors.  MON251 supplies the following breakpoint commands:

BS	define (BreakSet: Define breakpoint)

BK	kill (BreakKill: Kill Breakpoint)

BE	enable (BreakEnable: Enable Breakpoint)

BD	disable (BreakDisable: Disable Breakpoint)

BL	list (BreakList: Display Breakpoints)

MON251 sets a beakpoints by inserting a TRAP instruction.  This means that a breakpoint can be set in RAM only, there is no way to have a breakpoint in ROM.  The instruction at the break address (see Addresses and Ranges) is saved, replaced by a TRAP and restored later on, when the breakpoint is cleared.

related topics:

BreakSet: Define breakpoint

BreakKill: Kill Breakpoint

BreakList: Display Breakpoints

BreakDisable: Disable Breakpoint

BreakEnable: Enable Breakpoint


BreakSet: Define breakpoint

Syntax:  BS break_address

The Breakpoint Set command sets a breakpoint. The program execution (GO command) is stopped when the instruction at the breakpoint is reached. An error occurs if:

♦	An attempt is made to define more than 50 breakpoints

♦	The break address is already defined, or an overlap with an already defined breakpoint occurs

♦	The break address is illegal

NOTE
Break addresses must be op code addresses!  (The address of the first op code byte of an instruction.)

Examples

#BS C:0x4510   ; break at 0xFF4510
#BS C:0x4400   ; break at 0xFF4400


BreakKill: Kill Breakpoint

Syntax:  BK  bp [, ... ]

One or more breakpoints can be deleted by using the Breakpoint Kill command. Several breakpoints can be specified by separating them with commas. The breakpoint number can be obtained by using the breakpoint List command.

Example

#BK 0,1,2      ; kill breakpoints 0, 1 and 2


BreakList: Display Breakpoints

Syntax:  BL

The Breakpoint List command lists all the current breakpoints. The list consists of the following components:

♦	Breakpoint number
Each breakpoint is assigned a number between 0 and 9. This number is used, for example, when enabling or disabling the breakpoints.

♦	Breakpoint status
A breakpoint is either ENAbled or DISabled. A disabled breakpoint is not active during program execution.

♦	Breakpoint address


BreakDisable: Disable Breakpoint

Syntax:  BD  bp [, ... ]]

The Breakpoint Disable command disables breakpoints that are not presently required. The definitions are not altered.  Several breakpoints can be disabled by separating the breakpoint numbers with commas. The breakpoint numbers can be obtained by using the breakpoint List command.

Example

#BD 0,1,2       ; disable breakpoints 0, 1 and 2


BreakEnable: Enable Breakpoint

Syntax:  BE  bp [, ... ]

The Breakpoint Enable command enables disabled breakpoints.  Several breakpoints can be specified by separating each breakpoint number by a comma. The Breakpoint List command displays the defined breakpoint numbers.

Example

#BE 0,2,6,9


Execution Commands

♦	Go command (Go: Start Program Execution in 'Real time mode')

Start execution in real time mode.  All currently defined breakpoints marked 'enabled' are set before the execution is started.

♦	Single Step (Trace: Start Program Execution in 'Single Step Mode')

♦	Procedure Step (Pstep: 'Procedure Single Step Mode' Execution)

Single step one or more instructions.  A subroutine activated by some CALL instruction is treated as one step.  For non CALL instructions, Pstep is equivalent to Step.

Depending on your application, input and output will be performed over the serial line.  In this case, it is not possible to stop execution by entering CTRL-C.  To enable execution break while in Go mode, you must set the variable SERBRK to 1 (Command: SERBRK=1) before entering the Go command.  With SERBRK set to 1, you may stop execution by entering CTRL-C.  On the other hand, you can no longer provide serial input to the running application.  Setting SERBRK = 0 will disable serial break and enable serial input to the application.

related topics:

Go: Start Program Execution in 'Real time mode'

Trace: Start Program Execution in 'Single Step Mode'

Pstep: 'Procedure Single Step Mode' Execution


Go: Start Program Execution in 'Real time mode'

Syntax:  G [ startadr  [, breakaddr ] ]

The Go command starts program execution from the current program counter PC or from the optional start address. The breakpoint is also optional.  If the break address is not specified, program execution will stop at a breakpoint defined with the BS command. If no breakpoints are defined program execution has to be stopped by a hardware reset. The breakaddr  option defines a temporary breakpoint rather than a permanent breakpoint.  If a breakpoint terminates the program execution MON251 displays the message:

Execution stopped at 0xnnnnnn
#

Examples

#PC = C:0x4000    ; set PC to C:0x4000
#G, C:0x4832      ; from current PC until C:0x4832
#G                ; until breakpoint or hardware-Reset
#


Trace: Start Program Execution in 'Single Step Mode'

Syntax:  T  [ count ]

The Trace Instruction(s) command starts program execution in single step mode. The count of steps can be between 1 and 0xFFFF.  One step is assumed if count is not specified. Breakpoints do not affect program execution while in single step mode. The T command can be stopped by entering CTRL-C. The T command also executes program parts which reside in EPROM.

Example

#T                 ; execute a single step.
#T 512             ; execute 512 steps.

The following is an example of the display following a step.  It is important to note that an instruction is first executed and then the display is issued.  The 'PC' and the disassembled instruction displayed is the next instructions to be executed!

#T
R0   R2   R4   R6   R8   R10  R12  R14     PC      A  B      PSW
FFFF:FF04 000F:0011 041F:0000 0000:0000    FF:5C6C 00 00     ---R0---
WR16 WR18 WR20 WR22 WR24 WR26 WR28 WR30  DR56 DPTR DR60   SP PSW1
0000:0000 0000:0000 0000:0000 0000:0000  0001:0000 0000:0007 ---R0-Z-
C:05C6CH    DEC     WR8,#001H


Pstep: 'Procedure Single Step Mode' Execution

Syntax:  P  [ count ]

The Procedure Step command starts program execution like the Trace Step mode.  The difference is, that a subroutine (CALL instructions) counts as one single step.  The count of steps can be between 1 and 0xFFFF.  If count is omitted, then one Pstep is executed.  Breakpoints do not affect program execution while in procedure single step mode.  The P command can be stopped by entering CTRL-C.

Example

#P             ; execute one step.
#P 8           ; execute eight steps.


Loading and Saving

To communicate with other development tools, MON251 implements functions for loading and saving files:

♦	Load Hex/Object file (LOAD: Load a program)

♦	Save memory in Hex-80/386 file (SAVE: Save Program in HEX Format)

♦	Load symbol file (Load Symbols:  Load SFR Definitions)

related topics:

LOAD: Load a program

SAVE: Save Program in HEX Format

Load Symbols:  Load SFR Definitions


LOAD: Load a program

Syntax:  LOAD filename

The file name must specify an absolute object file in OMF51, OMF251, Intel HEX or HEX-386 format.  The program is transferred to the target board.  MON251 ignores the complete debug information contained in OMF files.  In case of an OMF51 or Intel HEX file, the content records are automatically shifted to segment 0xFF, the default code segment.  Addresses below 0xFF0000 can't be handled by OMF51 and Intel HEX.  In this case the application should be privided in OMF251 or HEX-386 format.

Note that a user program should match the target configuration, that is, the application should use the same mode of operation (source or binary) and interrupt frame size as the cpu on the target board.  If you load a program in OMF251 format, MON251 will check this and give a warning when differences are encountered.  If you load an application in OMF51 or HEX-80/386 format, MON251 has no chance to check this.  In this case, you should ensure that the program matches the target board's cpu configuration.

Examples

#LOAD MEASURE             ; load an object program

#LOAD MYPROG.HEX          ; load some HEX file (80 or 386)


SAVE: Save Program in HEX Format

Syntax:

SAVE386 startadr, endaddr filename
SAVE80 startadr, endaddr filename

The SAVE80 command is useful only for saving data from the default code segment (0xFF0000 to 0xFFFFFF) into a file.  The SAVE386 command uses HEX-386 format which can handle the full 16MB address space.

Example

#SAVE80  C:0x4000,C:0x7FFF C:\IMAGE.HEX
#SAVE386 0xFE8000,0xFF3FFF C:\HIMAGE.H36


Load Symbols:  Load SFR Definitions

Syntax:  LS filename

With the LS command you can load symbols for the Special Function Registers.  The format of such a file is exactly that one used in the Assemblers A51/A251 for definition of predefined symbols such as SFR's and SFR based bits.  Once you have loaded a symbol file, you may use a symbol to query or change the value.

Example

#LS REG251S.INC  ; load symbol file for 80251SB Cpu
#P1              ; query port-1 value
SFR P1=0x12      ; MON251 answers
#P1 = 0x33       ; change the port-1 value
#P1              ; query again
SFR P1=0x33
#T2              ; get value of bit P1.0
Bit T1=1         ; answer
#T2=0            ; clear P1.0

Structure of a Symbol File:

A symbol file can only contain symbols of the type DATA or BIT, the values of which are specified in HEX.

P0	DATA	80H
SP	DATA	81H
DPL	DATA	82H
DPH	DATA	83H

TF1	BIT	8FH
TR1	BIT	8EH
TF0	BIT	8DH
TR0	BIT	8CH
IE1	BIT	8BH
IT1	BIT	8AH
IE0	BIT	89H
IT0	BIT	88H


Monitor-251 Configuration

The Monitor-251 software can be adapted to correspond to different hardware configurations using the INSTALL program.  Parameters which can be passed with the INSTALL call are listed below:

INSTALL  { MODBIN | MODSRC } serialtype  datastart  [INTR2]

MODBIN or MODSRC specifies the CPU mode of the 251 CPU.  MODSRC configures the Monitor-251 for source mode.  MODBIN configures the Monitor-251 for binary mode.  A number between 0 and 3 can be entered for serialtype.  The function is explained in the following table.

Serial Type	Serial Interface	Clock Source	Baud Rate	CPU Clock	Target Systems
0	0	Timer 1	9600 bps	11,059 MHz	all
1	0	Timer 2	defined with the variable BAUDRATE in INSTALL.A51	defined with the variable XTAL in INSTALL.A51	all
3	external SIO	external SIO	defined with the variable BAUDRATE within INSTALL.A51 (default: 57600 bps)	the XTAL frequency of the external SIO must be 1,843200 MHz	MCB-251

Datastart is used to specify the start address of the off-chip memory area which the Monitor-251 uses for internal management (length = 32 bytes).  The entry is made in HEX and can be a number between 010000H and 0FFFFE0H inclusive.

If INTR2 is specified, Monitor-251 assumes that the 251 CPU is configured for 2-bytes interrupt frame size.

Example

INSTALL  MODBIN  0  0FF7FE0H

In this example, Monitor-251 is configured for binary mode and uses Timer 1 as the baudrate generator.  Monitor-251 uses the memory area from 0FF7FE0H .. 0FF7FFFH as data RAM.  The resulting Intel HEX or object file (MON251.HEX or MON251) can then be transferred in an EPROM programmer.  Monitor-251 offsets the interrupt vectors to  4000H.  To change this setting modify the variable INT_ADR_OFF in the assembler file INSTALL.A51.

Installation on the MCB-251 Board

Use the following invocation to install Monitor-251 on a MCB-251 Board.

Source mode using the external SIO:	INSTALL MODSRC 3 0xFEFFE0
Binary mode using the on-chip SIO:	INSTALL MODBIN 1 0xFEFFE0


ERROR Messages

MON251 issues a numbered error message when an error is encountered.  The error messages have the following format:

*** ERROR 1: illegal digit

Where

1	is the error number

illegal digit	is the error message.

The following table lists the MON251 error numbers and messages along with a description of the error.

Error Number	Error Message and Description
1	illegal digit a number contains an illegal digit.
2	illegal character constant A character constant is not terminated by '.
3	syntax error a command contains an unknown parameter.
4	mspace specifier not followed by constant An address value introduced by a memory space must bei followed by a numeric constant; for example ED:0x1000
5	file write error An error occurred during the writing of a file; i.e. no more room on the memory storage medium.
6	file does not exist the given file can't be opened
7	read only file or subdirectory specified The given name is not the name of a file but that of a directory or a write protected file.
8	can't create file MON251 cannot create the given file.
9	unknown command You have entered an unknown command.
10	serial transmission failed The serial protocal is broken.  This may happen for example, if you step into the target monitor code.  Reset the target board and restart MON251.
11	illegal address range The given address range is incorrect.  Either the start address is lower than the end address or the range crosses a 64K boundary.
12	invalid line line-nr. in asm-include file The file given in the LS command contains an invalid line.  The line number is shown with the error message.
13	missing address range You must supply an address range for the SAVE80 and SAVE386 command.
14	SAVE80: addresses not in range 'C:0x0000 ... C:0xFFFF' The SAVE80 command cannot handle addresses outside the default code segment.
15	banked object file not supported MON251 does not support banked object files.
16	invalid hex file The given hex file does not contain valid HEX-80 or HEX-386 records.
17	checksum error in hex file A record in the hex file to be loaded contains a checksum error.
18	invalid object file The file to be loaded does not contain valid OMF-51/251 records.
19	out of memory MON251 has run out of memory while loading a symbol file.
20	Memory-write error at Segment:Offset An attempt to write at the location Segment:Offset failed.
21	invalid string- or character constant A parameter does not constitute a valid string constant or character constant.
22	invalid register name The given register name is not supported by MON251.
23	invalid inline operand Inline assembler: an operand to the instruction is invalid.
24	too many inline operands Inline assembler: the number of operands exceeds three.
25	invalid indirect register Inline assembler: an indirect register is invalid.  For example @R7 where only @R0 and @R1 is valid.
26	unknown instruction mnemonic Inline assembler: the given instruction mnemonic is invalid.
27	number of operands does not match instruction
28	invalid base in bit-address The base of a bit address is invalid.  It must be in range 0x20 ... 0xFF.
29	invalid bit-position The bit-position given in a bit address is wrong, it must be in range 0 to 7.
30	target out of range Inline assembler: the target given in a short branch instruction is not in range $-128 ... $+127.
31	constant value out of range A constant value does not match the instruction, for example 'MOV DR28,#0xABCD0000' where the high word of the constant must have a value of 0x0000 or 0xFFFF.
32	invalid register operand A register given in the instruction does not match that instruction.
33	invalid instruction operand An operand does not match the instruction, for example ACALL @DR28.
34	invalid '#short' value The constant value of a 'DEC/INC Reg,#const' is not 1, 2 or 4.
35	instruction does not match cpu
36	unused.
37	undefined breakpoint number A breakpoint number given in a BK, BD or BE command is invalid.  Use BL to obtain the currently available breakpoints and the corresponding breakpoint numbers.
38	cannot write break-address location MON251 cannot write the TRAP opcode into the breakpoint location.  Breakpoints cannot be set into ROM areas.
39	invalid break address The given breakpoint address is not in range 0x000000 ... 0xFFFFFF or it crosses the boundary of an already existing breakpoint.  Note that a TRAP requires two bytes in binary mode and one byte in source mode.
40	too many breakpoints The maximum number of breakpoints is 50.
41	WARNING: file is in binary mode, cpu is in source mode You are loading a program designed for a different mode of cpu operation.  The program will not run correctly.
42	WARNING: file is in source mode, cpu is in binary mode You are loading a program designed for a different mode of cpu operation.  The program will not run correctly.
43	different stack frame sizes The program loaded uses a different stack frame size.  The stack frame size of the program should match the stack frame size of the cpu configured on the target board.