Motorola reserves the right to make changes without further notice to any products herein to
improve reliability, function or design. Motorola does not assume any liability arising out of the
application or use of any product or circuit described herein; neither does it convey any license
under its patent rights nor the rights of others. Motorola products are not designed, intended, or
authorized for use as components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which the failure of
the Motorola product could create a situation where personal injury or death may occur. Should
Buyer purchase or use Motorola products for any such unintended or unauthorized application,
Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and
distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney
fees arising out of, directly or indirectly, any claim of personal injury or death associated with
such unintended or unauthorized use, even if such claim alleges that Motorola was negligent
regarding the design or manufacture of the part.
C-2. MCU SCI Communication Formats.................................................................................C-14
C-3. Rev. A Chip Selection Summary......................................................................................C-15
C-4. Rev. B Chip Selection Summary......................................................................................C-16
C-5. BCC Rev. C Chip Selection Summary.............................................................................C-17
C-6. PFB Rev. C Compatibility................................................................................................C-18
M68CPU32BUG/D REV 1vi
Page 9
GENERAL INFORMATION
CHAPTER 1
GENERAL INFORMATION
1.1 INTRODUCTION
This chapter provides a general description, installation instructions, start-up and system restart
instructions, memory requirements, and a terminal input/output (I/O) control description for the
M68CPU32BUG Debug Monitor (hereafter referred to as CPU32Bug). Information in this
manual covers the 1.00 version of the CPU32Bug.
1.2 GENERAL DESCRIPTION
The CPU32Bug package evaluates and debugs systems built around the M6833XBCC Business
Card Computer. System evaluation facilities are available for loading and executing user
programs. Various CPU32Bug routines that handle I/O, data conversion, and string functions are
available to user programs through the TRAP #15 handler.
CPU32Bug includes:
• Commands for display and modification of memory,
• Breakpoint capabilities,
• An assembler/disassembler useful for patching programs,
• A power-up self test feature which verifies system integrity,
• A command-driven user-interactive software debugger (the debugger), and
• A user interface which accepts commands from the system console terminal.
There are two modes of operation in the CPU32Bug monitor; the debugger mode and the
diagnostic mode. When the user is in the debugger directory the prompt CPU32Bug> is
displayed, and the user has access to the debugger commands (see Chapter 3). When the user is
in the diagnostic mode the prompt CPU32Diag> is displayed, and the user has access to the
diagnostic commands (see Chapter 6). These modes are also called directories.
CPU32Bug is command-driven. It performs various operations in response to user commands
entered at the keyboard. Figure 1-1 illustrates the flow of control in CPU32Bug. CPU32Bug
executes entered commands and the prompt reappears upon completion. However, if a command
is entered which causes execution of user target code (i.e., GO) then control may or may not
return to CPU32Bug. This depends upon the user program function.
CPU32Bug is similar to Motorola’s other debugging packages, but there are two noticeable
differences. Many of the commands are more flexible with enhanced functionality. And the
debugger has more detailed error messages and an expanded on-line help facility.
M68CPU32BUG/D REV 11-1
Page 10
GENERAL INFORMATION
POWER-UP/RESET
WARM START?
YES
SET DEBUGGER
DIRECTORY
DISPLAY DEBUGGER
NAME AND VERSION
NO
INITILIZE BUG VARIBLES
MAIN
DISPLAY BUG PROMPT
WAIT FOR INPUT
DOES COMMAND
CAUSE TARGET CODE
EXECUTION
NO
EXECUTE COMMAND
GO TO MAIN
YES
RESTORE
TARGET STATE
TARGET CODE
DISPLAY WARM
START MESSAGE
Figure 1-1. CPU32Bug Operation Mode Flow Diagram
RUN SYSTEM
CONFIDENCE TEST
SET DEBUGGER
DIRECTORY
DISPLAY DEBUGGER NAME & VERSION
DISPLAY RESULTS OF CONFIDENCE
TEST
GO TO MAIN
EXECPTION
EXCEPTION
HANDLERS
SAVE TARGET
STATE
DISPLAY TARGET
REGISTERS
M68CPU32BUG/D REV 11-2
Page 11
GENERAL INFORMATION
1.3 USING THIS MANUAL
Those users unfamiliar with debugging packages should read Chapter 1 before attempting to use
CPU32Bug. This provides information about CPU32Bug structure and capabilities.
Paragraph 1.4 Installation and Start-up describes a step-by-step procedure for powering up the
module and obtaining the CPU32Bug prompt on the terminal screen.
For questions about syntax or operation of a particular CPU32Bug command, turn to the
paragraph which describes that particular command in Chapter 3.
Some debugger commands take advantage of the built-in one-line assembler/disassembler. The
command descriptions in Chapter 3 assume that the user is familiar with the
assembler/disassembler functionality. Chapter 4 includes a description of the assembler/
disassembler.
NOTE
In the examples shown, all user inputs are given in bold text. This should clarify
the examples by distinguishing between character input by the user and character
output by CPU32Bug. The symbol <CR> represents the carriage return key on the
user’s terminal keyboard. Whenever this symbol appears it indicates a carriage
return should be entered by the user.
1.4 INSTALLATION AND START-UP
Use the following set-up procedure to enable CPU32Bug to operate with the BCC:
1. Configure the jumpers on the BCC module. Refer to the EVK User’s Manual
Motorola publication number M68332EVK/AD1 or M68331EVK/AD1.
2. Connect the DB-9 serial communication cable connector to the terminal or host
computer which is to be the CPU32Bug system console. Connect the other end of the
cable to P4 on the BCC.
Set up the terminal as follows:
• Eight bits per character
• One stop bit per character
• Parity disable
• 9600 baud rate
M68CPU32BUG/D REV 11-3
Page 12
GENERAL INFORMATION
NOTE
In order for high-baud rate serial communication between
CPU32Bug and the terminal to function properly, the terminal
must use XON/XOFF handshaking. If messages are garbled and
have missing characters, check the terminal to verify XON/XOFF
handshaking is enabled.
3. Power up the system. CPU32Bug executes a self-test and displays the sign on
message (which includes version number) and the debugger prompt CPU32Bug>.
1.5 SYSTEM RESTART
There are three ways to initialize the system to a known state. Each situation determines the
appropriate system restart technique.
1.5.1 Reset
The M68300PFB platform board reset switch returns the system to a known state. When the reset
switch is first pushed the MCU send the default XON character to the terminal to prevent
possible terminal lockup. There are two reset modes: COLD and WARM. COLD reset is the
CPU32Bug default, refer to the RESET command description. During COLD reset a total
system initialization occurs, similar to the BCC power-up sequence. All static variables are
restored to their default states. The serial port is reset to its default state. The breakpoint table is
cleared. The offset registers are cleared. The target registers are invalidated. Input and output
character queues are cleared. On-board devices (timer, serial ports, etc) are reset. During WARM
reset, CPU32Bug variables and tables are preserved, as well as the target state registers and
breakpoints.
Use reset if the processor halts, for example, after a halt monitor fault, or if the CPU32Bug
environment is lost (vector table is destroyed, etc).
1.5.2 Abort
The M68300PFB platform board abort switch terminates all in-process instructions. When abort
is executed while running target code, a snapshot of the processor state is captured and stored in
the target registers. For this reason abort is appropriate when terminating a user program that is
being debugged. Use abort to regain control if the program gets caught in a loop, etc. The target
PC, stack pointers, etc. help pinpoint malfunctions.
Abort generates a non-maskable, level-seven interrupt. The target registers reflect the machine
state at the time of an abort and are displayed on the display screen. Any breakpoints installed in
the user code are removed and the breakpoint table remains intact. Control is then returned to the
debugger.
M68CPU32BUG/D REV 11-4
Page 13
GENERAL INFORMATION
1.5.3 Break
The BREAK key on the terminal keyboard initiates a break. Break does not generate an
interrupt. The only time break is recognized is when characters are sent or received by the
debugger console. Break removes any breakpoints in the user code and keeps the breakpoint table
intact. Break does not, however, take a snapshot of the machine state nor does it display the
target registers. It is useful for terminating active debugger commands that are outputing large
blocks of data.
NOTE
When using terminal emulation programs such as ProComm or
Kermit, the BREAK key on the keyboard is local to the emulation
program and may not be transmitted to the BCC. Consult your
emulation program’s user manual for the procedure on sending a
BREAK signal to the port connected to the BCC.
1.6 MEMORY REQUIREMENTS
The program portion of CPU32Bug is approximately 64k bytes of code. The EPROM on-board
the BCC contains 128k bytes and is mapped at locations $E0000 to $FFFFF. However, the
CPU32Bug code is position-independent and can execute anywhere in memory. The second half
of the EPROM ($F0000 - $FFFFF) is blank and available for user programs. See Appendix C
CPU32Bug Customization.
CPU32Bug requires a minimum of 12k bytes of random access memory (RAM) to operate. This
memory may be either off-board system memory (i.e., on an external memory board) or BCC onboard RAM. On-board RAM allows stand-alone operation of the BCC.
The first 12k bytes are used for CPU32Bug stack and static variable space and the rest of
memory is reserved as user space. Whenever the BCC is reset, the target program counter is
initialized to the beginning user space address and the target stack pointers are initialized to
addresses at the end of the user space. The target instruction stack pointer (SSP) is set to the top
of the user space. Register initialization is done solely as a convenience for the user. Consult the
CPU32 Reference Manual for information regarding actual register values during a poweron/reset.
M68CPU32BUG/D REV 11-5
Page 14
INTERNAL RAM(1)
GENERAL INFORMATION
XXX7FF(2)
XXX000
MCU
INTERNAL
MODULES
OPTIONAL FPCP(3)
PFB(4): U5
ALTERNATE MCU
INTERNAL MODULES
LOCATION
(see APPENDIX C)
OPTIONAL RAM/EPROM
PFB: U2 & U4
CPU32BUG EPROM
BCC: U4
OPTIONAL RAM
PFB: U1 & U3
TARGET RAM
BCC: U2 & U3
SYSTEM RAM
BCC: U2 & U3
FFFFFF
FFF000
FFE800
800000
7FF000
110000 /120000(5)
100000
0E0000
020000
010000
003000
000000
CPU32BUG
STACK
CPU32BUG
INTERNAL
VARIABLES
CPU32BUG VECTOR
TABLE
TARGET VECTOR
TABLE
(1) Consult the MCU device User’s Manual.
(2) XXXBase address is user programmable. Internal MCU modules,
such as internal RAM, can be configured on power-up/reset by
using the Initialization Table (INITTBL) covered in Appendix C.
(3) Floating Point Coprocessor - MC68881/MC68882
(4) Platform Board
(5) Depends on the memory device type used.
M68CPU32BUG/D REV 11-6
Figure 1-2. BCC Memory Map
Page 15
GENERAL INFORMATION
1.7 TERMINAL INPUT/OUTPUT CONTROL
When entering a command at the prompt, the following control codes may have a caret, " ^ ",
preceding the character, this indicates that the Control or CTRL key must be held down while
striking the character key).
^X (Cancel line) The cursor is backspaced to the beginning of the line.
^H (backspace) The cursor is moved back one position. The character at the new
cursor position is erased.
<del> (delete/rubout) Performs the same function as ’’^H’’.
^D (redisplay) The entire command line as entered is redisplayed on the following
line.
When observing output from any CPU32Bug command, the XON and XOFF characters may be
entered to control the output, if the XON/XOFF protocol is enabled (default). These characters
are initialized to ’’^S’’ and ’’^Q’’ respectively by CPU32Bug, but may be changed by the user using
the PF command. The initialized (default) mode operations are:
^S (wait) Console output is halted.
^Q (resume) Console output is resumed.
M68CPU32BUG/D REV 11-7
Page 16
GENERAL INFORMATION
M68CPU32BUG/D REV 11-8
Page 17
DEBUG MONITOR DESCRIPTION
CHAPTER 2
DEBUG MONITOR DESCRIPTION
2.1 INTRODUCTION
CPU32Bug performs various operations in response to user commands entered at the keyboard.
When the debugger prompt CPU32Bug> appears on the terminal screen the debugger is ready to
accept commands.
2.2 ENTERING DEBUGGER COMMAND LINES
As the command line is entered it is stored in an internal buffer. Execution begins only after the
carriage return is entered. This allows the user to correct entry errors using the control characters
described in paragraph 1.7.
The debugger executes commands and returns the CPU32Bug> prompt. However, if the entered
command causes execution of user target code, (i.e., GO), then control may or may not return to
the debugger. This depends upon the user program function. For example, if a breakpoint is
specified, then control returns to the debugger when the breakpoint is encountered. The user
program also returns control to the debugger by means of the TRAP #15 function, RETURN
(described in paragraph 5.2.16). Also refer to the paragraphs in Chapter 3 which detail elements
of the GO commands.
In general debugger commands include:
• A command identifier (i.e., MD or md for the memory display command). Both
upper- or lower-case characters are allowed for command identifiers and options.
• At least one intervening space before the first argument.
• A port number for running with multiple ports.
• Any required arguments, as specified by command.
• An option field, set off by a semicolon (;) to specify conditions other than the default
conditions of the command.
• Some commands (MD, GO, T, etc) are repeatable, i.e., entering a carriage return
(<CR>) only causes the last command to be repeated and the address (<ADDR>), if
any, incremented. Thus after an MD command, sequential memory locations will be
displayed by entering a carriage return only. Or after entering a TRACE (T)
command, entering a carriage return (<CR>) only traces the next instruction.
• Multiple debugger commands may be entered on a single command line by separating
the commands with the explanation point (!) character.
M68CPU32BUG/D REV 12-1
Page 18
DEBUG MONITOR DESCRIPTION
The commands use a modified Backus-Naur syntax. The meta-symbols are:
<>The angular brackets enclose a symbol, known as a syntactic variable. The
syntactic variable is replaced in a command line by one of a class of
symbols it represents.
[]Square brackets enclose an optional symbol. The enclosed symbol may
occur zero or one time. In some cases, where noted, square brackets are
required characters.
[]...Square brackets followed by periods enclose a symbol that is
optional/repetitive. The symbol within the brackets may appear zero or
more times.
|This symbol indicates that a choice is to be made. Select one of several
symbols separated by a straight line.
/Select one or more of the symbols separated by the slash.
{}Brackets enclose optional symbols that may occur zero or more times.
2.2.1Syntactic Variables
The following syntactic variables are used in the command descriptions which follow. In
addition, other syntactic variables may be used and are defined in the particular command
description in which they occur.
<DEL>Delimiter; either a comma or a space. <EXP> - Expression (described in
detail in paragraph 2.2.1.1).
<ADDR>Address (described in detail in paragraph 2.2.1.2).
<COUNT>Count; the same syntax as < EXP> .
<RANGE>A range of memory addresses which may be specified either by <
ADDR><DEL><ADDR> or by <ADDR> :<COUNT> .
<TEXT>An ASCII string of as many as 255 characters, delimited with single quote
marks (’TEXT’).
M68CPU32BUG/D REV 12-2
Page 19
DEBUG MONITOR DESCRIPTION
2.2.1.1 Expression as a Parameter
An expression is one or more numeric values separated by the arithmetic operators:
+plus
–minus
*multiplied by
/divided by
& logical AND
<< shift left
>> shift right
Base identifiers define numeric values as either a hexadecimal, decimal, octal or binary number.
If no base identifier is specified, then the numeric value is assumed to be hexadecimal.
A numeric value may also be expressed as a string literal of as many as four characters. The
string literal must begin and end with single quote marks ('). The numeric value is interpreted as
the concatenation of the ASCII values of the characters. This value is right-justified, as is any
other numeric value.
String LiteralNumeric Value (in hex)
’A’41
’ABC’414243
’TEST’54455354
Evaluation of an expression is always from left to right unless parentheses are used to group part
of the expression. There is no operator precedence. Sub-expressions within parentheses are
evaluated first. Nested parenthetical sub-expressions are evaluated from the inside out.
The total value of the expression must be between 0 and $FFFFFFFF.
2.2.1.2 Address as a Parameter
Many commands use <ADDR> as a parameter. The syntax accepted by CPU32Bug is similar to
the one accepted by the MC68300 Family one-line assembler. All control addressing modes are
allowed. An address+offset register mode is also allowed.
Table 2-1 summarizes the address formats which are acceptable for address parameters in
debugger command lines.
M68CPU32BUG/D REV 12-4
Page 21
DEBUG MONITOR DESCRIPTION
Table 2-1. Debugger Address Parameter Format
FormatExampleDescription
N140Absolute address+contents of automatic offset register.
N+Rn332+R5Absolute address+contents of the specified offset register (not an
N - Absolute address (any valid expression)
Dn - Data register n
An - Address register n
Xn - Index register n (An or Dn) d Displacement (any valid expression)
bd - Base displacement (any valid expression) n Register number (0 to 7)
Rn - Offset register n
ZXn - Zero suppressed register Xn
2.2.1.3 Offset Registers
Address register indirect with displacement (two formats accepted).
Address register indirect with index and displacement (two formats
accepted).
Symbol Definition
Eight pseudo-registers (R0 through R7) called offset registers are used to simplify the debugging
of re-locatable and position-independent files. These files when listed have a starting address
(normally 0), but when loaded into memory, due to the offset registers, they are loaded into a
different memory location. Implementing offset registers makes it harder to correlate addresses in
the listing with addresses in the loaded program. The offset registers solve this problem by taking
into account this difference and forcing the display of addresses in a relative address+offset
format. The range for each offset register is set by two addresses: base and top. Specifying the
base and top addresses for an offset register sets its range. Offset registers have adjustable ranges
which may overlap. In the event that an address falls in two or more offset register ranges, the
one that yields the least offset is chosen.
Relative addresses are limited to 1 megabyte (5 digits), regardless
of the range of the closest offset register.
M68CPU32BUG/D REV 12-5
NOTE
Page 22
DEBUG MONITOR DESCRIPTION
EXAMPLEA portion of the listing file of a re-locatable module assembled with the
MC68300 Family DOS resident assembler is shown below:
For Additional information about the offset registers, see the OF command description.
M68CPU32BUG/D REV 12-6
Page 23
DEBUG MONITOR DESCRIPTION
2.2.2 Port Numbers
Some CPU32Bug commands allow the user to decide which port is the input or output port.
Valid port numbers are:
0 - MCU SCI Port(RS-232C communication port; P4 on the BCC and P9 on the PFB)
Although CPU32Bug supports other ports (see PF command), there is no hardware present on
the BCC to support additional ports. Thus the commands which allow port numbers (DU, LO,PF, VE) can only use port 0. Those commands requiring a second port (PA, TM) are not
functional without additional hardware.
2.3 ENTERING AND DEBUGGING PROGRAMS
There are various ways to enter a user program into system memory. One is to create the program
using the assembler/disassembler option and the MM (memory modify) command.
The user enters the program one source line at a time. After each source line is entered, it is
assembled and the object code is loaded into memory. Refer to Chapter 4 for complete details of
the CPU32Bug assembler/disassembler.
Another way to enter a program is to download an object file from a host system (i.e., a personal
computer). The program must be in S-record format (described in Appendix A) and may be
assembled or compiled on the host system. The file is downloaded from the host into BCC
memory via the debugger LO command. Alternately, the program may be created using the
CPU32Bug MM command as outlined above and stored to the host using the DU (dump)
command. A communication link must exist between the host system and the BCC’s serial port.
2.4 CALLING SYSTEM UTILITIES FROM USER PROGRAMS
A convenient method to input and output characters as well as many other useful operations is
provided by the TRAP #15 instructions. This frees the user from having to write these routines
into the target code. Refer to Chapter 5 for details on various TRAP #15 utilities and how to
execute them from a user program.
2.5 PRESERVING DEBUGGER OPERATING ENVIRONMENT
Avoiding contamination of the debugger operating environment is explained in the following
paragraphs. CPU32Bug uses certain MCU on-board resources and may also use off-board system
memory to store temporary variables, exception vectors, etc. If the user violates CPU32Bug
dependent memory space, then the debugger may not function.
M68CPU32BUG/D REV 12-7
Page 24
DEBUG MONITOR DESCRIPTION
2.5.1 CPU32Bug Vector Table and Workspace
CPU32Bug requires 12k bytes of RAM to operate. On power-up or reset, CPU32Bug allocates
this memory space. The first 1024-bytes are reserved as a user program vector table area and the
second 1024-bytes are reserved as an exception vector table for use by the debugger. Next,
CPU32Bug reserves space for static variables and initializes these variables to predefined default
values. After the static variables, CPU32Bug allocates space for the system stack, then initializes
the system stack pointer to the top of this area.
With the exception of the first 1024-byte vector table area, do not to use the above-mentioned
reserved memory areas. Refer to paragraph 1.6 to define the reserved memory area location. If,
for example, a user program inadvertently wrote over the static variable area containing the seri al
communication parameters, these parameters would be lost, resulting in a loss of communication
with the system terminal. If a user program corrupts the system stack, then an incorrect value
may be loaded into the processor’s counter, causing the system to crash.
2.5.2 CPU32Bug Exception Vectors
The debugger exception vectors are listed below. Do not change these specified vector offsets in
the target program vector table or the associated debugger facilities (breakpoints, trace mode,
etc.) will not operate.
Table 2-2. CPU32Bug Exception Vectors
Vector
Number
4$10IllegalInstruction breakpoints (Used instruction by GO, GN,
When the debugger handles one of the exceptions listed in Table 2-2, the target stack pointer is
left pointing past the bottom of the exception stack frame; that is, it reflects the system stack
pointer values just before the exception occurred. In this way, the operation of the debugger
facility (through an exception) is transparent to the user, but it does change the locations on the
stack.
Notice that the value of the target stack pointer register (A7) has not changed even though a trace
exception has taken place. The user program may use the exception vector table provided by
CPU32Bug or it may create a separate exception vector table of its own.
2.5.2.1 Using CPU32Bug Target Vector Table
CPU32Bug initializes and maintains a vector table area for target programs. A target program is
any user program started by the CPU32Bug with GO or Trace commands. The starting address of
this target-vector table area is the base address of the BCC, described in paragraph 1.6. This
address is loaded into the target-state-vector base register at power-up or during a cold-start reset.
For verification use the RD command immediately after power-up to display the target-state
registers.
CPU32Bug loads the target-vector table with the debugger vectors (listed in Table 2-2) and the
other vector locations with the address of a generalized exception handler (refer to paragraph
2.5.2.3). The target program allocates as many vectors as required by simply writing its own
exception vectors into the table. If the vector locations listed in Table 2-2 are over-written, then
the accompanying debugger functions will be lost.
CPU32Bug maintains a separate vector table for its own use in a 1k byte space in the reserved
memory space. The debugger vector table is completely transparent to the user and no
modifications should ever be made to it.
M68CPU32BUG/D REV 12-9
Page 26
DEBUG MONITOR DESCRIPTION
2.5.2.2 Creating Vector Tables
A user program may create a separate vector table to store its exception vectors. If this is done,
the user program must change the value of the vector base register to point to the new vector
table. To use the debugger facilities, copy the vectors from the CPU32Bug vector table into the
corresponding user vector table locations (block of memory move (BM) command).
The vector for the CPU32Bug generalized exception handler (described in detail in paragraph
2.5.2.3) may be copied from offset $08 (Bus Error vector) in the target-vector table to all
locations in the user’s vector table where a separate exception handler is not used. This provides
diagnostic support in the event execution of the user program is terminated by an unexpected
exception. The generalized exception handler gives a formatted display of the target registers and
identifies the type of the exception.
The following is an example of a user routine which builds a separat e vector table and then set s
the vector base register to point at it.
*
***BUILDX
*
BUILDXMOVEC.LVBR,A0
LOOPMOVE.LD0,(A1,D1)
– Build exception vector table ***
LEA$1 0000,A1
MOVE.L$8(A0),D0
MOVE.W$3FC,D1
SU BQ.W#4, D 1
BPL.BLOOP
MOVE.L$1 0(A0),$1 0(A1 )
MOVE.L$24(A0),$24(A1 )
MOVE.L$BC(A0),$BC(A1 )
LEA.LTIMER(PC),A2
MOVE.LA2,$2C(A1 )
MOVEC.LA1 ,VBR
RTS
END
Get copy of VBR.
New vectors at $10000.
Get generalized exception vector.
Load count (all vectors).
Store generalized exception vector.
Initialize entire vector table.
Copy breakpoints vector.
Copy trace vector.
Copy system call vector.
Get user exception vector.
Install as F-Line handler.
Change VBR to new table.
The user program may use one or more of the exception vectors that are required for debugger
operation if the user’s excepti on handler can determine when to handle the exception itself and
when to pass the exception to the debugger.
When an exception occurs which requires debugger operation (i.e., ABORT), the user’s
exception handler must read the vector offset from the exception-stack-frame format word. This
offset is added to the address of the CPU32Bug target program vector table (which the user
program saves), producing the address of the CPU32Bug exception vector. The user program
then jumps to the address stored at this vector location (i.e., which is the address of the
CPU32Bug exception handler).
The user program must ensure an exception stack frame is in the stack and that it i s identical to
one the processor would create for the particular exception. It may then jump to the address of
the exception handler.
M68CPU32BUG/D REV 12-10
Page 27
DEBUG MONITOR DESCRIPTION
EXAMPLEThe user exception handler passes an exception along to the debugger.
*
*** EXCEPT - Exception handler ****
*
EXCEPTSUBQ.L#4,A7
LINKA6,#0
MOVEM.LA0-A5/D0-D7,-(A7)
: decide here if user code will handle exception, if so, branch...
MOVE.LBUFVBR,A0
MOVE.W14(A6), Do
AND.W#$0FFF,D0
MOVE.L(A0,D0.W),4(A6)
UNLK
RTS
Save space in stack for a PC value.
Frame pointer for accessing PC space.
Save registers.
Pass exception to debugger; Get VBR.
Get the vector offset from stack frame.
Mask off the format information.
Store address of debugger exception handler.
A6
Put address of exception handler into PC and go.
2.5.2.3 CPU32Bug Generalized Exception Handler
The CPU32Bug generalized exception handler supervises all exceptions not listed in Table 2-2.
For these exceptions, the target stack pointer points to the top of the user exception stack frame.
In this way, if an unexpected exception occurs during user code segment execution, the exception
stack frame displays to assist in determining the cause of the exception.
EXAMPLEBus error at address $F00000. It is assumed for this example that an access
of memory location $F00000 initiates bus error exception processing.
Before the normal register display information is printed, the exception type information is
displayed. This includes the type of exception with its format/vector word and the following:
MnemonicDescriptionOffset
SSWSpecial Status Word+$16
Fault Addr.Faulted Address+$10
DataData+$0C
Cur. PCProgram Counter+$02
Cnt. Reg.Internal Transfer
Count Register
+$14
The upper nibble of the count register (Cnt. Reg.) contains the microcode revision number of the
MCU device. Consult the CPU32 Reference Manual, Section 6 Exception Processing for more
details.
Notice that the target stack pointer is different. The target stack pointer now points to the last
value of the stacked exception stack frame. Examine the exception stack frame using the MD
command.
Function codes identify the address space being accessed on any given bus cycle, and are an
extension of the address. The function codes provide additional information required to find the
proper memory location.
For this reason, all debugger commands involving an address field were changed to allow the
specification of function codes:
The caret ( ^ ) symbol following the address field indicates that a function code specification
follows. The function code can be entered by specifying a valid function code mnemonic or by
specifying a number between 0 and 7. The syntax for address and function code specifications
are:
<ADDR>^<FC>Sets the function code to <FC> value.
<ADDR>^^Toggles the displaying of function code values.
<ADDR>^<FC>=Sets the function code to <FC> and the default function code to <FC>.
The default value at power up is SD.
M68CPU32BUG/D REV 12-12
Page 29
DEBUG MONITOR DESCRIPTION
The valid function code mnemonics are:
FunctionCode MnemonicDescription
0F0Unassigned, reserved
1UDUser Data
2UPUser Program
3F3Unassigned, reserved
4F4Unassigned, reserved
5SDSupervisor Data
6SPSupervisor Program
7CSCPU Space Cycle
The BR, GD, GO, and GT commands set the valid function codes to either a user program (UP)
or supervisor program (SP). When execution is started via GO, GN, or GD, the default address
space is determined by bit 13 (the S-bit) of the status register (SR). When set, SP i s used; when
cleared, UP is used. By specifying a function code with GO, GT, or GD command, the SR S-bit
is forced to the correct state before execution begins.
For the GT command, the temporary breakpoint is set using the function code specified, or it
defaults to SP or UP, depending on the state of the S-bit in the SR.
Though function codes are supported, the BCC hardware does not require function codes to
operate.
EXAMPLETo change data at location $5000 in the user data space.
TTrace3.30
TCTrace On Change of Control Flow3.31
TMTransparent Mode3.32
TTTrace To Temporary Breakpoint3.33
VEVerify S-Records Against Memory3.34
Each command is described in the following text. Command syntax symbols are explained in
section 2.1. In the examples of the debugger commands all user inputs are in bold type. This
helps clarify examples by distinguishing user input characters from CPU32Bug output characters.
The symbol <CR> represents the carriage return key on the user’s terminal keyboard. This
symbol indicates the user should enter a carriage return.
M68CPU32BUG/D REV 13-2
Page 33
DEBUG MONITOR COMMANDS
BCBlock of Memory CompareBC
3.2 BLOCK OF MEMORY COMPARE
BC <range><del><addr>[;B|W|L]
options:
B – Byte
W – Word
L – Longword
The BC command compares the contents of the memory addresses defined by <range> to another
place in memory, beginning at <addr>.
The option field is only allowed when <range> is specified using a count. In this case, the B, W,
or L defines the size of data to which the count is referring. For example, a count of four with an
option of L would mean to compare four long words (or 16 bytes) to the <addr> location. If the
range beginning address is greater than the end address, an error results. An error also results if
an option field is specified without a count in the range.
For the following examples, assume the following data is in memory.
CPU32Bug>MD 4000:20;B<CR>
0000400054 48 49 53 20 49 53 2041 20 54 45 53 54 21 21 THIS IS A TEST!!
<data> and <increment> are both expression parameters
options:
B – Byte
W – Word
L – Longword
The BF command fills the specified range of memory with a data pattern. If an increment is
specified, then <data> is incremented by this value following each write, otherwise <data>
remains a constant value. Enter a negative value in t he increment field to create a decrementing
pattern . The data entered by the user is right-justified in either a byte, word, or longword field as
specified by the option selected. The default field length is W (Word).
User-entered data or increment must fit into the data field or leading bits are truncated to size. If
truncation occurs, then a message is printed stating the actual data pattern and/or the actual
increment value.
If the range is specified using a count then the count is assumed to be in terms of the data size.
Truncation always occurs on byte or word sized fields when negative values are entered. For
example, entering "-1" in ternally becomes $FFFFFFFF which gets truncated to $FF for byte or
$FFFF for word sized field s. There i s no di fference int ernally between enteri ng "-1" and enterin g
$FFFFFFFFF, so truncation occurs for byte or word sized fields.
If the upper address of the range is not on the correct boundary for an integer multiple of the data
to be written, then data is filled to the last boundary before the upper address. Addresses outside
of the specified range are not written under any condition. ''Effective address'' messages
displayed by the command show the extent of the area written.
EXAMPLESAssume memory from $4000 to $402F is clear.
The longword pattern would not fit evenly in the given range. Only one longword was written
and the ’’Effective address’’ messages reflect the fact that data was not written all the way up to
the specified address.
CPU32Bug>BF 4000:18 0 1<CR>Default size is Word
Effective address: 00004000
Effective count : &24
CPU32Bug>MD 4000:18<CR>
The BM command copies the contents of the memory addresses, defined by <range>, to another
place in memory, beginning at <addr>. The option field is only allowed when <range> is
specified using a count. In this case the B, W, or L defines the size of data to which the count is
referring. For example, a count of four with an option of L would mean to move four longwords
(or 16 bytes) to the new location. An error results if an option field is specified without a count in
the range.
EXAMPLESAssume memory from $4000 to $402F is clear.
CPU32Bug>MD 4100:20;B<CR>
00004100 544B 4953 2049 5320 4120 5445 5354 2121 THIS IS A TEST!!
Now suppose the user would like to insert an NOP between the ADD.L instruction and the
ASR.L instruction. Block move the object code down two bytes to make room for the NOP.
The BR command allows the user to set a target code instruction address as a breakpoint address
for debugging purposes. Enter only the BR command to display the current breakpoints in the
breakpoint table, or enter {<addr> [:<count> ]} one or more times to set multiple breakpoints. If
during target code execution a breakpoint with 0 count is found, the target code state is saved in
the target registers and control returned to CPU32Bug. This allows the user to see the act ual stat e
of the processor at selected instructions in the code.
Breakpoints are normally only used in RAM, but they may be used in ROM when operating
under the TRACE commands (see T, TC, and TT commands for details).
As many as eight breakpoints can be defined. Breakpoints are kept in a table which is displayed
each time either BR or NOBR is used. If an address is specified with the BR command, that
address is added to the breakpoint table. The count field specifies how many times the instruction
at the breakpoint address is fetched before a breakpoint is taken. The count field defaults to
hexidecimal input, unless a numeric identifier prefix is used. The count, if greater than zero, is
decremented with each fetch. Every time a breakpoint with zero count is found, a breakpoint
handler routine prints the CPU state on the screen and control is returned to CPU32Bug. The
maximum <count> is a 32-bit value ($FFFFFFFF = 4,294,967,295).
NOBR is used to delete breakpoints from the breakpoint table. To remove a specific address
from the breakpoint table, enter NOBR followed by the address. If NOBR <CR> is entered then
all entries are deleted from the breakpoint table and the empty table is displayed.
BS <range><del><text> [;B|W|L] or
BS <range><del><data>[<del><mask>] [;B|W|L|N|V]
The BS command searches the specified range of memory for a match with a user-entered data
pattern. This command has three modes:
Mode 1LITERAL STRING SEARCH — ex ecutes a search for the ASCII equivalent of
the literal string entered by the user. Mode 1 is indicated if <RANGE> is followed
by a <text> field. The size as specified in the option field defines whether the
count field in <range> refers to bytes, words, or longwords. The option field is
available only if <range> is specified using a count. If a match is found then the
address of the first byte of the match is output.
Mode 2DATA SEARCH — a data pattern is entered by the user as part of the command
line. The data field size is entered by the user in the option field; the default is
word (W). The size entered in the option field also dictates whether the count field
in <RANGE> refers to bytes, words, or longwords. The following occurs during a
data search:
1. The user-entered data pattern is right-justified. Leading bits are truncated
or leading zeros are added as necessary to make the data pattern the
specified size.
2. Successive bytes, words, or longwords, within the specified range, are
compared to the user-entered data. Comparison is made only on those bits
at bit positions corresponding to a 1 in the mask. If no mask is specified
then a default mask of all one's is used (all bits are compared). The size of
the mask is the same size as the data.
3. If the ''N'' (non-aligned) option has been selected then the data is searched
on a byte-by-byte basis, rather than by words or longwords regardless of
the size of <data>. This is useful if a word (or longword) pattern is being
sought, but is not expected to lie on a word (or longword) boundary.
4. If a match is found, the address of the first byte of the match is output
along with the memory contents. If a mask was in use, then the actual data
at the memory location is displayed, rather than the masked data.
Mode 3DATA VERIFICATION — If the ''V'' (verify) option is selected and the memory
contents do not match the user-specified pattern, then addresses and data are
displayed. Otherwise this mode is identical to Mode 2.
M68CPU32BUG/D REV 13-10
Page 41
DEBUG MONITOR COMMANDS
BSBlock of Memory SearchBS
In all three modes information on matches is output to the screen in a four-column format. Only
24 lines of matches are displayed on the screen at a time. A message prints at the bottom of the
screen indicating there are more lines to display. Press any charact er key to resume output. Press
the BREAK key to cancel the output and exit the command.
If a match (or a mismatch in the case of Mode 3) is found with a series of bytes of memory
whose beginning is within and end is outside of the range, then that match and a message is
output stating that the last match does not lie entirely within the range. The user may search noncontiguous memory with this command without causing a Bus Error.
CPU32Bug>BS 3000 302F ’Error Status’<CR>
Effective address: 00003000
Effective address: 0000302Faddress of its first byte is output.
00003003
CPU32Bug>BS 3000 301F ’ConfigTableStart’<CR>
Effective address: 00003000
Effective address: 0000301Foutside of the range, so the address of
00003014its first byte and a message are output.
-last match extends over range boundary-
CPU32Bug>BS 3000:30 ’t’ ;B<CR>
Effective address: 00003000
Effective count : &48and size option: count is displayed in
0000300A 0000300C 00003020 00003023decimal, and address of each occur-
Mode 1: the string is not found, so a
Mode 1: the string is found, and the
Mode 1: the string is found, but it ends
Mode 1, using <RANGE> with count
rence of the string is output.
M68CPU32BUG/D REV 13-11
Page 42
DEBUG MONITOR COMMANDS
BSBlock of Memory SearchBS
CPU32Bug>BS 3000:18,2F2F<CR>
Effective address: 00003000
Effective count : &24count is displayedin decimal, and the data
00003012|2F2Fpattern is found and displayed.
CPU32Bug>bs 3000,302F 3d34<CR>
Effective address: 00003000
Effective address: 0000302Fpattern is not found, so a message is output.
-not found-
CPU32Bug>bs 3000,302F 3d34 ;n<CR>
Effective address: 00003000
Effective address: 0000302Faligned option is used, so the data pattern is
0000300F|3D34found and displayed.
Mode 2, using <RANGE> with count, mask
option, and size option: count is displayed in
decimal, and the actual unmasked data
patterns found are displayed.
Mode 3, mask option, scan for words with
low nibble non-zero: 17 non-matching
locations found.
M68CPU32BUG/D REV 13-12
Page 43
DEBUG MONITOR COMMANDS
BVBlock of Memory VerifyBV
3.7 BLOCK OF MEMORY VERIFY
BV <range><del><data> [<del><increment>][;B|W|L]
where:
<data> and <increment> are both expression parameters
options:
B – Byte
W – Word
L – Longword
The BV command compares the specified range of memory against a data pattern. If an
increment is specified, then <data> is incremented by this value following each comparison,
otherwise <data> remains a constant value. Enter a negative increment to execute a decrementing
pattern. The data entered by the user is right-justified in either a byte, word, or longword field
length (as specified by the option selected). The default field length is W (word).
User-entered data or increment must fit into the data field or leading bits are truncated to size. If
truncation occurs, then a message is printed stating the actual data pattern and/or the actual
increment value.
If the range is specified using a count then the count is assumed to be in terms of the data size.
Truncation always occurs on byte or word sized fields when negative values are entered. For
example, entering "-1" in ternally becomes $FFFFFFFF which gets truncated to $FF for byte or
$FFFF for word sized field s. There i s no di fference int ernally between enteri ng "-1" and enterin g
$FFFFFFFFF, so truncation occurs for byte or word sized fields.
If the upper address of the range is not on the correct boundary for an integer multiple of the data
to be verified, then data is verified to the last boundary before the upper address. Addresses
outside of the specified range are not read under any condition. ''Effective address'' messages
displayed by the command show the extent of the area read.
M68CPU32BUG/D REV 13-13
Page 44
DEBUG MONITOR COMMANDS
BVBlock of Memory VerifyBV
EXAMPLESAssume memory from $6000 to $602F is as indicated.
Use the DC command to simplify an expression into a single numeric value. The equivalent
value is displayed in its hexadecimal and decimal representation. If the numeric value is
interpreted as a signed negative number (i.e., if the most significant bit of the 32-bit internal
representation of the number is set) then both the signed and unsigned interpretations are
displayed.
Use DC to obtain the equivalent effective address of an MCU device addressing mode.
DU [<port><del>]<range><del>[<text><del>][<addr>][<offset>] [;B|W|L]
The DU command outputs data from memory in the form of Motorola S-records to a port
specified by the user. If <port> is not specified then the S-records are sent to the I/O port (port 0).
For S-record information see Appendix A.
The option field is only allowed when <range> is specified using a count. In this case the B, W,
or L defines the size of data to which the count is referring. For example, a count of four with an
option of L would mean to move four longwords (or 16 bytes) to the new location. An error
results if an option field is specified without a count in the range.
Use the optional <text> field for incorporating text into the S0 header record of the block of
records that is to be dumped.
To use the optional <addr> field, enter an entry address for code contained in the block of
records. This address is incorporated into the address field of the block’s termination record. If no
entry address is entered then the address field of the termination record will contain the
beginning <range> address. The termination record is an S7, S8, or S9 record and depends upon
the entered address.
An optional offset may also be specified by the user in the <offset> field. The offset value is
added to the addresses of the memory locations being dumped. This generates the address which
is written to the address field of the S-records, creating an S-record file which is loaded back into
memory at a different location than that from which it was dumped. The default offset is zero.
NOTE
If an offset is specified but no entry address is specified then two
commas (indicating a missing field) must precede the offset to
keep it from being interpreted as an entry address.
EXAMPLESDump memory from $8000 to $802F to port 1.
The following example illustrates the procedure for uploading S-records to a host computer, in
this case an IBM-PC or compatible running MS-DOS with the ProComm terminal emulation
utility. Assume memory from $4000 to $4007 is initialized as follows:
Enter the following command to dump S-records from memory locations $4000-$4007 with a
start address of $4000, a title of ’TEST.MX’, and an offset of $65000000. Before entering the
<CR> to send the DU command to CPU32Bug, enter the ProComm command <ALT-F1> keys
to open a log file. Enter the filename as TEST.MX. Then enter the carriage return, <CR> to
complete the DU command entry. The DU command output is sent to the screen and ProComm
copies it into the file TEST.MX.
Enter ALT-F1 again to close the log file TEST.MX. The log file contains the extra lines of
"Effective address" and "CPU32Bug", but they will not affect subsequent CPU32Bug load (LO)
commands, as it keys on the "S" character. The file could be edited to remove the extra lines, if
so desired.
M68CPU32BUG/D REV 13-18
Page 49
DEBUG MONITOR COMMANDS
GDGo Direct (Ignore Breakpoints)GD
3.10 GO DIRECT (IGNORE BREAKPOINTS)
GD [<addr>]
Use the GD command to start target code execution. If an address is specified, it is placed in the
target PC. Execution starts at the target PC address. Under the GD command no breakpoints are
inserted.
Once execution of target code begins, control is returned to CPU32Bug by various conditions:
• Press the ABORT switch or RESET switch of the M68300PFB Platform Board
Set PC to start of program and restart target code:
CPU32Bug>RM PC<CR>
PC =0000400E ? 4000.<CR>
CPU32Bug>GD<CR>
Effective address: 00004000
M68CPU32BUG/D REV 13-20
Page 51
DEBUG MONITOR COMMANDS
GNGo To Next InstructionGN
3.11 GO TO NEXT INSTRUCTION
GN
Use the GN command to set a temporary breakpoint at the next instruction’s address, that is, the
one following the current instruction. GN then starts target code execution. After setting the
temporary breakpoint, the sequence of events is similar to that of the GO command. If there is
already a breakpoint at the tempory breakpoint location, the breakpoint must have a count less
than or equal to one or an error occurs.
GN is helpful when debugging modular code, because it allows the user to trace through a
subroutine call as if it were a single instruction.
EXAMPLEThe following section of code resides at $6000.
Use the GO command (alias G) to initiate target code execution. All previously set breakpoints
are enabled. If an address is specified, it is placed in the target PC. Execution st arts at the target
PC address.
The sequence of events is:
1. An address is specified and loaded into the target PC
2. If a breakpoint is set at the target PC address, the instruction is traced at the target P C
(executed in trace mode)
3. All breakpoints are inserted in the target code
4. Target code execution resumes at the target PC address
There are several methods for returning control to CPU32Bug:
• Execute the .RETURN TRAP #15 function
• Press the ABORT switch or RESET switch of the M68300PFB Platform Board
Use the GT command to set a temporary breakpoint and start target code execution. A count may
be specified with the temporary breakpoint. Control is given at the target PC address. All
previously set breakpoints are enabled. The temporary breakpoint is removed when any
breakpoint with 0 count is encountered.
After setting the temporary breakpoint, the sequence of events is similar to that of the GO
command. At this point control is returned to CPU32Bug by:
• Executing the .RETURN SYSCALL (TRAP #15) function
• Press the ABORT switch or RESET switch of the M68300PFB Platform Board
Set PC to beginning of program, set temporary breakpoint, and start target code:
CPU32Bug>RM PC<CR>
PC =0000400E ? 4000.<CR>
CPU32Bug>
M68CPU32BUG/D REV 13-26
Page 57
DEBUG MONITOR COMMANDS
GTGo To Temporary BreakpointGT
CPU32Bug>GT 4006<CR>
Effective address: 00004006
Effective address: 00004000Current PC at $4000.
At Breakpoint
PC=00004006SR=2711=TR:OFF_S_7_X...CVBR=00000000
SFC=0=F0DFC=0=F0USP=00003830SSP*=00010000
D0=00052A9CD1=00000029D2=00000009D3=00000000
D4=00000000D5=00000000D6=00000000D7=00000000
A0=00000000A1=00000000A2=00000000A3=00000000
A4=00000000A5=00000000A6=00000000A7=00010000
00004006E289LSR.L#1,D1
CPU32Bug>
Set another temporary breakpoint at $4002 and continue target program execution.
Tempory breakpoint at $4006.
CPU32Bug>GT 4002<CR>
Effective address: 00004002
Effective address: 00004006Current PC at $4006.
At Breakpoint
PC=0000400ESR=2711=TR:OFF_S_7_X...CVBR=00000000
SFC=0=F0DFC=0=F0USP=00003830SSP*=00010000
D0=00052A9CD1=00000000D2=000000FFD3=00000000
04=00000000D5=00000000D6=00000000D7=00000000
A0=00000000A1=00000000A2=00000000A3=00000000
A4=00000000A5=00000000A6=00000000A7=00010000
0000400E60FEBRA.B$400E
Tempory breakpoint at $4002.
Note that a breakpoint from the breakpoint table was encountered before the temproary
breakpoint.
M68CPU32BUG/D REV 13-27
Page 58
DEBUG MONITOR COMMANDS
HEHelpHE
3.14 HELP
HE [<command>]
HE is the CPU32Bug help facility. HE <CR> displays all available commands and their title
plus any macro commands that have been defined (see macro define/display (MA) command).
All CPU32Bug commands are in alphabetical order except for NOxx and the "alias" commands.
Macro commands are displayed first, in the inverse order in which they were defined. When the
HE command output fills the terminal screen, a message is printed asking the user to press
"RETURN" to continue. Entering he <command> displays the specified command name and
title.
EXAMPLES
CPU32Bug>HE<CR>
BCBlock Compare
BFBlock Fill
BMBlock Move
BRBreakpoint Insert
NOBRBreakpoint Delete
BSBlock Search
BVBlock Verify
DCData Conversion and Expression Evaluation
DUDump S-Records
GDGo Direct (no breakpoints)
GNGo and Stop after Next Instruction
GOGo to Target Code
G"Alias" for previous command
GTGo and Insert Temporary Breakpoint
HEHelp Facility
LOLoad S-Records
MAMacro Define/Display
NOMAMacro Delete
MAEMacro Edit
MALEnable Macro Expansion Listing
NOMALDisable Macro Expansion Listing
MDMemory Display
MMMemory Modify
M"Alias" for previous command
MSMemory Set
OFOffset Registers
PAPrinter Attach
NOPAPrinter Detach
PFPort Format
RDRegister Display
RESETWarm/Cold Reset
RMRegister Modify
RSRegister Set
M68CPU32BUG/D REV 13-28
Page 59
DEBUG MONITOR COMMANDS
HEHelpHE
SDSwitch Directory
TTrace Instruction
TCTrace on Change of Flow
TMTransparent Mode
TTTrace to Temporary Breakpoint
VEVerify S-Records
CPU32Bug>
To display the available commands in the diagnostic directory use the switch directory (SD)
command and at the CPU32Diag> prompt enter HE.
CPU32Bug>sd<CR>
CPU32Diag>he<CR>
DEDisplay Errors
DPDisplay Pass Count
LCLoop-Continue Mode
LELoop-on-Error Mode
NVNOn-Verbose Mode
MTMemory Tests (Dir)
RLRead Loop (Dir)
SEStop-on-Error Mode
SMModify Self-Test Mask
STSelf Test Sequence
WLWrite Loop (Dir)
WRWrite/Read Loop (Dir)
ZEClear Error Counters
ZPZero Pass Count
BCBlock Compare
BFBlock Fill
BMBlock Move
BRBreakpoint Insert
NOBRBreakpoint Delete
BSBlock Search
BVBlock Verify
DCData Conversion and Expression Evaluation
DUDump S-Records
GDGo Direct (no breakpoints)
GNGo and Stop after Next Instruction
GOGo to Target Code
G"Alias" for previous command
GTGo and Insert Temporary Breakpoint
HEHelp Facility
LOLoad S-Records
MAMacro Define/Display
NOMAMacro Delete
MAEMacro Edit
MALEnable Macro Expansion Listing
M68CPU32BUG/D REV 13-29
Page 60
DEBUG MONITOR COMMANDS
HEHelpHE
NOMALDisable Macro Expansion Listing
MDMemory Display
MMMemory Modify
M"Alias" for previous command
MSMemory Set
OFOffset Registers
PAPrinter Attach
NOPAPrinter Detach
PFPort Format
RDRegister Display
RESETWarm/Cold Reset
RMRegister Modify
RSRegister Set
SDSwitch Directory
TTrace Instruction
TCTrace on Change of Flow
TMTransparent Mode
TTTrace to Temporary Breakpoint
VEVerify S-Records
CPU32Bug>
To display the command TC, enter:
CPU32Bug>HE TC<CR>
TCTrace on Change of Flow
CPU32Bug>
M68CPU32BUG/D REV 13-30
Page 61
DEBUG MONITOR COMMANDS
LOLoad S-Records From HostLO
3.15 LOAD S-RECORDS FROM HOST
LO [<port><del>][<addr>][;<X/-C/T>][=<text>]
Use the LO command to download a Motorola S-records format data file from a host computer
to the BCC. The LO command accepts serial data from the host and loads it into on-board
memory.
The optional port number allows the user to specify the download port. If this number is omitted,
the default is port 0.
The BCC default hardware configuration consists of one I/O port; P4 on the BCC or P9 on the
PFB. This limits the user to one host computer running a terminal emulation program. To send Srecords, the user must escape out of the terminal emulati on program because the host computer
can not perform terminal emulation and send S-records at the same time. When the host is not in
terminal emulation mode, all status messages from CPU32Bug would be lost. Thus the user must
press <CR> twice after re-entering the terminal emulation program to signal CPU32Bug that
status messages can now be sent.
The optional <addr> field allows the user to enter an offset address. This offset address is added
to the address contained in the address field of each record which causes the records to be stored
in memory at a different location. The contents of the automatic offset register are not added to
the S-record addresses (see OF command). If the address is in the range $0 to $1F and the port
number is omitted, enter a comma before the address to distinguish it from a port number. Only
absolute addresses (i.e., "1000") should be entered, as other addressing modes cause
unpredictable results. An address is allowed here rather than an offset (expression) to permit
support for function codes (see paragraph 2.5).
The optional text field, entered after the equal sign (=), is sent to the host before CPU32Bug
begins looking for S-records at the host port. This allows the user to send a download command
to the host device. This text should NOT be delimited by quote marks. The text string begins
immediately following the equal sign and terminates with the carriage return. If the host is
operating full duplex, the string is echoed back to the host port by the host and appears on the
user’s terminal screen.
In order to accommodate host systems that echo all received characters, the above-mentioned text
string is transmitted to and received from the host one character at a time. After the entire
command is sent to the host, LO looks for a line feed (LF) character from the host, signifying the
end of the echoed command. No data records are processed until this LF is received. If the host
system does not echo characters, LO continues looking for an LF character before data records
are processed. In situations where the host system does not echo characters, it is required that the
first record transferred by the host system be a header record. The header record is not used, but
the LF after the header record serves to break LO out of the loop so data records are processed.
M68CPU32BUG/D REV 13-31
Page 62
DEBUG MONITOR COMMANDS
LOLoad S-Records From HostLO
Other options:
-CIgnore checksum. A checksum for the data contained within an S-record is
calculated as the S-record is read in through the port. Normally this calculated
checksum is compared to the checksum contained within the S-record. If the
compare fails, an error message is sent to the screen on completion of the
download. If this option is selected, then the comparison is not made.
XEcho. As the S-records are read in at the host port, they are echoed to the user’s
terminal. Do not use this option when port 0 is specified.
TTRAP #15 code. This option causes LO to set the target register D4 = ’LO’x, with
x = $0C ($4C4F200C). The ASCII string ’LO’ indicates that this is the LO
command; the code $0C indicates TRAP #15 support with stack parameter/result
passing and TRAP #15 disk support. This code is used by the downloaded
program to select the appropriate calling convention when executing debugger
functions. Since some Motorola debuggers use conventions different from
CPU32Bug, they set a different code in D4.
The S-record format (refer to Appendix A) allows a specified ent ry point in the address field of
the S-record-block termination record. The contents of the termination-record address fi eld (plus
any offset address) is put into the target PC. Thus after a download the user need only enter G or
GO instead of G <addr> or GO <addr> to execute the downloaded code.
If a non-hex character is encountered within the data field of a data record, then that part of the
record, preceeding the non-hex character, is displayed. This causes the CPU32Bug error handler
to point at the faulty character.
An error condition exists if the embedded-record checksum does not agree with the checksum
calculated by CPU32Bug. An output message displays the address of the record (as obtained
from the address field of the record), the calculated checksum, and the checksum read with the
record. A copy of the record is also output. A checksum error is a fatal error and causes the
command to abort.
When a load is in progress, each data byte is written to memory and then the contents of this
memory location are compared to the data to determine if the data is stored properly. If for some
reason the compare fails, then an output message displays the address where the data was to be
stored, the data written, and the data read back during the compare. This is also a fatal error and
causes the command to abort.
S-records are processed character-by-character. So if the command aborts due to an error, all data
stored previous to the error is still in memory .
M68CPU32BUG/D REV 13-32
Page 63
DEBUG MONITOR COMMANDS
LOLoad S-Records From HostLO
EXAMPLESSuppose a host computer was used to create a program that looks like this:
1* Test Program.
2*
365004000ORG$65004000
4
5650040007001MOVEQ.L#1,D0
665004002D088ADD.LA0,D0
7650040044A00TST.BD0
8650040064E75RTS
9END
****** TOTAL ERRORS 0-****** TOTAL WARNINGS 0--
Then this program was converted into an S-record file named TEST.MX as follows:
Load this file into BCC memory for execution at address $4000 as follows:
CPU32Bug>LO -65000000<CR>
Blank line as the BCC waits for an S-record.
Enter the terminal emulator’s escape key to return to the host computer’s operating system (ALTF4 for ProComm). A host command is then entered to send the S-record file to the port where the
BCC is connected (for MS-DOS based host computer this would be "type test.mx >com1", where
the BCC was connected to the com1 port).
After the file has been sent, the user then restarts the terminal emulation program (for MS-DOS
based host computers, enter EXIT at the prompt).
Since the port number equals the current terminal, two <CR>’s are required to signal CPU32Bug
that the download is complete and the terminal emulation program is ready to receive any error
messages.
The <name> can be any combination of 1-8 alphanumeric characters.
The MA command allows the user to define a complex command consisting of any number of
CPU32Bug primitive commands with optional parameter specifications. By simply entering the
new <name> plus any arguments on the command line, the stored CPU32Bug commands are
executed. This allows the user to design new commands to simplify the debug process. The
NOMA command is used to delete either a single macro or all macros.
Entering MA without specifying a macro name causes CPU32Bug to list all currently defined
macros and their definitions.
When MA is executed with the name of a currently defined macro, that macro definition is
displayed.
Line numbers are shown when displaying macro definitions to facilitate editing via the macro
edit (MAE) command. If MA is executed with a valid name that does not currently have a
definition, then the CPU32Bug enters the macro definition mode. In response to each macro
definition prompt "M=", enter a CPU32Bug command and a carriage return. Commands entered
are not checked for syntax until the macro is executed. To exit the macro definition mode, enter
only a carriage return (null line) in response to the prompt. If the macro contains errors, it can
either be deleted and redefined or it can be edited with the MAE command. A macro containing
no primitive CPU32Bug commands (i.e., no definition) is not accepted.
Macro definitions are stored in a string pool of fixed size. If the string pool becomes full while in
the definition mode, the offending string is discarded, a message STRING POOL FULL, LAST
LINE DISCARDED is printed and the user is returned to the CPU32Bug command prompt. This
also happens if the string entered would cause the string pool to overflow. The string pool has a
capacity of 511 characters. The only way to add or expand macros when the string pool is full is
to either edit or delete macros.
CPU32Bug commands contained in macros may reference arguments supplied at invocation
time. Arguments are denoted in macro definitions by embedding a back slash (\) followed by a
numerial. As many as ten arguments are permitted. A definition containing a back slash followed
by a zero would cause the first argument to that macro to be inserted in place of the "\0"
characters.
M68CPU32BUG/D REV 13-34
Page 65
DEBUG MONITOR COMMANDS
MAMacro Define/DisplayMA
NOMA
Macro DeleteNOMA
The second argument is used whenever the sequence "\1" occurs. Entering ARGUE 3000 1 ;B on
the debugger command line would execute the macro named ARGUE with the text strings 3000,
1, and ;B replacing "\0", "\1", and "\2", respectively, within the body of the macro.
To delete a macro, execute NOMA followed by the name of the macro. Executing NOMA
without specifying a macro name deletes all macros. If NOMA is executed with a valid macro
name that does not have a definition, an error message is printed.
<name>any combination of 1-8 alphanumeric characters
<line#>line number in range 1-999
<string>replacement line to be inserted
The MAE command permits modification of the macro named on the command line. MAE is
line oriented and supports the following actions: insertion, deletion, and replacement.
To insert a line, specify a line number between the numbers of the lines that the new line is to be
inserted between. The text of the new line to be inserted must also be specified on the command
line following the line number.
To replace a line, specify its line number and enter the replacement text after the lin e number on
the command line.
A line is deleted if its line number is specified and the replacement line is omitted.
Attempting to delete a nonexistent line results in an error message being printed. MAE does not
permit deletion of a line if the macro consists of only that line. NOMA must be used to remove a
macro. To define new macros, use MA; the MAE command operates only on previously defined
macros.
Line numbers serve one purpose: specifying the location within a macro definition to perform the
editing function. After the editing is complete, the macro definition is displayed with a new set of
line numbers.
M68CPU32BUG/D REV 13-37
Page 68
DEBUG MONITOR COMMANDS
MAEMacro EditMAE
EXAMPLES
CPU32Bug>MA<CR>List definitions of macro ABC.
MACRO ABC
010 MD 3000
020 GO \0
CPU32Bug>
The MAL command allows t he user to view expanded macro lines as they are executed. This is
especially useful when errors result, as the line with the error appears on the display.
The NOMAL command is used to suppress the listing of macro lines during execution.
The use of MAL and NOMAL is a convenience for the user and in no way interacts with the
function of the macros.
M68CPU32BUG/D REV 13-39
Page 70
DEBUG MONITOR COMMANDS
MDMemory DisplayMD
3.19 MEMORY DISPLAY
MD[S] <addr>[:<count>|<addr>][; [B|W|L|DI]]
Use the MD command to display the contents of multiple memory locations. MD accepts the
following data types:
Integer Data Type
B – Byte
W – Word
L – Longword
The default data type is word (W). Integer data types are always displayed in both hex and
ASCII. The DI option enables the resident MCU disassembler. No other option is allowed if DI is
selected.
The optional count argument in the MD command specifies the number of data items to be
displayed, or the number of disassembled instructions to display if the disassembly option is
selected. The default is 8 if no value for <count> is entered. The default count is changed to 128
if the S (sector) modifier is used. After the command has completed, enter <CR> at the prompt
to re-execute the command and display the same number of lines of data beginning at the next
address.
If the address location requested is not displayed, the automatic
offset register is non-zero and has been added to the address. See
the offset (OF) command.
M68CPU32BUG/D REV 13-41
Page 72
DEBUG MONITOR COMMANDS
MMMemory ModifyMM
3.20 MEMORY MODIFY
MM <addr>[;[[B|W|L][A][N]]|[DI]]
Use the MM command (alias M) to examine and change memory locations. MM accepts the
following data types:
Integer Data Type
B – Byte
W – Word
L – Longword
The default data type is word. The MM command (alias M) reads and displays the contents of
memory at the specified address and prompts the user with a question mark ( ? ). The user may
enter new data for the memory location, followed by <CR>, or may simply enter <CR>, which
leaves the contents unaltered. That memory location is closed and the next memory location is
opened.
The user may also enter one of several step control characters, either at the prompt or after
writing new data. Enter one of the following step control characters to modify the command
execution:
V or vThe next successive memory location is opened. This is the default. It
initializes whenever MM is executed and remains initialized until changed
by entering one of the other special characters.
^MM backs up and opens the previous memory location.
=MM re-opens the same memory location. This is useful for examining I/O
registers or memory locations that are changing over time).
.Terminates MM command. Control returns to CPU32Bug.
The N option of the MM command disables the read portion of the command. The A option
forces alternate location accesses only, i.e. skip a byte/word/longword access per the data type in
use.
NOTE
If the address location requested is not displayed, the automatic
offset register is non-zero and has been added to the address. See
the offset (OF) command.
M68CPU32BUG/D REV 13-42
Page 73
DEBUG MONITOR COMMANDS
MMMemory ModifyMM
EXAMPLES
CPU32Bug>MM 3100<CR>Access location 3100.
00003100 1234?<CR>
00003102 5678? 4321<CR>Modify memory.
00003104 9ABC? 8765^<CR>Modify memory and backup.
00003102 4321?<CR>No change, backup still utilized.
00003100 1234? abcd.<CR>Modify memory and exit.
CPU32Bug>MM 3001;LA<CR>Longword access to location 3001.
00003001 CD432187?<CR>Alternate location accesses.
00003009 00068010? 68010+10=<CR>Modify and re-open location.
00003009 00068020?<CR>No change, re-open still utilized.
00003009 00068020? .<CR>Exit MM.
CPU32Bug>MM 4000<CR>Modify WORDs starting at $4000.
00004000 0000? ’A’<CR>Enter ASCII ’A’, right justified.
00004002 0000? ’B’<CR>Enter ASCII ’B’, right justified.
00004004 0000? ’CD’<CR>Enter ASCII ’CD’, right justified.
00004006 0000? ’EFG’<CR>Enter ASCII ’FG’, right justified. Note the ’E’ is
The DI option activates the one-line assembler/disassembler. All other options are invalid if DI is
selected. The contents of the specified memory location is disassembled and displayed and the
user prompted for an input with a question mark ( ? ). At this point the user has three options:
• Enter <CR> – This closes the present location and continues with disassembly of the
next instruction. The instruction is unchanged.
• Enter a new source instruction followed by <CR> – This actuates the assembler to
assemble the new instruction and generate a disassembly of the object code generated.
• Enter <CR> – This closes the present location and exits the MM command.
If a new source line is entered (second option above), the present line is erased and replaced by
the new source line.
If an error is found during assembly, the caret symbol (^) appears below the suspect field
followed by an error message. The accessed location is redisplayed.
Refer to Chapter 4 for additional information about the assembler.
M68CPU32BUG/D REV 13-43
Page 74
DEBUG MONITOR COMMANDS
MSMemory SetMS
3.21 MEMORY SET
MS <addr>{hexadecimal number}/{’string’}
Use the MS command to write data to memory starting at a specified address. Hex numbers are
not size specific, so they can contain any number of digits (as allowed by command line buffer
size). If an odd number of digits is entered, the least significant nibble of the last byte accessed is
unchanged.
ASCII strings are entered by enclosing them in single quotes (’string’). To include a quote as part
of the string, enter two consecutive quotes.
EXAMPLEMemory is initially cleared:
CPU32Bug>ms 25000 0123456789abcDEF ’This is ’’CPU32Bug’’’ 23456<CR>
CPU32Bug>md 25000:10;w<CR>
00025000 0123 4567 89AB CDEF 5468 6973 2069 7320.#Eg.+MoThis is
If the address location requested is not displayed, the automatic
offset register is non-zero and has been added to the address. See
the offset (OF) command.
The MS command stores all data on a byte-by byte basis and thus
should not be used on any locations that require word accessing
only, such as the MC68332 TPU registers. For those locations
requiring word accessing, use the memory modify (MM) command
with the ;W or ;L option.
M68CPU32BUG/D REV 13-44
Page 75
DEBUG MONITOR COMMANDS
OFOffset Registers Display/ModifyOF
3.22 OFFSET REGISTERS DISPLAY/MODIFY
OF [Rn[;A]]
The OF command allows the user to access and change pseudo-registers called offset registers.
These registers are used to simplify the debugging of relocatable and position independent
modules (refer to offset registers in paragraph 2.1.1.3).
There are 8 offset registers (R0 through R7), but only R0 through R6 can be changed. Both the
base and top addresses of R7 is always set to 0. This disables the automatic register function by
selecting R7 as the automatic register.
Each offset register has two values: base and top. The base is the absolute least address used for
the range declared by the offset register. The top address is the absolute greatest address used.
When entering the base and top, the user may use either an address/address format or an
address/count format. When specifying a count the value of count is in bytes. If the top address is
omitted from the range, then a top address of $FFFFFFFF is the default. The top address must
equal or exceed the base address. Wrap-around is not permitted.
Command usage:
OFDisplay all offset registers. An asterisk indicates which register is the
OF RnDisplay/modify Rn. Scroll through the registers using the same method as
OF Rn;ADisplay/modify Rn and set it as the automatic register. The automatic
Range entry:
Ranges are entered in three formats; base address alone, base and top as a pair of
addresses, and base address followed by byte count. Step control characters as
described in the MM (memory modify) command are supported.
Range syntax:
automatic register.
the MM command.
register is added to the absolute address argument of every command
except if an offset register is explicitly added. in the display an asterisk
indicates which register is the automatic register.
[<base address> [<del> <top address>] ] [^|v|=|.]
or
[<base address> [ : <byte count> ] ] [^|v|=|.]
M68CPU32BUG/D REV 13-45
Page 76
DEBUG MONITOR COMMANDS
OFOffset Registers Display/ModifyOF
Offset register rules:
• At power-up and cold-start reset, R7 is the automatic register, and all offset registers
have both base and top addresses preset to 0. This disables the offset registers.
• R7 always has both base and top addresses set to 0; it cannot be changed.
• Any offset register can be set as the automatic register.
• The automatic register is always added to every absolute address argument of every
CPU32Bug command where an offset register is not explicitly defined (this includes
the OF command itself). To enter an absolute address, always add R7 to the address,
i.e. +R7.
• The register commands (RD, RM) do not use the automatic register, i.e. the program
counter is always displayed/entered absolutely. However, the RS (register set)
command does use the automatic register.
• There is always an automatic register. To disable the effect of the automatic register
set R7 as the automatic register. This is the default condition.
EXAMPLESDisplay offset registers. Shows base and top values for each register.
PA attach a printer to a specified port. NOPA detaches a printer from a speci fied port. When the
printer is attached, everything appearing on the computer terminal is echoed to the attached
printer. If no port is specified when executing PA, the default is port 1. NOPA detaches all
attached printers. The port number must be in the range 0 to $1F.
If the port number specified is not currently assigned, PA displays an error message. If NOPA is
attempted on a printer that is not currently attached, an error message is displayed. Use the PF
(port format) command to configure the port before attaching a printer to it.
RECOVERING FROM A ’’HUNG’’PRINTER: attached ports are not detached by exceptions
(bus errors, abort, etc). If PA is executed using incorrect parameters, or a fault such as a paper
jam occurs, press the RESET switch on the M68300PFB Platform Board to recover control of the
printer.
EXAMPLES
CONSOLE DISPLAY:PRINTER OUTPUT:
CPU32Bug>PA <CR>
(attaching port 1 by default)(printer now attached)
CPU32Bug>NOPA <CR>CPU32Bug>NOPA
(detach all attached printers)(printer now detached)
CPU32Bug>
M68CPU32BUG/D REV 13-48
Page 79
DEBUG MONITOR COMMANDS
PFPort FormatPF
3.24 PORT FORMAT
PF [<port>]
Use the PF command to display and change the serial input/output environment. Use PF to
display a list of the current port assignments, configure a port that is already assigned, or assign
and configure a new port. The configuration process is interactive, much like modifying registers
or memory (RM and MM commands). An interlock is provided prior to configuring the
hardware, the user must explicitly direct PF to proceed.
Only eight ports are assigned at any given time. The port number must be within the range 0 to
$1F.
3.24.1 List Current Port Assignments
Executing PF without specifying a port number lists the board and port names.
EXAMPLE
CPU32Bug>PF <CR>
Current port assignments: (Port #: Board name, Port name)
00: BCC, "SCI"
CPU32Bug>
3.24.2 Port Configuration
Use PF to primarily change baud rates, stop bits, etc. Execute the PF command with the desired
port number to assign and configure port parameters. Refer to paragraph 3.20.4 New Port
Assignment.
When PF is executed with the number of a previously assigned port, the interactive mode is
entered immediately. To exit from the interactive mode, enter a period by itself or following a
new value/setting. While in the interactive mode, step control characters as described in the MM
(memory modify) command are supported.
EXAMPLEChange number of stop bits on port number 0.
• Parity type – Set parity: even (E), odd (0), or disabled (N).
• Character width – Select 5-, 6-, 7-, or 8-bit characters.
• Number of stop bits – Only 1 and 2 stop bits are supported.
• Automatic software handshake – Current drivers have the capability of responding to
XON/XOFF characters sent to the debugger ports. Receiving a XOFF causes a driver
to cease transmission until a XON character is received. None of the current drivers
utilize FIFO buffering, therefore, none initiate an XOFF condition.
• Software handshake character values – The values used by a port for XON and XOFF
may be defined as any 8-bit value. ASCII control characters or hexadecimal values are
accepted.
NOTE
Not all combinations of parity type, character width, and stop bits
are supported for the BCC "SCI" port, 00. See Appendix C for
details.
M68CPU32BUG/D REV 13-50
Page 81
DEBUG MONITOR COMMANDS
PFPort FormatPF
3.24.4 New Port Assignment
PF supports a set of drivers for a number of different boards and ports. To assign one of these to
a previously unassigned port number, execute the command with that port number. A message is
then printed to indicate that the port is unassigned and a prompt issued to request the type of
serial communication device. Pressing RETURN at this point lists the currently supported boards
and ports. Once the name of the board is entered, the port name is requested at the prompt. After
the port name is entered, PF prompts the user through the port configuration process.
Once a valid port is specified, default parameters are supplied. The base address of this new port
is one of these default parameters. Before entering the interactive configuration mode, the user is
allowed to change the port base address. Press RETURN to retain the present base address.
If the configuration of the new port is not fixed, then the system enters the interactive
configuration mode. Refer to paragraph 3.20.2 regarding configuring assigned ports. If the new
port has a fixed configuration, then PF issues the ’’OK to proceed (Y/N)?’’ prompt.
The user must enter the letter ’’Y’’ at the ’’OK to proceed (Y/N)?’’ prompt before PF initializes the
hardware. Pressing BREAK any time prior to this step or responding with the letter ’’N’’ at the
prompt leaves the port unassigned. This is only true of ports not previously assigned.
EXAMPLEAssigning port 1.
CPU32Bug>PF 1<CR>
Logical unit $01 unassigned
Name of board?<CR>
Boards and ports supported:
BCC: SCI
MC68681: A, B
Name of board? mc68681<CR>
Name of port? a<CR>
Port base address = $FFFFE000?<CR>
Baud rate [110, 300, 600, 1200, 2400, 4800, 9600, 19200] = 9600? .<CR>
Use the RD command to display the target state, that is, the register state associated with the
target program (refer to the GO command). The target PC points to the instruction to be
disassembled and displayed. Internally, a register mask specifies which registers are displayed
when RD <CR> is executed. At reset time, this mask is set to display the MPU registers only.
Change this register mask with the RD command. Optional arguments allow the user the
capability to enable or disable the display of any register or group or registers. This is useful for
showing only the registers of interest, minimizing unnecessary data on the screen.
The arguments are:
+Add a device or register range
-Remove a device or register range, except when used between two register
names. In which case it indicates a register range.
=Set a device or register range.
/Use this delimiter between device names and register ranges.
<reg1>Indicates the first register in a range of registers.
<reg2>Indicates the last register in a range of registers.
<dname>Indicates a device name. Use <DNAME> to enable or disable all device
registers for:
MPUMicroprocessor Unit
M68CPU32BUG/D REV 13-52
Page 83
DEBUG MONITOR COMMANDS
RDRegister DisplayRD
Observe the following when specifying any arguments in the command line:
• The qualifier is applied to the next register range only.
• If no qualifier is specified, a + qualifier is assumed.
• All device names should precede register names.
• The command line arguments are parsed from left to right, with each field being
processed after parsing, thus, the sequence in which qualifiers and registers are
organized has an impact on the resultant register mask.
• When specifying a register range, <REG1> and <REG2> do not have to be of the
same class, i.e. D0 - A7.
• The register mask used by RD is also used by all the exception handler routines,
including the trace and breakpoint exception handlers.
An asterisk following a stack pointer name indicates an active
stack pointer. To facilitate reading the status register it includes a
mnemonic portion. These mnemonics are:
Trace BitsThe trace bits (T0, T1) control the trace feature of the MCU and are
displayed by the mnemonic as shown in the following table. The user
should not modify these bits when executing user programs.
T1T0MnemonicDescription
00TR:OFFTrace off
01TR:CHGTrace on change of flow
10TR:ALLTrace all states
11TR:INVInvalid mode
S BitsThe bit name (S) appears if the supervisor/user state bit is set, otherwise a
period (.) indicates it is cleared.
Interrupt MaskA number from 0 to 7 indicates the current processor priority level.
Condition CodesThe bit name (X, N, Z, V, C) appears if the respective bit is set, otherwise
a period (.) indicates it is cleared.
M68CPU32BUG/D REV 13-54
Page 85
DEBUG MONITOR COMMANDS
RDRegister DisplayRD
The source and destination function code registers (SFC, DFC) include a two character
mnemonic:
Function CodeMnemonicDescription
0F0Undefined
1UDUser Data
2UPUser Program
3F3Undefined
4F4Undefined
5SDSupervisor Data
6SPSupervisor Program
7CSCPU Space
Note that an equivalent command is ’’RD +PC-A7’’ or ’’RD =PC-A7’’.
M68CPU32BUG/D REV 13-55
Page 86
DEBUG MONITOR COMMANDS
RESETCold/Warm ResetRESET
3.26 COLD/WARM RESET
RESET
Use the RESET command to specify the reset operation level when a RESET exception is
detected by the processor. Press the RESET switch on the M68300PFB platform board to
generate a reset exception.
Two RESET levels are available:
COLDThis is the standard mode of operation, and is the default at power-up. In
this mode all the static variables are initialized every time a reset is
executed.
WARMIn this mode all the static variables are preserved when a reset exception
occurs. This is convenient for keeping breakpoints, offset register values,
the target register state, and any other static variables in the system.
EXAMPLE
CPU32Bug>RESET<CR>
Cold/Warm Start = C (C/W)? W<CR>
CPU32Bug>
Set to warm start.
Press the RESET pushbutton.
CPU32Bug Debugger/Diagnostics - Version 1.00
(C) Copyright 1991 by Motorola Inc.
Warm Start
CPU32Bug>
M68CPU32BUG/D REV 13-56
Page 87
DEBUG MONITOR COMMANDS
RMRegister ModifyRM
3.27 REGISTER MODIFY
RM <reg>
Use the RM command to display and change the target registers. The RM command functions in
essentially the same way as the MM command, and the same step control characters are used to
control the display/change session. Refer to the MM command.
Use the RS command to display or change a single target register. The default offset register
value is always added to <exp> unless overridden by specifically including an offset register. See
the OF (offset register) command.
The ;A option is only valid when <reg> is an offset register, i.e. R0 - R7. Use the ;A option to set
<reg> as the automatic register. If R7 is specified, no <exp> is allowed (R7 cannot be changed).
See the OF (offset register) command.
EXAMPLES
CPU32Bug>RS PC 40*1000+4<CR>
PC =00040004
CPU32Bug>
CPU32Bug>OF R4;A<CR>
R4*00000000 00000000? 4000 4FFF<CR>Set up automatic offset register R4.
CPU32Bug>RS PC 124<CR>
PC =00004124Set PC=$124+R4.
CPU32Bug>RS A4 32A<CR>
A4 =0000432ASet A4=$32A+R4.
CPU32Bug>RS A5 400+R7<CR>
A5 =00000400Set A5 equal to absolute location $400
($400+R7).
CPU32Bug>
M68CPU32BUG/D REV 13-58
Page 89
DEBUG MONITOR COMMANDS
SDSwitch DirectoriesSD
3.29 SWITCH DIRECTORIES
SD
Use the SD command to toggle between the debugger directory and the diagnostic directory.
Use the HE (Help) command to list the current directory commands.
Directory structure allows access to the debugger commands from either directory but the
diagnostic commands are only available from the diagnostic directory.
EXAMPLES
CPU32Bug>SD<CR>
CPU32Diag>
The user has changed from the debugger
directory to the diagnostic directory, as can
be seen by the ’’CPU32Diag>’’ prompt
CPU32Diag>SD<CR>
CPU32Bug>
The user is now back in the debugger
directory.
M68CPU32BUG/D REV 13-59
Page 90
DEBUG MONITOR COMMANDS
TTraceT
3.30 TRACE
T [<count>]
Use the T command to execute one instruction at a time and display the target state after
execution. T starts tracing at the address in the target PC. The optional count field specifies the
number of instructions to be traced before returning control to CPU32Bug. The count field
default is 1. As each instruction is traced, a register display printout is generated.
During tracing, breakpoints in ROM or write protected memory are monitored (but not inserted)
for all trace commands which allow the use of breakpoints in ROM or write protected memory.
Control is returned to CPU32Bug if a breakpoint with 0 count is encountered.
Trace functions are implemented with the trace bits (T0, T1) in the MCU device status register.
Do not modify trace bits (T0, T1) while using the trace commands. Because the t race functions
are implemented using the hardware trace bits in the MCU, code i n ROM can be traced. During
trace mode, breakpoints are monitored and their counts decremented when the corresponding
instruction with breakpoint is traced. This allows breakpoints to work in ROM, but only in the
trace mode.
EXAMPLEThe following program resides at location $7000.
Use the TC command to start execution at the address in the target PC. Tracing begins at
detection of an instruction that causes a change of control flow, such as Bcc, JSR, BSR, RTS,
etc. Execution is in real time until a change of flow instruction is encountered. The optional
count field specifies the number of change of flow instructions to be traced before returning
control to CPU32Bug. The optional count field default is 1. Register display printout only occurs
when a change of control flow occurs.
During tracing, breakpoints in ROM or write protected memory are monitored (but not inserted)
for all trace commands which allow the use of breakpoints. Note that the TC command
recognizes a breakpoint only if it is at a change of flow instruction. Control is returned to
CPU32Bug if a breakpoint with 0 count is encountered. See the trace (T) command for more
details.
The trace functions are implemented with the trace bits (T0, T1) in the MCU device status
register. Do not modify the trace bits (T0, T1) while using the trace commands. Because the trace
functions are implemented using the hardware trace bits in the MCU, code in ROM can be
traced. During trace mode, breakpoints are monitored and their counts decremented when the
corresponding instruction with breakpoint is traced. This allows breakpoints to work in ROM,
but only in the trace mode.
EXAMPLEThe following program resides at location $7000.
Note that the above display also shows the change of flow instruction.
M68CPU32BUG/D REV 13-64
Page 95
DEBUG MONITOR COMMANDS
TMTransparent ModeTM
3.32 TRANSPARENT MODE
TM [<port>][<escape>]
The TM command connects the console serial port and the host port together, allowing the user
to communicate with a host computer. A message displayed by TM shows the current escape
character, i.e., the character used to exit the t ransparent mode. The two ports remain connected
until the escape character is received by the console port. The escape character is not transmitted
to the host and at power up or reset is initialized to $01=^A.
The optional port number allows the user to specify which port is the host port. If the port
number is omitted the default is port 1. The port number must be within the range 0 to $1F.
Ports do not have to have the same baud rate, but for reliable operation the terminal port baud
rate should be equal to or greater than the host port baud rate. Use the PF command to change
baud rates.
The optional escape argument allows the user to specify the exit character. Use one of three
formats:
ascii code:$03Set escape character to ^C
ascii character:’cSet escape character to c
control character:^CSet escape character to ^C
If the port number is omitted and the escape argument is entered as a numeric value, precede the
escape argument with a comma to distinguish it from a port number.
EXAMPLES
CPU32Bug>TM<CR>
Escape character: $01=^ A
<^A>
CPU32Bug>TM ^g<CR>Enter TM and set escape character
Escape character: $07=^ Gto ^ G.
<^G>Exit transparent mode.
CPU32Bug>
Enter TM.
Exit code is always displayed.
Exit transparent mode.
M68CPU32BUG/D REV 13-65
Page 96
DEBUG MONITOR COMMANDS
TTTrace To Temporary BreakpointTT
3.33 TRACE TO TEMPORARY BREAKPOINT
TT <addr>
Use the TT command to set a temporary breakpoint at a specified address and trace until
encountering a 0 count breakpoint. The temporary breakpoint is then removed (TT is analogous
to the GT command) and control is returned to CPU32Bug. Tracing starts at the target PC
address. As each instruction is traced, a register display printout is generated.
During tracing, breakpoints in ROM or write protected memory are monitored (but not inserted)
for all trace commands which allow the use of breakpoints. Control is returned to CPU32Bug if a
breakpoint with 0 count is encountered. See the trace (T) command for more details.
The trace functions are implemented with the trace bit s (T0, T1) in the MCU status register. Do
not modify trace bits (T0, T1) while using the trace commands. Because the t race functions are
implemented using the hardware trace bits in the MCU, code in ROM can be traced. During trace
mode, breakpoints are monitored and their counts decremented when the corresponding
instruction with breakpoint is traced. This allows breakpoints to work in ROM, but only in the
trace mode.
EXAMPLEThe following program resides at location $7000.
VE is identical to the LO command with the exception that data is not stored to memory but
merely compared to the contents of memory.
The VE command accepts serial data from a host system in the form of a Mot orola S -records fil e
and compares it to data already in memory. If the data does not compare, then the user is alerted
via information sent to the terminal screen.
The optional port number allows the user to specify which is the download port. If the port
number is omitted the default is port 0. The port number must be within the range 0 to $1F.
The BCC default hardware configuration consists of one I/O port; P4 on the BCC or P9 on the
PFB. This limits the user to one host computer running a terminal emulation program. To send Srecords, the user must escape out of the terminal emulati on program because the host computer
can not perform terminal emulation and send S-records at the same time. When the host is not in
terminal emulation mode, all status messages from CPU32Bug would be lost. Thus the user must
press <CR> twice after re-entering the terminal emulation program to signal CPU32Bug that
status messages can now be sent.
The optional <addr> field allows the user to enter an offset address which is added to the address
contained in the record address field. This causes the records to be compared to memory at
different locations than would normally occur. The contents of the automatic offset register are
not added to the S-record addresses. If the address is in the range $0 to $1F and the port number
is omitted, precede the address with a comma to distinguish it from a port number. Only absolute
addresses (i.e., "1000") should be entered, as other addressing modes cause unpredictable results.
An address is allowed here rather than an offset (expression) to permit support for function codes
(see paragraph 2.5).
The optional text field, entered after the equals sign (=), is sent to the host before CPU32Bug
begins to look for S-records at the host port. This allows the user to send a command to the host
device to initiate the download. Do not delimited text with quote marks. The text follows the
equals sign and terminates with a carriage return. If the host is operating full duplex, the string
echoes back to the host port and appears on the user’s terminal screen.
Some host systems echo all received characters so the text string is sent to and received from the
host one character at a time. After the entire command is sent to the host, VE looks for an LF
character from the host signifying the end of the echoed command. No data records are processed
until LF is received. If the host system does not echo characters, VE still looks for an LF
character before data records are processed. For this reason it is required in situations where the
M68CPU32BUG/D REV 13-68
Page 99
DEBUG MONITOR COMMANDS
VEVerify S-Records Against MemoryVE
host system does not echo characters that the first record transferred by the host system be a
header record. The header record is not used, but the LF after the header record serves to break
VE out of the loop so that data records are processed.
Other VE options are:
-C optionIgnore checksum. A checksum for the data contained within an S-Record
is calculated as the S-record is read in at the port. Normally, this calculated
checksum is compared to the checksum contained within the S-Record and
if the compare fails, an error message is sent to the screen. If this option is
selected, the comparison is not made.
X optionEcho. This option echoes the S-records to the user’s terminal as they are
read in at the host port. Do not use this option when port 0 is specified.
During a verify operation S-record data is compared to memory. Verification begins with the
address contained in the S-record address field (plus the offset address). If the verification fails,
then the non-comparing record is set aside until the verify is complete and then it is displayed on
the screen. If three non-comparing records are encountered in the course of a verify operation,
then the command is aborted.
If a non-hex character is encountered within the data field, then the received portion of the record
is printed to the screen and CPU32Bug’s error handler points to the faulty character.
An error condition exists if the embedded checksum of a record does not agree with the
checksum calculated by CPU32Bug. A message is displayed showing the address of the record
(as obtained from the address field of the record), the calculated checksum, and the checksum
read with the record. A copy of the record is also output. This is a fatal error and causes the
command to abort.
EXAMPLES
This short program was developed on a host system.
1* Test Program
2*
365004000ORG$65004000
4
565004000 7001MOVEQ.L#1,D0
665004002 D088ADD.LA0,D0
765004004 4A00TST.BD0
865004006 4E75RTS
9END
****** TOTAL ERRORS0-****** TOTAL WARNINGS0--
M68CPU32BUG/D REV 13-69
Page 100
DEBUG MONITOR COMMANDS
VEVerify S-Records Against MemoryVE
Then converted into an S-Record file named TEST.MX as follows:
This file was downloaded into memory using "LO -65000000" at address $4000. The program
may be examined in memory using the MD (memory display) command.
To ensure the program has not been destroyed in memory, use the VE command to perform a
verification.
CPU32Bug>VE -65000000<CR>
Blank line as the BCC waits for an S-record.
Enter the terminal emulator’s escape key to return to the host computer’s operating system (ALTF4 for ProComm). A host command is then entered to send the S-record file to the port where the
BCC is connected (for MS-DOS based host computer this would be "type test.mx >com1", where
the BCC was connected to the com1 port).
After the file has been sent, the user then restarts the terminal emulation program (for MS-DOS
based host computers, enter EXIT at the prompt).
Since the port number equals the current terminal, two <CR>’s are required to signal CPU32Bug
that verification is complete and the terminal emulation program is ready to receive the status
message.