Category : Recently Uploaded Files
Archive   : EMILY52.ZIP
Filename : EMILY52.DOC

 
Output of file : EMILY52.DOC contained in archive : EMILY52.ZIP













==================================================================
EEEEEEE MM MM IIIIIII L Y Y 5555555 22222
E M M M M I L Y Y 5 2 2
E M M M I L Y Y 555555 2
EEEE M M I L Y --- 5 22222
E M M I L Y 5 2
E M M I L Y 5 5 2
EEEEEEE M M IIIIIII LLLLLLL Y 55555 2222222
==================================================================





A
Simulator/Emulator
for the
8051 and 8052





Release 1.4

Revised 11-Oct-94















Copyright 1991-1994 Dave Dunfield
All rights reserved
EMILY: An 8051/52 simulator Page: 1


1. INTRODUCTION

EMILY is a software simulator for the 8051/52 family of
processors. It provides a powerful debugging environment, offering
many features:

- Supports full 64K of PROGRAM and 64K of DATA memory. DATA and
PROGRAM memory may also be overlapped into a single 64K address
space.

- Hardware emulation mode communciates with the target system, and
allows you to include the physical I/O lines, timers etc. in your
simulation.

- Single step, Multi Step, Animate and Full Speed execution modes.

- Simultanious on-screen displays of program disassembly, internal
memory, CPU registers and simulation messages.

- Full screen editors for CPU registers, Special Function Registers
(SFR's), and each of the INTERNAL, EXTERNAL DATA and PROGRAM memory
spaces. All of the above may be viewed/altered at any time during
the debugging session.

- Multiple breakpoints are transparent to the user program.

- Supports the additional SFR's and internal RAM of the 8052 series.

1.1 System Requirements

EMILY will run on any IBM PC/AT/PS2 compatible system with a
MDA/CGA/EGA or VGA display, two COM ports, and at least 192K of
free system RAM.

- If hardware emulation or serial I/O are not used, only one COM
port is required.

- If Overlapped data/program memory is used, only 128K of free ram
is required.

- Some CGA displays may exibit "snow" or flicker during high speed
screen updates. This effect will not occur with MDA, EGA or VGA
displays.
EMILY: An 8051/52 simulator Page: 2


2. STARTING UP EMILY

If you are using the optional hardware emulation mode, insure that
the resident control software (supplied) is inserted into the target
system, and that the PC running EMILY is connected to the target
systems serial port via COM2. Power on the test system before
starting EMILY. The resident control software must be active when
EMILY "looks" for it.

EMILY is invoked by typing her name at the DOS command line. You
will be greeted with a "welcome" screen which displays a reminder of
the command line syntax and the copyright message. This screen will
remain on the display for about 5 seconds (10 seconds in the demo
version). Pressing any key while this screen is visible will bypass
this delay, and proceed directly to the main control panel.

If EMILY is given a file name on the command line, she loads it in
the same manner as if the 'L'oad command had been used from within
the main control panel.
EMILY: An 8051/52 simulator Page: 3


EMILY also accepts several option switches on the command line:

/Hardware[:n] - Enables the hardware emulation feature to cause
EMILY to interact with the target system when
performing I/O accesses. This option may be
followed by a ':' and a numeric value which
defines the BAUD RATE to be used to communicate
with the target system. Default is 28800.

/Mono * - Inhibits the color display, even if a color
adapter is present. This option may be useful
if your monitor/adapter combination provides an
unpleasent or unusable display for EMILY.

/Overlap - Joins EXTERNAL DATA and PROGRAM memory into a
single 64K address space which can be accessed
with either MOVX or MOVC. This is equivalent to
a hardware implementation in which the PSEN and
RD signals are ANDed together.

/Reset - Causes EMILY to de-assert the RTS line when she
initializes the serial port.

/Swapcom - Exchanges the operation of the two serial ports
on the PC. When this option is used, COM1 will
be used to communicate with the target system,
and COM2 is used for serial I/O redirection.
*Note: the EMSETUP program can be used establish
alternate COM ports including COM3 and/or COM4.

* Note: If some of the EMILY windows appear to be an un-readable
washed-out yellow color, try adjusting the color contrast on
your monitor. Those windows should be an easy to read brown.

If you are using the '/Hardware' option, and EMILY is unable to
establish communication with the target system, you will see an error
message flashing on the screen. EMILY will keep trying, allowing you
to debug the connection. You may also press the ESCAPE key to disable
hardware emulation, and proceed with a software only simulation.
EMILY: An 8051/52 simulator Page: 4


3. USING EMILY

3.1 The Main Control Panel

Once EMILY is up and running, you will be presented with the
"Main Control Panel", which consists of four "windows" displaying:

- A disassembly of program memory (Upper LEFT)
- The contents of CPU registers (Upper CENTER)
- The contents of INTERNAL MEMORY (Upper RIGHT)
- Informational messages from EMILY (Lower portion)

All of EMILY'S functions are accessed by command characters
entered from this screen:

3.1.1 A - Animate execution

This function begins execution of the user program (from the
address in the PC register). As each instruction is executed,
EMILY will display the instruction being executed, the CPU
registers, and the contents of internal RAM in the appropriate
windows.

When you enter the 'A' command, EMILY will prompt you for
the number of instructions to animate. Pressing return (without
entering a number) will cause the animation to proceed
non-stop. Pressing will return you to the Main Control
Panel.

The animation will terminate when:

- The requested number of instructions have been stepped.
- A breakpoint is encountered.
- The illegal opcode ($A5) is encountered.
- The key is pressed on the PC console.

3.1.2 B - set Breakpoint

This command sets a breakpoint such that program execution
under the 'A'nimate, or 'G'o, commands will perform an action
when the breakpoint address is encountered.

Up to 10 breakpoints may be in effect at the same time.

You will be prompted for the address (in HEX). Pressing
return (without entering an address) will cause the breakpoint
to be set at the current program counter (PC) location.
Pressing will return you to the main control panel.

EMILY stores the breakpoint addresses internally in a simple
zero terminated list. This allows her to avoid searching a
fixed size table, and helps speed up the operation of the
program, especially when there are few breakpoints. This does
however cause the restriction that you cannot set a breakpoint
at address zero ($0000).
EMILY: An 8051/52 simulator Page: 5


After accepting the address, EMILY will prompt you with a
menu of flags which control the operation of the breakpoint:

(E)nable NO/YES
(W)atchpoint NO/YES
(K)eypress NO/YES
(P)ause NO/YES (delay)
(C)ounter NO/Counter# (current value)
(D)ecrement/stop NO/YES

The (E)nable flag allows the breakpoint to function. You can
clear this flag to temporarily disable a breakpoint without
removing it.

The (W)atchpoint flag causes the breakpoint to update the
EMILY display screens without stopping. This allows you to view
the registers or memory content at various points in your
program.

The (K)eypress flag causes the breakpoint to stop and wait
for a key before proceeding. SPACE will cause the simulation to
proceed, and ESCAPE will halt the program. (W)atchpoint may be
used to cause a display update before the key is requested.

The (P)ause flag causes the breakpoint to delay the number
of milliseconds specified in the breakpoint delay timer. This
is most useful with (W)atchpoint to allow time to view the
displays before the program proceeds.

The (C)ounter option allows you to select one of three
"breakpoint counters" which will be incremented with the
breakpoint is encountered. The program will proceed after the
counter is updated (Does not stop).

The (D)ecrement/stop option is only available when a
(C)ounter is selected, and causes the counter to be decremented
instead of incremented. The program will be halted when the
counter reaches zero. This allows you to specify use a
breakpoint to stop a loop etc. after a certain number of
iterations. To do this enable this option, and set the counter
to the number of times that you want the breakpoint skipped.

The Breakpoint Counters and Delay timer can be viewed and
changed with the F4 (Breakpoint Counter) function.

If none of the option flags are set, a breakpoint will
simply cause the program to halt.
EMILY: An 8051/52 simulator Page: 6


3.1.3 C - Change register

You will be prompted for the CPU register to change. Enter a
character from the following list, ESCAPE to abort, or F1 for a
reminder:

A - A accumulator
B - B accumulator
D - Data pointer (DPTR)
S - Stack pointer
P - Program counter
W - processor status Word
0-7 - general register 0-7

After you have selected the register, you will be prompted
for the new contents (in HEX).

3.1.4 D - edit Data memory

This command allows you to edit EXTERNAL DATA memory using
EMILY's built in memory editor. See the "Memory Editor"
section.

3.1.5 F - display/edit special Function registers

The names and contents of all SFR's are displayed in a menu.
To change a register, enter the character preceeding the ':',
immediately to the left of its name. You will be prompted for
its new contents.

If multiple columns of SFR's are defined, use to
select the column to edit.

When debugging with the hardware emulation option, the
values read/and written to the SFR's will reflect the actual
state of the hardware lines etc. on the target system board.
Pressing any key while in this menu will refresh the display,
and make visible any changes which have occured on the target
system I/O lines etc.

When debugging without the hardware emulator option, SFR's
are simply stored internaly within EMILY's memory.

3.1.6 G - Go: execute program

This function begins high-speed execution of the user
program (from the address in the PC register).

When you enter the 'G' command, EMILY will prompt you for
the number of instructions to execute. Pressing return (without
entering a number) will cause the program to proceed non-stop.
Pressing will return you to the Main Control Panel.
EMILY: An 8051/52 simulator Page: 7


Program execution will terminate when:

- The requested number of instructions have been executed.
- A breakpoint is encountered.
- The illegal opcode ($A5) is encountered.
- The key is pressed on the PC console. *

* NOTE: If you are using 'Local' serial I/O mode, ESCAPE offers
you a menu of execution I/O functions. See the F3 command for
more information.

3.1.7 I - edit Internal memory

This command allows you to edit INTERNAL memory using
EMILY's built in memory editor. See the "Memory Editor"
section.

3.1.8 J - Jump to PC

This command re-positions the disassembly display window (if
necessary) to display the instruction addressed by the current
CPU Program Counter (PC).

3.1.9 K - Kill all breakpoints

Removes ALL breakpoints after prompting for permission to do
so.

3.1.10 L - Load program image

Prompts for the name of a file, and loads it into PROGRAM
memory. The file must be in either INTEL or MOTOROLA hex
download format.

3.1.11 N - Next disassembly window

Advances the disassembler to display the following screen.
Subsequent 'N' commands will proceed to disassemble higher
memory addresses.

3.1.12 P - edit Program memory

This command allows you to edit PROGRAM memory using EMILY's
built in memory editor. See the "Memory Editor" section.

3.1.13 R - Remove a breakpoint

Prompts for the address, and if a breakpoint is set at that
address, it is removed. Pressing return (without entering an
address) will remove the breakpoint at the current program
counter (PC) location.
EMILY: An 8051/52 simulator Page: 8


3.1.14 T - Traceback viewer

In all execution modes, EMILY keeps track of the last 4095
instructions executed. By entering the traceback viewer, you
can examine this recording, and determine program activity up
to 4095 instructions preceeding the one on which execution last
stopped.

The following command keys are available in the viewer:

Up - Backup the display 1 instruction.
Down - Advance the display 1 instruction.
PgUp - Backup the display 50 instructions.
PgDn - Advance the display 50 instructions.
Home - Position to the beginning of recording.
End - Position to the end of recording.
F1 - Display a help summary.
F2 - Prompt for position & move.
F3 - Search backward (in time) for address. *
F4 - Search forward (in time) for address. *
Esc - Exit the Traceback viewer.

* If you press without entering an address, the search
commands will look for the previous or next instance of the
instruction at your current position in the traceback buffer.

Only the instruction executed is saved in the traceback
viewer, the contents of registers, RAM etc. are not recorded.

The instruction at position 0 in the traceback buffer is the
one to which the current PC points, and has not yet been
executed.

3.1.15 U - scroll disassembler Up

Backs up the disassembler to display the previous screen.
Subsequent 'U' commands will proceed to disassemble lower
memory addresses. NOTE: The 'U' command makes an attempt to
insure that the disassembled code is correct, however there is
a possibility that in backing up, the disassembler will align
on an incorrect code boundary, and not be able to detect the
condition.

3.1.16 V - Vector to interrupt

This function prompts you with a menu of the available
8051/52 interrupts. Use the arrow keys to position the cursor
bar to the interrupt you desire to simulate, and press ENTER to
select it. You may use ESCAPE to cancel the function and return
to the Main Control Panel.

EMILY will simulate a long call (LCALL) to the corresponding
interrupt vector address by saving the current Program Counter
on the CPU stack, and reloading it with the vector. Any SFR
bits normally set when the particular interrupt occurs will be
set at this time.
EMILY: An 8051/52 simulator Page: 9


3.1.17 F1 - Help display

Pressing this key displays a summary of the EMILY commands
which are available from the Main Control Panel.

3.1.18 F2 - Set Disassembler Address

Prompts for an address (in HEX), and re-positions the
disassembler window to display instructions beginning at that
address.

3.1.19 F3 - Setup Serial Port

Opens a window displaying the (B)audrate, (P)arity, (D)ata
bits and (S)top bits which are currently configured for the
PC's COM1 serial port.

Press B, P, D or S to cycle to the next corresponding entry.

When Baudrate is selected as 'Local', EMILY will re-direct
the programs serial accesses to the message window. Any
characters which are written to SBUF will be output in the
message window, and any character which are typed at the
keyboard will appear as incomming serial data. When this mode
is active, Pressing ESCAPE in the 'G'o command brings up a menu
of execution options:

End simulation - Stops the 'G'o command.
Send ESCAPE - Send ESCAPE through as a charcter.
Zoom window - Switch to full screen I/O window.

If 'Local' is not selected, EMILY re-directs the programs
serial accesses to the PC's COM1 serial port, however, for
maximum flexibility, the actual data format used may be
configured by this menu.

EMILY allows you to "fine tune" a baud rate, by using the
Up/Down keys. Note that the available baud rate values are
determined by the PC COM port hardware, and may not fall
exactly on the value you wish to use.

Asynchronous communication is specified to work properly as
long as the device is operating within 5% of the intended baud
rate.

For example:

Desired baud rate : 1500
Allowable range (+/- 5%): 1425-1575
Closest PC baud rate : 1496

In the above example, the baud rate produced is within 0.3%
of the desired value, and is therefore well within
specifications.
EMILY: An 8051/52 simulator Page: 10


3.1.20 F4 - Breakpoint Counters

This function presents a the current breakpoint counter
values, as well as the delay timer. You can edit this list with
the cursor keys. Use PgUp to clear the entire field, or PgDn to
clear to the end of the field. A blank field will be
interpreted as ZERO.

3.1.21 F5 - Reset processor

This function performs a "reset" of the simulated processor.
All registers and SFR's are cleared to their default values.
For convienence in debugging code not origined at zero, the PC
register is loaded with the base address of the last file
loaded.

3.1.22 F10 - Shell to DOS

Activating this function suspends the simulator, clears the
screen, and invokes the operating system prompt. Entering the
'EXIT' command returns to the simuation.

3.1.23 - Single step one instruction

Every time you press the bar, EMILY will execute one
instruction, and update the on-screen displays.

3.1.24 PgDn - Advance IRAM display page

Pressing this key advances the internal memory display
window by one page (64 bytes).

3.1.25 PgUp - Backup IRAM display page

Pressing this key backs up the internal memory display
window by one page (64 bytes).

3.1.26 Down - Advance IRAM display line

Pressing the "down arrow" key advances the internal memory
display window by one line (4 bytes).

3.1.27 Up - Backup IRAM display line

Pressing the "up arrow" key backs up the internal memory
display window by one line (4 bytes).
EMILY: An 8051/52 simulator Page: 11


3.2 The Memory Editor

When you activate the 'D', 'I' or 'P' commands from the main
control panel, EMILY will invoke its internal "Memory Editor" to
access the desired memory area. When you are within this editor,
the following commands are available:

3.2.1 F1 - Help display

Pressing this key displays a summary of the EMILY commands
which are available from within the Memory Editor.

3.2.2 F2 - Set Edit Address

Prompts for an address (in HEX), and re-positions the editor
display and cursor to edit at that address.

3.2.3 F3 - Toggle Edit Mode

EMILY allows two edit modes, HEX and ASCII. When in HEX
mode, your cursor will be positioned in the hexidecimal display
portion of the memory memory dump, allowing you to change
memory by entering a new value as two hexidecimal characters.
When in ASCII mode, your cursor will be positioned over the
ASCII portion of the dump, and you can replace memory with
ASCII text typed at the keyboard.

Pressing F3 will toggle between HEX and ASCII mode, causing
your cursor to switch between the corresponding portion of the
memory display.

3.2.4 F4 - Block fill memory

This function prompts with "Starting address", "Ending
address", and "Fill value". Memory between the specified
addresses will be set to the given value.

3.2.5 Up - Move up 1 line

Pressing the UP ARROW causes the cursor to move upwards on
the screen by one line. This reduces the memory edit address by
16 bytes.

3.2.6 Down - Move down 1 line

Pressing the DOWN ARROW causes the cursor to move downwards
on the screen by one line. This increases the memory edit
address by 16 bytes.

3.2.7 Left - Move left 1 byte

Pressing the LEFT ARROW causes the cursor to move to the
left by one byte position. This reduces the memory edit address
by 1 byte.

If the cursor is already at the left hand margin, it will
wrap around to the rightmost position of the previous line.
EMILY: An 8051/52 simulator Page: 12


3.2.8 Right - Move right 1 byte

Pressing the RIGHT ARROW causes the cursor to move to the
right by one byte position. This in increases the memory edit
address by 1 byte.

If the cursor is already at the right hand margin, it will
wrap around to the leftmost position of the following line.

3.2.9 PgUp - Move back 1 page

Pressing the PGUP key causes the editor to move back one
display page. This reduces the memory edit address by 256
bytes.

3.2.10 PgDn - Move forward 1 page

Pressing the PGDN causes the editor to move forward one
display page. This increases the memory edit address by 256
bytes.

3.2.11 Home - Move to start of line

Pressing the HOME key causes the cursor to move to the
leftmost position of the line it is currently on. If the cursor
was already in the leftmost position, it is moved to the
leftmost position of the preceeding line.

3.2.12 End - Move to end of line

Pressing the END key causes the cursor to move to the
rightmost position of the line it is currently on. If the
cursor was already in the rightmost position, it is moved to
the rightmost position of the following line.

3.2.13 Ctrl-PgUp - Move to start of memory

Pressing the CTRL and PGUP keys re-positions the editor
display and cursor to address $0000 at the start of the memory
block.

3.2.14 Ctrl-PgDn - Move to end of memory

Pressing the CTRL and PGDN keys re=positions the editor
display and cursor to the highest address available in the
memory block.
EMILY: An 8051/52 simulator Page: 13


3.3 Hardware Emulation

EMILY supports a hardware emulation mode, which provides access
to most of the physical I/O ports, timers etc. from the target
system in your simulation.

The target system must be running the supplied control
software, which interacts with EMILY, and perform the I/O accesses
upon her commands. The serial port of the target system must be
connected to the COM2 serial port of the PC.

There are a few restrictions which apply:

- The target system must provide access to the CPU serial port.

- There is an approximatly 0.7 MS delay when accessing the I/O
ports and other physical hardware. This occurs due to the
serial activity required to communicate the data to and from
the target system. For most applications, this delay is
acceptable, particularly in the stop/start environment of
simulation and debugging. NOTE: If you are using a baudrate
to communicate with the target system which is lower than the
default (28800), this delay will be longer.

- The control software uses TIMER1 internally to generate the
baud rate clock for its serial port. This means that TIMER1
is unavailable during the simulation. If your application
uses the serial port, we recommend you also use TIMER1 as the
baud rate generator. Since EMILY has a separate setup memu
for serial port speed, parity etc. It will not affect your
program that TIMER1 is disabled during the simulation. Simply
press F3 at EMILY's main control panel, and select the serial
parameters you desire.

When using this (Hardware Emulation) feature, the Resident
Control Firmware should be running in the target system BEFORE
executing EMILY. Be sure to specify '/H:' parameter on the
command line when starting EMILY.

The value of depends on the target systems operating
frequency. A complete description of its calculation, as well as a
table of common values is located in the introductory comments of
the KERNAL.ASM source file.
EMILY: An 8051/52 simulator Page: 14


3.4 Messages

During the course of operation, EMILY may display the following
messages in the message window located in the lower portion of the
screen:

3.4.1 All Used!

You have tried to enter a breakpoint, when all available
breakpoints are in use. EMILY allows up to 10 code breakpoints
to be active at any one time.

3.4.2 Animating at XXXX

Indicates that EMILY has commenced animated execution of
your program, beginning at the address 'XXXX'.

3.4.3 Already set!

Issued to indicate that the address at which you have tried
to set a breakpoint is already active as a breakpoint.

This message will also result of you attempt to set a
breakpoint at address zero ($0000).

3.4.4 Breakpoints: [XXXX ...]

This message shows the currently set breakpoint addresses,
and is issued whenever any command involving breakpoints is
performed.

3.4.5 Executing at XXXX

Indicates that EMILY has commenced full speed exection of
your program, beginning at the address 'XXXX'.

3.4.6 Code and data are overlapped

This message results from the use of the '/Overlap' switch
on the EMILY command line, and indicates that the external CODE
and DATA memory address spaces are combined into a single
overlapping 64K segment.

3.4.7 Code and data are separate

Indicate that EMILY has established separate 64K memory
address spaces for the code and data, resulting in 128K total
external memory.

3.4.8 FILENAME: Bad checksum

EMILY has encountered a record containing a incorrect
checksum value while attempting to 'L'oad the named file.
EMILY: An 8051/52 simulator Page: 15


3.4.9 FILENAME: Demo limit exceeded!

This message occurs only in the "Demonstration" version of
EMILY, and indicates that you have attempted to 'L'oad more
than 500 bytes of code. The demonstration release is intended
only to allow you to check out EMILY's features, you must
purchase the "production" version if you intend to use the
program for serious development and debugging.

3.4.10 FILENAME: Invalid HEX record

EMILY has encountered an improperly formatted download
record while attempting to 'L'oad the named file.

3.4.11 FILENAME: N bytes loaded

The indicated number of bytes have been successfully
'L'oaded from the named file.

3.4.12 FILENAME: Unable to access

EMILY was unable to open and read the named file.

3.4.13 Hardware emulation is disabled

Indicates that the EMILY is running as a software only
simulator, and will emulate special functions registers etc.
using internal RAM memory.

3.4.14 Hardware emulation is enabled

Issued if the "/Hardware" switch was used on the EMILY
command line, and the Resident Control Software in the target
system has been detected. In this mode of operation, special
function register accesses are communicated to the control
software, and result in physical activity on the target system.

3.4.15 Stopped at XXXX

Indicates that EMILY has stopped execution of you program at
the indicated address. This message is appended to the initial
message indicating that execution had commenced.

3.4.16 Target system is not responding!!!

Indicates that the "/Hardware" option switch was used on the
EMILY command line, but EMILY cannot establish communication
with the target system. EMILY will keep trying, allowing you to
attempt to debug the connection. You may also press the ESCAPE
key, to disable hardware emulation mode, and proceed with a
software only simulation.
EMILY: An 8051/52 simulator Page: 16


3.4.17 XXXX: Not found

This message is issued while in the 'T'raceback viewer, to
indicate that an address 'XXXX' you have searched for does not
occur between your current position, and the start/end of the
traceback buffer.



EMILY: An 8051/52 simulator

TABLE OF CONTENTS


Page

1. INTRODUCTION 1

1.1 System Requirements 1

2. STARTING UP EMILY 2


3. USING EMILY 4

3.1 The Main Control Panel 4
3.2 The Memory Editor 11
3.3 Hardware Emulation 13
3.4 Messages 14