Motorola HC12 User Manual

0 (0)
MCUez HC12 Assembler User's Manual
MCUEZASM12/D
Rev. 1
Easy development software
from the company that
knows MCU hardware best
MCUEZASM12/D
Rev. 1
NON-DISCLOSURE AGREEMENT REQUIRED
MCUez
HC12 Assembler
User’s Manual
NON-DISCLOSURE AGREEMENT REQUIRED
User’s Manual
User’s Manual MCUez HC12 Assembler
4 MOTOROLA
Important Notice to Users
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, includingimplied
warranties 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.
© Motorola, Inc., and HIWARE AG., 1999; All Rights Reserved
MCUez HC12 Assembler User’s Manual
MOTOROLA List of Sections 5
User’s Manual MCUez HC12 Assembler

List of Sections

Section 1. General Information . . . . . . . . . . . . . . . . . . . .23
Section 2. Graphical User Interface. . . . . . . . . . . . . . . . .37
Section 3. Environment Variables . . . . . . . . . . . . . . . . . .55
Section 4. Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71
Section 5. Assembler Options . . . . . . . . . . . . . . . . . . . . .77
Section 6. Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
Section 7. Assembler Syntax. . . . . . . . . . . . . . . . . . . . .117
Section 8. Assembler Directives . . . . . . . . . . . . . . . . . .159
Section 9. Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203
Section 10. Assembler Listing File . . . . . . . . . . . . . . . .209
Section 11. Operating Procedures . . . . . . . . . . . . . . . .217
Section 12. Assembler Messages . . . . . . . . . . . . . . . . .243
Appendix A. MASM Compatibility . . . . . . . . . . . . . . . . .311
Appendix B. MCUasm Compatibility . . . . . . . . . . . . . . .315
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .317
User’s Manual MCUez HC12 Assembler
6 List of Sections MOTOROLA
List of Sections
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 7
User’s Manual MCUez HC12 Assembler

Table of Contents

Section 1. General Information
1.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3 Structure of This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4.1 Creating a New Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.4.2 Creating an Assembly Source File. . . . . . . . . . . . . . . . . . . . . . . . . 28
1.4.3 Assembling a Source File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.4.4 Linking an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Section 2. Graphical User Interface
2.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.3 Starting the Motorola Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.4 Assembler Graphical Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.4.1 Window Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.4.2 Content Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.3 Assembler Toolbar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.4.4 Status Bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.4.5 Assembler Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.4.6 File Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.4.6.1 Editor Settings Dialog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.4.6.2 Save Configuration Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.4.6.3 Assembler Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.7 View Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.7.1 Option Settings Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
User’s Manual MCUez HC12 Assembler
8 Table of Contents MOTOROLA
Table of Contents
2.4.8 Specifying the Input File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.4.8.1 Using the Editable Combo Box in the Toolbar. . . . . . . . . . . . . 53
2.4.8.2 Using the Entry File | Assembly ... . . . . . . . . . . . . . . . . . . . . . . 53
2.4.8.3 Using Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.5 Error Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Section 3. Environment Variables
3.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.3 Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.4 Line Continuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.5 Environment Variables Description . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.5.1 ASMOPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.5.2 GENPATH. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.5.3 ABSPATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.5.4 OBJPATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.5.5 TEXTPATH. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.5.6 SRECORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.5.7 ERRORFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.5.8 COPYRIGHT: Copyright Entry in Object File . . . . . . . . . . . . . . . 67
3.5.9 INCLUDETIME: Create Time in Object File . . . . . . . . . . . . . . . . 68
3.5.10 USERNAME: User Name in Object File . . . . . . . . . . . . . . . . . . . 69
Section 4. Files
4.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.3 Input Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.3.1 Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.3.2 Include Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.4 Output Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.4.1 Object Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.4.2 Absolute Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.4.3 Motorola S Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Table of Contents
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 9
4.4.4 Listing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.4.5 Debug Listing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.4.6 Error Listing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Section 5. Assembler Options
5.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3 ASMOPTIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.4 Assembler Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.4.1 -CI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.4.2 -Env . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.4.3 -F2 -FA2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.4.4 -H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.4.5 -L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.4.6 -Lc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.4.7 -Ld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.4.8 -Le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.4.9 -Li. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.4.10 -Ms -Mb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.4.11 -MCUasm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.4.12 -N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.4.13 -V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.4.14 -W1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.4.15 -W2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.4.16 -WmsgNe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.4.17 -WmsgNi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.4.18 -WmsgNw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.4.19 -WmsgFbv -WmsgFbm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.4.20 -WmsgFiv -WmsgFim. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Section 6. Sections
6.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.3 Section Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
User’s Manual MCUez HC12 Assembler
10 Table of Contents MOTOROLA
Table of Contents
6.3.1 Code Sections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.3.2 Constant Data Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.3.3 Data Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4 Section Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4.1 Absolute Sections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4.2 Relocatable Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.4.3 Relocatable versus Absolute Section. . . . . . . . . . . . . . . . . . . . . . 114
6.4.3.1 Modularity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.4.3.2 Multiple Developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.4.3.3 Early Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.4.3.4 Enhanced Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.4.3.5 Tracking Overlaps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.4.3.6 Reusability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Section 7. Assembler Syntax
7.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.3 Comment Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.4 Source Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.4.1 Label Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
7.4.2 Operation Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
7.4.2.1 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
7.4.2.2 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.4.2.3 Macro Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.4.3 Operand Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.4.3.1 Inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.4.3.2 Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.4.3.3 Direct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.4.3.4 Extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.4.3.5 Relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.4.3.6 Indexed, 5-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.4.3.7 Indexed, 9-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.4.3.8 Indexed, 16-Bit Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.4.3.9 Indexed, Indirect 16-Bit Offset . . . . . . . . . . . . . . . . . . . . . . . . 137
7.4.3.10 Indexed, Pre-Decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Table of Contents
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 11
7.4.3.11 Indexed, Pre-Increment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.4.3.12 Indexed, Post-Decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.4.3.13 Indexed, Post-Increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7.4.3.14 Indexed, Accumulator Offset . . . . . . . . . . . . . . . . . . . . . . . . . 142
7.4.3.15 Indexed-Indirect, D Accumulator Offset . . . . . . . . . . . . . . . . 143
7.4.3.16 Indexed PC versus Indexed PC Relative
Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.4.4 Comment Field. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.5 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.5.1 User-Defined Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.5.2 External Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.5.3 Undefined Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.5.4 Reserved Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.6 Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.6.1 Integer Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.6.2 String Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.6.3 Floating-Point Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.7 Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.7.1 Addition and Subtraction Operators (Binary) . . . . . . . . . . . . . . . 149
7.7.2 Multiplication, Division, and Modulo Operators (Binary) . . . . . 149
7.7.3 Sign Operators (Unary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.7.4 Shift Operators (Binary). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.7.5 Bitwise Operators (Binary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.7.6 Bitwise Operators (Unary). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.7.7 Logical Operators (Unary). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.7.8 Relational Operators (Binary) . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.7.9 Memory PAGE Operator (Unary) . . . . . . . . . . . . . . . . . . . . . . . . 153
7.7.10 Force Operator (Unary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.8 Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.8.1 Absolute Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
7.8.2 Simple Relocatable Expression . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.9 Translation Limits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
User’s Manual MCUez HC12 Assembler
12 Table of Contents MOTOROLA
Table of Contents
Section 8. Assembler Directives
8.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
8.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8.2.1 Section Definition Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8.2.2 Constant Definition Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8.2.3 Data Allocation Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8.2.4 Symbol Linkage Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8.2.5 Assembly Control Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8.2.6 Listing File Control Directives . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8.2.7 Macro Control Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8.2.8 Conditional Assembly Directives . . . . . . . . . . . . . . . . . . . . . . . . 164
8.3 ABSENTRY — Application Entry Point. . . . . . . . . . . . . . . . . . . . . 165
8.4 ALIGN — Align Location Counter . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.5 BASE — Set Number Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
8.6 CLIST — List Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . 168
8.7 DC — Define Constant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
8.8 DCB — Define Constant Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
8.9 DS — Define Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
8.10 ELSE — Conditional Assembly. . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
8.11 END — End Assembly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
8.12 ENDIF — End Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . 176
8.13 ENDM — End Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
8.14 EQU — Equate Symbol Value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
8.15 EVEN — Force Word Alignment. . . . . . . . . . . . . . . . . . . . . . . . . . . 178
8.16 FAIL — Generate Error Message. . . . . . . . . . . . . . . . . . . . . . . . . . . 179
8.17 IF — Conditional Assembly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
8.18 IFCC — Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
8.19 INCLUDE — Include Text from Another File. . . . . . . . . . . . . . . . . 185
Table of Contents
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 13
8.20 LIST — Enable Listing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
8.21 LLEN — Set Line Length. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.22 LONGEVEN — Forcing Longword Alignment. . . . . . . . . . . . . . . . 188
8.23 MACRO — Begin Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . 189
8.24 MEXIT — Terminate Macro Expansion . . . . . . . . . . . . . . . . . . . . . 190
8.25 MLIST — List Macro Expansions . . . . . . . . . . . . . . . . . . . . . . . . . . 191
8.26 NOLIST — Disable Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
8.27 NOPAGE — Disable Paging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.28 ORG — Set Location Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.29 OFFSET — Create Absolute Symbols. . . . . . . . . . . . . . . . . . . . . . . 194
8.30 PAGE — Insert Page Break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
8.31 PLEN — Set Page Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
8.32 SECTION — Declare Relocatable Section . . . . . . . . . . . . . . . . . . . 197
8.33 SET — Set Symbol Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.34 SPC — Insert Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.35 TABS — Set Tab Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.36 TITLE — Provide Listing Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.37 XDEF — External Symbol Definition . . . . . . . . . . . . . . . . . . . . . . . 201
8.38 XREF — External Symbol Reference . . . . . . . . . . . . . . . . . . . . . . . 202
Section 9. Macros
9.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.3 Macro Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.4 Defining a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
9.5 Calling Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
User’s Manual MCUez HC12 Assembler
14 Table of Contents MOTOROLA
Table of Contents
9.6 Macro Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
9.7 Labels Inside Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.8 Macro Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
9.9 Nested Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Section 10. Assembler Listing File
10.1 Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
10.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
10.3 Page Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
10.4 Source Listing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
10.4.1 Absolute (Abs.) Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
10.4.2 Relative (Rel.) Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
10.4.3 Location (Loc.) Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
10.4.4 Object (Obj.) Code Listing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
10.4.5 Source Line Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Section 11. Operating Procedures
11.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
11.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
11.2.1 Working with Absolute Sections. . . . . . . . . . . . . . . . . . . . . . . . . 218
11.2.2 Defining Absolute Sections in the Assembly Source File. . . . . . 218
11.2.3 Linking an Application Containing Absolute Sections . . . . . . . . 219
11.3 Working with Relocatable Sections . . . . . . . . . . . . . . . . . . . . . . . . . 221
11.3.1 Defining Relocatable Sections in the Assembly Source File. . . . 221
11.3.2 Linking an Application Containing Relocatable Sections. . . . . . 222
11.4 Initializing the Vector Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
11.4.1 Initializing the Vector Table in the Linker PRM File . . . . . . . . . 224
11.4.2 Initializing Vector Table in Assembly Source Files
Using a Relocatable Section . . . . . . . . . . . . . . . . . . . . . . . . . . 225
11.4.3 Initializing the Vector Table in the Assembly Source File
Using an Absolute Section . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
11.5 Splitting an Application into Different Modules . . . . . . . . . . . . . . . 231
Table of Contents
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 15
11.6 Using Direct Addressing Mode to Access Symbols. . . . . . . . . . . . . 233
11.6.1 Using Direct Addressing Mode to Access
External Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11.6.2 Using Direct Addressing Mode to Access
Exported Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11.6.3 Defining Symbols in the Direct Page. . . . . . . . . . . . . . . . . . . . . . 234
11.6.4 Using a Force Operator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
11.6.5 Using SHORT Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.7 Directly Generating an .abs File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.7.1 Assembler Source File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
11.7.2 Assembling and Generating the Application. . . . . . . . . . . . . . . . 238
Section 12. Assembler Messages
12.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
12.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
12.2.1 Warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
12.2.2 Error. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
12.2.3 Fatal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
12.3 Message Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
12.3.1 A1000: Conditional Directive not Closed . . . . . . . . . . . . . . . . . . 247
12.3.2 A1001: Conditional Else not Allowed Here . . . . . . . . . . . . . . . . 248
12.3.3 A1051: Zero Division in Expression . . . . . . . . . . . . . . . . . . . . . . 249
12.3.4 A1052: Right Parenthesis Expected. . . . . . . . . . . . . . . . . . . . . . . 249
12.3.5 A1053: Left Parenthesis Expected. . . . . . . . . . . . . . . . . . . . . . . . 250
12.3.6 A1054: References on Non-Absolute Objects Are not Allowed
When Options -FA1 or -FA2 Are Enabled. . . . . . . . . . . . . . . 251
12.3.7 A1101: Illegal Label: Label is Reserved . . . . . . . . . . . . . . . . . . . 252
12.3.8 A1103: Illegal Redefinition of Label. . . . . . . . . . . . . . . . . . . . . . 253
12.3.9 A1104: Undeclared User-Defined Symbol <symbolName>. . . . 254
12.3.10 A1201:Label <labelName> Referenced in Directive
ABSENTRY is not Defined in Code Segment . . . . . . . . . . . . 255
12.3.11 A2301: Label is Missing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
12.3.12 A2302: Macro Name is Missing . . . . . . . . . . . . . . . . . . . . . . . . . 256
12.3.13 A2303: ENDM is Illegal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
12.3.14 A2304: Macro Definition Within Definition . . . . . . . . . . . . . . . . 258
12.3.15 A2305: Illegal Redefinition of Instruction or Directive Name . . 259
User’s Manual MCUez HC12 Assembler
16 Table of Contents MOTOROLA
Table of Contents
12.3.16 A2306: Macro not Closed at End of Source . . . . . . . . . . . . . . . . 260
12.3.17 A2307: Macro Redefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
12.3.18 A2308: Filename Expected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
12.3.19 A2309: File not Found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
12.3.20 A2310: Illegal Size Character . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
12.3.21 A2311: Symbol Name Expected . . . . . . . . . . . . . . . . . . . . . . . . . 264
12.3.22 A2312: String Expected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
12.3.23 A2313: Nesting of Include Files Exceeds 50. . . . . . . . . . . . . . . . 265
12.3.24 A2314: Expression Must Be Absolute. . . . . . . . . . . . . . . . . . . . . 265
12.3.25 A2316: Section Name Required . . . . . . . . . . . . . . . . . . . . . . . . . 266
12.3.26 A2317: Illegal Redefinition of Section Name . . . . . . . . . . . . . . . 267
12.3.27 A2318: Section not Declared . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
12.3.28 A2320: Value too Small. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
12.3.29 A2321: Value too Big . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
12.3.30 A2323: Label is Ignored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
12.3.31 A2324: Illegal Base (2, 8, 10, 16) . . . . . . . . . . . . . . . . . . . . . . . . 272
12.3.32 A2325: Comma or Line End Expected . . . . . . . . . . . . . . . . . . . . 273
12.3.33 A2326: Label is Redefined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
12.3.34 A2327: ON or OFF Expected . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
12.3.35 A2328: Value is Truncated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
12.3.36 A2329: FAIL Found. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
12.3.37 A2330: String is not Allowed . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
12.3.38 A2332: FAIL Found. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
12.3.39 A2333: Forward Reference not Allowed. . . . . . . . . . . . . . . . . . . 279
12.3.40 A2334: Only Labels Defined in the Current Assembly Unit
Can Be Referenced in an EQU Expression. . . . . . . . . . . . . . . 280
12.3.41 A2335: Exported Absolute SET Label is not Supported . . . . . . . 281
12.3.42 A2336: Value too Big . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
12.3.43 A2338: <Message String> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
12.3.44 A2341: Relocatable Section not Allowed: Absolute File
is Currently Directly Generated . . . . . . . . . . . . . . . . . . . . . . . 284
12.3.45 A12001: Illegal Addressing Mode. . . . . . . . . . . . . . . . . . . . . . . . 285
12.3.46 A12002: Complex Relocatable Expression not Supported . . . . . 286
12.3.47 A12003: Value is Truncated to One Byte . . . . . . . . . . . . . . . . . . 287
12.3.48 A12005: Value Must Be Between 1 and 8. . . . . . . . . . . . . . . . . . 288
12.3.49 A12007: Comma Expected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
12.3.50 A12008: Relative Branch with Illegal Target . . . . . . . . . . . . . . . 289
12.3.51 A12009: Illegal Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Table of Contents
MCUez HC12 Assembler User’s Manual
MOTOROLA Table of Contents 17
12.3.52 A12010: Register Expected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
12.3.53 A12011: Size Specification Expected . . . . . . . . . . . . . . . . . . . . . 292
12.3.54 A12102: Page Value Expected . . . . . . . . . . . . . . . . . . . . . . . . . . 293
12.3.55 A12103: Operand not Allowed . . . . . . . . . . . . . . . . . . . . . . . . . . 294
12.3.56 A12104: Immediate Value Expected . . . . . . . . . . . . . . . . . . . . . . 295
12.3.57 A12105: Immediate Address Mode not Allowed . . . . . . . . . . . . 296
12.3.58 A12107: Illegal Size Specification for HC12 Instruction . . . . . . 297
12.3.59 A12109: Illegal Character at the End of Line . . . . . . . . . . . . . . . 298
12.3.60 A12110: No Operand Expected . . . . . . . . . . . . . . . . . . . . . . . . . . 299
12.3.61 A12201: Lexical Error in First or Second Field . . . . . . . . . . . . . 300
12.3.62 A12202: Not an HC12 Instruction or Directive. . . . . . . . . . . . . . 301
12.3.63 A12203: Reserved Identifiers not Allowed
as Instruction or Directive. . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
12.3.64 A12401: Value Out of Range –128...127. . . . . . . . . . . . . . . . . . . 302
12.3.65 A12402: Value Out of Range –32,768...32,767. . . . . . . . . . . . . . 304
12.3.66 A12403: Value Out of Range –256...255. . . . . . . . . . . . . . . . . . . 305
12.3.67 A12405: PAGE with Initialized RAM not Supported . . . . . . . . . 307
12.3.68 A12408: Code Size Per Section Is Limited to 32 Kbytes . . . . . . 308
12.3.69 A12409: In PC Relative Addressing Mode,
References to Object Located in Another Section
or File Only Allowed for IDX2 Addressing Mode. . . . . . . . . 309
12.3.70 A12411: Restriction: Label Specified in a DBNE, DBEQ,
IBNE, IBEQ, TBNE, or TBEQ Instruction Should
Be Defined in the Same Section They Are Used . . . . . . . . . . 310
Appendix A. MASM Compatibility
A.1 Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.3 Comment Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.4 Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.5 Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
A.6 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
User’s Manual MCUez HC12 Assembler
18 Table of Contents MOTOROLA
Table of Contents
Appendix B. MCUasm Compatibility
B.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
B.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
B.3 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
B.4 Set Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
B.5 Obsolete Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Index
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
MCUez HC12 Assembler User’s Manual
MOTOROLA List of Figures 19
User’s Manual MCUez HC12 Assembler

List of Figures

Figure Title Page
1-1 MCUez Shell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1-2 Environment Configuration Dialog Box. . . . . . . . . . . . . . . . . . . . . . . 25
1-3 Working Project Directory Dialog Box . . . . . . . . . . . . . . . . . . . . . . . 26
1-4 New Configuration Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1-5 Assembler Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1-6 Options Settings Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1-7 Selecting an Object File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1-8 Assembling a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1-9 Linker Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1-10 Link Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2-1 Tip of the Day Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2-2 Assembler Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2-3 Assembler Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2-4 Assembler Status Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2-5 Starting the Global Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2-6 Starting the Local Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2-7 Starting the Editor with the Command Line. . . . . . . . . . . . . . . . . . . . 46
2-8 Starting the Editor with DDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2-9 Save Configuration Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4-1 Assembler Structural Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6-1 Absolute Section Programming Example. . . . . . . . . . . . . . . . . . . . . 109
6-2 PRM File Example Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6-3 Relocatable Section Programming Example . . . . . . . . . . . . . . . . . . 111
6-4 Defining One RAM and One ROM Area. . . . . . . . . . . . . . . . . . . . . 112
6-5 Defining Multiple RAM and ROM Areas . . . . . . . . . . . . . . . . . . . . 113
User’s Manual MCUez HC12 Assembler
20 List of Figures MOTOROLA
List of Figures
Figure Title Page
7-1 Relocatable Symbols Program Example. . . . . . . . . . . . . . . . . . . . . . 146
7-2 Set or EQU Directive Program Example . . . . . . . . . . . . . . . . . . . . . 146
7-3 External Symbol Program Example . . . . . . . . . . . . . . . . . . . . . . . . . 146
7-4 Undefined Symbol Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
11-1 Starting the MCUez Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
11-2 Options Setting Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
11-3 Selecting the Object File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
11-4 Generating an .abs File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
MCUez HC12 Assembler User’s Manual
MOTOROLA List of Tables 21
User’s Manual MCUez HC12 Assembler

List of Tables

Table Title Page
2-1 Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2-2 Assembler Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2-3 Advanced Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3-1 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5-1 Assembler Option Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5-2 Scope of Each Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5-3 Assembler Option Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7-1 ExecuInstructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
7-2 Addressing Mode Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7-3 Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7-4 Expression — Operator Relationship (Unary) . . . . . . . . . . . . . . . . . 157
7-5 Expression — Operator Relationship (Binary). . . . . . . . . . . . . . . . . 158
8-1 Section Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8-2 Constant Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8-3 Data Allocation Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
8-4 Symbol Linkage Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8-5 Assembly Control Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8-6 Assembler List File Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8-7 Macro Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8-8 Conditional Assembly Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8-9 Conditional Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
A-1 Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
A-2 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
B-1 Obsolete Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
User’s Manual MCUez HC12 Assembler
22 List of Tables MOTOROLA
List of Tables
MCUez HC12 Assembler User’s Manual
MOTOROLA General Information 23
User’s Manual MCUez HC12 Assembler

Section 1. General Information

1.1 Contents

1.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3 Structure of This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.4.1 Creating a New Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.4.2 Creating an Assembly Source File. . . . . . . . . . . . . . . . . . . . . . . . . 28
1.4.3 Assembling a Source File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.4.4 Linking an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

1.2 Introduction

Features of the MCUez HC12 assembler include:
Graphical user interface (GUI)
Online help
Support for absolute and relocatable assembler code
32-bit application
Compatible with MCUasm Release 5.3
Conforms to Motorola assembly language input standard and
ELF/DWARF 2.0 object code format
User’s Manual MCUez HC12 Assembler
24 General Information MOTOROLA
General Information

1.3 Structure of This Manual

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
Appendices
Index

1.4 Getting Started

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
NOTE:
All directory paths and listings are examples only. Paths and directory listings
may change depending upon the MCUez configuration.
General Information
Getting Started
MCUez HC12 Assembler User’s Manual
MOTOROLA General Information 25

1.4.1 Creating a New Project

The first step in creating an application is to define the new project. Do this by
using the MCUez Shell.
1. Start the MCUez Shell.
Figure 1-1. MCUez Shell
2. Click on the ezMCU button to open the Configuration dialog box.
Figure 1-2. Environment Configuration Dialog Box
3. Click on the New button to open the Project Directory dialog box.
User’s Manual MCUez HC12 Assembler
26 General Information MOTOROLA
General Information
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.
General Information
Getting Started
MCUez HC12 Assembler User’s Manual
MOTOROLA General Information 27
Figure 1-4. New Configuration Dialog Box
7. Click on the OK button in the New Configuration dialog box to create
the MCUez configuration files in the specified project directory.
User’s Manual MCUez HC12 Assembler
28 General Information MOTOROLA
General Information

1.4.2 Creating an Assembly Source File

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:
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.
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:
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.
General Information
Getting Started
MCUez HC12 Assembler User’s Manual
MOTOROLA General Information 29

1.4.3 Assembling a Source File

This procedure describes how to assemble a source file.
1. Start the assembler by clicking on the ezASM button in the MCUez
Shell. Enter the name of the file to be assembled in the editable combo
box, as shown in Figure 1-5.
Figure 1-5. Assembler Window
User’s Manual MCUez HC12 Assembler
30 General Information MOTOROLA
General Information
2. Select the menu entry Assembler | Options to generate anELF/DWARF
2.0 object file. The Options Settings dialog is displayed as shown in
Figure 1-6.
Figure 1-6. Options Settings Dialog Box
Loading...
+ 298 hidden pages