hsw12asm

Introduction

The HSW12 IDE is a debugging tool for HC(S)12 assembler code. It is written in Perl/Tk and provides an interface to the D-BUG12 POD. It comes with its own assembler which has been written in Perl as well. This document gives a quick overview on how to use this software.

Start the HSW12 IDE as follows:
perl hsw12.pl [<file name>] The optional argument can be either an Assembler file (*.s) of an HSW12 session (*.hsw12).

Menu Bar

The HSW12 GUI is split up into several windows to give you the freedom to place its components anywhere on the screen. When you launch "hsw12.pl" the six HSW12 windows will pop up on the screen:
1Menu Bar
2Terminal Window
3Source Code Window
4Variables Window
5Registers Window
6Control Window

Menu Bar

Menu Bar

There are four menu buttons in the menu bar:
1File Menu Button
2Preferences Menu Button
3Window Menu Button
4Help Menu Button

File Menu Button

File Menu Button

The File Menu contains ten entries:
1New Session
Starts a new HSW12 session.
2Restore Session
Restores a previous HSW12 Session.
3Save Session
Saves the current HSW12 Session.
4Save Session as...
Saves the current HSW12 Session in a new file.
5Load Source Code
Loads an assembler source code file.
6Recompile Source Code
Recompiles the current assembler file.
7Save List File
Dumps an assembler listing.
8Save Linear S-Record
Dumps a linear S-Record file.
9Save Paged S-Record
Dumps a paged S-Record file.
10Quit
Quits the HSW12 IDE.

Preferences Menu Button

I/O Menu Button

The Preferences menu allows you to select:
1Terminal I/O Parameters
2S-Record Format
3Address Mode

Terminal I/O Parameters

Terminal I/O Parameters

The I/O parameters that need to be set are:
1Serial Port
2S-Record Format
Serial Port
I/O Port

1This menu selects the port that your D-Bug12 POD is connected to. (Be careful! Don't select the port that your mouse is connected to.)
Baud Rate
Baud Rate

1This menu gives you a few choices to select the baud rate.

S-Record Format

S-Record Format

There are four setup options to select the S-Record format:
1S-Record Address Format
2S-Record Data Length
3S5-Record Insertion
4S-Record Fill Bytes
S-Record Address Format
S-Record Address Format

1The D-Bug12 POD supports two address formats:
S-Record Data Length
S-Record Data Length

The number of data bytes per S-record can be selected in 1this menu.
S5-Record Insertion
S5-Record Insertion

S5-Records contain the number of S-Records that have already been transmitted. 1This menu determines how frequently S5-Records should be sent. 2"None" disables the insertion of S5-Records.
S-Record Fill Bytes
S-Record Fill Bytes

Most target devices only allow full words to be programmed into their flashes. 1 The "Fill Bytes" ensures that all S-Records contain an even number of bytes by inserting $FF wherever necessary.

Address Mode

Address Mode

If 1this is disabled HSW12 will truncate all addresses down to 16-Bit. If it is enabled addresses in the range from $8000 to $C000 are 24-Bit wide.

Window Menu Button

Window Menu Button

The Window Menu lets you reopen or raise a particular 1HSW12 window. The 2"All Windows" function reopens or raises all of the HSW12 windows. If the 3"connect" checkbutton is set, then all the HSW12 windows are connected. Moving one window will make all of them move.

Help Menu Button

Help Menu Button

At the moment the Help Menu only consists of an 1"About" screen which contains the version numbers of the current HSW12 release.

Terminal Window

Terminal Window

The Terminal Window consists of:
1Terminal Display
2Command Entry
3Upload Button
4Clear Button
5Macro Buttons

Terminal Display

The Terminal Display logs all data that is received from the D-Bug12 POD. If the display widget is in focus, all keyboard entries will be directly transmitted to the POD.

Command Entry

The Command Entry allows quick transmissions of recurring commands.

Upload Button

The Upload Button sends the linear S-Record to the B-Bug12 POD.

Clear Button

The Clear Button resets the Terminal Display.

Macro Buttons

Each of the Macro Buttons can store a sequence D-Bug12 command. A left-click on the button will execute the macro. A right-click will open a Macro Editor.

Macro Editor

The two entry fields in the Macro Editor let you modify 1the macro name and 2the macro sequence. Please find a description of the HSW12 Macro Language below

Source Code Window

Source Code Window

The Source Code Window has four elements:
1Source Code Display
2Follow PC Switch
3Address Search
4Text Search

Source Code Display

The Source Code Display shows the assembler listing with syntax highlighting. Double-clicking on any line of code will open up a text editor. The preferred editor can be selected through the following environment variables:
$HSW12_EDITOR
The $HSW12_EDITOR variable should contain a string to launch your favorite editor. It should contain the two symbols "%f" and "%l" which will be substituted by the file name and the line number, i.e.: "emacs +%l %f"
$WINEDITOR
If $HSW12_EDITOR isn't set HSW12 will look for the variable $WINEDITOR. This variable should only contain the plain editor call. The string "+%l %f" will be appended to the variable's contents automatically.
$EDITOR
If none of the above variables are set HSW12 will try to read the $EDITOR variable. This variable works just like $WINEDITOR except that the editor will be executed in a new "xterm" window. Other terminal windows can be selected through the variable $HSW12_TERMINAL.
If no editor is selected, then "emacs" will be launched as default.

Follow PC Switch

If the Follow PC Switch is enabled, the Source Code Display will show the current address every time the PC or PPAGE registers change. The current PC is determined by: PPAGE:PC.

Address Search

The Address Search field allows you to display a certain address in the Source Code Display. The entry expects an HSW12 assembler expression.

Text Search

The Text Search field lets you parse the source code for text strings. The entry expects a regular expression.

The Variables Window

Variables Window

The Variables Window contains:
1Variables Display
2Variables Entry
3Edit Button

Variables Display

The Variables Display shows a selection of monitored memory locations in the MCU. The selection is done through an HSW12 macro.

Variables Entry

The Variables Entry lets you modify memory locations in the MCU. There are three entry fields for:

Each entry expects an HSW12 assembler expression.

Edit Button

Macro Editor

The Edit Button opens an Editor for 1HSW12 Macros to modify the display format.

Registers Window

Registers Window

The Register Window lets you view and alter the MCU's register contents. Its window elements are:
1Current Register Values
2Registers Entry
3PPAGE Address

Current Register Values

The Current Register Values are the monitored contents of the MCU's registers.

Registers Entry

The Registers Entries allow you to modify the register contents.

PPAGE Address

The PPAGE Address field tells the HSW12 IDE at which memory location to find the PPAGE register.

The Control Window

Control Window

The Control Window has three elements:
1Breakpoint Entry
2Program Execution Control
3Update Button

Breakpoint Entry

The Breakpoint Entry allows you to set breakpoints to interrupt the program execution.

Program Execution Control

The Program Execution Control buttons invoke several D-Bug12 commands to control the MCU's program execution.

Update Button

This button updates all displayed variables and registers.

HSW12 Macro Language

The HSW12 Macro Language is very simple. It only consists of two elements:

Regular Output Text

Regular Output Text is any text that is not a Macro Command. This text will be outputted unaltered.

Macro Commands

Macro Commands are surrounded by brackets [...]. The HSW12 IDE knows five different macro commands. Some of them are not available for Variables Display macros:
[update]
Updates all variable and register displays.(Not available for Variables Display macros)
[upload linear] ([upload])
Uploads the linear S-Record to the D-Bug12 POD.(Not available for Variables Display macros)
[upload paged]
Uploads the paged S-Record to the D-Bug12 POD. (Not available for Variables Display macros)
[recompile]
Recompiles the current assembler file. (Not available for Variables Display macros)
[evaluate <expression> <format>]
Evaluates an HSW12 assembler expression (first argument) and outputs the result. The second argument determines the output format of the integer result. Valid output formats are:
nb: n byte integer in binary format
nd: n byte integer in decimal format
nh: n byte integer in hexadecimal format
na: n character ASCII string
[lookup <expression> <format>]
Evaluates an HSW12 assembler expression (first argument) and reads the content of this memory address from the MCU. The output is formated as above. If this Macro Command is executed from a Terminal macro, no data will be read from the MCU; only cached data will be used.