While every effort has been made to ensure the accuracy of all information
in this document, Motorola assumes no liability to any party for any loss or
damage caused by errors or omissions or by statements of any kind in this
document, its updates,supplements, or special editions, whether such errors
are omissions or statementsresulting from negligence,accident, or any other
cause. Motorola further assumes no liability arising out of the application or
use of any information, product, or system described herein; norany liability
for incidental or consequential damages arising from the use of this
document. Motorola disclaims all warranties regarding the information
containedherein, whether expressed, implied, or statutory, includingimpliedwarranties of merchantability or fitness for a particular purpose. Motorola
makes no representation that the interconnection of products in the manner
described herein will not infringe on existing or future patent rights, nor do
the descriptions contained herein imply the granting or license to make, use
or sell equipment constructed in accordance with this description.
The computer program contains materialcopyrighted by Motorola, Inc., first
published in 1997, and may be used only under a license such as the License
For Computer Programs (Article 14) contained in Motorola’s Terms and
Conditions of Sale, Rev. 1/79.
Trademarks
This document includes these trademarks:
MCUez and MCUasm are trademarks of Motorola, Inc.
Microsoft Windows and Microsoft Developer Studio are registered
trademarks of Microsoft Corporation in the U.S. and other countries.
WinEdit is a trademark of Wilson WindowWare.
This list describes the topics contained in this manual.
•Graphical user interface — Description of the MCUez assembler GUI
•Environment — Description of the MCUez assembler environment
variables
•Assembler options — Detailed description of the full set of assembler
options
•Assembler syntax — Description of the assembler input file syntax
•Assembler directives — List of all directives supported by the
assembler
•Assembler messages — Description and examples produced by the
assembler
1.4 Getting Started
NOTE:
•Appendices
•Index
This section describes how to get started using MCUez. The locations of
specific working directories and the directories reflected in dialog window
reflect the directories that have been chosen.
This section provides instructions to:
•Create a new project
•Write the assembly source file
•Assemble the assembly source file
•Link the application to generate an executable file
All directory paths and listings are examples only. Paths and directory listings
may change depending upon the MCUez configuration.
4.Enter the path for thenew project in the editbox. For example, substitute
C:\MCUEZ\MCuez12\DEMO\WMMDS12A with
C:\MCUEZ\MCUez12\DEMO\mydir as the example shows in
Figure 1-3.
Figure 1-3. Working Project Directory Dialog Box
NOTE:
The specified directory must be accessible from a PC.
5.Click on the OK button to close the Project Directory dialog box. The
New Configuration dialog box will then appear.
6.Define the editor to use with the project. Select the Editor tab. Select an
editor from the Editor drop down box. In the Executable command line,
enter the path and command used to start the editor.
For example:
C:\MCUEZ\MCUez12\Prog\Motpad.EXE
The command also can be selected by using the Browse... button.
Once the project has been configured, writing the application can begin. For
example, source code may be stored in a file named test.asm and may look as
like this:
initStk:EQU $AFE; Initial value for SP
dataSec:SECTION; Define a section
var1:DC.W 5; Assign 5 to the symbol var1
codeSec:SECTION; Define a section for code
entry:
LDS #initStk; Load stack pointer
LDD var1
BRA entry
When writing assembly source code, pay special attention to these points:
XDEF entry; Make the symbol entry visible for
; external module.
; This is necessary to allow the
; linker to find the symbol and
; use it as the entry point for
; the application.
•All symbols referenced outside the current source file (in another source
file or in the linker configuration file) must be visible externally. Forthis
reason, the assembly directive XDEF entry has been inserted.
•To make debugging from the application easier, defining separate
sections for code, constant data (defined with DC (define constant)), and
variables (defined with DS (define space)) are strongly recommended.
This enables the symbols located in the variable or constant data sections
to be displayed in the data window component of the debugger.
•The stack pointer must be initialized when using BSR (branch to
subroutine) or JSR (jump to subroutine) instructions in an application.
This procedure describes how to assemble a source file.
1.Start the assembler by clicking on the ezASM button in the MCUezShell. Enter the name of the file to be assembled in the editable combo
box, as shown in Figure 1-5.
4.The file is assembled, as shown in Figure 1-8, when the Assemble
button is clicked.
Figure 1-8. Assembling a File
The macro assembler indicates a successful assembler session by printing the
number of generated bytes of code. The message Code size: 10 indicates that
test.asm was assembled withouterrors. The macro assemblergenerates a binary
object file anda debug listing file for each source file.The binary object file has
the same name as the input module with an extension of .o. The debug listing
file has the same name as the input module, with an extension of .dbg.
When the assembly option -L is specified on the command line, the macro
assembler generates a list file containing the source instruction and
corresponding hexadecimal code.
Once the object file is available, the application can be linked. The linker will
organize code and data sections according to the linker parameter file. Follow
this procedure to link an application:
1.Starttheeditor and create the linker parameter file. Copy thefilefibo.prm
to test.prm.
2.In the file test.prm, change the name of the executable and object files to
test.
3.Additionally, modify the start and end addresses for the ROM and RAM
memory areas.
The test.prm module appears like this:
LINK test.abs/* Name of the executable file generated.*/
NAMES test.o END/*Name of the object files in the application*/
SEGMENTS
MY_ROM = READ_ONLY 0x800 TO 0x8FF;/*READ_ONLY memory area */
MY_RAM = READ_WRITE 0xB00 TO 0xBFF;/*READ_WRITE memory area */
END
PLACEMENT
.data INTO MY_RAM; /* Variables should be allocated in MY_RAM */
.text INTO MY_ROM; /* Code should be allocated in MY_ROM */
END
INIT entry/* entry is the entry point to the application */
VECTOR ADDRESS 0xFFFE entry/* Initialization for Reset vector */
The MCUez HC12 assembler uses a Microsoft Windowsapplication, which
is a graphical user interface (GUI).
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface37
Graphical User Interface
2.3 Starting the Motorola Assembler
Start the assembler from the MCUez Shell by clicking on the ezASM icon in
the toolbar.
When the assembler is started, a standard Tip of the Day window, containing
tips about the assembler, is displayed.
Figure 2-1. Tip of the Day Window
Click Next Tip to see the next piece of information about the assembler. Click
Close to close the Tip of the Day dialog.
To bypass the standard Tip of the Day window when the assembler is started,
uncheck Show Tips on StartUp.
To re-enable the tips window, choose the Help|Tip of the Day ... menu option.
The Tip of the Day dialog will open. Then select Show Tips on StartUp.
User’s ManualMCUez HC12 Assembler
38Graphical User InterfaceMOTOROLA
2.4 Assembler Graphical Interface
If the assembler was started without specifying a filename, the window in
Figure 2-2 is displayed. The assembler window provides a window title, menu
bar, toolbar, content area, and status bar.
Graphical User Interface
Assembler Graphical Interface
Menu Bar
Toolbar
Content
Area
2.4.1 Window Title
Status Bar
Figure 2-2. Assembler Window
The window title displays the assembler name and project name. If no project
is currently loaded, Default Configuration is displayed. An * (asterisk) after
the project name indicates that some values have been changed. The * indicates
changes in options, editor configuration, or appearance (window position, size,
font, etc.).
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface39
Graphical User Interface
2.4.2 Content Area
The content area displays logging information about the assembly session and
consists of:
•Name of file being assembled
•Complete path and name of files processed (main assembly file and all
•List of error, warning, and information messages
•Size of code generated during the assembly session
If a filename is dragged and dropped into the content area, the file is either
loaded as a configuration file or is assembled. It is loaded as a configuration file
if the file hasa .ini extension. Ifnot, the file is assembled with thecurrent option
settings. (See 2.4.8 Specifying the Input File.)
included files)
Assembly information in the content area includes:
•Files created or modified
•Location within file where errors occurred
•A message number
Some files listedin the content area can be opened inthe editor specified during
project configuration. Double click on a filename to open an editable file or
select a line that contains a filename and click the right mouse button to display
a menu that contains an Open ... entry (if file is editable).
A message number is displayed with message output. From this output, there
are three ways to open the corresponding help information.
1.Select one line of the message and press F1. Help for the associated
message number is displayed. If the selected line does not have a
message number, the main help is displayed.
2.PressShift-F1and then click on the message text.Ifthereisno associated
message number, the main help is displayed.
3.Click the right mouse button on the message text and select Help on ....
This menu entry is available only if a message number is available.
User’s ManualMCUez HC12 Assembler
40Graphical User InterfaceMOTOROLA
After an assembly session has completed, error feedback can be performed
automatically by double clickingon the messagein the content area. The source
file containing the error or warning message will open to the line containing the
problem.
2.4.3 Assembler Toolbar
Figure 2-3 illustrates the assembler toolbar.
Graphical User Interface
Assembler Graphical Interface
Displays Program Help Information
Saves the Current Configuration
Loads a Configuration
New Configuration
Command Line (Editable Combo Box)
Context Help
Assemble
Option Settings
Stop Current Assembly
Figure 2-3. Assembler Toolbar
The three buttons on the left correspond with entries in the File menu. The New
Configuration, Load Configuration, and SaveConfiguration buttons enable
the user to reset, load, and save configuration files for the assembler.
The Help and Context Help buttons open the help file or use the
context-sensitive help feature.
Press the Context Help button to change the mouse cursor to a question mark
and arrow. Then click on an item within the application to display help
information. Help is available for menus, toolbar buttons, and window areas.
The command line box contains a drop down list of the last commands
executed. Once a command line has been selected or entered in the combo box,
click the Assemble button to execute the command.
The Options Setting button opens the Options Setting dialog box.
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface41
Graphical User Interface
2.4.4 Status Bar
Figure 2-4 shows the assembler status bar.
Message Area
Point to a menu entry or button in the toolbar to display a brief explanation in
the message area.
2.4.5 Assembler Menu Bar
The entries in Table 2-1 are available in the Menu Bar.
Menu entryDescription
FileAssembler configuration file management
AssemblerAssembler option settings
ViewAssembler window settings
HelpStandard windows help menu
Current Time
Figure 2-4. Assembler Status Bar
Table 2-1. Menu Bar
2.4.6 File Menu
An assembler configuration file typically contains the following information:
•Assembler option settings specified in the assembler dialog boxes
•Last command line executed and current command line
•Window position, size, and font
•Editor associated with the assembler
•Tip of the Day settings
User’s ManualMCUez HC12 Assembler
42Graphical User InterfaceMOTOROLA
Graphical User Interface
Assembler Graphical Interface
Assembler configuration information is stored in the specified configuration
file. As many configuration filesas required for a projectcan be defined. Switch
to different configuration files by selecting File|Load Configuration and
File|Save Configuration, or by clicking the corresponding toolbar buttons.
For instance:
•Choose File|Assemble to open a standard Open File dialog box
. A list
of all .asm files in the project directory is displayed. Select an input file.
Click OK to close the dialog box and assemble the selected file.
•Choose File|New/Default Configuration to reset assembler options to
the default values. Default values are specified in the section titled
Command Line Options.
•Choose File|Load Configuration to open a standard Open File dialog
box. A list of all .ini files in the project directory is displayed. Select a
configuration file to be used by subsequent assembly sessions.
•Choose File|Save Configuration to store the current settings in the
configuration file specified in the title bar.
•ChooseFile|SaveConfigurationas ... to open a standardSaveAsdialog
box and display the list of all .ini files in the project directory. Specify
the name and location of the configuration file. Click OK to save the
current settings in the specified configuration file.
•Choose File|Configuration ... to open the Configuration dialog box.
Specify an editor and related information to be used for error feedback,
then save the configuration.
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface43
Graphical User Interface
2.4.6.1 Editor Settings Dialog
This dialog box has several radio buttons for selecting a type of editor.
Depending on the type selected, the content below it changes.
These are the main entries:
•Global Editor (Configured by the Shell)
Figure 2-5. Starting the Global Editor
This entry is enabled only when an editor is defined in the [Editor] section of
the global initialization file mcutools.ini.
User’s ManualMCUez HC12 Assembler
44Graphical User InterfaceMOTOROLA
•Local Editor (Configured by the Shell)
Graphical User Interface
Assembler Graphical Interface
Figure 2-6. Starting the Local Editor
This entry is only enabled if an editor is defined in the local configuration file,
usually project.ini in the project directory.
The Global Editor and Local Editor settings cannot be edited within this
dialog box, since they are read only. These entries can be configured with the
MCUez Shell application.
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface45
Graphical User Interface
•Editor started with Command Line
Figure 2-7. Starting the Editor with the Command Line
When this editor type is selected, a separate editor is associated with the
assembler for error feedback. Theeditor configured in the shell will notbe used
for error feedback. Enter the appropriate path and command name to start the
editor. Command modifiers are specified on the command line.
Example:
For WinEdit 32-bit version
C:\WinEdit32\WinEdit.exe %f /#:%l
For Write
C:\Winnt\System32\Write.exe %f
Write does not support line number modifier.
For Motpad
C:\TOOLS\MOTPAD\MOTPAD.exe %f::%l
Motpad supports line numbers.
User’s ManualMCUez HC12 Assembler
46Graphical User InterfaceMOTOROLA
•Editor started with DDE
Graphical User Interface
Assembler Graphical Interface
Figure 2-8. Starting the Editor with DDE
Enter the service, topic, and client name to be used for a DDE connection to the
editor. All entries can have modifiers forfilename and linenumber as explained
in the next example.
Example: For Microsoft Developer Studio
Service Name : "msdev"
Topic Name : "system"
ClientCommand : "[open(%f)]"
, use this setting:
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface47
Graphical User Interface
•Modifiers
The editor format depends on the command syntax used to start the editor.
Check the editor manual for modifiers that can be used to define the editor
command line.
When either entry Editor Started with the Command line or Editorstarted with DDE is selected, the configuration may contain modifiers
to identify which file to open and which line to select.
–The %f modifier refers to the name of the file (including path) where
the error has been detected.
–The %l modifier refers to the line number where the message has
been detected.
NOTE:
NOTE:
Be cautious whenusing the%lmodifier. This modifiercan be used only with an
editor that can be started with a line number as a parameter. Editors such as
WinEdit version 3.1 or lower and Notepad do not allow this kind of parameter.
When using a word processing editor, such as Microsoft Word or Wordpad,
make sure to save the input file as an ASCII text file; otherwise, the assembler
will have trouble processing the file.
User’s ManualMCUez HC12 Assembler
48Graphical User InterfaceMOTOROLA
2.4.6.2 Save Configuration Dialog
Figure 2-9 shows the Save Configuration dialog box.
Graphical User Interface
Assembler Graphical Interface
Figure 2-9. Save Configuration Dialog Box
The second page of the configuration dialog consists of save operations. In the
SaveConfiguration dialog, select attributesto be stored intheproject file. This
dialog box provides the following configurations:
•Options — When set, the current option settings are stored in the
configuration file. Disable this option to retain the last saved options.
•Editor configuration — When set, the current editor settings are stored
in the configuration file. Disable this option to retain the last saved
options.
•Appearance—Whenset, the current application appearance, such asthe
window position (only loaded at startup time) and the command line
content and history, is saved. Disable to keep previous settings.
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface49
Graphical User Interface
•Save on exit — If this option is set, the assembler will save the
configuration on exit. No prompt will appear to confirm this operation.
If this option is not set, the assembler will ignore any changes.
NOTE:
Almost all settings are stored in the configuration file. Exceptions are the
recently used configuration listandall settings in thisdialog. These settings are
stored in the assembler section of the mcutools.ini file.
Assembler configurations can coexist in the same file used for the project
configuration (defined by the shell application) along with other MCUez tool
specifications. When an editor is configured by the shell, the assembler can
read this information from the project file, if present. The project configuration
file created by the shell is named project.ini. Therefore, this filename is also
suggested (but not mandatory) to the assembler.
2.4.6.3 Assembler Menu
Table 2-2 depicts the Assembler menu that allows customization of the
assembler and setting or resetting of assembler options.
Table 2-2. Assembler Menu
ItemDescription
Options
Allows defining of the options to be activated when assembling
an input file
2.4.7 View Menu
This menu enables customization of the assembler window. For instance,
whether the status baror toolbar will bedisplayed or hidden canbe defined. The
user also can define the font used in the window or clear the window.
•Choose View|Tool Bar to switch on/off the assembler window toolbar.
•Choose View|Status Bar to switch on/off the assembler window status
bar.
•Choose View|Log ... to customize the output in the assembler window
content area.
User’s ManualMCUez HC12 Assembler
50Graphical User InterfaceMOTOROLA
•Choose View|Log ...|Change Font to open a standard Font Selection
dialog box. Options selected in this dialog are applied to the assembler
window content area.
•Choose View|Log ...|Clear Log to clear the assembler window content
area.
2.4.7.1 Option Settings Dialog Box
This dialog box enables the user to set/reset assembler options, as shown in
Figure 2-10.
Graphical User Interface
Assembler Graphical Interface
Figure 2-10. Option Settings Dialog Box
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface51
Graphical User Interface
Available options are arranged in different groups as shown in Table 2-3.
Option GroupDescription
Table 2-3. Advanced Options
NOTE:
Output
InputLists options related to the input file
HostLists options related to the host
Code
Generation
MessagesLists options controlling the generation of error messages
Lists options related to the output files generated
(type of files to be generated)
Lists options related to code generation
(memory models, ...)
An assembly option is set when the corresponding check box is checked. To
obtain more information about a specific option, select the option and press the
F1 key or the Help button. To select an option, click once on the option text.
Options that require additional parameters will display an edit box or an
additional subwindow where additional parameters can be set.
Assembler options specified in the project file (using the MCUez Shell) are
automatically displayed in the Option Settings dialog box.
2.4.8 Specifying the Input File
The input file to be assembled can be specified in several ways. During the
assembly session, options will beset according to the configurationprovided by
the user in the Option Settings dialog box. Before assembling a file, make sure
a project directory is associated with the assembler.
User’s ManualMCUez HC12 Assembler
52Graphical User InterfaceMOTOROLA
2.4.8.1 Using the Editable Combo Box in the Toolbar
The following describes how to use the Editable Combo box.
•Assembling a new file — A new filename and additional assembler
options can be entered on the command line. Click on the Assemble
button or press the Enter key to assemble the specified file.
•Reassembling a file — The previously executed command can be
displayed by clicking on the arrowon the rightside of the command line.
From the drop down list, select a command. Click on the Assemble
button or press the Enter key to assemble the specified file.
2.4.8.2 Using the Entry File | Assembly ...
Select the menu entry File | Assemble to display the File to Assemble dialog
box. Browse to and select the desired file. Click Open to assemble the selected
file.
Graphical User Interface
Error Feedback
2.4.8.3 Using Drag and Drop
A filename can be dragged from an external program (for example, the File
Manager) and dropped into the assembler window. The dropped file is
assembled as soon as the mouse button is released in the assembler window. If
the dragged file has the extension .ini, it is a configuration file and will be
loaded and not assembled.
2.5 Error Feedback
Aftera source file has been assembled, thecontentareadisplays a list of all error
or warning messages detected. The message format is:
>> <FileName>, line <line number>, col <column number>
pos <absolute position in file>
<Portion of code generating the problem>
<message class> <message number>: <Message string>
MCUez HC12 AssemblerUser’s Manual
MOTOROLAGraphical User Interface53
Graphical User Interface
Example:
>> in “C:\DEMO\fiboerr.asm”, line 76, col 20, pos 1932
BRA label
^
ERROR A1104: Undeclared user defined symbol: label
Errorscanbe corrected by using the editor definedduringconfiguration.Editors
such as WinEdit Version 95 (or higher) or Codewright from Premia
Corporation can be started with a line number in the command line. If
configured correctly, these editors are activated automatically by double
clicking on an error message. The editor will open the file containing the error
and position the cursor on the line with the error.
Editors like WinEdit Version 31 or lower, Notepad, or Wordpad cannot be
started with a line number. These editors can be activated automatically by
double clicking on a message. The editor will open the file containing the error.
To locate the error, use the find or search feature of the editor. In the assembler
content area, select the line containing the message class, number, and string
and press CTRL+C to copy the message. Paste the message in the Find dialog
box of the editor to search for the error.
User’s ManualMCUez HC12 Assembler
54Graphical User InterfaceMOTOROLA
This section describes environment variables used by the MCUez assembler.
Environment variables are set in thePaths or Additionaltab of the MCUez shell
New Configuration or Current Configuration dialog box. Refer to the MCUezInstallation and Configuration User’s Manual, Motorola document order
number MCUEZINS/D. Environment variables that define paths (such as
GENPATH, OBJPATH, ABSPATH, etc.) are used by the assembler and other
MCUez applications.
3.3 Paths
Environmentvariables that contain pathsindicatewhere to look for files.A path
list is a list of directory names separated by semicolons or a directory name
preceded by an asterisk. If a directory name is preceded by an asterisk (*), the
programs recursively search the wholedirectory tree for afile, not just thegiven
directory. Directories are searched in the order they appear in the path list.
The remainder of this section describes each of the environment variables
available for the assembler. The information in Table 3-1 describes the
structure for explaining each environment variable.
Table 3-1. Environment Variables
TopicDescription
Syntax
ArgumentsDescribes and lists optional and required arguments for the variable
DefaultShows the default setting for the variable, if applicable
Description
Example
ToolsLists tools that use this variable, if applicable
MCUez
Shell
See alsoLists related sections, if applicable
Specifies the syntax of the option in EBNF (Extended Backus-Naur
Form) format
Provides a detailed description of the environment variable and how
to use it
Gives an example of usage and effects of the variable where
possible
Explains how the environment variable can be initialized
Syntax:ASMOPTIONS=<option>
Arguments:<option>: Assembler command line option
Description:If this environment variable is set, the assembler appends its
contents to its command line each time a file is assembled. It
can be used to globally specify certain options that should
alwaysbe set, so theydon’t haveto be specifiedeach time afile
is assembled.
Options listed here must be valid assembler options and are
separated by space characters.
Example:ASMOPTIONS=-W2 -L
MCUez Shell:Open the Current Configuration dialog box.
Select the Additional tab.
Enter the environment variable definition in the edit box.
Syntax:GENPATH=<path>
Arguments:<path>: Paths separated by semicolons, without spaces.
Description:The macro assembler will look for the source or included files
first in the project directory, then in the directories listed in the
environment variable GENPATH.
NOTE:
If a directory specification in this environment variable starts with an asterisk
(
*
), the entire directory tree is searched recursively, for instance, all
subdirectories are searched.
Example:GENPATH=\sources\include;..\..\headers;*\user
MCUez Shell:Open the Current Configuration dialog.
Select the Paths tab.
In the Configure combo box, select General Path.
Enter the directories in the list box (one directory on each line).
Syntax:ABSPATH=<path>
Arguments:<path>: Paths separated by semicolons, without spaces
Description:This environment variable is only relevant when absolute files
are directly generated by the macro assemblerinstead of object
files. When this environment variable is defined, the assembler
will store the absolute files it produces in the first directory
specified. If ABSPATH is not set, the generated absolute files
will be stored in the directory where the source file was found.
Example:
ABSPATH=\sources\bin;..\..\headers;\usr\local\bin
MCUez Shell:Open the Current Configuration dialog.
Select the Paths tab.
In the Configure combo box, select Absolute.
Enter the directories in the list box (one directory on each line).
Syntax:OBJPATH=<path>
Arguments:<path>: Paths separated by semicolons, without spaces
Description:When this environment variable is defined, the assembler will
store the object files it produces in the first directory specified.
If OBJPATH is not set, the generated object files will be stored
in the directory where the source file was found.
Example:
OBJPATH=\sources\bin;..\..\headers;\usr\local\bin
MCUez Shell:Open the Current Configuration dialog.
Select the Paths tab.
In the Configure combo box, select Object.
Enter the directories in the list box (one directory on each line).
Syntax:TEXTPATH=<path>
Arguments:<path>: Paths separated by semicolons, without spaces
Description:When this environment variable is defined, the assembler will
store the listing files it produces in the first directory specified.
If TEXTPATH is not set, the generated listing files will be
stored in the directory where the source file was found.
Syntax:SRECORD=<RecordType>
Arguments:<Record Type>: Force the type for the Motorola S record that
Description:This environment variable is only relevant when absolute files
must be generated. This parameter may take the value S1, S2,
or S3.
are generated directly by the macro assemblerinstead of object
files. When this environment variable is defined, the assembler
will generate a Motorola S file containing records from the
specified type (S1 records when S1 is specified, S2 records
when S2 is specified, and S3 records when S3 is specified).
When this variable is not set, the type of S record generated
will depend on the size of the address loaded there. If the
address can be coded on two bytes, an S1 record is generated.
If the address is coded on three bytes, an S2 record is
generated. Otherwise, an S3 record is generated.
NOTE:
If the environment variable SRECORD is set, it is the user’s responsibility to
specify the appropriate S record type. If S1 is specified while the code is loaded
above 0xFFFF, the Motorola S file generated will not be correct because the
addresses will all be truncated to 2-byte values.
Example:SRECORD=S2
MCUez Shell:Open the Current Configuration dialog.
Select the Additional tab.
Enter the environment variable in the list box.
Arguments:<filename>: Filename with possible format specifiers
Description:The environment variable ERRORFILE specifies the name of
the error file used by the assembler.
Possible format specifiers are:
%n: Substitute with the filename, without the path
%p: Substitute with the path of the source file
%f: Substitute with the full filename (path included; same as
%p%n)
Examples:ERRORFILE=MyErrors.err
Logs all errors in the file MyErrors.err in the current
directory
ERRORFILE=\tmp\errors
Logs all errors in the filenamed errors in the directory \tmp
ERRORFILE=%f.err
Logs all errors in a file with the same name as the source file
(with extension .err) into the same directory as the source
file.Forexample,ifthefile\sources\test.asmisassembled,an
error file \sources\test.err will be generated.
ERRORFILE=\dir1\%n.err
An error file \dir1\test.err will be generated for a source file
named test.asm.
An error file \dir1\dir2\errors.txt will be generated for a
source file \dir1\dir2\test.asm.
If the environment variable ERRORFILE is not set, errors
arewritten to the defaulterrorfile.The default error filename
is dependent upon how the assembler is configured and
started. If no filename is provided, errors are written to the
err.txt file in the project directory.
Select the Additional tab.
Enter the environment variable definition in the list box.
Tools:Assembler and linker
Syntax:USERNAME=<user>
Arguments:<user>: Name of user
Default:None
Description:Each object file contains an entry identifying the user who
created the object file. This information may be retrieved from
the object files using a decoder.
Example:USERNAME=MOTOROLA
MCUez Shell:Open the Current Configuration dialog.
Select the Additional tab.
Enter the environment variable definition in the list box.
Environment Variables
Environment Variables Description
See also:Environment variable3.5.8 COPYRIGHT: CopyrightEntry
in Object File
Environment variable 3.5.9 INCLUDETIME: Create Time
This chapter describes all file types associated with the MCUez application.
4.3 Input Files
The following sections describe input files:
•Source files
•Include files
MCUez HC12 AssemblerUser’s Manual
MOTOROLAFiles71
Files
4.3.1 Source Files
4.3.2 Include Files
The macro assembler takes any file as input and does not require the filename
to have a special extension. However, it is suggested that all source filenames
have the extension .asm and all included files have the extension .inc. Source
files will be searched first in the project directory and then in the GENPATH
directory.
Thesearch for include files is governed bytheenvironmentvariable GENPATH.
Include files are searched first in the project directory, then in the directories
specified in the environment variable GENPATH. The project directory is set
from the MCUez Shell or the environment variable DEFAULTDIR.
4.4 Output Files
4.4.1 Object Files
The following sections describe six types of output files:
1.Object files
2.Absolute files
3.Motorola S files
4.Listing files
5.Debug listing files
6.Error listing files
After a successful assembly session, the macro assembler generates an object
file containing the target code as well as some debugging information. This file
is written to the directory given in the environment variable OBJPATH. If that
variable contains more than one path, the object file is written to the first
directory given. If this variable is not set, the object file is written to the
directory where the source file was found. Object files always get the
extension .o.
User’s ManualMCUez HC12 Assembler
72FilesMOTOROLA
4.4.2 Absolute Files
4.4.3 Motorola S Files
Files
Output Files
When an application is encoded in a single module and all the sections are
absolute sections, the user can decide to generate an absolute file instead of an
object file. Thisfile is written to the directory given inthe environment variable
ABSPATH. If that variable contains more than one path, the absolute file is
written in the first directory given. If this variable is not set, the absolute file is
written in the directory where the source file was found. Absolute files always
get the extension .abs.
When an application is encoded in a single module and all the sections are
absolute sections, the user can decide to generate an absolute file instead of an
object file. In that case, a Motorola S record file is generated at the same time.
This file can be burnt into an EPROM. It contains information stored in all
READ_ONLY sections in the application. The extension for the generated
Motorola S record file depends on the SRECORD variable setting.
For instance:
•If SRECORD = S1, the Motorola S record file gets the extension
.s1.
•If SRECORD = S2, the Motorola S record file gets the extension
.s2.
•If SRECORD = S3, the Motorola S record file gets the extension
.s3.
•If SRECORD is not set, the Motorola S record file gets the
extension .sx.
Thisfile is written to thedirectorygiven in the environment variable ABSPATH.
If that variable contains more than one path, the motorola S file is written in the
first directory given. If this variable is not set, the file is written in the directory
the source file was found.
MCUez HC12 AssemblerUser’s Manual
MOTOROLAFiles73
Files
4.4.4 Listing Files
4.4.5 Debug Listing Files
After a successful assembly session,the macro assembler generates alisting file
containing each assembly instruction with its associated hexadecimal code.
This file is generated when the option -L is activated, even if the macro
assembler generates an absolute file. This file is written to the directory given
in the environment variableTEXTPATH. If that variablecontains more thanone
path, the listing file is written in the first directory specified. If this variable is
not set, the listing fileis written in thedirectory where the source filewas found.
Listing files always get the extension .lst. Section 10. Assembler Listing File
describes the format of this file.
After a successful assembling session, the macro assembler generates a debug
listing file, which will be used to debug the application. This file is always
generated, even when the macro assembler generates an absolute file. The
debug listing file is a duplicateof the source, where all the macros are expanded
and the include files merged. This file (with the extension .dbg) is written to the
directory listed in the environment variable OBJPATH. If that variable contains
more than one path, the debug listing file is written to the first directory given.
If this variable is not set, the file is written in the directory where the source file
was found. Debug listing files always get the extension .dbg.
4.4.6 Error Listing Files
If the macro assembler detects any errors, it creates an error file. The name and
location of this file depend on the settings from the environment variable
ERRORFILE.
If the macro assembler’s window is open, it displays the full path of all include
files read. After successful assembly, the number of code bytes generated and
the number of global objects written to the object file are displayed. Figure 4-1
shows the different structures associated with the assembler.
The assembler offers a number of options that control how the assembler
operates. Options consist of a dash (-) followed by one or more letters or digits.
Anything not starting with a dash is assumed to be the name of a source file to
be assembled. Assembler options may be specified on the command line or in
the ASMOPTIONS environment variable. Typically, each assembler option is
specified only once per assembly session.
NOTE:
NOTE:
5.3 ASMOPTIONS
Arguments for an option must not exceed 128 characters.
Command line options are not case sensitive. –Li is the same as –li. For
options that belong tothe same group, forexample –Lc and –Li,the assembler
allows options to be combined, for example, –Lci or –Lic instead of –Lc–Li.
Itis not possible to combineoptionsin different groups, for instance,
cannot be abbreviated by the terms
If this environment variable is set, the assembler appends the values (options)
defined for this variableto its commandline each time afile is assembled.It can
be used to globally specify certain options that should always be set, so the user
doesn’t have to specify them each time a file is assembled.
Table 5-1 describes how assembler options are grouped and Table 5-2
describes the scope of each option.
GroupDescription
HOSTLists options related to the host
Assembler Options
Assembler Options
Table 5-1. Assembler Option Group
OUTPUT
INPUTLists options related to input file
CODE
MESSAGELists options controlling generation of error messages
VARIOUSLists various options
Lists options related to output file generation (type of file
to be generated)
Lists options related to code generation (memory models,
float format, etc.)
Table 5-2. Scope of Each Option
ScopeDescription
The option has to be set for all files (assembly units) of an
Application
Assembly
unit
None
application. A typical example is an option to set the memory
model. Mixing object files will have unpredictable results.
The option can be set differently for each assembly unit of an
application. Mixing objects in an application is possible.
The option is not related to a specific code part. A typical example is
options for message management.
Available options are arranged in separate groups, and a dialog box tab is
available for each group. The content of the list box depends on the tab selected
in the dialog box.
The remainder of this section describes each of the options available for the
assembler. The options are listed in alphabetical order and described by the
categories shown in Table 5-3.
GroupHOST, OUTPUT, INPUT, CODE, MESSAGE, VARIOUS
ScopeApplication, assembly unit, or none
SyntaxSpecifies the syntax of the option in EBNF format
ArgumentsDescribes and lists optional and required arguments for the option
DefaultShows the default setting for the option
DescriptionProvides a detailed description of the option and how to use it
Example
See alsoRelated options
Table 5-3. Assembler Option Details
TopicDescription
Gives an example of usage and effectsof the option where possible.
Assembler settings, source code and/or linker PRM files are
displayed where applicable.
-CI:Set case sensitivity for label names OFF
Group:INPUT
Scope:Assembly unit
Syntax:-CI
Arguments:None
Default:ON
Description:Switches case sensitivity OFF for label names. When this
option is activated, the assembler ignores case sensitivity for
label names.
Thisoptioncan be only specified when the assembler generates
an absolute file. (Option -FA2 must be activated.)
Example:When case sensitivity for label names is switched off, the
assembler will not generate error messages for this code:
ORG $200
entry: NOP
BRA Entry
The instruction BRA Entry will branch on the label entry.
By default, the assembler is case sensitivefor label names. The
labels Entry and entry are two distinct labels.
-Env:Set environmental variable
Group:HOST
Scope:Assembly unit
Syntax:-Env <EnvironmentVariable>=<VariableSetting>
Arguments:<EnvironmentVariable>: Environment variable to be set
<VariableSetting>: Assigned value
Default:None
Description:This option sets an environment variable.
Example:ASMOPTIONS=-EnvOBJPATH=\sources\obj
This is the same as OBJPATH=\sources\obj in the
default.env file.
See also:Section 3. Environment Variables
-L:Generates a listing file
Group:OUTPUT
Scope:Assembly unit
Syntax:-L
Arguments:None
Default:None
Description:Switches on generation of the listing file. This listing file will
have the same name as the source file, but with the extension
.lst. The listing file contains macro definitions, invocation, and
expansion lines as well as expanded include files.
Example:ASMOPTIONS=-L
In the following assembly code example, the macro cpChar
accepts two parameters. The macro copies the value of the first
parameter to the second one.
When option -L is specified, the following portion of code:
INCLUDE "macro.inc"
CodeSec: SECTION
Start:
cpChar char1, char2
NOP
-Lc:No macro call in listing file
Group:OUTPUT
Scope:Assembly unit
Syntax:-Lc
Arguments:None
Default:None
Description:Switches on generation of the listing file, but macro
invocations are not present in the listing file. The listing file
contains macro definitions and expansion lines as well as
expanded include files.
Example:ASMOPTIONS=-Lc
In the following assembly code example, the macro cpChar
accepts two parameters. The macro copies the value of the first
parameter to the second one.
When option -Lc is specified, the following portion of code:
Generates the following output in the assembly listing file:
5 5 cpChar:
MACRO
66
LDD \1
77
STD \2
8 8
ENDM
99codeSec:
SECTION
10 10 Start:
126m000000 FC xxxx+
LDD char1
137m000003 7C xxxx+
STD char2
14 12 000006 A7
NOP
15 13 000007 A7
NOP
Contents of included files, macro definitions, and expansion
are stored in the list file. The source line containing the macro
call is not present in the listing file. Refer to Section 10.
-Ld:No macro definition in listing file
Group:OUTPUT
Scope:Assembly unit
Syntax:-Ld
Arguments:None
Default:None
Description:Switches on generation of the listing file, butmacro definitions
are not present in the listing file. The listing file contains macro
invocation and expansion lines as well as expanded include
files.
Example:ASMOPTIONS=-Ld
In the following example, the macro cpChar accepts two
parameters. The macro copies the value of the first parameter
to the second one. When option -Ld is specified, the
following portion of code:
Generates this output in the assembly listing file:
5 5 cpChar:
MACRO
99codeSec:
SECTION
10 10 Start:
11 11
cpChar char1, char2
126m000000 FC xxxx+
LDD char1
137m000003 7C xxxx+
STD char2
14 12 000006 A7
NOP
15 13 000007 A7
NOP
Contents of included files, as well as macro invocation and
expansion are stored in the listing file. Source code from the
macro definition is not present in the listing file. Refer to
Section 10. Assembler Listing File for detailed information.
-Le:No macro expansion in listing file
Group:OUTPUT
Scope:Assembly unit
Syntax:-Le
Arguments:None
Default:None
Description:Switchesongeneration of the listing file,butmacroexpansions
are not present in the listing file. The listing file contains macro
definitions and invocation lines as well as expanded include
files.
Example:ASMOPTIONS=-Le
In the following example, the macro cpChar accepts two
parameters. The macro copies the value of the first parameter
to the second one. When option -Le is specified, the following
portion of code:
Generates this output in the assembly listing file:
5 5 cpChar:
MACRO
66
LDD \1
77
STD \2
8 8
ENDM
99codeSec:
SECTION
10 10 Start:
11 11
cpChar char1, char2
14 12 000006 A7
NOP
15 13 000007 A7
NOP
Contents of included files, as well as macro definitions and
invocation are stored in the listing file. Macro expansion lines
are not present in the listing file. Refer to Section 10.
-Li:No included file in listing file
Group:OUTPUT
Scope:Assembly unit
Syntax:-Li
Arguments:None
Default:None
Description:Switches on generation of the listing file, but include files are
not expanded in the listing file. The listing file contains macro
definitions, invocation, and expansion lines.
Example:ASMOPTIONS=-Li
When option -Li is specified, this portion of code:
INCLUDE "macro.inc"
codeSec: SECTION
Start:
cpChar char1, char2
NOP
Generates the following output in the assembly listing file:
55
INCLUDE "macro.inc"
126codeSec:
SECTION
13 7 Start:
153m000000 FC xxxx+
LDD char1
164m000003 7C xxxx+
STD char2
17 9 000006 A7
NOP
18 10 000007 A7
NOP
Macro definition, invocation, and expansion are stored in the
listing file.
-N:Display error notification box
Group:MESSAGES
Scope:Assembly unit
Syntax:-N
Arguments:None
Default:None
Description:Causes the assembler to display an alert box if an error occurs
during assembly.This is useful when running a makefile, since
the assembler waits for the user to acknowledge the message,
-V:Displays the assembler version
Group:VARIOUS
Scope:None
Syntax:-V
Arguments:None
Default:None
Description:Prints the assembler version and the current directory
NOTE:
This option is useful to determine the current directory.
Example:-V produces this list:
Directory: C:\MCUEZ\demo\WMMDS12A
Limitation Status: none
Common Module V-5.0.4, Date Mar 18 1998
Assembler Kernel, V-5.0.9, Date Mar 20 1998
User Interface Module, V-5.0.14, Date Mar 18 1998
Assembler Target, V-5.0.13, Date Mar 20 1998
-W1:No information messages
Group:MESSAGES
Scope:Assembly unit
Syntax:-W1
Arguments:None
Default:None
Description:INFORMATION messages are not displayed. Only
WARNING and ERROR messages are listed.
Example:ASMOPTIONS=-W1
See also:None
-W2:No information and warning messages
Group:MESSAGES
Scope:Assembly unit
Syntax:-W2
Arguments:None
Default:None
Description:INFORMATION and WARNING messages are not displayed.
Only ERROR messages are listed.
Example:ASMOPTIONS=-W2
See also:None
-WmsgNe:Number of error messages
Group:MESSAGES
Scope:Assembly unit
Syntax:-WmsgNe <number>
Arguments:<number>: Maximum number of error messages
Default:50
Description:Sets the number of errors detected before the assembler stops
processing
Example:ASMOPTIONS=-WmsgNe2
The assembler stops assembling after two error messages.
See also:5.4.17 -WmsgNi and 5.4.18 -WmsgNw