#
Chapter 2 User Interface

The BSVC graphical user interface provides friendly access to the otherwise character-based simulators developed using the BSVC simulation framework. This chapter discusses the various features of the user interface.

Invoking BSVC

If you are using Unix the BSVC user interface is invoked by typing the following command:

bsvc

If you are using Windows then you should select BSVC from the Start menu. Once invoked, the BSVC user interface should appear as shown in Figure 2-1. At this point the only options available are the drop down menus. These menus and other features of the user interface are discussed in the following sections of this chapter.

FIGURE 2-1 BSVC User Interface at Start-Up
File Menu

This menu allows you to create a new setup, open an existing setup, save the current setup, load a program, and quit BSVC. A simulator setup consists of a simulator and a list of devices attached to the simulator. Once BSVC is invoked the first step is to load an existing setup or create a new setup.

Creating a New Setup

- Choose the "New Setup..." option
- Enter the name of the simulator to execute (e.g. Sim68000, etc.)
- Use the device setup dialog that appears to attach devices to the simulator (See "Device Management")

Opening an Existing Setup

- Choose the "Open Setup..." option
- Select the setup file to load using the file selector

Saving a Setup

- Choose the "Save Setup..." option
- Select or enter a file name using the file selector

Loading a Program

- Choose the "Load Program..." option
- Choose the object file to load using the file selector

Quitting BSVC

- Choose the "Quit" option

Edit Menu

This menu allows you to modify the simulator's device setup by attaching or detaching devices.

Editing the Device Setup

- Choose the "Device Setup..." option
- Use the dialog that appears to edit the device setup (See "Device Management")

Device Management

Whenever a setup is created or edited the dialog in Figure 2-2 is displayed. Using this dialog devices can be attached and detached from the simulator.

FIGURE 2-2 Device Setup Dialog
Attaching a Device

- Select the device to attach from the available device list and press the "Attach" button
- Setup the device using the device's setup dialog. An example of a device setup dialog is shown in Figure 2-3.

Detaching a Device

- Select the device to remove from the attached device list
- Press the "Detach" button

FIGURE 2-3 Ram Setup Dialog
Detaching all Devices

- Press the "Detach All" button to detach all of the devices from the simulator

Window Menu

In addition to the main BSVC window that appears upon executing BSVC there are two other windows that are very useful. This menu allows you to open the memory viewer and the program listing windows.

Viewing the Simulator's Memory

- Choose the "Memory Viewer" option
- Use the memory viewer to view the desired memory locations (See "Memory Viewer")

Source Level Debugging

- Choose the "Program Listing" option
- Use the program listing to help with your debugging (See "Program Listing")

Memory Viewer

After the "Memory Viewer" option from the "Window" menu has been selected the memory viewer utility will appear as shown in Figure 2-4. This utility allows the simulator's memory to be dumped to a file, altered, and viewed.

FIGURE 2-4 Memory Viewer
File Menu

This menu allows you to dump memory to a file and close the memory viewer.

Dumping Memory to a File

- Choose the "Dump..." option
- Enter the starting and ending address of the memory dump in the dialog that appears
- Select or enter a file name using the file selector

Closing the Memory Viewer

- Choose the "Close" option

Edit Menu

This menu allows you to modify a single memory location or a block of memory.

Changing a Memory Location

There are two ways to change a memory location. The first way is to:

- Choose the "Change Memory Location..." option
- Enter the memory location and the value to change it to in the dialog that appears

The second way is to:

- Use the left mouse button to select a memory location to change
- Enter the value to change the location to in the dialog that appears

Filling a Memory Block

- Choose the "Fill Memory Block..." option
- Enter the starting address of the block, the length of the block and the value to fill the block with in the dialog that appears

View Menu

This menu allows you to specify the starting address for the memory display.

Viewing from a Specified Address

- Choose the "From Address..." option
- Enter the address to start the memory display at in the dialog that appears

Viewing from the Start of Memory

- Choose the "From Start of Memory" option

Viewing from the Value of a Register

- Choose the "From Register..." option
- Select the register you want to start the memory display at from the dialog that appears

Scrolling through Memory

The arrow icons in the upper right hand corner of the window can be used to scroll through memory a line or a screen at a time.

- Press the "Up Arrow" button to scroll up one line
- Press the "Down Arrow" button to scroll down one line
- Press the "Double-Up Arrow" button to scroll up one screen
- Press the "Double-Down Arrow" button to scroll down one screen

The up-arrow, down-arrow, page-up and page-down keys can also be used to scroll through memory.

Notes

1. In general it's a bad idea to view memory mapped I/O devices because some devices do things depending on how many times a register has been read or written. If the Memory Viewer is used to view one of these registers it could interfere with the simulation.
2. Addresses that do not map to a device will appear as "xx".
3. Having the memory viewer open while single-stepping through a program will cause the simulation to run slower.

Program Listing

After you select the "Program Listing" option from the "Window" menu the window in Figure 2-5 should appear. This utility allows assembly listing files generated by an assembler to be loaded and viewed. While you single-step through a program the program listing will be automatically repositioned according to the current value of the program counter. This can be really useful when debugging a program. You can also set and clear breakpoints by clicking on a source code line with the left mouse button.

FIGURE 2-5 Program Listing
File Menu

This menu allows you to load an assembler listing and to close the program listing.

Loading a Listing

Since the program listing is automatically loaded whenever you load a program you should not need to use this option. However, if you do then:

- Choose the "Load..." option
- Select the listing file to load from the file selector

Closing the Program Listing

- Choose the "Close" option

Edit Menu

This menu allows you to find a string and to clear all the breakpoints that have been set.

Finding a String

- Choose the "Find..." option
- Enter the string (or regular expression) you wish to find in the dialog that appears

Clearing All Breakpoints

- Choose the "Clear Breakpoints" options

Notes

1. Having the Program Listing dialog open while single-stepping through a program will slow down the simulation.
2. Sometimes an incorrect line will be highlighted.

Register Manipulation

Once a simulator is executing the register list will appear as shown in Figure 2-6. The values of the registers will be updated as you execute a program.

Modifying a Register's Value

- Select a register to modify using the left mouse button
- Select the "Alter..." option from the "Registers" menu
- Enter the new hexadecimal value for the register

Clearing all the Registers

- Select the "Clear All" option from the "Registers" menu

FIGURE 2-6 Register List
Simulator Statistics

Some simulators keep simulation statistics. These statistics might include the number of instructions executed, the number of reads and writes to memory, and any other statistics the simulator designer wants. If a simulator keeps statistics they will be displayed in the statistics list as shown in Figure 2-7.

Clearing Statistics

- Select the "Clear All" option from the "Statistics" menu

FIGURE 2-7 Hector 1600 Simulator Statistics
Program Execution and Control

The program execution and control area of the user interface is shown in Figure 2-8. These controls allow setting breakpoints, single stepping, running, and system resetting.

FIGURE 2-8 Execution Control Area
Breakpoints

Breakpoints can be set or cleared using the breakpoint dialog displayed when the "Breakpoints" button is pressed. The breakpoint dialog is shown in Figure 2-9. In general it's much easier to use the breakpoint facility in the program listing utility than to use this approach.

Adding Breakpoints

- Select the "Add" entry field
- Enter the breakpoint's address and press return

Removing Breakpoints

- Select the breakpoints to remove using the left mouse button
- Press the "Remove" button

FIGURE 2-9 Breakpoint Dialog
Single Stepping

- Pressing the "Single Step" button will execute the next instruction and display a trace record in the trace window.

Running

- Pressing the "Run" button causes the simulator to execute instructions until a fatal error occurs, a breakpoint is reached, or execution is stopped

Stopping Execution

- After the "Run" button is pressed its label changes to "Stop"
- Pressing the "Stop" button tells the simulator to stop executing instructions

Reset

- Pressing the "Reset" button causes the simulator to perform a system reset

Trace Window

Every time an instruction is executed using the single step button a trace record will be displayed in the trace window. The actual contents of a trace record are simulator specific. The trace window is shown in Figure 2-10.

FIGURE 2-10 Trace Window
Saving Contents

- Select the "Save Contents..." option from the "Trace" menu
- Select or enter a file name using the file selector

Clearing Contents

- Select the "Clear Contents" option from the "Trace" menu

Inserting Registers

- Select the "Insert Registers" option from the "Trace" menu to insert the register list into the trace window

Inserting Statistics

- Select the "Insert Statistics" option from the "Trace" menu to insert the statistics into the trace window

Setting Trace Preferences

- Select the "Trace Preferences..." option from the "Trace" menu
- Select the trace record entries to display using the dialog that appears

Bugs

Although the user interface has been designed to handle most errors it's not foolproof.

1. If the simulator process dies for some reason the user interface will freeze up. This will hopefully be fixed in a future release.
2. If a program that never does any output is ran as a simulator the user interface will lockup (e.g., 'cat' instead of 'Sim68000').
3. Not all of the Tcl/Tk errors are trapped by the user interface in its current incarnation. Therefore the default Tcl/Tk error dialog will be displayed.

This document was produced using an evaluation version of HTML Transit