The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

User's Manual UM003601-COR1299 ©1999 ZiLOG, Inc. rights rese


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Zilog Macro Cross Assembler
User's Manual
UM003601-COR1299
©1999 ZiLOG, Inc. rights reserved. Information this publication concerning devices, applications, technology described intended suggest possible uses superseded. ZiLOG, INC. DOES ASSUME LIABILITY PROVIDE REPRESENTATION ACCURACY INFORMATION, DEVICES, TECHNOLOGY DESCRIBED THIS DOCUMENT. ZiLOG ALSO DOES ASSUME LIABILITY INTELLECTUAL PROPERTY INFRINGEMENT RELATED MANNER INFORMATION, DEVICES, TECHNOLOGY DESCRIBED HEREIN OTHERWISE. Except with express written approval ZiLOG, information, devices, technology critical components life support systems authorized. licenses conveyed, implicitly otherwise, this document under intellectual property rights.
ZiLOG, Inc. East Hamilton Ave., Suite Campbell, 95008 Telephone: (408) 558-8500 FAX: (408) 558-8300 Internet: http://www.zilog.com
UM003601-COR1299
ABOUT THIS MANUAL
recommend that read understand everything this manual before setting using product. However, recognize that users have different styles learning. Therefore, have designed this manual used either how-to procedural manual reference guide important data. following conventions have been adopted provide clarity ease use:
Universe Medium 10-point all-caps used highlight following items: commands displayed messages menu selections, pop-up lists, button, fields, dialog boxes modes pins ports program application name instructions, registers, signals subroutines action performed software icons
Courier Regular 10-point used highlight following items software code file names paths
UM003601-COR1299
hexadecimal value
Grouping Actions Within Procedure Step Actions procedure step performed same window dialog box. Actions performed different windows dialog boxes appear separate steps.
UM003601-COR1299
TABLE CONTENTS
Chapter Title Subsections Page
Chapter Introduction
Introduction. ZMASM Development Environment Understanding Relocatable Assembly
Chapter Assembler Description
Introduction. Assembler Overview Source Statement Format Assembler Symbols. 2-13 Assembler Reserved Words. 2-16 Assembler Operators 2-23 Assembler Expressions. 2-25 Structured Assembly Outputs. 2-41 Conditional Assembly. 2-41 Conditional Assembly Inputs 2-42 Conditional Assembly Processing 2-50
Chapter Macro Language
Introduction. Using Macros Referencing System Symbols 3-14
UM003601-COR1299
Chapter Title Subsections
Page
Chapter Linker Description
Introduction .4-1 Invoking Linker.4-5 Linker Options.4-6 Link File .4-11
Appendix DOS-Version Assembler Linker
Invoking Assembler Invoking Linker. A-10 Appendix Utilities Description ZFIXUP
Appendix Assembler Linker Error Messages
assembler errors. LINKER errors C-27
Appendix Importing From Other Assemblers
Introduction
Appendix ASCII Character Appendix Sample Output File Printouts
Output Files .G-1 .MAP file .G-1 .HEX file.G-8 .SYM file .G-30
Glossary
UM003601-COR1299
LIST FIGURES
Figure Figure Figure Figure Figure Figure Figure Figure Figure Figure Figure Figure Figure Page Cross Assembler Functional Relationship. Assembly Language Programs Cross Assembler Block Diagram Restricted, Reserved, Special Assembler Symbols 2-15 General Format Conditional Inputs 2-43 General Format Macro Example Nested Macro Macro Call, Expansion 3-11 Linker Functional Relationship Linker Components Sample Symbol File 4-21 Linker Components A-10
UM003601-COR1299
LIST TABLES
Table Table Table Table Table Table Table Table Table Table Table 2-10 Table 2-11 Table 2-12 Table 2-13 Table 2-14 Table 2-15 Table 2-16 Table 2-17 Table 2-18 Table 2-19 Table 2-20 Table 2-21 Table 2-22 Table 2-23 Table 2-24 Table 2-25 Table 2-26 Table 2-27 Table 2-28 Table 2-29 Table 2-30 Table 2-31 Page Character Constant Escape Sequences Character Constant Escape Sequences 2-11 String Constants Escape Sequences. 2-13 Assembler Directives. 2-16 Mnemonic Operators 2-17 Machine Instructions. 2-18 Registers. 2-18 Condition Flags 2-18 Interrupt Vectors 2-19 Z89C00 Z893XX Machine Instructions 2-19 Z89C00 Z893XX Registers 2-19 Z89C00 Z893XX Condition Flags 2-19 Z89C00 Z893XX Interrupt Vectors 2-19 Z180 Processor Machine Instructions 2-20 Z180 Processor Registers 2-20 Z180 Processor Condition Flags. 2-21 Z380 Processor Machine Instructions 2-21 Z380 Processor Registers 2-22 Z380 Processor Condition Flags. 2-22 Assembler Expression Operators. 2-23 Types Expressions. 2-27 Assembler Directives Structured Assembly 2-30 Assembler Directives Conditional Assembly 2-42 Assembler Directive Summary. 2-55 Number Addresses Initializer. 2-69 Number Addresses Initializer. 2-71 Number Addresses Initializer. 2-78 Family Control Section Address Spaces 2-81 Hybrid Z8/Z89C00 Family Control Section Address Spaces. 2-82 Z89C00 Family Control Section Address Spaces 2-83 Print Assembler Directive Options. 2-113
UM003601-COR1299
Table Table 2-32 Table 2-33 Table 2-34 Table Table Table Table Table Table Table
Page Supported Types 2-126 Vector Locations. 2-129 Z89C00 Family Vectors 2-130 Macro Assembler Instructions. Examples Symbol Substitution Concantenation. 3-12 System Symbol Names Descriptions 3-14 Acronyms Abbreviations Command Line Options. Summary Linker Options A-12 Summary Linker Commands. A-13
UM003601-COR1299
ZILOG MACRO CROSS ASSEMBLER
CHAPTER INTRODUCTION
INTRODUCTION
addition providing that necessary install Zilog Macro Cross Assembler (ZMASM) software, this chapter introduces basic concepts that greatly simplify your target application development: "ZMASM Development Environment" section briefly describes this software product used conjunction with other tools that make Zilog ZMASM development environment. "Understanding Relocatable Assembly" section lists explains some obvious benefits modular programming when compared writing programs larger file. third section, "Getting Started", lists minimum recommended system requirements necessary ZMASM software shows simple procedure installing ZMASM software diskette begin building target application program your own.
Chapter Topics:
ZMASM Development Environment Understanding Relocatable Assembly Getting Started System Requirements Installing ZMASM Software
UM003601-COR1299
Introduction
Introduction
ZMASM Features
Dual Processor Chips DSP) Same Source File Structured Assembly Data Code Source-Level Debug Support Built-In Register Equates Linker
Topics Covered Other Chapters:
Using Assembler Chapter Assembler Syntax Directives Chapter Macro Language Chapter Linker Description Chapter
UM003601-COR1299
Introduction
ZMASM Development Environment
ZMASM DEVELOPMENT ENVIRONMENT
ZMASM principal software tool ZMASM development environment supporting Zilog's family microcontrollers. designed used conjunction with other tools assembler development environment, which enhances programmer productivity. assembler development environment enables users develop software assembler language, including assembly, debug, programming, code submission. Using Microsoft Windows-based project interface, user easily manage large numbers source files only minimum number required files reassembled when source code changes made. assembler takes source file containing assembly language statements translates into corresponding object file. produce listing file containing source code, object code, comments. assembler supports macros, structure assembly, conditional assembly. functional relationship assembler other elements ZMASM development environment shown Figure 1-1.
Text Editor
Language Source Files
Compiler
Assembler Source Code Files Assembler Listing Files
Cross Assembler Relocatable Object Files
Object Files Libraries
Linker Executable Load File Source Debug File
File Conversion Utility ZDUMP EPROM Programmer
Figure 1-1. Cross Assembler Functional Relationship
UM003601-COR1299
Understanding Relocatable Assembly
Introduction
UNDERSTANDING RELOCATABLE ASSEMBLY
Relocation process whereby program broken into smaller individual modules files, assembled separately, then rejoined together create final binary object file that executed. Relocation precisely mechanism achieve high-level top-down design, top-down coding, top-down testing. relocation process breaking program into smaller modules, modular programming, permits greater programmer efficiency many reasons: Easier conceptualize smaller modules. Easier faster edit smaller modules. Easier faster debug verify smaller modules. Easier faster reassemble only modules that have errors debug process. assemble larger programs using same host computer memory size. Reduces global variables which enhances understanding improves maintenance reliability. understand relocation linking concepts, consider assembly language program Figure 1-2a, which shows program written long file. This program been simplified ease reader's understanding, concept easily expanded larger programs. convert this program into several relocatable files, first step find logical breaks create smaller files shown Figure 1-2b. This usually done separating program functional blocks, such "startup", "main", "input_output", other logical groups subroutines. Then each file examined symbols that referenced that file defined. each these symbols, they must defined this file "external", which means they will defined some other file "global". each symbol that will used another file, must defined "global" "external" reference other file will satisfied. This shown Figure 1-2c.
UM003601-COR1299
Introduction
Understanding Relocatable Assembly
program.src
data1 data2 data3 data4 start clear clear store store call call
program1.src
data1 data2 data3 data4 start clear clear store store call call
program1.src
global external data1 data2 data3 start clear store store call call jump data1, data2, data3 subr1, subr2
data3 data4 data1 data2 subr1 subr2
data3 data4 data1 data2 subr1 subr2
data3 data1 data2 subr1 subr2 loop
jump loop subr1 load data1 data2 store data3 return subr2 load data1 data2 store data3 return
jump loop
program2.src
subr1 load data1 data2 store data3 return
program2.src
global external subr1 load store return subr1 data1, data2, data3 data1 data2 data3
program3.src
subr2 load data1 data2 store data3 return
Long File
program3.src
global subr2 external data1, data2, data4 subr2 load data1 data2 store data4 return Three Relocatable Files
Three Smaller Files
Figure 1-2. Assembly Language Programs
UM003601-COR1299
linker then examines cross-referenced global external symbols resolves them absolute address, thus creating final absolute address object module. When each individual file then assembled, final absolute address known therefore listing file output from assembler will show "relative" addresses. Each listing file will show program counter starting with value zero. When file linked, link will show starting address each file linked. adding relative address listing file starting address link that file, absolute address determined. this make debugging very tedious error prone hexadecimal calculations, ZMASM provides utility overcome this. ZFIXUP, simple DOS-based utility, does "address fix-ups" examining link file determine starting addresses each file. Then reads each listing file simply rewrites file with correct addresses dictated link map. (Refer Appendix Utilities Description more information ZFIXUP other utilities.) Another important concept relocation "sections". Sections thought separate logical groupings memory. most common usage imagine memory embedded processor system that typically contain "ram1", "ram2", "rom1", "rom2", "i/o". Sections permit one-to-one mapping correspondence from assembly language program physical memory resources. This also especially important when memory sections similar type (RAM ROM) disjointed because permits easy assignment control resources. Sections also permit assembling programs dual-processor MCUs common assembly file. Dual processor MCUs, such Z89175 Z89C65, combine powerful core with versatile Z89C00 core into single device cost-reduced mixed-mode applications. Finally, overcome problems managing many files, utility programs have been written examine file dependencies modification times only minimum amount reassembly done after edit session. These utilities typically called "make" because they help make final object file. ZMASM includes simple "make" type utility Windows based "project" front enhance programmer productivity. NOTE: Refer Managing Structured Techniques, Strategies Software Development 1990's, Edward Yourdon, third edition, Yourdon Press Prentice Hall, Englewood Cliffs, Jersey 07632.
ZILOG MACRO CROSS ASSEMBLER
CHAPTER ASSEMBLER DESCRIPTION
INTRODUCTION
Zilog's Macro Assembler (ZMASM) software tools making Zilog's integrated development environment that supports Zilog's family microcontrollers. assembler, therefore, designed used conjunction with other tools that make integrated development environment. assembler takes source file containing assembly language statements translates into corresponding object file that then used target application. also produce listing containing source code, object code, comments. addition, assembler supports macros, structured, conditional assembly. "Assembler Overview" section further describes basic functions assembler. Additional sections that follow specifically address such topics assembler's source statement format, constants, symbols, expressions, structured conditional assembly. This chapter also includes complete listing full description each ZMASM assembler directive concludes with listing assembly errors warnings.
Chapter Topics:
Source Statement Format Assembler Constants Assembler Symbols Assembler Operators Assembler Expressions Structured Conditional Assembly Assembler Directives
UM003601-COR1299
Assembler Overview
Assembler Description
ASSEMBLER OVERVIEW
assembler reads source file that been generated compiler, created user with text editor, creates relocatable object file. object file then linked with other object files libraries, using linker. Output from linker executable load file, which loaded into target system debugged, using Source Level Debug program, programmed into EPROM masked ROM, direct customer's application Figure 2-1. assembler performs following primary functions:
Converts machine instructions, coded mnemonic form, their binary representation, writes that representation relocatable object file which suitable linking with other object files create absolute load file. Creates assembler listing file, providing mapping source code statements their machine representation. Allows frequently occurring source sequences coded macros, which called using single directive. Provides high-level control structures decision loop control support structured assembly language programming. Supports conditional assembly portions source module. Allows source module split over multiple physical source files, which processed single entity through file inclusion mechanism. Performs syntax checking source statements, notify programmer invalid forms. Provides debug information object module, support assembler language debugging source module level.
UM003601-COR1299
Assembler Description
Assembler Overview
Source Module
File
READ
Read Source
STOP
Conditionally Excluded?
READ
Source Syntax Correct?
Report Error
READ
Expand Macros Listing File Emit Code
Object File
READ
Figure 2-1. Cross Assembler Simplified Block Diagram
UM003601-COR1299
Source Statement Format
Assembler Description
SOURCE STATEMENT FORMAT
assembly language source file lines called source statements. Source statements delimited ASCII newline character (ASCII decimal code 10), ASCII character pair carriage-return plus newline (ASCII decimal code followed ASCII decimal code 10). assembler source statements written free format, contain ASCII text characters, excluding statement delimiters. Column source statements reserved specifying labels, that only labels appear column one, although they need Apart from this restriction, there requirements certain things appear particular column position. source statements divided into fields, which arbitrary length, appear column, except that fields positionally dependent with respect another, their combined length must exceed characters. There four fields source statement, listed here order which they must appear source statement: Label Field Operation Field Operand Field Comment Field general syntax source statements follows: [label
operation
[operands]
comment]
UM003601-COR1299
Assembler Description
Source Statement Format
Some fields source statement upper-case lower-case sensitive. following table summarizes case sensitivity:
Table 2-1. Character Constant Escape Sequences
Area
Labels/symbols Operation codes (machine instructions assembler directives) Macro names Operands Reserved symbols
Case Sensitive
Examples
"Start" "start" distinct labels. "LOAD", "load", "Load" same. "CHIP", "chip", "Chip" same. "MACRO" "macro", "Macro" same. "Fetch" "fetch" distinct macros. "AbsSection" "ABSSection" distinct operands. "$F" "$f" same redefined.
UM003601-COR1299
Source Statement Format
Assembler Description
Assembler Source Statement Label Field
label field optional. used, contains label identify source statement. labeled statement referenced another statement using statement label. label usually assigned value assembler's location counter. valid assembler symbol placed label field; label simply assembler symbol used label field. Sometimes programmers interchange usage `label' `symbol', there subtle difference. statement contain only label label field. present, label must valid assembler symbol. Labels symbols case sensitive; uppercase distinct from lowercase. label does begin column one, label must suffixed with colon (:). label specified column one, colon suffix optional. Whitespace separate label colon suffix. Label names scope recorded assembler's symbol table. Labels must unique within their scope. Labels need unique with respect machine assembler directive mnemonics. That directive mnemonics reserved assembler. label local label first character '$'. Local labels have restricted scope, being visible only between assembler SCOPE .NEWBLOCK directives which bound their definition. Local labels within macro definitions visible only within that definition. symbol `$$' anonymous label, appear arbitrary number times source module. Anonymous labels referenced symbols which refer nearest forward-referenced anonymous label nearest backward anonymous label, respectively. period character must appear only first character label. period other position within label, "Invalid label" error occurs.
UM003601-COR1299
Assembler Description
Source Statement Format
Assembler Source Statement Operation Field
operation field contains operation code. This field contains symbolic name (mnemonic) assembler, machine macro call directive. This field required operand field used, coded position after label field. label field omitted, operation field begin position after column one, long nothing other that whitespace precedes label field specified, whitespace optionally separate label from operation code. Operation codes (machine instructions assembler directives) case sensitive; uppercase lowercase characters handled exactly same way. Macro names, however, comprised symbols, case sensitive. Operand Field operand field contains operands. This field optional, depending requirements specific directive coded operation field. contains more operands associated with directive coded operation field. more than operand used, individual operands separated commas. Whitespace characters optionally surround comma separators. least whitespace character must separate operation operand fields. Operands case sensitive, they comprised symbols. Comment Field comment field optional; used, contains comment. Comments introduced with comment character (;). After comment character, string ASCII text characters coded (except newline, which delimits source statements). comment character optionally separated from preceding field coding whitespace characters. there preceding fields, comment character specified first column, preceded whitespace. first character source statement asterisk (*), then entire statement treated comment.
UM003601-COR1299
Source Statement Format
Assembler Description
Assembler Constants
assembler constant self-defining term whose value specified explicitly. assembler supports four kinds constant: Arithmetic Constants Character Constants String Constants Symbolic Constants Assembler Arithmetic Constants assembler supports following kinds arithmetic constant:
Binary Integer Constants Octal Integer Constants Decimal Integer Constants Hexadecimal Integer Constants Floating Point Constants Fixed Point Constants
integral constants represented internally signed, 32-bit numbers. specified integral constant cannot represented bits, truncated warning generated. Integral constants sign extended. Thus, constant 0FFH equal 00FF (hexadecimal) (decimal); does equal floating point constants represented internally IEEE 64-bit, double precision, floating point format. specified floating point constant cannot represented double precision format, truncated warning generated. Assembler Binary Integer Arithmetic Constants Binary integer constants specified coding base number suffixed letter Base numbers coded using binary digits through following examples valid binary integer constants. 00000000B 0100000b Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal)
UM003601-COR1299
Assembler Description
11111000B
Source Statement Format Constant equal (decimal) (hexadecimal)
Assembler Octal Integer Arithmetic Constants Octal integer constants specified coding base number suffixed letter Base numbers coded using octal digits through following examples valid octal integer constants. 0100000O 226O 1232O Constant equal (decimal) (hexadecimal) Constant equal 32,768 (decimal) 8,000 (hexadecimal) Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal)
Assembler Decimal Integer Arithmetic Constants Base default base arithmetic constants. Decimal integer constant therefore specified coding base number with prefix suffix. Base numbers coded using decimal digits through following examples valid decimal integer constants. 1000 32768 Constant equal 1,000 (decimal) (hexadecimal) Constant equal 32,768 (decimal) 8,000 (hexadecimal) Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal)
Assembler Hexadecimal Integer Arithmetic Constants Hexadecimal integer constants specified coding base number suffixed letter Base numbers coded using hexadecimal digits through letters through (uppercase lowercase). avoid ambiguity with symbols, hexadecimal integer constants must begin with digits through following examples valid hexadecimal integer constants. 37ACh Constant equal (decimal) (hexadecimal) Constant equal (decimal) 000F (hexadecimal) Constant equal 14,252 (decimal) 37AC (hexadecimal)
UM003601-COR1299
Source Statement Format 0abcH
Assembler Description
Constant equal 2,748 (decimal) 0ABC (hexadecimal)
Assembler Floating-Point Arithmetic Constants floating-point constant consists three parts, specified following order: Integer Part Fraction Part Exponent Part Integer Part. floating-point integral part mandatory, consists more decimal digits followed period. Fraction Part. floating-point fraction part optional. specified, consists more decimal digits. Exponent Part. floating-point exponent part optional. specified, consists optionally followed followed more decimal digits. following examples valid floating-point arithmetic constants: 2.e-5 0.5E2 4.0e+2 2.0E3 Assembler Fixed-Point Arithmetic Constants Fixed-point arithmetic constants real numbers range [-1,1). That fixed-point arithmetic constants greater than equal -1.0, less than 1.0. These numbers used, example, (FRACT) assembler directive, such
2-10
UM003601-COR1299
Assembler Description
Assembler Character Constants
Source Statement Format
character constant represents ASCII character code single ASCII character. character constant integer value. value character constant ASCII decimal code character. character constant coded enclosing single ASCII graphic character, character escape sequence, within single quotation marks ASCII decimal code 39'). following examples valid character constants. Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal) Constant equal (decimal) (hexadecimal)
Table 2-2. Character Constant Escape Sequences
Sequence
Decimal Value
Description
Null character. Alert (bell). Backspace. Tab. Newline Vertical tab. Formfeed. Carriage return. Double quote. Within character constants, necessary escape double quote, legal. Single quote. Within character constants, necessary escape single quote. Backslash.
UM003601-COR1299
2-11
Source Statement Format Assembler String Constants
Assembler Description
string constant consists more ASCII graphic characters enclosed double quotation marks ASCII decimal code 34"). embed double quote mark inside string, escape character backslash must precede double quote character. This same mechanism used programming language. Each character string must single ASCII graphic character, character escape sequence. null string represented empty pair matching double quotes. NOTE: Null character (\0) escape sequence invalid.
following examples valid string constants. "version" "Plan \"9\" done" Defines 7-character string version. Defines 16-character string Plan done.
2-12
UM003601-COR1299
Assembler Description
Character strings used following:
Assembler Symbols
File names, INCLUDE "filename.s" Section names, .SECT "section" Data initialization directives, .ASCII "char string"
Table 2-3. String Constants Escape Sequences
Sequence
Decimal Value
Description
Alert (bell). Backspace. Tab. Newline Vertical tab. Formfeed. Carriage return. Single quote. Within string constant, necessary escape single quote, legal. Double quote. Within string constant, necessary escape double quote, legal. Backslash.
Assembler Symbolic Constants symbolic constant named constant. Symbolic constants defined using assembler directives.
ASSEMBLER SYMBOLS
assembler symbol single character combination characters that used represent label, assembler, machine macro call directive.
UM003601-COR1299
2-13
Assembler Symbols
Assembler Description
Symbols consist numeric digits, uppercase lowercase letters, special characters: underscore (_), period (.), dollar sign ($), question mark (?), pound sign (#); combination such digits, letters characters. NOTE: period (.), this true only first character
Symbols cannot begin with numeric digit with pound sign (#). Symbols length greater than zero less than hundred twenty eight (128). Certain symbols reserved restricted assembler. Uppercase lowercase letters distinct.
2-14
UM003601-COR1299
Assembler Description
Assembler Reserved Symbols
Assembler Symbols
following table summarizes restricted, reserved special assembler symbols.
Figure 2-2. Restricted, Reserved, Special Assembler Symbols
Symbol Description Current value location counter Notes Restrictions This symbol reserved, meaning that redefined programmer. This symbol used label arbitrary number times. This symbol referenced most recent anonymous label defined before reference. This symbol reserved: redefined. This symbol referenced most recent anonymous label defined after reference. This symbol redefined. These symbols used assembler-generated labels, required structured assembly processing. illegal programmer define label this form, programmer's responsibility ensure that such programmer-defined labels unique.
Anonymous label. Anonymous label backward reference.
Anonymous label forward reference.
$Lnnnnnn
Assembler-generated label. nnnnnn six-digit decimal number.
UM003601-COR1299
2-15
Assembler Reserved Words
Assembler Description
ASSEMBLER RESERVED WORDS
Reserved words consist register names, condition flags, machine instructions directives. reserved words must conform following rules:
Reserved words must used labels. used labels, ZMASM will flag error; however these attempts cause unexpected result your program. Reserved words must used macro arguments; otherwise, syntax error will generated. Reserved words munt occur firts column, ZMASM will process label. This cause unexpected results.
Table 2-4. ASSEMBLER DIRECTIVES
.$BREAK .$IF .ACIZ .ELSE .EMSG .GLOBAL .LONG .MNOLIST .SBLOCK .TAB .WORD BLKW .$CONTINUE .$UNTIL .ASG .ELSEIF .EQU .MACRO .NEWBLOCK .SECT .TAG .WMSG DEFINE .COPY .$WEND .BES .END .EVAL .INCLUDE .MEXIT .NOLIST .SET .TEXT ALIGN CHIP .$ELSE .$WHILE .BYTE .ENDIF .EXTERN .INT .MLIST .ORG .SPACE .TITLE BFRACT COMMENT .$ELSEIF .ALIGN .DATA .ENDM .FILE .LENGTH .MMREGS .PAGE .STRING .USECT BLKB CONDLIST .$REPEAT .ASCII .DEF .ENDSTRUCT .FLOAT .LIST .MMSG .REF .STRUCT .WIDTH BLKL
2-16
UM003601-COR1299
Assembler Description Table 2-4. ASSEMBLER DIRECTIVES
ENDMAC IFNEQI IFMA MACEXIT NOLIST TARGET XREF ELIF IFDEF FILE INCLUDE MACLIST ROMSIZE TITLE ELSE ERROR IFNDEF GLOBAL LFRACT MACNOTE SCOPE
Assembler Reserved Words
ELSEIF EXIT IFEQ GLOBALS LIST MACRO PRINT SEGMENT VECTOR
EXTERN IFEQI MACCNTR MACLIST WARNING
ENDIF FRACT IFNEQ IFNB MACEND NEWPAGE PUBLIC SUBTITLE XDEF
MNEMONIC OPERATORS
Table 2-5. Mnemonic Operators
LOW16 HIGH .$ELSE HIGH16
UM003601-COR1299
2-17
Assembler Reserved Words
Assembler Description
Table 2-6. Machine Instructions
DJNZ LEDI HALT CALL STOP DECW INCW LDCI PUSH IRET SWAP
Table 2-7. Registers
FLAGS PRE0 PRE1 R0-R15 P01M P0-P3 RR0-RR15
Table 2-8. Condition Flags
2-18
UM003601-COR1299
Assembler Description Table 2-9. Interrupt Vectors
IRQU RESET IRQ1 IRQ2 IRQ3
Assembler Reserved Words
IRQ4
IRQ5
Z89C00 Z893XX
Table 2-10. Z89C00 Z893XX Machine Instructions
COPF SIEF MPYA PUSH MPYS SOPF CALL CIEF
Table 2-11. Z89C00 Z893XX Registers
Dn:b EXTn Pn:b
Table 2-12. Z89C00 Z893XX Condition Flags
Table 2-13. Z89C00 Z893XX Interrupt Vectors
INT0 INT1 INT2 RESET
UM003601-COR1299
2-19
Assembler Reserved Words
Assembler Description
Z180 PROCESSOR
Table 2-14. Z180 Processor Machine Instructions
INDR OTIMR RETI RLCW SBCW SUBW HALT LDDR OTIR PUSH RETN RLCA RRCW SWAP CPDR INIR OTDM RRCA SRAW DJNZ LDIR OTDMR OUT0 RESC SETC TSTIO CALL CPIR OTDR OUTD SRLW OTIM OUTI RETB SLAW XORW
Table 2-15. Z180 Processor Registers
2-20
UM003601-COR1299
Assembler Description Table 2-16. Z180 Processor Condition Flags
Assembler Reserved Words
Z380 PROCESSOR
Table 2-17. Z380 Processor Machine Instructions
CPLW DJNZ INDW INIRW LDIR NEGW ADCW BTEST CPDR EXXY INDR LDDW LDIRW CALL DDIR HALT INAW INDRW LDDR ADDW CALR EXALL LDDRW MTEST CPIR DECW EXTS INCW MULTW OTDM ANDW EXTSW INIR LDCTL LDIW OTDMR
UM003601-COR1299
2-21
Assembler Reserved Words
Assembler Description
Table 2-17. Z380 Processor Machine Instructions
OTDR OUTDW RESC SETC TSTIO OTDRW OUTW OUTI SRLW OTIM OUT0 OUTIW RETB SLAW XORW OTIMR OUTA RETI RLCW SBCW SUBW OTIR OUTAW PUSH RETN RLCA RRCW SWAP OTIRW OUTD RRCA SRAW
Table 2-18. Z380 Processor Registers
IXL' IYL' IXU' IYU'
Table 2-19. Z380 Processor Condition Flags
2-22
UM003601-COR1299
Assembler Description
Assembler Operators
ASSEMBLER OPERATORS
assembler recognizes monadic dyadic operators shown following table.
Table 2-20. Assembler Expression Operators
Operator
HIGH HIGH16 LOW16
Description
High Byte Byte High Word Word Plus Minus One's Complement Logical Exponentiation Multiplication Division Modulo Shift Left Shift Right Plus Minus String Concatenation Bitwise Bitwise Exclusive Bitwise Inclusive
Type
Monadic Monadic Monadic Monadic Monadic Monadic Monadic Monadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic
Associativity
Right Left
Right Left
Left Right Left Right Left Right
Left Right
Left Right
UM003601-COR1299
2-23
Assembler Operators
Assembler Description
Table 2-20. Assembler Expression Operators
Operator
Description
Equal Equal Strings Equal Strings Equal Less Than Greater Than Less Than Equal Greater Than Equal Logical Logical Inclusive Logical Exclusive Logical Equivalence
Type
Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic Dyadic
Associativity
Left Right
NOTES: Operators listed table order precedence: operators nearer table applied before those lower table. Operators with same precedence shown groups delimited double horizontal rules. Within group, order evaluation controlled operator's associativity. Operators whose associativity left right applied from left right within same precedence group. Operators whose associativity right left applied from right left within same precedence group. operator either monadic dyadic. Monadic operators operate single operand, operator prefixes operand (prefix notation). Dyadic operators operate operands, operator separates operands (infix notation). Parentheses used force particular order evaluation, independent operator precedence associativity. Parentheses have higher precedence that operator.
2-24
UM003601-COR1299
Assembler Description
Assembler Expressions
ASSEMBLER EXPRESSIONS
expression constant, symbol, combination constants, symbols operators. assembler evaluates each expression into single value, then uses that value operand. Expression have type attribute well value. assembler supports following types expression:
Absolute Expressions Relocatable Expressions Floating Point Expressions String Expressions Logical Expressions Conditional Expressions
UM003601-COR1299
2-25
Assembler Expressions
Assembler Description
type expression depends type operands. Expression types important reasons: Some assembler directives require expressions particular type. Only certain types operators allowed certain types expressions. Assembler Absolute Expressions absolute expression expression with integral value that completely determined assembler assembly time. Thus, absolute expression independent possible control section relocation that occurs link time. following operators supported absolute expressions: Assembler Relocatable Expressions relocatable expression expression with integral value that cannot completely resolved assembly time. Thus, value relocatable expression dependent possible control section relocation that occurs link time. Relocatable Expression relocatable expression following:
label relocatable control section. symbol relocatable expression, using assembler directive.
External Expression external expression following:
label defined using EXTERN assembler directive. symbol external expression, using assembler directive.
2-26
UM003601-COR1299
Assembler Description
Assembler Expressions
assembler supports arithmetic operations addition subtraction applied relocatable expressions, absolute expressions external expressions, certain combinations. legal combinations summarized following table.
Table 2-21. Types Expressions
Type Expression absolute external relocatable absolute external relocatable absolute external relocatable
Type Expression absolute absolute absolute external external external relocatable relocatable relocatable
absolute external relocatable external illegal relocatable relocatable illegal illegal
absolute illegal illegal external illegal illegal relocatable illegal absolute
Assembler Floating-Point Expressions floating point expression expression with floating point value that completely determined assembler assembly time. Thus, floating point expression independent possible control section relocation that occurs link time. floating point expression following: floating point constant. symbol floating point expression, using assembler directive. expression involving floating point expressions: operators.
Assembler String Expressions string expression expression with string value that completely determined assembler assembly time. Thus, string expression independent possible control section relocation that occurs link time.
UM003601-COR1299
2-27
Assembler Expressions string expression following: string constant.
Assembler Description
symbol string expression, using assembler directive. expression involving string expressions additive that concatenates strings.
following operators supported string expressions: Assembler Logical Expressions logical expression expression that tests relationship expression another assembly time. result logical expression Boolean value: true (non-zero) specified relationship holds between expressions; false (zero) relationship does hold. Logical expressions used conditional assembly test directives. logical expression following: symbol logical expression, using assembler directive. absolute expression. expression involving absolute expressions relational operators. Relational operators
expression involving string expressions relational operators. expression involving logical expressions logical operators. logical operators Assembler Conditional Expressions conditional expression expression that tests relationship expression another execution time, executes code sequences based result test. Conditional expressions used structured assembly test directives. conditional expressions evaluated execution-time, assembly-time. This imposes some restrictions format conditional expressions, assembler makes comparison branching instructions available target microcontroller's machine instruction set. conditional expression following: expression form condition, where condition name condition code. expression form lExpression <operator> rExpression, where lExpression rExpression absolute relocatable expressions addressing mode valid
2-28
UM003601-COR1299
Assembler Description
Assembler Expressions
right-hand left-hand operands compare machine instruction, respectively, <operator> conditional operator. conditional operators expression form lExpression <operator> rExpression, where lExpression rExpression conditional expressions, <operator> logical operator. logical operators
UM003601-COR1299
2-29
Assembler Expressions
Assembler Description
Structured Assembly
Structured assembly supports execution-time selection sequences source statements based execution-time conditions. structured assembly directives test specified condition execute block statements only condition true. NOTE: There structured assembly support Z89C25/50 core.
structured assembly directives, when used conjunction with ability assembly link modules independently, facilitate structured programming assembly language. difficult assimilate logical structure traditional, non-structured assembly language program. Structured assembly language programs generally easier read understand than nonstructured programs. They also easier debug change. assembler directives associated with structured assembly summarized following table.
Table 2-22. Assembler Directives Structured Assembly
Assembler Directive
.$IF, .$REPEAT, .$WHILE .$ELSEIF .$ELSE .$BREAK, .$CONTINUE .$ENDIF, .$UNTIL, .$WEND
Description
Structured assembly test primary Structured assembly test alternate Structured assembly test default Structured assembly test control Structured assembly test
assembler directives shown preceding table known collectively structured assembly test directives, always used together form homogeneous structured assembly block. assembler supports decision structure (.$IF) looping structures (.$WHILE .$REPEAT). assembler supports decision structure with .$IF, .$ELSEIF, .$ELSE, .$ENDIF directives. These directives generate code test more execution-time conditions, execute block statements based result tests.
2-30
UM003601-COR1299
Assembler Description
example, decision structure: .$if .$else .$endif NOTE:
Assembler Expressions
examples shown this "Structured Assembly" section Z89C00 syntax.
assembler generates following code: .$if a,#0 ne,$L000001 .$else $L000002 .$endif $L000002:
$L000001:
assembler supports types looping structure with .$WHILE, .$WEND, .$REPEAT, .$UNTIL directive pairs. .$WHILE directive generates code test execution-time condition, execute block statements while condition true. Since test performed before executing block, block executed. example, looping structure: .$while x,@d0:0 a,#1 .$wend
UM003601-COR1299
2-31
Assembler Expressions assembler generates following code: .$while $L000001: .$wend $L000002: a,#0 eq,$L000002 x,@d0:0 a,#1 $L000001
Assembler Description
2-32
UM003601-COR1299
Assembler Description
Assembler Expressions
.$REPEAT directive generates code test execution-time condition after executing block statements, repeatedly executes block until condition true. Since test performed after executing block, block executed least once. example, looping structure: .$repeat x,@d0:0 a,#1 .$until (eq)
assembler generates following code: .$repeat $L000001: x,@d0:0 a,#1 .$until (eq) ne,$L000001
UM003601-COR1299
2-33
Assembler Expressions Structured Assembly Inputs This section describes structured assembly input requirements. Structured Assembly Block Inputs
Assembler Description
.$IF, .$ELSEIF, .$ELSE .$ENDIF assembler directives used test execution-time conditions, conditionally execute object code based results test. Syntax .$IF condition1 comment]
statements
.$ELSEIF condition2 comment statements .$ELSE comment statements .$ENDIF comment
2-34
UM003601-COR1299
Assembler Description
Assembler Expressions
following qualifications elaborate syntax semantics structured assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. .$IF, .$ELSEIF, .$ELSE, .$ENDIF assembler directives must specified that order. .$ELSEIF assembler directive optional. specified arbitrary number times between .$IF .$ENDIF assembler directives. .$ELSE assembler directive optional. specified most once between .$IF .$ENDIF directives. used, .$ELSE assembler directive must coded after .$ELSEIF directives. valid assembler statement appear statements sections structured assembly test directives. This means, among other things, that structured assembly test directives nested. structured assembly test directives nested levels. Nested .$ELSEIF .$ELSE directives associated with most recent .$IF directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. Each expression must conditional expression. "Assembler Expressions". .$IF .$ENDIF directives must coded matching pairs. That legal code .$IF directive without matching .$ENDIF directive appearing later source module; legal code .$ENDIF directive without matching .$IF directive appearing earlier source module. .$ELSEIF .$ELSE assembler directives only appear between enclosing .$IF .$ENDIF directives. valid .$ELSEIF .$ELSE directives appear other context. .$ELSE directive does have parameters. .$ENDIF directive does have parameters. None .$IF, .$ELSEIF, .$ELSE, .$ENDIF assembler directives labeled. label specified, warning message issued, label discarded. REPEAT Structured Assembly Block Inputs .$REPEAT, .$BREAK, .$CONTINUE .$UNTIL assembler directives used test execution-time conditions, conditionally execute object code based results test. UM003601-COR1299 2-35
Assembler Expressions Syntax .$REPEAT comment]
Assembler Description
statements
.$BREAK .$IF condition2 comment statements .$CONTINUE .$IF condition3 comment statements .$UNTIL condition1 comment following qualifications elaborate syntax semantics structured assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. .$REPEAT .$UNTIL assembler directives must specified that order. .$BREAK assembler directive optional. specified arbitrary number times between .$REPEAT .$UNTIL assembler directives. .$CONTINUE assembler directive optional. specified arbitrary number times between .$REPEAT .$UNTIL directives. valid assembler statement appear statements sections structured assembly test directives. This means, among other things, that structured assembly test directives nested. structured assembly test directives nested levels. Nested .$BREAK .$CONTINUE directives associated with most recent .$REPEAT directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. .$REPEAT .$UNTIL directives must coded matching pairs. That legal code .$REPEAT directive without matching .$UNTIL directive appearing later source module; legal code .$UNTIL directive without matching .$REPEAT directive appearing earlier source module.
2-36
UM003601-COR1299
Assembler Description
Assembler Expressions
.$BREAK .$CONTINUE assembler directives only appear between enclosing .$REPEAT .$UNTIL directives between .$WHILE .$WEND directives). valid .$BREAK .$CONTINUE directives appear other context. .$BREAK directive optional .$IF conditional parameter. .$CONTINUE directive optional .$IF conditional parameter. None .$REPEAT, .$BREAK, .$CONTINUE, .$UNTIL assembler directives labeled. label specified, warning message issued, label discarded. WHILE Structured Assembly Block Inputs .$WHILE, .$BREAK, .$CONTINUE .$WEND assembler directives used test execution-time conditions, conditionally execute object code based results test. Syntax .$WHILE condition1 comment]
statements
.$BREAK .$IF condition2 comment statements .$CONTINUE .$IF condition3 comment statements .$WEND comment following qualifications elaborate syntax semantics structured assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. .$WHILE .$WEND assembler directives must specified that order. .$BREAK assembler directive optional. specified arbitrary number times between .$WHILE .$WEND assembler directives. .$CONTINUE assembler directive optional. specified arbitrary number times between .$WHILE .$WEND directives. valid assembler statement appear statements sections structured assembly test directives. This means, among other things, that structured assembly test
UM003601-COR1299
2-37
Assembler Expressions
Assembler Description
directives nested. structured assembly test directives nested levels. Nested .$BREAK .$CONTINUE directives associated with most recent .$WHILE directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. .$WHILE .$WEND directives must coded matching pairs. That legal code .$WHILE directive without matching .$WEND directive appearing later source module; legal code .$WEND directive without matching .$WHILE directive appearing earlier source module. .$BREAK .$CONTINUE assembler directives only appear between enclosing .$WHILE .$WEND directives between .$REPEAT .$UNTIL directives). valid .$BREAK .$CONTINUE directives appear other context. .$BREAK directive optional .$IF conditional parameter. .$CONTINUE directive optional .$IF conditional parameter. None .$WHILE, .$BREAK, .$CONTINUE, .$WEND assembler directives labeled. label specified, warning message issued, label discarded.
2-38
UM003601-COR1299
Assembler Description
Assembler Expressions
Structured Assembly Processing
This section describes assembly-time processing structured assembly directives. Validity Checks following validity checks performed structured assembly block input data. Unless otherwise specified, violations cause assembly fail. syntax structured assembly block must conform requirements specified "Structured Assembly Inputs". .$IF .$ENDIF directives must properly balanced, i.e., there must exactly .$ENDIF directive each .$IF directive, .$IF directive must precede corresponding .$ENDIF directive. .$REPEAT .$UNTIL directives must properly balanced, i.e., there must exactly .$UNTIL directive each .$REPEAT directive, .$REPEAT directive must precede corresponding .$UNTIL directive. .$WHILE .$WEND directives must properly balanced, i.e., there must exactly .$WEND directive each .$WHILE directive, .$WHILE directive must precede corresponding .$WEND directive. structured assembly block must completely specified with single assembly unit. assembly unit single source file, single macro definition. Sequence Operations following sequences operations performed processing structured assembly test directives. .$IF Sequence Operations following sequence operations performed processing .$IF structured assembly test directives. assembler generates object code evaluate conditions specified .$IF directive optional .$ELSEIF directives. condition true execution time, object code generated from statements associated with .$IF directive executed. condition specified .$IF directive false execution-time, assemblergenerated object code successively evaluates conditions specified .$ELSEIF directives, there any, until true condition evaluated. evaluating true .$ELSEIF condition, object code generated from statements associated with .$ELSEIF directive executed.
UM003601-COR1299
2-39
Assembler Expressions
Assembler Description
conditions .$IF .$ELSEIF directives false execution-time, .$ELSE directive present, object code generated from statements associated with .$ELSE directive executed. tested condition true, .$ELSE directive specified, statements structured assembly block executed. .$REPEAT Sequence Operations following sequence operations performed processing .$REPEAT structured assembly test directives. assembler generates object code evaluate conditions specified .$UNTIL directive optional .$BREAK .$CONTINUE directives. execution-time, object code generated from statements structured assembly block executed until specified condition true. execution time, object code generated from .$BREAK directives executed point where appears block. condition specified .$BREAK condition, condition true, .$REPEAT loop exited. execution time, object code generated from .$CONTINUE directives executed point where appears block. condition specified .$CONTINUE condition, condition true, execution code generated from statements block resumes beginning block.
.$WHILE Sequence Operations following sequence operations performed processing .$WHILE structured assembly test directives. assembler generates object code evaluate conditions specified .$WHILE directive optional .$BREAK .$CONTINUE directives. execution-time, object code generated from statements structured assembly block executed while specified condition true. execution time, object code generated from .$BREAK directives executed point where appears block. condition specified .$BREAK condition, condition true, .$WHILE loop exited. execution time, object code generated from .$CONTINUE directives executed point where appears block. condition specified .$CONTINUE condition, condition true, execution code generated from statements block resumes beginning block.
2-40
UM003601-COR1299
Assembler Description
Structured Assembly Outputs
STRUCTURED ASSEMBLY OUTPUTS
Outputs from structured assembly object code generated from source statements structured assembly block, well assembler-generated object code evaluate conditionals structured assembly directives. assembler-generated directives appear listing file. generated object code appears object module. errors detected during structured assembly processing, then error messages generated. Error messages written messages file, listing file, being produced.
CONDITIONAL ASSEMBLY
This section describes conditional assembly capabilities ZMASM cross assembler. Conditional assembly supports assembly-time selection sequences source statements based assembly-time conditions. conditional assembly directives test specified condition assemble block statements only condition true. While conditional assembly directives used open code, they most useful when used conjunction with macro processor, vary sequence statements generated during macro expansion. particular, capabilities that dependent conditional assembly greatly enhance usefulness macros:
Conditional assembly directives used validate macro call actual parameters. statements generated result macro expansion conditioned values macro parameters.
UM003601-COR1299
2-41
Conditional Assembly Inputs
Assembler Description
assembler directives associated with conditional assembly summarized following table.
Table 2-23. Assembler Directives Conditional Assembly
Assembler
IFDEF, IFNDEF, IFEQ, IFEQI, IFNEQ, IFNEQI, IFB, IFNB ELSEIF ELSE ENDIF
Description
Conditional assembly test primary Conditional assembly test alternate Conditional assembly test default Conditional assembly test Assign value symbol
IFDEF/IFNDEF, IFEQ/IFEQI/IFNEQ/IFNEQI, IFB/IFNB, ELSEIF, ELSE ENDIF conditional assembly directives known collectively conditional assembly test directives, always used together form homogeneous conditional assembly block. Symbols defined with assembler directive known variable symbols. directive used independently conditional assembly test directives, although usually most powerful when used conjunction with other conditional assembly directives.
CONDITIONAL ASSEMBLY INPUTS
input elements conditional assembly are:
Symbols expressions, their attributes. Assembler directives conditional assembly.
general format conditional assembly inputs illustrated following figure.
2-42
UM003601-COR1299
Assembler Description
Conditional Assembly Inputs
Optional Symbols
Primary Test
statements
Optional Alternate Test (May repeated)
elseif
statements
Optional Test Default
else statements
Conditional Test
endif
Figure 2-3. General Format Conditional Inputs
UM003601-COR1299
2-43
Conditional Assembly Inputs Conditional Assembly Variable Inputs
Assembler Description
assembler directive used assign expression value type symbol. symbol then used throughout remainder source module. particular, used with conditional assembly test directives, vary sequence statements assembled. Name Expression Syntax following qualifications elaborate syntax semantics conditional assembly directive. Unless otherwise specified, violations these qualifications cause assembly fail. Name symbolic name Expression. Name must valid symbol. "Assembler Symbols" section. Name same that used previous directive. That variable symbols redefined. Name same symbol except symbol defined with previous directive. Expression must absolute, string, floating point expression. "Assembler Expressions" section.
Conditional Assembly Block Inputs Conditional Assembly Block Inputs ELSEIF, ELSE ENDIF assembler directives used test assembly-time conditions, conditionally assemble source statements based results test.
2-44
UM003601-COR1299
Assembler Description
Syntax expression comment]
Conditional Assembly Inputs
statements
ELSEIF expression comment statements ELSE comment statements ENDIF comment following qualifications elaborate syntax semantics conditional assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. ELSEIF, ELSE, ENDIF assembler directives must specified that order. ELSEIF assembler directive optional. specified arbitrary number times between ENDIF assembler directives. ELSE assembler directive optional. specified most once between ENDIF directives. used, ELSE assembler directive must coded after ELSEIF directives. valid assembler statement appear statements sections conditional assembly test directives. This means, among other things, that conditional assembly test directives nested. conditional assembly test directives nested levels. Nested ELSEIF ELSE directives associated with most recent directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations.
UM003601-COR1299
2-45
Conditional Assembly Inputs
Assembler Description
Each expression must logical expression. "Assembler Expressions". ENDIF directives must coded matching pairs. That legal code directive without matching ENDIF directive appearing later source module; legal code ENDIF directive without matching directive appearing earlier source module. ELSEIF ELSE assembler directives only appear between enclosing ENDIF directives. valid ELSEIF ELSE directives appear other context. ELSE directive does have parameters. ENDIF directive does have parameters. None ELSEIF, ELSE, ENDIF assembler directives labeled. label specified, warning message issued, label discarded. IFDEF/IFNDEF Conditional Assembly Block Inputs IFDEF ENDIF assembler directives used test assembly-time conditions, conditionally assemble source statements based results test. Syntax IF[N]DEF label comment]
statements
ELSE comment statements ENDIF comment following qualifications elaborate syntax semantics conditional assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. IF[N]DEF, ELSE, ENDIF assembler directives must specified that order. ELSE assembler directive optional. specified most once between IF[N]DEF ENDIF directives. valid assembler statement appear statements sections conditional assembly test directives. This means, among other things, that conditional assembly test
2-46
UM003601-COR1299
Assembler Description
Conditional Assembly Inputs
directives nested. conditional assembly test directives nested levels. Nested ELSE directives associated with most recent IF[N]DEF directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. Each label must valid assembler symbol. "Assembler Symbols". IF[N]DEF ENDIF directives must coded matching pairs. That legal code IF[N]DEF directive without matching ENDIF directive appearing later source module; legal code ENDIF directive without matching IF[N]DEF directive appearing earlier source module. ELSE directive does have parameters. ENDIF directive does have parameters. None IF[N]DEF, ELSE, ENDIF assembler directives labeled. label specified, warning message issued, label discarded. IFEQ/IFEQI/IFNEQ/IFNEQI Conditional Assembly Block Inputs IFEQ[I], ELSE ENDIF assembler directives used test assembly-time conditions, conditionally assemble source statements based results test. Syntax IF[N]EQ[I] argument1 argument2 comment]
statements
ELSE comment statements ENDIF comment following qualifications elaborate syntax semantics conditional assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. IF[N]EQ[I], ELSE, ENDIF assembler directives must specified that order.
UM003601-COR1299
2-47
Conditional Assembly Inputs
Assembler Description
ELSE assembler directive optional. specified most once between IF[N]EQ[I] ENDIF directives. valid assembler statement appear statements sections conditional assembly test directives. This means, among other things, that conditional assembly test directives nested. conditional assembly test directives nested levels. Nested ELSE directives associated with most recent IF[N]EQ[I] directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. Each argument1 argument2 must valid assembler string expression macro formal parameter name. "String Expressions" "Macro Definition Inputs". IF[N]EQ[I] ENDIF directives must coded matching pairs. That legal code IF[N]EQ[I] directive without matching ENDIF directive appearing later source module; legal code ENDIF directive without matching IF[N]EQ[I] directive appearing earlier source module. ELSE directive does have parameters. ENDIF directive does have parameters.
None IF[N]EQ[I], ELSE, ENDIF assembler directives labeled. label specified, warning message issued, label discarded. IFB/IFNB Conditional Assembly Block Inputs IF[N]B, ELSE ENDIF assembler directives used test assembly-time conditions, conditionally assemble source statements based results test.
2-48
UM003601-COR1299
Assembler Description
Syntax IF[N]B fParameter comment]
Conditional Assembly Inputs
statements
ELSE comment statements ENDIF comment following qualifications elaborate syntax semantics conditional assembly test directives. Unless otherwise specified, violations these qualifications cause assembly fail. IF[N]B, ELSE, ENDIF assembler directives must specified that order. ELSE assembler directive optional. specified most once between IF[N]B ENDIF directives. valid assembler statement appear statements sections conditional assembly test directives. This means, among other things, that conditional assembly test directives nested. conditional assembly test directives nested levels. Nested ELSE directives associated with most recent IF[N]B directive. There preset limit number statements that appear statements sections; there number assembler statements each statements section, including zero. operating system file system impose limitations file sizes, user should consult appropriate operating system users guide such limitations. Each fParameter must macro definition formal parameter name. "Macro Definition Inputs". IF[N]B ENDIF directives must coded matching pairs. That legal code IF[N]B directive without matching ENDIF directive appearing later source module; legal code ENDIF directive without matching IF[N]B directive appearing earlier source module. ELSE directive does have parameters. ENDIF directive does have parameters. None IF[N]B, ELSE, ENDIF assembler directives labeled. label specified, warning message issued, label discarded. UM003601-COR1299 2-49
Conditional Assembly Processing
Assembler Description
CONDITIONAL ASSEMBLY PROCESSING
This section describes assembly-time processing conditional assembly directives. directive processing described "Conditional Assembly Processing". ELSEIF, ELSE, ENDIF assembler directives treated together, their processing described "Conditional Assembly Block Processing". Conditional Assembly Variable Processing This section describes processing assembler directive. Validity Checks following validity checks performed conditional assembly directive input data. Unless otherwise specified, violations cause assembly fail. syntax conditional assembly block must conform requirements specified "Conditional Assembly Inputs". directive Name referenced before defined.
Sequence Operations following sequence operations performed processing conditional assembly directive, references defined variable symbols. assembler creates symbol table node variable symbol Name, Name previously defined. variable symbol Expression evaluated, Expression value type recorded with symbol Name symbol table. Subsequent references Name source module operand field replaced with value Expression specified directive. "Assembler Source Statements" description source statement fields. variable symbol Name referenced before first defined, assembler flags error. That legal forward reference variable symbol. References defined variable symbol refer most recent definition. Conditional Assembly Block Processing This section describes processing statements conditional assembly block.
2-50
UM003601-COR1299
Assembler Description
Validity Checks
Conditional Assembly Processing
following validity checks performed conditional assembly block input data. Unless otherwise specified, violations cause assembly fail. syntax conditional assembly block must conform requirements specified "Conditional Assembly Inputs". ENDIF directives must properly balanced; that there must exactly ENDIF directive each directive, directive must precede corresponding ENDIF directive. IF[N]DEF ENDIF directives must properly balanced; that there must exactly ENDIF directive each IF[N]DEF directive, IF[N]DEF directive must precede corresponding ENDIF directive. IF[N]EQ[I] ENDIF directives must properly balanced; that there must exactly ENDIF directive each IF[N]EQ[I] directive, IF[N]EQ[I] directive must precede corresponding ENDIF directive. IF[N]B ENDIF directives must properly balanced; that there must exactly ENDIF directive each IF[N]B directive, IF[N]B directive must precede corresponding ENDIF directive. conditional assembly block must completely specified with single assembly unit. assembly unit single source file, single macro definition. Sequence Operations following sequences operations performed processing conditional assembly test directives. Sequence Operations following sequence operations performed processing conditional assembly test directives. assembler evaluates condition specified directive, condition true, statements associated with directive assembled. condition specified directive false, assembler successively evaluates conditions specified ELSEIF directives, there any, until true condition evaluated. evaluating true ELSEIF condition, statements associated with ELSEIF directive assembled. conditions ELSEIF directives false, ELSE directive present, statements associated with ELSE directive assembled. 2-51
UM003601-COR1299
Conditional Assembly Processing
Assembler Description
tested condition true, ELSE directive specified, statements conditional assembly block assembled.
IFDEF Sequence Operations following sequence operations performed processing IFDEF conditional assembly test directives. assembler interrogates symbol table label specified IFDEF directive, label defined table, statements associated with IFDEF directive assembled. label IFDEF directive undefined, ELSE directive present, statements associated with ELSE directive assembled. label IFDEF directive undefined, ELSE directive specified, statements conditional assembly block assembled. IFNDEF Sequence Operations following sequence operations performed processing IFNDEF conditional assembly test directives. assembler interrogates symbol table label specified IFNDEF directive, label defined table, statements associated with IFNDEF directive assembled. label IFNDEF directive defined, ELSE directive present, statements associated with ELSE directive assembled. label IFDEF directive defined, ELSE directive specified, statements conditional assembly block assembled.
IFEQ Sequence Operations following sequence operations performed processing IFEQ conditional assembly test directives. assembler compares string expressions specified IFEQ directive, they equal, statements associated with IFEQ directive assembled. strings considered equal they same length, each positionally matched pair characters same ASCII value. This comparison case-sensitive. strings IFEQ directive different, ELSE directive present, statements associated with ELSE directive assembled. UM003601-COR1299
NOTE:
2-52
Assembler Description
Conditional Assembly Processing
strings equal, ELSE directive specified, statements conditional assembly block assembled.
IFEQI Sequence Operations following sequence operations performed processing IFEQI conditional assembly test directives. assembler compares string expressions specified IFEQI directive, they equal, statements associated with IFEQI directive assembled. strings considered equal they same length, each positionally matched pair characters same ASCII value represents same alphabetic character. NOTE: This comparison case-insensitive.
strings IFEQI directive different, ELSE directive present, statements associated with ELSE directive assembled. strings equal, ELSE directive specified, statements conditional assembly block assembled.
IFNEQ Sequence Operations following sequence operations performed processing IFNEQ conditional assembly test directives. assembler compares string expressions specified IFNEQ directive, they equal, statements associated with IFNEQ directive assembled. strings considered equal they same length, each positionally matched pair characters same ASCII value. This comparison case-sensitive. strings IFNEQ directive different, ELSE directive present, statements associated with ELSE directive assembled. strings equal, ELSE directive specified, statements conditional assembly block assembled.
NOTE:
IFNEQI Sequence Operations following sequence operations performed processing IFNEQI conditional assembly test directives. assembler compares string expressions specified IFNEQI directive, they equal, statements associated with IFNEQI directive assembled. UM003601-COR1299 2-53
Conditional Assembly Processing
Assembler Description
strings considered equal they same length, each positionally matched pair characters same ASCII value represents same alphabetic character. NOTE: This comparison case-insensitive.
strings IFNEQI directive different, ELSE directive present, statements associated with ELSE directive assembled. strings equal, ELSE directive specified, statements conditional assembly block assembled. Sequence Operations following sequence operations performed processing conditional assembly test directives. assembler interrogates symbol table macro formal parameter specified directive, corresponding actual macro parameter null, statements associated with directive assembled. parameter named directive null ELSE directive present, statements associated with ELSE directive assembled. parameter null, ELSE directive specified, statements conditional assembly block assembled. IFNB Sequence Operations following sequence operations performed processing IFNB conditional assembly test directives. assembler interrogates symbol table macro formal parameter specified IFNB directive, corresponding actual macro parameter null, statements associated with directive assembled. parameter named directive null ELSE directive present, statements associated with ELSE directive assembled. parameter null, ELSE directive specified, statements conditional assembly block assembled.
2-54
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Conditional Assembly Outputs
Outputs from conditional assembly source statements true conditional assembly block. conditionally included statements appear listing file. statements conditionally accepted block cause object code generated, then generated object code appears object module. errors detected during conditional assembly processing, then error messages generated. Error messages written messages file, listing file, being produced.
Assembler Directives
assembler supports following directives. Full descriptions each directive follow summary table, which follows. compatibility with other assemblers, assembler supports indicated synonyms.
Table 2-24. Assembler Directive Summary
Mnemonic
ALIGN .ASCII .ASCIZ .ASECT .ASG .BES BFRACT BLKB BLKL BLKW
Alias
.ALIGN .STRING
Description
Advance Location Counter Boundary Assemble Values Into Consecutive Memory Locations Assemble/Append Values Into Consecutive Memory Locations Specify Current Control Section Assign Character Strings Substitution Symbols Reserve Initialized Space Current Control Section Assemble Fractional Values Into Memory Locations Reserve/Initialize Blocks Storage Reserve/Initialize Blocks Storage Reserve/Initialize Blocks Storage
Page
2-60 2-62 2-64 2-66 2-67 2-68 2-69 2-71 2-71 2-71
UM003601-COR1299
2-55
Conditional Assembly Processing
Assembler Description
Table 2-24. Assembler Directive Summary
Mnemonic
.BSS CHIP COMMENT CONDLIST .DATA DEFINE
Alias
Description
Reserve Space .BSS
Page
2-73 2-74 2-75 2-76 2-62 2-78 2-80 2-78 2-84 2-78 2-78 3-86 3-86 2-85 3-86 2-123 2-88 2-90 2-92 2-90 2-93
Specify Target Microcontroller Classify Stream Characters Control Listing Conditional Assembly Blocks Current Control Section
.BYTE
Assemble Values Into Consecutive Locations Name Control Section
.LONG
Assemble Values Into Consecutive Locations Reserve Uninitialized Space
.INT .WORD
Assemble Values Into Consecutive Locations Assemble Values Into Consecutive Locations Support Conditional Assembly Support Conditional Assembly Terminates Assembly Support Conditional Assembly Group Data Elements
ELSEIF
.ELSEIF ELIF
ENDIF .ENDSTRUCT ERROR EVAL EXIT EXTERN
.END .ENDIF
.EQU .EMSG
Equate Symbols Expressions Generate Error/Warning Messages Assign Character Strings Substitution Symbols Generate Error/Warning Messages
.EXTERN
Identify External Symbol
2-56
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Table 2-24. Assembler Directive Summary
Mnemonic
Alias
.GLOBAL .REF XREF
Description
Identify Defined Symbol Identify Defined Symbol Identify Defined Symbol Identify Source File Name Assemble Floating-Point Values
Page
2-93 2-93 2-93 2-94 2-95 2-69 2-96 3-86 2-97 2-97 2-69 2-99 2-100 2-104 2-104 2-101 2-102 2-103 2-104 2-106
FILE .FLOAT FRACT GLOBALS INCLUDE
.FILE
Assemble Fractional Values Into Memory Locations Declare Symbols Globally Linker
.COPY .INCLUDE
Support Conditional Assembly Insert Source Statement Insert Source Statement Assemble Fractional Values Into Memory Locations Control Statements Listing File Limit Macro Recursion Depth
LFRACT LIST MACCNTR MACEND
.LIST
.ENDM ENDMAC
Place Values Into Consecutive Memory Locations Place Values Into Consecutive Memory Locations Terminate Macro Expansion Specify Listing File Contents
MACEXIT MACLIST MACNOTE MACRO .MLIST
.MEXIT
.MMSG .MACRO MACLIST
Print Listing File Message Define Macro Control Macro Expansion Statements
UM003601-COR1299
2-57
Conditional Assembly Processing
Assembler Description
Table 2-24. Assembler Directive Summary
Mnemonic
.MMREGS .MNOLIST NEWPAGE NOLIST PRINT PUBLIC
Alias
Description
Define Register Names
Page
2-107 2-106 2-108 2-109 2-110 2-111 2-112 2-115 2-116 2-116 2-116 2-117 2-118 2-119 2-120 2-121 2-122 2-88 2-88 2-68
MACLIST .PAGE .NOLIST .ORG .LENGTH
Control Macro Expansion Statements Generate Page Break Control Statements Listing File Location Counter Specify Page Length Specify Statements Listing File
.TAB .DEF .GLOBAL XDEF
Tabs Listing File Identify Global Symbol Identify Defined Symbol Identify Defined Symbol Specify Listing File Page Width Specify Microcontroller Size Align Section Until Page Boundary Reached
ROMSIZE .SBLOCK SCOPE .SECT SEGMENT
.WIDTH
.NEWBLOCK
Reset Local Symbol Scoping Assemble Into Named Control Section Specify Name Current Control Section
.SET
Equate Symbols Expressions Equate Symbols Expressions Reserve Space Current Control Section
.SPACE
2-58
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Table 2-24. Assembler Directive Summary
Mnemonic
.STRUCT SUBTITLE .TAG TARGET .TEXT TITLE .USECT VECTOR WARNING
Alias
Description
Group Data Elements Define Listing Subtitle Group Data Elements Specify Target Microcontroller Make .TEXT Control Section Current Section
Page
2-123 2-125
2-126 2-127 2-125 2-128 2-129 2-90
.TITLE
Define Listing Subtitle Reserve Uninitialized Space Initialize Microcontroller Vector Generate Error/Warning Messages
UM003601-COR1299
2-59
Conditional Assembly Processing
Assembler Description
.ALIGN
Purpose
Advance Location Counter Boundary
.ALIGN
ALIGN assembler directive advances location counter until specified boundary reached. Syntax ALIGN [expression] Alias .Align Description ALIGN assembler directive aligns next variable directive address that multiple specified expression. expression operand required, must absolute integral constant expression. assembler advances current control section location counter next address that evenly divisible value specified expression. Example This example illustrates align location counter next address that multiple sixteen. ALIGN Expression Specified When there expression specified, ALIGN/.ALIGN assembler directive aligns section program counters next 128-byte 128-word boundary, respectively corresponding byte word addressable MCU. alignment purpose ensures following code begins page boundary. assembler assembles bytes words containing NOPS 128-word boundary.
2-60
UM003601-COR1299
Assembler Description
Example
Conditional Assembly Processing
This example shows that section program counter aligned next 128-byte boundary MCU. 00000000 00000075 AAAA 0000007A 00000080 0AAH align .string "ABC"
page boundary NOTE: Locations filled with NOPS directives. must label this instruction.
UM003601-COR1299
2-61
Conditional Assembly Processing
Assembler Description
.ASCII
Assemble Values Into Consecutive Memory Locations
.ASCII
Purpose .ASCII assembler directive assembles specified values into consecutive memory locations. Syntax label Alias .STRING Description .ASCII directive places 8-bit characters from character string into current control section. word-addressed control sections, data packed that each word contains 8-bit bytes. Each initializer either: expression that assembler evaluates treats 8-bit (byte sections) 16bit (word sections) signed number, character string enclosed double quotes. Each character string represents separate 8-bit value. word-addressed sections, values packed into words, starting with most significant byte word. unused space padded with null bytes (0s). This assembler directive differs from directive that does pack values into words. assembler truncates values that greater than bits. have number initializers, they must single source statement line. Each initializer preceded repeat specification, which absolute number enclosed square brackets. memory allocation initialization performed repeat times. label, points first memory address that initialized. .ASCII repeat1 initializer1 repeat2 initializer2
2-62
UM003601-COR1299
Assembler Description
Examples
Conditional Assembly Processing
This example shows simple string initialization with label pointing first memory address allocated. StrLabel: .ASCII "ABCD"
This example shows string initializer repeated hundred times. .ASCII
UM003601-COR1299
2-63
Conditional Assembly Processing
Assembler Description
.ASCIZ
Assemble Values Into Consecutive Memory Locations
.ASCIZ
Purpose .ASCIZ assembler directive assembles specified values into consecutive memory locations, appending value zero each value. Syntax label Description .ASCIZ directive places 8-bit characters from character string into current control section. word-addressed control sections, data packed that each word contains 8-bit bytes. After space allocated initializer, additional address allocated initialized zero. Each initializer either: expression that assembler evaluates treats 8-bit (byte sections) 16bit (word sections) signed number, character string enclosed double quotes. Each character string represents separate 8-bit value. word-addressed sections, values packed into words, starting with most significant byte word. unused space padded with null bytes (0s). This assembler directive differs from directive that does pack values into words. assembler truncates values that greater than bits. have number initializers, they must single source statement line. .ASCIZ repeat1 initializer1 repeat2 initializer2
2-64
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Each initializer preceded repeat specification, which absolute number enclosed square brackets. memory allocation initialization performed repeat times. label, points first memory address that initialized. Examples This example shows simple zero-terminated string initialization with label pointing first memory address allocated. StrLabel: .ASCIZ "ABCD"
This example shows zero-terminated string initializer repeated hundred times. .ASCIZ
UM003601-COR1299
2-65
Conditional Assembly Processing
Assembler Description
.ASECT
Purpose
Specify Current Control Section
.ASECT
.ASECT assembler directive makes named absolute control section current control section. Syntax .ASECT "section", address Description .ASECT assembler directive makes named control section current control section; assembler begins assembling into named section. address specifies origin control section. Sections defined with .ASECT assembler directive absolute sections, subject relocation linker. section operand required, specifies control section name. must enclosed double quotes. address operand required, specifies control section origin, start address. must absolute integer expression. must label this directive. Example This example illustrates make named absolute section current control section. .ASECT "AbsSection", 1000h
2-66
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
.ASG
Assign Character Strings Substitution Symbols
Purpose
.ASG
.ASG assembler directive assigns character strings substitution symbols. Syntax .ASG character-string ["], substitution symbol
Description .ASG assembler directive substitutes character string with symbol. quotation marks optional. substitution symbol required must valid symbol. Example .asg "EXT1", reg1
UM003601-COR1299
2-67
Conditional Assembly Processing
Assembler Description
.BES/.SPACE
Purpose
Reserve Uninitialized Space Current Control Section
.BES/.SPACE
.SPACE .BES assembler directives reserve uninitialized space current control section. Syntax label label Description .SPACE .BES assembler directive reserves uninitialized space current control section. length specifies number bits reserved current section. optional label names symbol assigned value first last address reserved. length operand required, specifies number bits reserved current control section. label optional. label specified .SPACE directive, label names symbol assigned value first address allocated directive current control section. label specified .BES directive, label names symbol assigned value last address allocated directive current control section. Example This example illustrates allocate bits current section, assign label first address allocated. TempVar .SPACE .SPACE length .BES length
2-68
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
BFRACT/FRACT/ LFRACT
Purpose
Assemble Fractional Values Into Memory Locations
BFRACT/FRACT/ LFRACT
BFRACT, FRACT, LFACT assembler directives assemble specified fractional values into consecutive memory locations. Syntax label BFRACT[[ repeat1 initializer1 repeat2 initializer2 label FRACT[[ repeat1 initializer1 repeat2 initializer2 label LFRACT[[ repeat1 initializer1 repeat2 initializer2 Description BFRACT, FRACT LFRACT directives place fractional values into current control section. Each initializer must floating point expression range [-1.0,1.0). FRACT directive places 16-bit fractional values into current control section. BFRACT directive places 8-bit fractional values into current control section. LFRACT directive places 32-bit fractional values into current control section. number addresses allocated depends upon size memory current control section. following table shows number addresses allocated initializer.
Table 2-25. Number Addresses Initializer
Instruction
BFRACT FRACT LFRACT
8-Bit
16-Bit
32-Bit
have number initializers, they must single source statement line, they must separated commas. Each initializer preceded repeat specification, which absolute number enclosed square brackets. memory allocation initialization performed repeat times.
UM003601-COR1299
2-69
Conditional Assembly Processing
Assembler Description
label, points first memory address that initialized. Examples This example shows simple fractional initialization with label pointing first memory address allocated. FxLabel: FRACT
This example shows fractional initializer repeated five times. FRACT 0.25
2-70
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
BLKB/BLKL/BLKW
Purpose
Reserve/Initialize Blocks Storage
BLKB/BLKL/BLKW
BLKB/BLKW/BLKL assembler directives reserve, optionally initialize, blocks storage. Syntax label BLKB count initializer] label BLKW count initializer] label BLKL count initializer] Description BLKB/BLKW/BLKL directives allocate optionally initialize block storage current control section. count operand required, specifies number 8-bit bytes (BLKB), 16-bit words (BLKW), 32-bit longwords (BLKL) allocate. optional initializer specifies value used initializer. initializer omitted, memory allocated initialized. initializer specified string expression, assembler allocates sufficient memory hold value string, initializes memory with value string. this case, count operand taken repetition counter: memory allocated initialized count times. initializer omitted, specified string expression, assembler allocates sufficient memory count bytes, words, longwords. number addresses allocated depends upon size memory current control section. following table shows number addresses allocated count.
Table 2-26. Number Addresses Initializer
Instruction
BLKB BLKW BLKL
8-Bit
16-Bit
32-Bit
UM003601-COR1299
2-71
Conditional Assembly Processing
Assembler Description
label, points first memory address that allocated. Examples This example shows simple memory allocation with label pointing first memory address allocated. MemLabel: BLKB
This example shows allocate memory addresses, each initialized zero. BLKB 10,0 This example shows allocate sufficient memory hold five 16-bit words, each initialized zero. BLKW
2-72
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
.BSS
Purpose
Reserve Space .BSS
.BSS
.BSS assembler directive reserves uninitialized space .BSS control section. Syntax label Description .BSS assembler directive reserves uninitialized space .bss control section. symbol names symbol assigned value first address reserved, length specifies number addresses reserved .bss section. symbol operand required, names symbol assigned value first address allocated directive .bss control section. length operand required, specifies number addresses reserved .bss control section. label this directive, points first memory address that allocated. Example This example illustrates allocate addresses .bss section, assign label first address allocated. .BSS TempVar,4 .BSS symbol, length
UM003601-COR1299
2-73
Conditional Assembly Processing
Assembler Description
CHIP/CPU
Purpose
Specify Target Microcontroller
CHIP/CPU
CHIP assembler directive specifies target microcontroller which code will assembled. Syntax CHIP microcontroller Alias Description CHIP assembler directive basically used compatibility with other assemblers specify target microcontroller, allowing assembly machine instructions that processor. microcontroller operand required, literal token specifying part number Zilog microcontroller. TARGET assembler instruction select appropriate target multiple processors such Z89175. must label this directive. When developing code using ZMASM, CHIP directive required; GUI's "Project/Target" performs same function. Example This example illustrates specify target microcontroller assembly. CHIP Z89C50
2-74
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
COMMENT
Purpose
Classify Stream Characters
COMMENT
COMMENT assembler directive classifies stream characters comment. Syntax COMMENT delimiter text delimiter Description COMMENT assembler directive causes assembler treat arbitrary stream characters comment. delimiter printable ASCII character. assembler treats comments text between initial final delimiter, well text same line final delimiter. must label this directive. Example This example illustrates include block comment spanning multiple source lines. COMMENT This text comment, delimited dollar sign, spanning multiple source lines. This delimiter marks this line comment block.
UM003601-COR1299
2-75
Conditional Assembly Processing
Assembler Description
CONDLIST
Listing Conditional Assembly Blocks
CONDLIST
Purpose CONDLIST assembler directive controls listing conditional assembly blocks. Syntax CONDLIST mode Description CONDLIST assembler directive controls whether statements conditional assembly blocks printed listing file. directive effect listing file being produced. mode operand optional. specified, mode must literal tokens OFF. omitted, mode defaults mode (explicitly implicitly) source lines conditional assembly blocks printed listing file. mode OFF, source lines unassembled conditional assembly blocks printed listing file. must label this directive. Example This example illustrates inhibit listing unassembled conditional assembly blocks. CONDLIST
2-76
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
.DATA
Current Control Section
.DATA
Purpose .DATA assembler directive makes .DATA control section current control section. Syntax .DATA Description DATA assembler directive makes .data control section current control section; assembler begins assembling into .data section. must label this directive. Example This example illustrates make .data section current control section .DATA
UM003601-COR1299
2-77
Conditional Assembly Processing
Assembler Description
DB/DW/DL
Assemble Values Into Consecutive Locations
DB/DW/DL
Purpose DB/DW/DL assembler directives assemble specified values into consecutive memory locations. Syntax label label label Description DB/DW/DL directives allocate initialize storage current control section. directives allocate initialize 8-bit bytes (DB), 16-bit words (DW), 32-bit longwords (DL). have number initializers, they must single source statement line. initializer string expression, assembler allocates sufficient memory hold value string. initializer string expression, assembler allocates sufficient memory byte, word, longword. number addresses allocated depends upon size memory current control section. following table shows number addresses allocated initializer. repeat1 initializer1 repeat2 initializer2 repeat1 initializer1 repeat2 initializer2 repeat1 initializer1 repeat2 initializer2
Table 2-27. Number Addresses Initializer
Instruction
8-Bit
16-Bit
32-Bit
2-78
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Each initializer preceded repeat specification, which absolute number enclosed square brackets. memory allocation initialization performed repeat times. label, points first memory address that allocated. Examples This example shows allocate initialize memory with 8-bit value. points first memory address allocated. MemLabel: label
This example shows allocate memory addresses, each initialized zero. This example shows allocate sufficient memory hold five 16-bit words, each initialized zero.
UM003601-COR1299
2-79
Conditional Assembly Processing
Assembler Description
DEFINE
Name Control Section
DEFINE
Purpose DEFINE assembler directive names control section specifies attributes. Syntax DEFINE section ALIGN= alignment ORG= origin SPACE= space Description DEFINE assembler directive defines control section named section having specified alignment, origin address space control section attributes. Once control section been defined, make current control section using SEGMENT assembler directive. section operand required, names control section. optional alignment clause specifies control section alignment. omitted, alignment defaults (1). assembler arranges first address control section aligned multiple alignment. optional origin clause specifies control section origin, start address. omitted, control section origin determined until link time. Sections with origin clause absolute sections. Sections without origin clause relocatable sections. space clause specifies address space which control section should assigned. omitted, control section assigned target's program memory space. Z89C00 family microcontroller control section address spaces described Table 2-28.
2-80
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Table 2-28. Family Control Section Address Spaces
Mnemonic
RFILE
Description
Register File. standard register file contains consecutive bytes (registers). Program Memory. This address space encompasses both internal external program memory. first bytes program memory reserved interrupt vectors. External Data Memory. address Kbytes external data memory beginning location 4096.
XDATA
UM003601-COR1299
2-81
Conditional Assembly Processing
Assembler Description
hybrid Z8/Z89C00 family microcontroller control section address spaces described Table 2-29.
Table 2-29. Hybrid Z8/Z89C00 Family Control Section Address Spaces
Mnemonic DSPROM Description Z89C00 Program Memory. Programs words masked into internal ROM. Four locations dedicated vector addresses three interrupts (0FFDH-0FFFH) starting address following Reset (0FFCH). Internal mapped from 0000H 0FFFH, highest location program 0FFBH. /ROMEN held high, internal inactive, processor executes external fetches from 0000H FFFFH. this case locations FFFCH-FFFFH used vector addresses. Z89C00 Internal Data RAM. Z89C00 internal 16-bit word data organized banks 16-bit words each, referred RAM0 RAM1. Each data bank addressed three pointers, referred Pn:0 (n=0-2) RAM0 Pn:1 0-2) RAM1. addresses RAM0 RAM1 arranged from 0-255 256-511, respectively. Register File. standard register file contains consecutive bytes (registers). External Data Memory. address Kbytes external data memory beginning location 4096. Program Memory. This address space encompasses both internal external program memory. first bytes program memory reserved interrupt vectors.
RAM0 RAM1
RFILE XDATA Z8ROM
Z89C00 family microcontroller control section address spaces described
2-82
UM003601-COR1299
Assembler Description
Table 2-30.
Conditional Assembly Processing
Table 2-30. Z89C00 Family Control Section Address Spaces
Mnemonic RAM0 RAM1 Description Internal Data RAM. Z89C00 internal 16-bit word data organized banks 16-bit words each, referred RAM0 RAM1. Each data bank addressed three pointers, referred Pn:0 (n=0-2) RAM0 Pn:1 0-2) RAM1. addresses RAM0 RAM1 arranged from 0-255 256-511, respectively. Program Memory. Programs words masked into internal ROM. Four locations dedicated vector addresses three interrupts (0FFDH-0FFFH) starting address following Reset (0FFCH). Internal mapped from 0000H 0FFFH, highest location program 0FFBH. /ROMEN held high, internal inactive, processor executes external fetches from 0000H FFFFH. this case locations FFFCHFFFFH used vector addresses. must label this directive. Example This example shows define relocatable control section default program address space, make that section current section, assemble directive into section. DEFINE SEGMENT ProgSection ProgSection Define section Make current section Assemble machine directive
UM003601-COR1299
2-83
Conditional Assembly Processing
Assembler Description
Purpose
Reserve Uninitialized Space
assembler directive reserves uninitialized space current control section. Syntax label Description assembler directive reserves uninitialized space current control section. optional label names symbol assigned value first address reserved, length specifies number addresses reserved current section. label optional. specified, names symbol assigned value first address allocated directive current control section. length operand required, specifies number addresses reserved current control section. Example This example illustrates allocate addresses current section, assign label first address allocated. TempVar: length
2-84
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
Purpose
Terminates Assembly
assembler directive terminates assembly. Syntax address Alias .END Description assembler directive signifies source module and, optionally, sets program entry point address. assembler directive causes assembler stop assembling source module. absence directive, assembler assembles statements source file. directive accepts optional operand, namely program entry point address. address emitted object file, linker, debugger, other tools. address does appear object code, that does occupy space control section. must label this directive. Example This example illustrates signal source module, specify program entry-point. EntryPoint
UM003601-COR1299
2-85
Conditional Assembly Processing
Assembler Description
IF/ELSEIF/ELSE/ENDIF
IF/ELSEIF/ELSE/ENDIF
Support Conditional Assembly
Purpose ELSEIF, ELSE, ENDIF assembler directives support conditional assembly sequences source statements. Syntax expression
statements
ELSEIF expression
statements
ELSE [statements] ENDIF Description ELSEIF, ELSE ENDIF assembler directives used test assembly-time conditions, conditionally assemble source statements based results test. assembler directive marks beginning conditional assembly block. required expression operand must absolute expression, involving forward references. value expression determines which source statements conditional assembly block assembled.
expression true (non-zero), assembler assembles source statements between directive next ELSEIF, ELSE ENDIF directive. expression false (zero), assembler evaluates turn each expression ELSEIF directives between ENDIF directives. such expression found true (non-zero), assembler assembles source statements between ELSEIF next ELSEIF, ELSE ENDIF directive. such expression found true, there ELSEIF directives, then assembler assembles directives between ELSE ENDIF directives. none directives ELSEIF directives true, there ELSE directive, directive between ENDIF directives assembled.
There number ELSEIF directives following directive. There must
2-86
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
exactly directive each directive. ELSE directive used, must appear before ENDIF directive, after ELSEIF directives. There more that ELSE directive each directive. must label these directives. Example This example illustrates select source statements assembly based upon assembly-time conditions. call ELSEIF call ELSE call ENDIF functionx SELECT=1 function1 SELECT=2 function2
UM003601-COR1299
2-87
Conditional Assembly Processing
Assembler Description
EQU/SET
Equate Symbols Expressions
EQU/SET
Purpose assembler directives equate symbols expressions. Syntax
symbol symbol
Alias EQU: .EQU SET: .SET, Description
expression expression
assembler directives equate named symbol with specified expression both type value. This allows equate symbolic names with constants other values. directives differ that directive allows redefine symbol previously defined with directive, whereas symbols defined with directive redefined.
2-88
UM003601-COR1299
Assembler Description
NOTE:
Conditional Assembly Processing
directive redefined, value must equal original definition. symbols specified expression must previously defined. Undefined external symbols symbols that defined later module cannot used expression. expression relocatable, symbol which assigned also relocatable. value expression appears object field listing. This value part actual object code written output file. Symbols defined with made externally visible with PUBLIC directive. This means that define global absolute constants. Example This example shows assign symbolic name value arithmetic expression. THREE FOUR FIVE SEVEN TWO+THREE TWO+FIVE
UM003601-COR1299
2-89
Conditional Assembly Processing
Assembler Description
ERROR/EXIT/WARNING
Generate ERROR/EXIT/WARNING Error Messages
Purpose ERROR, EXIT, WARNING assembler directives generate synthetic error warning messages. Syntax ERROR EXIT WARNING Alias ERROR: .EMSG WARNING: .WMSG Description These directives allow define your error warning messages. assembler tracks number errors warnings encounters prints these numbers listing file. directives require single argument, message, which must string, enclosed double quotes. ERROR directive produces messages same natural assembly errors, incrementing error count preventing assembler from producing object file. EXIT directive produces messages same natural assembly fatal errors, causes assembler terminate immediately, without producing object file. WARNING directive produces messages same natural assembly warnings, incrementing warning count preventing assembler from producing object file severe warning option been enabled. must labels these directive.
message message message
2-90
UM003601-COR1299
Assembler Description
Example
Conditional Assembly Processing
This example illustrates ERROR directive signal assembly-time conditions that find unfavorable. ERROR ENDIF FAILURES "Failure limit exceeded"
UM003601-COR1299
2-91
Conditional Assembly Processing
Assembler Description
.EVAL
Assign Character Strings Substitution Symbols
.EVAL
Purpose .EVAL assembler directive performs arithmetic substitution symbols. Syntax .EVAL predefined expression, substitution symbol
Description .EVAL assembler directive allows arithmetic operations substitution symbols. This directive evaluates pre-defined expression assigns string value result substitution symbol. pre-defined expression required must have been defined before they appear expression. Example .eval reg1+1, reg1
2-92
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
EXTERN
Identify External Symbol
EXTERN
Purpose EXTERN assembler directive identifies symbol defined another source module. Syntax EXTERN Alias .EXTERN .GLOBAL .REF XREF Description EXTERN assembler directive defines more external symbols, optionally specifying address spaces which they reside. external symbol symbol which defined different source module from that currently being assembled. declare number external symbols single statement, they must single source statement line. commas separate symbols. Each symbol associated with particular address space, coding colon literal name address space immediately after symbol. description DEFINE assembler directive list valid address space names. must label this directive. Examples This example shows declare symbol defined another source module. EXTERN ExFunction
symbol1 space1 symbol2 space2
UM003601-COR1299
2-93
Conditional Assembly Processing
Assembler Description
FILE
Identify Source File Name
FILE
Purpose FILE assembler directive identifies source file name. Syntax FILE name Alias .FILE Description FILE assembler directive associates file name with source module. This allows associate file name wish with current source module. absence FILE directive, assembler associates actual source file name with source module. FILE assembler directive requires single operand, namely, file name associated with source module. file name must enclosed double quotes. must label this directive. Example This example illustrates associate file name with current source module. FILE "debug.c"
2-94
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
.FLOAT
Assemble Floating-Point Values
.FLOAT
Purpose .FLOAT assembler directive assembles specified floating-point values into consecutive memory locations. Syntax label .FLOAT[[repeater1]] initializer1[,[[repeater2]] initializer2]. Description .FLOAT directive places floating-point values into current control section. 16-bit core, .FLOAT places each floating-point into word memory location. 8-bit core, assembles floating-point value into word memory location. Each initializer must floating-point expression. have number initializers, they must single source statement line they must separated commas. Each initializer preceded repeat specification(repeatern), which absolute number enclosed square brackets. memory allocation initialization performed repeat times. label, points first memory address that initialized. Examples This example shows simple floating-point initialization with label pointing first memory address allocated 16-bit core. 000000000000 4020.float
This example shows each floating-point initializer repeated times 8-bit core: 000000004316 4316 .float[2]1.5e2, 000000064040 4040
UM003601-COR1299
2-95
Conditional Assembly Processing
Assembler Description
GLOBALS
Declare Symbols Globally Linker
GLOBALS
Purpose GLOBALS assembler directive makes symbols globally visible linker. Syntax GLOBALS mode Description GLOBALS assembler directive enables disables global visibility symbols defined after GLOBALS directive. globally visible symbol symbol that defined source module that currently being assembled, referenced another source module. mode operand required, must literal tokens OFF. mode then symbols defined after GLOBALS directive will globally visible linker. Global visibility remains effect until disabled subsequent GLOBALS directive. mode OFF, then global visibility disabled, symbols will only globally visible linker explicitly named PUBLIC assembler directive. must label this directive. Example This example illustrates declare subsequent symbols have global scope. GLOBALS
2-96
UM003601-COR1299
Assembler Description
Conditional Assembly Processing
INCLUDE
Insert Source Statement
INCLUDE
Purpose INCLUDE assembler directive inserts source statements from specified file into current source module. Syntax INCLUDE filename Alias .COPY .INCLUDE Description INCLUDE assembler directive causes statements specified file assembled immediately after point where dir

Other recent searches


TC7SA32F - TC7SA32F   TC7SA32F Datasheet
TC7SA32FU - TC7SA32FU   TC7SA32FU Datasheet
SD820T - SD820T   SD820T Datasheet
SD860T - SD860T   SD860T Datasheet
PBSS306PZ - PBSS306PZ   PBSS306PZ Datasheet
LMC6024 - LMC6024   LMC6024 Datasheet
LB11851TT - LB11851TT   LB11851TT Datasheet
LB11851TTMOS-TRIC - LB11851TTMOS-TRIC   LB11851TTMOS-TRIC Datasheet
CxxxRT230-S0200 - CxxxRT230-S0200   CxxxRT230-S0200 Datasheet
1N5820 - 1N5820   1N5820 Datasheet
1N5822 - 1N5822   1N5822 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive