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*)

 

 

Assembler Linker UM0144 User manual June 2005 BLANK


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



STMicrolectronics
Assembler Linker
UM0144 User manual
June 2005
BLANK
UM0144 User Manual
Assembler Linker
Introduction
Thanks choosing ST7! This manual describes Assembler-Linker develop applications microcontrollers. assembly tools described this book form development system that assembles, links formats your source code. Figure Schematic overview assembler toolset
Assembler-Linker includes following tools:
Assembler (ASM): translates your source code (.ASM) written assembly language, into object code (.OBJ) specific target machine optional listing file (.LST). Linker (LYN): processes object files (.OBJ) produced assembler, resolves cross-references between object files locates modules memory. resulting code output object code file (.COD). second pass, Assembler uses these files produce object code file, listing with absolute paths. Obsend (OBS): translates object code file produce final executable default format (.FIN) other format that specify (e.g. S-record, Motorola S-record, Intel Hex.). (Librarian): librarian enables store frequently used subroutines location with number applications.
June 2005
UM0144
3/92
www.st.com
Assembler Linker
Note: utility file asli.bat automatically runs ASM, LYN, OBSEND after other you. this batch file only have only assembly source file ".ASM".
About user manuals.
This manual provides information about producing application executable from your application source code Assembly language. Here, will find:
overview Assembly language Instructions running Assembler-Linker Descriptions Assembler output
information related subjects refer following documentation:
ST7xxxx Datasheet full description your ST7. Programming Manual complete reference Assembly language
Host system requirements
This tool been designed operate that meets following:
following operating systems: Microsoft® Windows® 2000, Millennium, XP®. Intel® Pentium compatible) processor with minimum speed MHz. Minimum recommended). free hard disk space install tools.
Getting assistance
more information, application notes, FAQs software updates microcontroller development tools, check CD-ROM website: www.st.com/mcu assistance microcontroller subjects, help developing applications that your microcontroller's MSCI peripheral, refer contact list provided Product Support page 108. We'll glad help you.
4/92
UM0144
Assembler Linker
Contents
Getting Started Addressing Modes
Overview addressing modes General instruction syntax Short long addressing modes Inherent addressing mode Immediate operands Direct indirect modes Indexed modes Relative mode High, addressing modes
Assembler
Overview Source files Assembly source code format Segmentation Macros Conditional assembly Running assembler
Linker
What linker does Invoking linker Command line Linking detail linker more detail
OBSEND
What OBSEND does Invoking OBSEND
UM0144
5/92
Assembler Linker
Librarian
Overview Invoking librarian Adding modules library Deleting modules from library Copying modules from library Getting details your library
Appendix Assembler Directives Appendix Error Messages Appendix Revision History. Appendix Product Support.
6/92
UM0144
Assembler Linker
Getting Started
Getting Started
Installing Assembler-Linker
Assembler-Linker delivered part toolset. free installation package available www.st.com/mcu. install
Select ST7>ST7 toolchain from main menu "Microcontroller Development Tools" CD-ROM, installation executable that have downloaded from internet.
Note:
Windows® 2000, XP®users must have administrator privileges install certain software components.
After installation, installation directory should contain following (Table 1):.
Table
ASM.EXE LYN.EXE
Description installed files
Assembler Linker output file formatter librarian description files batch file ASM+LYN+OBSEND release notes
OBSEND.EXE LIB.EXE ST7.TAB ASLI.BAT RELEASE_NOTES.PDF
Up-to-date release notes provided format. additional file contains demonstration examples.
UM0144
7/92
Addressing Modes
Assembler Linker
Addressing Modes
Overview addressing modes
assembler instruction incorporates following different addressing modes: Table Addressing modes
Addressing Mode Inherent Immediate Direct (short address) Direct (long address) Indexed offset) Indexed (short offset) Indexed (long offset) Short Pointer Indirect (short pointed data) Short Pointer Indirect (long pointed data) Short Pointer Indirect (short pointed data) Indexed Example A,#$F5 A,$F5 A,$F5C2 A,(X) A,($F5,X) A,($F5C2,X) A,[$F5] A,[$F5.w] A,([$F5],X)
Instruction
Short Pointer Indirect (long pointed data) A,([$F5.w],X) Indexed Direct Relative (short offset) Short Pointer Indirect Relative (short pointed data) operation [$F5] bset byte,
addressing modes described full detail, with specific examples, Family 8-bit MCUs Programming Manual. This chapter seeks only give brief explanation main addressing mode types.
General instruction syntax
instruction provide single source-coding model regardless which components operands-the accumulator (A), index register 8-bit stack pointer ST7, condition code register (CC), memory location. example, single instruction, originates register register transfers well memory accumulator data movements.
8/92
UM0144
Assembler Linker
Addressing Modes
Two-operand instructions coded with destination operand appearing first position. example:
lab01 lab02 A,memory memory,A load accumulator with memory contents load memory location with contents load with accumulator contents
Short long addressing modes
there addressing modes that differ memory address size (i.e. byte short mode bytes long mode). Because these different addressing modes, target address range operands will depend upon addressing mode chosen:
0-$FF $100-$FFFF short addressing mode long addressing mode
Some instructions accept both long short addressing modes, while others only accept other. example:
lab10 lab11 A,memory memory accepts both types addressing modes accepts only short addressing mode
instructions supporting both short long formats, when external symbols referenced, long mode chosen Assembler. example:
EXTERN symb3 symb1 A,symb1 A,symb3 short mode long mode chosen
Inherent addressing mode
This concept hardware-oriented, meaning that instruction operands coded inside operation code. source coding level, operands written explicitly. Examples:
lab06 lab07 push accumulator onto stack multiply
UM0144
9/92
Addressing Modes
Assembler Linker
Immediate operands
Immediate operands permit input specific value with instruction. They signaled sharp sign before value. Examples:
lab08 lab09 bset btjt A,#1 memory,#3 memory,#3,label load with immediate value memory location test memory jump true (set)
range 8-bit immediate operand from 255.
Direct indirect modes
direct addressing mode means that data byte required operation found memory address, which follows op-code. indirect addressing mode means that data byte required operation found memory address which located memory (pointer). pointer address follows op-code. This last group consists memory indirect variants:
short indirect (short pointed data), long indirect (long pointed data), short indirect indexed (short pointed data), long indirect indexed (long pointed data),
devices, address specified must always page (i.e. address must less than $100). Examples:
A,[80] A,[80.b] A,[80.w] short indirect short indirect long indirect
lab12
A,([lab12],X) A,([lab12.b],X) A,([lab12.w],Y) short indirect X-indexed short indirect X-indexed long indirect Y-indexed
make distinction between short long indirect addressing mode, suffix.w specified indicate that want work long indirect mode (this also true indexed addressing mode). Implicitly, nothing specified, short indirect addressing mode assumed. devices, also use.b specify short indirect addressing mode with indexed addressing mode).
10/92 UM0144
Assembler Linker
Addressing Modes
Indexed modes
hardware supports four types indexed mode:
indexed without offset, indexed with 8-bit unsigned offset (range ,255]), indexed with 16-bit offset, no-offset indexing. (offset,X) (offset,Y)for indexed with offset.
source coding syntax
Some instructions (such add) support first three types indexed mode. Some instructions (such inc) only support first types (i.e. indexed without offset indexed with 8-bit unsigned offset). Examples:
A,(X) A,(0,X) A,(127,X) A,(259,X) no-offset mode 8-bit offset mode 8-bit offset mode 16-bit offset mode
Relative mode
This addressing mode used modify Program Counter (PC) register value adding 8-bit signed offset (i.e. range -128 +127). relative addressing mode made sub-modes:
relative (direct)-where offset following op-code. relative (indirect)-where offset defined memory, whose address follows opcode.
Relative mode used instructions JRxx, CALLR, BTJx. source coding level, target label specified (and assembler computes displacement).
High, addressing modes
some instances, necessary access highest part address highest bits) lowest part address lowest bits) well. this feature, syntax following one:
<expression>
where expression
symbol.H (highest part) symbol.L (lowest part).
UM0144
11/92
Addressing Modes
Assembler Linker
Examples:
lab12 A,#lab12.h A,#lab12.l load with load with $0012
more information about each instruction various addressing modes, refer Programming Manual, which downloaded from Internet www.st.com/mcu.
12/92
UM0144
Assembler Linker
Assembler
Assembler
Overview
Assembler program cross-assembler, meaning that produces code target machine-an microprocessor-which different from host machine. assembler turns your source code files into relocatable object modules ready linking. During process, checks many different types errors. These errors recorded ASCII file called cbe.err. (Note that linker also writes this file.) Error messages explained page produce code ready execution, must assembler (ASM), linker (LYN), object code formatter (OBSEND).
Source files
Source program code written Assembler language saved ASCII text file named source file. source file extension .asm. made lines, each which terminated line character. complete reference Assembler language, refer Programming Manual.
Assembly source code format
first line assembly source code file reserved specifying *.tab file target processor. cannot other instructions comments this line. this line specify directory location *.tab file. directory specified, default Assembler searches first current directory, then directory where Assembler's executable located. '.tab' suffix left out-as assembler only looks this file type. example, first line your source code might look like:
c:\st7tools\asm\st7\
file st7.tab can't found specified default directories, then error produced assembly aborted. rest source code lines have following general format:
where <space> refers either SPACE ($20) ($09) character. four fields left blank, <space> fields mandatory unless:
whole line blank, line begins comment, line ends before remaining fields.
UM0144 13/92
Assembler
Assembler Linker
example:
examp A,$ffff long addressing mode
opcode label operand
separator
comments
next sections describe main components source code file.
3.3.1
About labels Label structure
Labels must start column one. label contain following characters:
Upper Case letters (A-Z) Lower case letters (a-z) Digits (0-9) Underscore
first letter label must letter underscore. Note that upper lower case treated differently because assembler case sensitive. Upon assembly, label that exceeds characters truncated warning alerts user that this occurred. When truncated, more labels have same name, phase inconsistency error generated. When labels defined, several attributes defined along with value. These are:
Size (Byte, Word Long) Relativity (Linker Relative Absolute) Scope (Internally Externally defined)
function each attribute explained following sections.
Label size
Defining label's size allows assembler determine what kind addressing mode choose even value associated with label undefined. default size memory location label word bytes). Whenever label suffix, then default size assumed. directives BYTES, WORDS LONGS bytes) allow change default. Regardless default size, define size specific label adding suffix byte, word long. suffix used when label referred Using suffixes other than will result error upon assembly.
14/92
UM0144
Assembler Linker
example:
label1.b label2.l segment byte `ram' bytes
Assembler
word-size label (default) byte-size label long label
force size label bytes byte-size label byte-size label with word-size space reserved this address
count pointer
ds.b ds.w
Label relativity
There sorts labels: absolute labels relative labels.
Absolute labels usually assigned constants, such port addresses, common values used within program. Relative labels defined derived from) external label label derived from position some program code. They exclusively used labels defined within pieces program data.
example:
ioport $8000 absolute label `count' absolute word label `ioport'
segment `eprom' start X,#count A,#'*' loop ioport,A jrne loop stop stop then loop ever
Only linker sort actual address code, assembler idea many segments precede this class. assembly time, labels such 'start' 'loop' actually allocated 'blank' values ($0000). These values will filled later linker. Labels such 'count' 'ioport', which were defined absolutely will filled assembler. Source code lines that have arguments containing relative labels marked with listing, showing that they 'linker relative'. Segments discussed Section page
UM0144
15/92
Assembler
Assembler Linker
Label scope
Often, multi-module programs, piece code will need refer label that actually defined another module. this, module that exports label must declare PUBLIC, module which imports label must declare EXTERN. directives EXTERN PUBLIC together pair. Most labels program will interest other pieces program-these known 'internal' labels since they only used module where they defined. Labels 'internal' default. Here incomplete example modules that pass labels between them:
module EXTERN _sig1.w EXTERN _sig2.w PUBLIC _handlers segment byte _handlers: _sig1 _sig2 module EXTERN _handlers.w PUBLIC _sig2 segment byte _sig2: call _handlers refer _handlers define _sig2 import _handlers (addr. word) export _sig2 define _handlers refer _sig1 refer _sig2 import _sig1 import _sig2 export _handlers
see, module refers '_sig2' subroutine which defined module Note that when module refers '_sig2' label EXTERN directive specifies WORD size with '.w' suffix. Because assembler cannot look definition '_sig2' told address size explicitly. doesn't need told relativity: external labels assumed relative. Absolute labels declared between modules should defined INCLUDE file that called modules program; this idea using INCLUDE files very important since reduce number PUBLIC symbols-and therefore link time-significantly. Lines source code listing which refer external labels marked with given 'empty' values linker fill.
16/92
UM0144
Assembler Linker
Assembler
short cut, labels declared PUBLIC preceding them with their definition. this done label name need given PUBLIC directive. example, following code fragment declares label 'lab4' PUBLIC automatically:
lab3 A,#0 .lab4
3.3.2
About opcodes
Opcode field serve three different purposes. contain:
opcode mnemonic assembly instruction, name directive, name macro invoked.
Opcodes must separated from preceding field (i.e. label, there one) space tab. comprehensive Opcode description found Programming Manual. Macros discussed Section page Directives discussed page
3.3.3
About operands
Operands following:
Numbers addresses, String character constants, Program Counter references, Expressions.
following paragraphs explain these types operands.
Number address representation
default, representation numbers addresses follows MOTOROLA syntax. When want hexadecimal number with instructions labels, they must preceded When nothing specified, default base decimal. example:
lab03 lab04 A,$ffff A,#$cb A,#100 decimal hexadecimal long addressing mode immediate addressing mode decimal representation
UM0144
17/92
Assembler
Assembler Linker
change Motorola format representation using directives (.INTEL, .TEXAS) indicate setting format. more information, refer page
Caution: Addresses SEGMENT definition always given hexadecimal: segment byte 100-1FF 'test'
segment 'test' defined within 256-511 address range.
Numeric constants radix
Constants need special characters define radix given number. assembler supports MOTOROLA format default. INTEL, TEXAS, ZILOG formats also available format forced .INTEL .TEXAS .ZILOG directives. Table page shows summary these formats.
Note:
Decimal constants always default, require special characters.
Table
Format Motorola
Numeric constants radix formats
$ABCD &ABCD %100 Binary ~665 Octal Current (use MULT MULTIPLY)
Intel
0ABCDh
100b
665o 665q ~665 %(8)665
Texas Zilog
>ABCD %ABCD
?100 %(2)100
String constants
String constants strings ASCII characters surrounded double quotes. example:
"This ASCII string"
ASCII character constants
assembler's arithmetic parser also handles ASCII characters single quotes, returning ASCII given character(s). example:
`AB' $4142
18/92
UM0144
Assembler Linker
Assembler
characters used within single pair quotes give long constant. following special sequences used denote special characters:
`\b' `\f' `\n' `\r' `\t' `\\' `\0' `\"' backspace formfeed linefeed carriage return tabulation slash single-quote null double-quote
Program counter reference
current value program counter (PC) specified asterisk "*". example:
lab05
Expressions operators
Expressions numeric values that made from labels, constants, brackets operators. Labels constants have been discussed previous paragraphs. Arithmetic brackets allowed nested levels-the curly braces used instead common "()" because instructions parenthesis denote indexed addressing modes.
UM0144
19/92
Assembler
Assembler Linker
Operators have levels precedence. Operators level (listed Table take precedence over operators level (listed Table each level, operators have same precedence-they evaluated from left right. Table Level operators
Result, level negated logical logical logical shifted right times shifted left times a<b, else a>b, else a=b, else a>=b, else unequal else a/256, force BYTE type 256, force BYTE type 65536, force WORD*16 type a/65536, force WORD*16 type invert bits invert bits invert bits sign extend byte bits sign extend byte bits sign extend word bits
Operation high offset bnot wnot lnot sexbw sexbl sexwl
Table
Level operators
Result, level divided divided
Operation
Table
Level operators
Result, level multiplied above motorola (character reserved)
Operation mult
20/92
UM0144
Assembler Linker
Table Level operators
Result, level minus plus
Assembler
Operation
Operator names longer than character must followed space character. example, correct, '1AND2' not. Place curly braces around arithmetic expressions. Also, always curly braces top-level, when defining numeric expression. doing produce unexpected results.
Wrong syntax:
#define SIZE DS.W SIZE+1 SIZE #ENDIF
Wrong, syntax error Wrong, same SIZE
Correct syntax:
#define SIZE DS.W {SIZE+1} {SIZE #ENDIF
3.3.4
Comments
Comments preceded semicolon. Characters following semicolon ignored assembler.
3.3.5
source code example
Below example short source code.
st7/ small example module showing source formats ioport handshake $8000 $9000 port write here strobe
segment 'program' start loop a,#0 ioport,x zero counter store into ioport
UM0144
21/92
Assembler
Assembler Linker
segment word FFFC 'code' WORD start
Don't worry some directives don't make sense yet; they will covered soon. Also, take special notice SEGMENT directive.
Segmentation
Segments very important. have understand segments before assembler. Take time understand them you'll save yourself puzzling later. Segmentation 'naming' areas your code making sure that linker collates areas same name together same memory area, whatever order segments object files. different segments defined each module. segment directive itself four arguments, separated spaces:
[<name>] SEGMENT [<align>] [<combine>] '<class>' [cod]
example:
FILE1:
st7/ BYTES segment byte 80-FF `RAM0' counter.b address.b ds.b ds.w ds.b stack ds.b loop counter address storage stack allocation stack grows downward
segment byte E000-FFFF `eprom' A,#stack init stack pointer
22/92
UM0144
Assembler Linker
Assembler
FILE2:
st7/ segment `RAM0' serialtemp serialcou ds.b ds.b
WORDS segment `eprom' serial_in A,#0
preceding example, FILE1 FILE2 separate modules belonging same program. FILE1 introduces classes: 'RAM0' 'eprom'. class-names names choose characters. first time class used-introduced-you have declare default alignment, start addresses class, course, name class. Users generally specify class each 'area' their target system. examples above, user class bytes on-chip from 0080 00FF ('RAM0') another 'eprom'. code stored from E000 FFFF ('eprom'). have supply this information very first time class, otherwise only class-name necessary, FILE2.
3.4.1
Parameters
following paragraphs describe each argument detail.
Name
<name> argument optional; contain name characters. does, then segments with same name grouped together within their class, order that names defined.
Align
<align> argument defines threshold which each segment must start. default alignment specified introduction class none specified class introduction then para alignment assumed), although alignment types described Table allowed specified overriding default.
UM0144
23/92
Assembler
Assembler Linker
Alignment types
Description address Next address boundary Next address 16-byte boundary Next address 64-byte boundary Next address 128-byte boundary Next address 256-byte boundary Next address 4-byte boundary Next address 1k-byte boundary Next address 4K-byte boundary 1001->1002 1001->1010 1001->1040 1001->1080 1001->1100 1001->1004 1001->1400 1001->2000 Examples
Table
Type byte word para page long
Looking back example page should able that 'RAM0' class will allocate counter, address, stack FILE1, when linker meets segment FILE2 same class, serialtemp will allocated serialcou same processing happens 'eprom' class segments-the second, FILE2, will tacked first FILE1. FILE2 'eprom' class segment specified, say, long align type instead default byte, then that segment would have been next long-word boundary after FILE1 'eprom' class segment.
Combine
<combine> argument tells assembler linker treat segment. There three types handle Table Combine types
Type at:X[-Y] common <none> Description Starts class from address address common segments that have same class name will start same address. This address determined linker. Follows from last segment this class.
at-type <combine> must used introduction class, only once. at-type <combine> must have argument: start address class, optionally given address limit) class too. given, linker checks that items class have gone over limit address; this does occur, warning issued link time. hexadecimal numbers should have radix specifiers. common-type <combine> segments that have same class name will start same address. linker keeps track longest segment. common segments used sharing data across different applications.
24/92
UM0144
Assembler Linker
example:
st7/ dat1 segment byte 'DATA' ds.w com1 .lab1 com1 .lab2 com2 .lab3 com2 .lab4 dat2 .lab5 segment common 'DATA' ds.w segment common 'DATA' ds.w segment common 'DATA' ds.w segment common 'DATA' ds.w segment 'DATA' ds.w
Assembler
values labels lab1, lab2, lab3, lab4, lab5 respectively.
Note:
Since can't specify both common combines simultaneously, only specify exact location commons insert empty combine segment before first common declaration.
example:
com1 com1 segment byte 'DATA' segment common 'DATA' com1 segment common 'DATA'
parameter, output file control
last field SEGMENT directive controls where linker places code given class. When introducing class, this field specified, code this class will sent normal, default.COD file linker. [cod] file given number between then code generated under class being introduced will sent different '.COD' file linker. linker produces file called 'prog.cod', example, then code produced under classes with [cod] field will into that file, normal.
UM0144
25/92
Assembler
Assembler Linker
class introduced with [cod] field though, then code produced under that class sent instead file prog_1.cod. code produced under other classes sent usual prog.cod. Using this scheme, bank switching schemes quickly directly, even when multiple EPROMs share same addressing space. Simply allocate each EPROM class own, introduce each class with different [cod] field. This will result linker collating EPROM's contents into different .COD file OBSEND independently. example:
segment byte at:8000-BFFF 'eprom1' segment byte at:8000-BFFF 'eprom2'
3.4.2
Copying code
sometimes happens that need copy block code from EPROM RAM. This presents some difficulties because labels that piece code must have addresses, otherwise absolute address references code will point back EPROM copy. this case, helps specify class execution, different class storage, following example:
segment byte 'code' segment byte 8000 'ram' segment 'ram>code' label1:
code starting from 'label1' will stored 'code' class usual, labels that special segment will given addresses 'ram' class, memory will also reserved class contents special segment.
Macros
Macros assembly-time subroutines. When call execution-time subroutine have through several time-consuming steps: loading registers with arguments subroutine, having saved emptied contents registers necessary, pushing registers used subroutine (with attendant stack activity) returning from subroutine (more stack activity) then popping preserved registers continuing. Although macros don't these problems, they long toward making your program execute faster than using subroutines-at cost. cost program size. Each time invoke macro particular job, whole macro assembly code inserted into your source code. This means there stacking return addresses-your program just runs straight into code; it's obviously feasible this subroutines above certain size.
26/92
UM0144
Assembler Linker
Assembler
true macros small snippets code that repeatedly- perhaps with different arguments-which formalized into 'template' macros' definition.
3.5.1
Defining macros
Macros defined using three directives: MACRO, MEND LOCAL. format
<macro-name>MACRO [parameter-1][, parameter-2 [LOCAL] <label-name>[, label-name <body-of-macro> MEND
example:
add16 MACRO first,second,result A,first A,second result,A MEND
piece code example might called
add16 index,offset,index
which would following statements source code that point:
A,index A,offset index.X,A
Note that formal parameters given definition have been replaced actual parameters given calling line. These parameters expressions strings well label names constants. Because they complex expressions, they bracketed when there extra numeric activity; this make sure they come with precedence correctly parsed. Macros need have parameters. leave MACRO argument field blank (and, this case, give parameters calling line). There further problem: because macro called several times same module, labels defined macro will duplicated. LOCAL directive gets around this problem:
UM0144
27/92
Assembler
Assembler Linker
example:
getio MACRO LOCAL loop loop A,$C000 loop MEND
This macro creates code loop await port $C000 low. Without LOCAL directive, label 'loop' would defined many times macro called, producing syntax errors assembly time. Because it's been declared LOCAL start MACRO definition, assembler takes care Wherever sees label 'loop' inside macro, changes name 'loop' 'LOCXXXX' where XXXX number from 0000 FFFF. Each time local label used, XXXX incremented. first time getio macro called, 'loop' actually defined 'LOC0', second time 'LOC1' each these being unique reference name. reference 'loop' 'if' statement also detected changed appropriate local variable. directives Table very useful, conjunction with macros: Table Some useful directives
Usage implement macro optional parameters. test parameter defined. test parameter label. compare parameter given string.
Directive #IFB #IFDEF #IFLAB #IFIDN
3.5.2
Parameter substitution
assembler looks macro parameters after every space character. want embed parameter, example, middle label, must precede parameter name with ampersand character, make parameter visible preprocessor. example, have parameter called 'param'.,
dc.w param
works expected, ampersand necessary
label&param:nop label&param&_&param:nop
Otherwise 'labelparam' would left valid label name; macro parameter 'param' value '5', then 'label5' 'label5_5' would created.
28/92
UM0144
Assembler Linker
Assembler
Conditional assembly
Conditional assembly used choose ignore select whole areas assembler code. This useful generating different versions program setting particular variable INCLUDE file that forces certain pieces code instead others.
3.6.1
#IF, #ELSE #ENDIF directives
There three main directives used perform conditional assembly, shown Table Table Summary assembly directives
Usage marks start conditional decides whether following zone will assembled not. optionally reserves condition previous following zone. marks previous #IF's.
Directive #ELSE #ENDIF
condition given with '#IF' take form numeric expression. rule deciding whether resolves 'true' 'false' simple: zero value then it's false, else it's true. These directives should start column line, reserved labels. example:
{count %OUT 'true' #ELSE %OUT 'false' #ENDIF
This sequence would print 'true' label 'count' equal `false' didn't. example:
{count
%OUT count more than {count
%OUT .and more #ELSE %OUT .but more than two! #ENDIF #ELSE %OUT count more than #ENDIF
UM0144
29/92
Assembler
Assembler Linker
see, conditionals nested-the #ELSE #ENDIF directive assumed apply most recent unterminated #IF. Other special directives available shown Table Table Special directives
Usage require conditional argument. appropriate pass being assembled, condition considered 'true'; instance #IF1 will considered true while assembler first pass, #IF2 while second pass. checks label definition. checks empty argument (i.e., empty, containing spaces tabs), useful testing macro parameter existence. False) similar #IF, checks negation condition argument. tests string equality between arguments separated space. This useful testing macro parameters against fixed strings. checks argument predefined label.
Directive #IF1 #IF2
#IFDEF #IFB #IFF #IFIDN #IFLAB
3.7.1
Running assembler
Command line
assembler needs following arguments:
<file assemble>, <listing file>, <switches>
arguments left command line, you'll prompted remaining arguments. example:
STMicroelectronics Assembler rel. 4.44 File Assemble: game
example above, parameters were given command line, parameters were prompted for. <file assemble> parameter assumes default suffix ".ASM". example, type 'game' then 'game.asm' actual filename used. listing file file which assembly report sent selected. default filename (which displayed square brackets), made from path base-name file assemble. default filename suffix assembly report file ".LST". instance, type 'game', then 'game.lst' actual filename used. Note that unless assembler told create either pass-1 pass-2 complete listing options argument, listing file will created.
30/92
UM0144
Assembler Linker
Assembler
3.7.2
About options
Options always preceded with minus sign '-'. Upper lower cases accepted define options. Supported options listed Table Table Command line options
Option -SYM -LI=<listfile> -OBJ=<path> -FI=<mapfile> enable symbol table listing enable pass-2 listing enable listing specify name .LST file specify .OBJ file specify 'final' listing mode #define specify paths included loaded files output make rule enable pass-1 listing disable phase errors Function
option
Description: Format: Example: This option allows generation symbol table. <file> -sym prog -sym output file prog.sym
option
Description: Request generate complete listing file. option -li=<pathname> specify pathname generated .LST file. <file> <file> -li=<pathname> prog output file prog.lst current directory prog -li=obj\prog output file obj\prog.lst
Format:
Example:
UM0144
31/92
Assembler
Assembler Linker
option
Description: Format: Example: specify pathname generated .OBJ file, using following option: <file> -obj=<pathname> prog -obj=obj\prog Forces assembler generate object file obj\prog.obj.
option
Description: side effect using linker that modules assembled separately, leaving inter modules' cross-references fixed linker. result assembler listing file unresolved references displays warning character. '-fi' option enables perform absolute patch desired listing. Therefore, must have produced listing file (.LST) linked your application compute relocations produce .COD file file. When want full listing generated, must have made edits since last link (otherwise named map-file would 'out date' module being assembled). This usually problem since full listings only needed after code been completed. automatically selects complete listing. <file> -fi=<file>.map output <file>.lst contains absolute patches.
Format:
Note:
When assembling '-fi' mode, assembler uses file produced linker, object files generated.
Example: ex1+ex2,ex (produces ex1.lst) (produces ex2.lst) (produces ex.map, ex.cod) (see Chapter Linker page (produces ex1.lst) (produces ex2.lst)
-fi=ex.map -fi=ex.map
Note:
When using option -fi=<file>.map, assembler step fail under certain circumstances: there empty segments (Error 73). avoid this, comment empty segments. assemble file that been used produce .map file (Error 73). Some EXTERN labels never used (Warning 80). avoid this, comment unused EXTERN labels out.
32/92
UM0144
Assembler Linker
Assembler
option
Description:
option allows specify string that replaced another during assembly.
blank space required between string replaced replacement string. example <string> same <string>=2. possible specify only argument <string>). which case, <string> replaced with This extremely useful changing assembly module using directives, because change value tests from assembler's command line. means that assembler with different switches same source file, produce different codes. Format: <file> <string> <string> <file> <string>=<string> <file> <string> EPROM EPROM=2 RAM=3 both cases string EPROM replaced with string replaced with EPROM this case EPROM replaced with
Example:
Note:
specify multiple switches, they should always separated space.
option
Description: option used specify list search paths files that included (with #include) loaded (with #load). different paths separated character path list must enclosed within double quotes. also enter multiple include paths using theI option more than once separating each with blank space. current working directory always searched first. After that, assembler searches directories same order they were specified (from left right) command line. -I="<path1>;<path2>;.;<pathN>" call -I="<path1>" -I="<path2>". -I="<pathN>" call -I="include;include2" call -I="include" -I="include2" call
Format:
Example:
UM0144
33/92
Assembler
Assembler Linker
option
Description: option tells assembler output rule suitable make, describing dependencies make object file. given source file, assembler outputs make rule whose target object file name that source file whose dependencies included (#include) source files loaded (#load) binary files uses. rule printed standard output. <source file name> -I="include;include2" call output appears screen rule: call.obj: call.asm include\map.inc include2\map2.inc include\map3.inc include\code.bin
Format: Example:
option
Description: Format: Request generate pass-1 listing. this listing internal forward references known. They marked undefined with listing file. <file>
Example:
file1 output file file1.lst
option
Description: Format: Example: This option disables error generation. <file> file1
34/92
UM0144
Assembler Linker
Linker
Linker
What linker does
After having separately assembled component modules your program, next step link them together into .COD file which then sent final destination using OBSEND. This linking process just simple concatenation object modules. resolves external references. referenced label defined PUBLIC, error detected. also checks type relocation places segment according your mapping, checks them overrun.
Invoking linker Command line
linker needs following arguments: <.OBJ file>[+<.OBJ file>.], [<.COD file>],[<lib>][+<lib>.] arguments left command line, you'll prompted. example: STMicroelectronics Linker .OBJ files: begin .COD file [begin.cod]: begin Libraries:
3.00
.OBJ files simply list object files that form your program. .OBJ suffix left out, more than specified they should separated characters, example game+scores+keys would tell linker link 'game.obj', 'scores.obj' 'key.obj'. Object file path names should include characters. Character should avoided, except suffixes. .COD file default name formed first object file's name with forced suffix '.COD'. This will name file produced link session. contains information from link session special format: however, OBSEND must used .COD file before ready use. default filename what want, filename given prompt used instead. suffix will forced .COD left blank. default selected leaving this argument blank command line, pressing <ENTER> prompt. 'Libraries' prompt asks list library files generated utility that should searched case finding unresolved external references. format giving multiple libraries same .OBJ list, except suffix .LIB assumed. Some examples:
Linking together modules game.obj, scores.obj, key.obj, game1.obj, game2.obj game3.obj without using libraries generating .COD file named game.cod, requires following command line:
UM0144
35/92
Linker
Assembler Linker
Linking same modules same environment, generating .cod file named prog.cod requires:
4.3.1
Response files
Response files text files that replace command line generate arguments required. Although they used assembler linker, only really makes sense them linker. command line given with name program execute (here LYN) only take characters argument. most programs this fine, linker allows to128 modules linked run; their names have declared linker first argument. This where response files come in-they allow redirect command line parser file instead expecting arguments come from command line keyboard. response file invoked giving sign filename response first argument want come from response file. filename assumed have suffix '.RSP' none supplied. Repeating example used earlier, this time with response file called game.rsp: @game.rsp that needs typed, file game.rsp must contain: game+scores+keys+ game1+ game2+game3 prog Which echoes what would have been typed keyboard. response file ends prematurely, remaining arguments prompted keyboard. very large session, .OBJ files argument won't line: continued next ending last .OBJ file first line with '+'. Note that when using response files, there must least carriage returns file.
4.4.1
Linking detail
PUBLICs EXTERNs
labels declared external modules being linked together must have corresponding PUBLIC definition another module. doesn't, error. Similarly, there must only PUBLIC definition given label. bulk linker's filling those relative external blanks left assembler .OBJ files; lesser extent, also handles special functions such DATE SKIP directives. Equally important, collate together allocate addresses segments.
36/92
UM0144
Assembler Linker
Linker
4.4.2
Segments linker
typical system look like diagram alongside: good candidate four different segments, perhaps named 'RAM0', 'RAM1', 'EPROM' 'ROM'. reset interrupt vectors live map, perhaps from FFEE-FFFF then might mark fifth segment called 'vectors' those addresses truncate 'ROM' FFED; that linker will warn 'ROM' much code that overflows into where vectors live. These classes would introduced follows: segment byte 0-FF'RAM0' segment byte 100-027F'RAM1' segment byte 8000-BFFF'EPROM' segment byte C000-FFDF'ROM' segment byte FFE0-FFFF'VECTORS' After their full introduction that needs only done once whole program, rest program refer classes just giving class names quotes, example: segment 'RAM0' xtemp time ds.w ds.b segment 'ROM' A,#1 A,#10 this example followed immediately after class instruction 'xtemp' label would given value time would given C000. however, code several modules away from introduction with segments classes 'RAM0' 'ROM', then value allocated labels will depend much space used those modules. linker takes care this allocation. This linker handles problems relocatability; keep mind that this link system going have handle compiled code from high level languages you'll perhaps begin understand things have generalized much. segments we've looked have <name> field, more accurately, they null name field. ensure that related segments same class, perhaps scattered over your modules with segments same class collated together contiguous area class memory giving them same name. temp storage register timer count index
UM0144
37/92
Linker example: grafix cursor_buf segment byte 100-027F 'RAM1' ds.b
Assembler Linker
buffer under cursor
segment byte 8000-BFFF 'ROM' show_page segment 'RAM1' field-buf ds.b {{256 mult 256}/8} segment 'ROM' dump_buf grafix A,field_buffer segment 'RAM1'
cursor_temp ds.b This complex sequence segments shows instances class 'RAM1' being used with segment name 'grafix'. Because first instance class 'RAM1' name 'grafix' 'grafix' RAM1 segments placed memory first followed null-name RAM1 segment (which defines 'field_buf'). Note this order segments code-segments with same name collated together (even from separate .OBJ files), lumps segments same name into memory order that names found .OBJ files. explained Section page your file suffix when introducing class, code that code sent into cod-file named file_x.cod, where file name first file, cod-file suffix (1-9).
4.4.3
Symbol files
successful link, more .OBJ files will have been combined into single .COD file. .MAP file will have been produced, containing textual information about segments, classes external labels used .OBJ module(s). Finally compact .SYM file generated, containing PUBLIC symbols found link with their final values. linker supports special feature-you link .SYM files from other link sessions. This means that with programs, cannot only partition your code assembler level, divide code into 'lumps' which linked loaded separately, have access each other's label EXTERNs. 'link symbol table simply giving name with suffix .SYM. Always give symbol tables start object file list. File Example: prog1.sym+prog2,vectors,irq; Once this done, PUBLIC symbols from prog1.sym available PUBLICs prog2.obj, vectors.obj irq.obj. Because changes link will automatically update references changed link code other links, it's necessary when using this technique 'fix' each link area memory, have 'jump table' each area. This means that 'function' addresses permanently fixed jump table offset, changes each link will result automatic redirection jump targets start
38/92
UM0144
Assembler Linker
Linker
each routine. another way, each link must have entry fixed points routine, otherwise re-linking 'lump' program could make references addresses other modules date.
4.5.1
linker more detail
composition .OBJ files
.OBJ files produced assembler contain enormous amount overhead, mostly coded expressions describing exactly what needs into 'blank spaces' assembler been liberal with. linker contains full arithmetic parser 'working out' complex expressions that include external labels: This means (unlike most other assemblers) there restrictions where external labels appear. assembler also includes line-number information with .OBJ file, connecting each piece generated object code with line number from given source file. files also contain 'special' markers handling SKIP DATE type directive.
4.5.2
composition .COD files
.COD files, other hand, contain very little overhead; there bytes segment that describe start address length that segment. Besides that, rest code final form. segment zero length marks file. only remains OBSEND take code segment segment send destination.
4.5.3
Reading mapfile listing
linker also generates files with suffix .SYM .MAP addition .COD file have already discussed. .SYM file contains compact symbol table list suitable with debuggers simulators. .MAP file listing shows three important things: table segments with their absolute address, table classes program, list external labels with their true values, modules they were defined size. Here example MAPFILE, where class, ROM, gone past limit, overwriting more correctly, having part itself overwritten VECTORS. [void] some segments segment list says that these segments were used create object code, were used non-coding-creating tasks such allocating label values with ds.b etc. number straight brackets segment true address list shows many segments 'into' module this segment i.e., 1st, etc. given module. first shows range addresses. (line) field external labels list shows source code file line number that label defined number start each class list line cod-file that class contents were sent (default
UM0144
39/92
Linker Segment Address List: prog prog main prog main monitor monitor Class List: `RAM0' `RAM1' `eprom' `rom' byte from (lim 10888282568844886 1456 01008000C000C509F579FFEE6 875B C508 F578 FFF9 FFFF
Assembler Linker
`RAM0' [void] 'RAM1' [void] 'eprom' 'rom' 'rom' 'rom' 'vectors'
byte from (lim 27F) byte from 8000 875B (lim BFFF) byte from C000 FFF9 (lim FFDF) C*Overrun*
`vectors' byte from FFEE FFFF (lim FFFF) 100%
External Label List: Symbol Name Value Size Def(line)
char char1 label
ABCD
BYTE BYTE WORD
game.obj(10) game.obj(11) game.obj(25)
labels
external label list only includes labels that were declared PUBLIC: labels used internally module included. This table most useful debugging purposes, since values labels likely relocated between assemblies. labels given first-character-alphabetic order.
40/92
UM0144
Assembler Linker
OBSEND
OBSEND
What OBSEND does
After your program been assembled linked form '.COD' file needs sent place where will executed. Right now, your code just stored file disk where target system can't OBSEND general purpose utility .COD files various ways using various formats.
Invoking OBSEND
OBSEND follows same standard formats rest assembler linker; arguments given from command line, keyboard response file. general syntax
OBSEND
where <file> name .COD file formatted (default extension .COD). filename given command line, you're prompted keyboard with:
OBSEND STMicroelectronics Obsend rel. .2.00 File Send: test Destination Type (<f>ile,<v>ideo): Final Object code Filename [test.fin]: test.s19 Object Format <ENTER>=Straight Binary, <2>, <4>:
5.2.1
Destination type
<destination> (file) (video). Only single character required.
5.2.2
Destination arguments
When destination type (file) argument <filename> tells OBSEND where send code. default suffix '.FIN' assumed none given. example:
OBSEND test,f,image.s19,s
command generates file 'image.s19' containing code from 'test.cod', Srecord format. When destination code (video), this field void.
UM0144
41/92
OBSEND
Assembler Linker
5.2.3
Format definitions
<format> specifies output format. Output format options listed Table Table Output formats
Output Format
straight binary, i.e., image Intel Intel with 32-byte data line Intel extended Motorola S-record byte address, e.g. ST7) Motorola S-record extended with symbol file S-record bytes address, e.g. D950) S-record bytes address, e.g. ST18932 program space) 'Filled' straight binary format Industrial binary format
<format>
<none>
5.2.4
Straight binary format
<format>= <none>
This simplest formats. It's nothing bit-for-bit copy original file. This usual mode sending EPROM Emulators, etc., default format argument given.
Note: When destination screen (the destination code "v"), don't this format; otherwise will only weird control codes.
<format>=
This `filled' straight binary format where gaps between adjacent segments filled with $FF.
5.2.5
Intel format
<format>=
This format very much more complex. Intel bears similarities S-record that we'll looking later. Let's look line Intel format detail:
number data bytes decimal)
1900 address record type data bytes checksum
42/92
UM0144
Assembler Linker
OBSEND
first thing note that every thing printable ASCII. Eight numbers converted into two-characters hexadecimal representation. Each line begins with ASCII ($3A) character. next characters form byte that declares many data bytes follow data byte section little further along. next four characters form 16-bit high-byte first number that specifies address first byte this data; rest follows sequentially. next characters record type this line: data line, signals EOF. following characters until last data bytes this line and, last checksum line, calculated starting with subtracting real value characters sent after until checksum itself. 'Real value' means that example, characters should subtract from checksum, Every line ends with CR-LF combination, $0D. last line sent must END-OF-FILE line, which denoted line with data bytes record type instead Giving instead intel argument uses same format, sends bytes data line.
5.2.6
Motorola S-record format
<format>=
This another complex method sending data. Again cuts data into 16-byte 'records' with overhead either sides. S-record come four types: known header record, data records with 24-bit address fields, S9and records with 24bit address fields.
Note: convention close 16-bit data record with 16-bit record, close 24-bit data record with 24-bit record.
S10D0010E0006285E000628562856D record type number bytes left, address, data checksum decimal)
0010 address data bytes checksum
first characters define record type: next characters form hexadecimal representation numbers bytes left record (i.e., numbers characters This count must include checksum addresses bytes that follow. address field four characters wide characters wide most significant character always comes first. OBSEND will always type records wherever possible (i.e., when address less than $10000) type data records where (i.e., address $FFFF). data bytes then follow, with checksum appended end. checksum calculated starting with subtracting 'real value' bytes sent from
UM0144
43/92
OBSEND
Assembler Linker
including byte count field until checksum itself. this context, 'real value' means value byte before expanded into ASCII characters. record concluded CR-LF combination $0A, $0D. (i.e., header EOF) records always same:
S00600004844521B
and:
S804000000FB S9030000FC
complete example S-record transmission look like:
S00600004844521B S20801C004FFC0000073 <format>=
extended S-record format, selected format sends code described above, except that after sends list records, after other, format:
0000 LABEL
where 0000 four ASCII zeroes, LABEL five ASCII characters. There spaces after space after 0000. 0000 represents hexadecimal value label. LABEL extend characters, with carriage return.
5.2.7
S-record formats
<format>= <format>=
These industrial formats defined specific needs. This format allows specify 2-byte words address. This format allows specify 4-byte words address.
5.2.8
binary
<format>=
This format simple. 16-byte count beginning low-byte first, calculated starting adding value each byte until data reached. there 'gaps' your code, obsend will fill them with $FF, adjust checksum accordingly. After that four bytes header information, data follows block.
44/92
UM0144
Assembler Linker
Librarian
Librarian
Overview
work similar boards especially those with same processor, makes great deal sense reuse lumps code you've already written same task different program. simplest level, could just copy source code block text into program. This works fine, subtle disadvantage: update subroutine, have hunt around usages performing update each. around this problem, many people have source common routines place, link .OBJ module with each program needing routine. Then only need update source code once, reassemble .OBJ file, then link again users routine, will have .OBJ file. While this scheme works well, generates some problems own. example, each routine needs .OBJ file. nature, these common routines tend small, giving dozens extra .OBJ modules linker, having .OBJ modules scattered around your hard disk. base concept librarian combine these small, useful .OBJ modules into large .LIB library file. could then tell linker about library, would take care sorting which .OBJ modules pull into link. would know which ones pull fact that main code being linked would have undefined externals, example, call missing library routines. librarian simply takes each undefined external turn, checks against modules library. modules declares PUBLIC same name, knows need that .OBJ module includes automatically.
Invoking librarian
librarian called LIB, takes command line argument that name library operate given, you'll prompted [library name] .LIB added suffix left off. library indicate doesn't exist, asks it's library. example: LIB1 STMicroelectronics Librarian 1.00 Couldn't open Library file 'LIB1.LIB' file? (y/n): answer 'n', aborts. library exists, prints report library. Library LIB1.LIB long. 16/1024 Public labels used 2/128 modules. Next you're faced with main prompt: LIB1.LIB: Operation (<ENTER> help):
UM0144
45/92
Librarian Pressing ENTER gives access options shown Table
Assembler Linker
Table
Library file options
Description add/update object module to/in library delete object module from library update object module library
Operation
+filename -filename !filename *filename
copy object module separate file from library list contents library Exit
Adding modules library
Typing example: +user1\board
would look file, called user1\board.obj, library. can't find named file, reports fact returns operations prompt. Else issues following message: Adding board.obj labels added Done. library already contained file board.obj, would prompt with: board.obj already library LIB1.LIB, replace with board.obj (Y/N): Responding with returns operations prompt, while first removes board.obj then continues above.
Deleting modules from library
This done example: -board cannot find board.obj current library, reports error aborts back operation prompt. find makes sure know what doing with: board.obj deleted from library LIB1.LIB: sure (Y/N): aborts operation prompt. continues, reporting: Removing board.obj Done.
46/92
UM0144
Assembler Linker
Librarian
Copying modules from library
make copy .OBJ module located library back your hard disk, use, example: *board This will check existence board.obj current library, it'll report failure abort operation prompt. does find invites give name hard disk file create contain copy .OBJ module. Copy into .obj file [board.obj]: type <ENTER>, it'll select original name object module copy's name. Otherwise, give path spec. file give already exists, says: File board.obj already exists; overwrite? (Y/N): Again, responding aborts operations prompt, while does copy with message: Copying board.obj disk. Done.
Getting details your library
last operation: causes print details current library. Library LIB1.LIB long 16/1024 Publics labels used 2/128 modules z1.obj (z1.asm) length board.obj (board.asm) length 7FFF name brackets source module from which named object module assembled.
UM0144
47/92
Assembler Linker
Appendix Assembler Directives
Introduction
Each directive been given section itself, entry index. name directive, which will always appear second field given heading section. Next there line showing arguments allowed any) this directive. penultimate section describes action directive format nature argument specified previous section, last section gives more example directive use. There 'see also' cross reference bottom page. directives must placed second, OPCODE, field, with arguments away argument field.
.BELL
Purpose: Ring bell console.
Format:
.BELL
Description:
This directive simply rings bell console; used signal pass-1 pass-2 with #IF1 #IF2. This directive does generate assembly code data.
Example: Also:
.BELL
48/92
UM0144
Assembler Linker
BYTE
Purpose: Format: Description: Define byte object code. BYTE <exp "string">,[,<exp "string">.] This directive forces byte(s) argument list into object code current address. argument composed complex expressions, which even include external labels. argument expression value greater than then lower bits expression used errors generated. String argument(s) must surrounded double quotes: theses translated into ASCII processed byte byte. It's generally used defining data tables. Synonymous with STRING DC.B.
BYTE 1,2,3 generates 01,02,03
Example:
BYTE "HELLO" generates 48,45,4C,4C,4F BYTE "HELLO",0 generates 48,45,4C,4C,4F,0
Also:
DC.B, STRING, WORD, LONG, DC.W, DC.L
BYTES
Purpose: Format: Description: Label type definition where type byte. BYTES When label defined, separate attributes defined with scope (internally externally defined), value (actual numerical value label), relativity (absolute relative), length, (BYTE, WORD LONG). these attributes, except length, defined explicitly before definition. force label certain length giving suffix-eg. 'label.b' forces byte length. also define default state label length: labels created this length unless otherwise forced with suffix. default WORD start assembly, changed BYTES, WORDS LONGS appropriate length. Example: lab1 Also:
BYTES
byte length lab1
LONGS, WORDS
UM0144
49/92
Assembler Linker
CEQU
Purpose: Format: Description: Equate pre-existing label expression. label CEQU <exp>
This directive similar EQU, allows change label's value. Used macros counter REPEAT UNTIL.
Example:
lab1
CEQU {lab1+1} lab1
Also:
EQU, REPEAT, UNTIL
.CTRL
Purpose: Format: Description: Send control codes printer. .CTRL <ctrl>[,<ctrl>]. This directive used send printing printing control codes selected listing device. It's intended sending control codes embolden underline, etc. areas listing printer. arguments sent listing device listing currently selected. This directive does generate assembly code data.
Example:
.CTRL 27,18
Also:
.LIST, .NOLIST, .BELL
DATE
Purpose: Format: Description: Define 12-byte ASCII date into object code. DATE This directive leaves message linker place date link 12-byte block assembler leaves spare position DATE directive. This means that every link will leave date object code, allowing automatic version control. date takes form ASCII) DD_MMM_YYYY where character represents space; example JUL. 1988. date left linker fill instead assembler since source code module containing DATE directive reassembled after every editing session would possible lose track.
Example: Also:
DATE
50/92
UM0144
Assembler Linker
DC.B
Purpose: Format: Description: Define byte(s) object code. DC.B <exp "string">,[,<exp "string">] This directive forces byte(s) argument list into object code current address. argument composed complex expressions, which even include external labels. argument expression value greater than then lower bits expression used errors generated. String argument(s) must surrounded double-quotes: these translated into ASCII processed byte byte. It's generally used defining data tables. Synonymous with BYTE STRING. Example:
DC.B 1,2,3 generates 01,02,03 DC.B "HELLO" generates 48,45,4C,4C,4F DC.B "HELLO",0 generates 48,45,4C,4C,4F,00
DC.W
Purpose: Format: Description: Define word(s) object code. DC.W<exp>[, <exp>.] This directive forces word(s) argument list into object code current address. arguments composed complex expressions, which even include external labels. argument expression value greater than FFFF then lower bits expression used errors generated. DC.W sends words with most significant byte first. It's generally used defining data tables. Synonymous with WORD, except that DC.W places words High order. Example:
DC.W 1,2,3,4,$1234
;0001,0002,0003,0004,1234
Also:
DC.B, BYTE, STRING, WORD, LONG, DC.L
UM0144
51/92
Assembler Linker
A.10 DC.L
Purpose: Format: Description: Define long word(s) object code. DC.L <exp>[,<exp>.] This directive forces long word(s) argument list into object code current address. arguments composed complex expressions, which even include external labels. argument expression value greater than FFFFFFFF then bits expression used errors generated. DC.L sends words with most significant byte first. It's generally used defining data tables. Synonymous with LONG, except that DC.L stores long-words High order. Example:
DC.L 1,$12345678 LONG 1,$12345678
0000,0001,1234,5678 0100,0000,7856,3421
Also:
DC.B, DC.W, BYTE, STRING, WORD, LONG
A.11 #DEFINE
Purpose: Format: Description: Define manifest constant. #DEFINE <CONSTANT <real characters> benefits using labels assembler level programming obvious well known. Sometimes, though, values other than straight numerics allowed labels used repeatedly programs ideal candidates special labelling. #DEFINE directive allows define special labels called 'manifest constants'. These basically labels that contain strings instead numeric constants. During assembly, wherever manifest found source code, replaced real argument before assembly proceeds. #DEFINE definition label, space must precede declaration. number defines that Assembler manage limited 4096. However, this depends number characters statements. Depending their length, reach this limit sooner. Example:
#define value a,#value
a,#5
Also:
52/92
UM0144
Assembler Linker
A.12 DS.B
Purpose: Format: Description: Define byte space object code. DS.B [optional number bytes] This directive used 'space out' label definitions. example let's need byte-sized temporary storage locations defined RAM, starting address $4000. could write: segment byte 4000 'RAM' temp1 temp2 $4000 $4001
which would work fine, however, recommend write: segment byte 4000 'RAM' temp1 temp2 DS.B DS.B
which does same job. advantage that increments automatically. There other types instructions available doing WORD LONG length storage areas: DS.W DS.L. Note that areas question initialized value; it's merely allocating values labels. optional argument specifies many bytes allocate; default Because code generated fill space, allowed DS.B segments containing code, only segments with data definitions. Example:
labl
DS.B
Also:
DS.W, DS.L
UM0144
53/92
Assembler Linker
A.13 DS.W
Purpose: Format: Description: Define word space object code. DS.W [optional number words] This directive used 'space out' label definitions. example let's need word-sized temporary storage locations defined RAM, starting address $4000. could write: segment byte 4000 'RAM' temp1 temp2 $4000 $4002
which would work fine, however, recommend write: segment byte 4000 'RAM' temp1 temp2 DS.W DS.W
which does same job. advantage that increments automatically. There other types instructions available doing BYTE LONG length storage areas: DS.B DS.L. Note that areas question initialized value; it's merely allocating values labels. optional argument specifies many bytes allocate; default Because code generated fill space, allowed DS.W segments containing code, only segments with data definitions. Example:
labl
DS.W
Also:
DS.B, DS.L
54/92
UM0144
Assembler Linker
A.14 DS.L
Purpose: Format: Description: Define long space object code. DS.L [optional number long words] This directive used 'space out' label definitions. example let's need long-word-sized temporary storage locations defined RAM, starting address $4000. could write: segment byte 4000 'RAM' temp1 temp2 $4000 $4004
which would work fine, however, recommend write: segment byte 4000 'RAM' temp1 temp2 DS.L DS.L
which does same job. advantage that increments automatically. There other types instructions available doing BYTE WORD length storage areas: DS.B DS.W. Note that areas question initialized value; it's merely allocating values labels. optional argument specifies many bytes allocate; default Because code generated fill space, allowed DS.L segments containing code, only segments with data definitions. Example:
labl
DS.L
Also:
DS.B, DS.W
A.15
Purpose: Format: Description: source code. This directive marks assembly main source code file. directive supplied source-code file then illegal error will generated assembler. Include files require directive.
Example:
Also:
UM0144
55/92
Assembler Linker
A.16
Purpose: Format: Description: Equate label expression. label <EXPRESSIONS> Most labels created program attached source code line that generates object code, used target jumps memory references. rest labels used 'constants', used example, hold port number system keyboard: number that will remain constant throughout program. directive allocates value, segment type length label field. value derived from result expression, relativity (absolute segment-relative derived from most recent segment), length BYTE, WORD LONG, derived from size default (starts WORD changed directives BYTES, WORDS LONGS). Example: labl
Also:
A.17 EXTERN
Purpose: Format: Description: Declare external labels. EXTERN When your program consists several modules, some modules need refer labels that defined other modules. Since modules assembled separately, until link stage that necessary label values going known. Whenever label appears EXTERN directive, note made linker resolve reference. Declaring label external telling assembler expect label defined this module, although will used. Obviously, external labels must defined other modules link stage, that gaps left assembler filled with right values. Because labels declared external actually defined, assembler knowing length, i.e., (byte, word long) label. Therefore, suffix must used each label EXTERN directive declaring type; type undefined, current default label scope (set BYTES, WORDS, LONGS directives) assumed. Example: EXTERN label.w, label1.b, label2.l Also: PUBLIC
56/92
UM0144
Assembler Linker
A.18 #ELSE
Purpose: Format: Description: Conditional ELSE. #ELSE Forces execution statements until next #ENDIF last statement found false disables execution statements until next #ENDIF last statement found true. #ELSE optional #ENDIF structures. case nested #ELSE statements, #ELSE refers last #IF. Example: #ELSE block assembled #ENDIF Also: #IF, #ENDIF block assembled
A.19 #ENDIF
Purpose: Format: Description: Conditional terminator. #ENDIF This optional terminator structure. there only level nesting force, then statements after this directive will never ignored, matter what result previous was. other words, #ENDIF ends capability previous suppress assembly. When used nested situation does same job, last #ENDIF structure block source suppressed previous still force, whole last #ENDIF structure will ignored matter what result previous was. {count #ENDIF
Example:
Also:
#IF, #ELSE
UM0144
57/92
Assembler Linker
A.20
Purpose: Format: Description: Form constant string. <"string"> |<bytes> [<"string"> |<bytes>]. This directive works same common STRING directive, except that last character string argument (e.g. MSB) forced high. Numeric arguments same list left untouched. "ALLO" STRING "ALLO" STRING 41,4C,4C,CF 41,4C,4C,4F
Example:
Also:
A.21 .FORM
Purpose: Format: Description: form length listing device. .FORM <exp> assembler paginates listing (when selected) with default lines page. This directive changes page length from default. This directive does generate assembly code data. .FORM
Example:
Also:
TITLE, SUBTTL, %OUT, .LALL, .XALL, .SALL, .LIST,.NOLIST
A.22 GROUP
Purpose: Format: Description: Name area source code. GROUP <exp> source code following GROUP directive until next GROUP directive file 'belongs' named group. Source code included inside group allocated special group called 'Default'. GROUP mainloop
Example:
Also:
58/92
UM0144
Assembler Linker
A.23
Purpose: Format: Description: Start conditional assembly. <exp> Sometimes necessary have different versions program macro. This achieved completely SEPARATE programs macros, this solution associated problem that changes part program common versions requires them being changed, which tedious. Conditional assembly offers solution controlled 'switching off' assembly source code, depending value numeric expressions. structure known 'IF/ELSE/ENDIF': example format. #ELSE statement optional. expression resolves expression assumed have 'false' result: source code between false next #ENDIF #ELSE supplied) will assembled. #ELSE supplied, code following #ELSE will assembled only condition false. Conditionals nested levels: when nesting them, keep mind that each must have #ENDIF level, that #ENDIFs #ELSEs refer last unterminated #IF. Example: %out true #FALSE %out false #ENDIF Also: #ENDIF, #ELSE, #IF1, #IF2
A.24 #IF1 Conditional
Purpose: Format: Description: Conditional being pass #IF1 This directive works just like except argument only evaluates itself true assembler first pass through source code. #ELSE requires #ENDIF. #IF1 %OUT "Starting Assembly" #ENDIF
Example:
Also:
#IF2, #ELSE, #IF, #ENDIF
UM0144
59/92
Assembler Linker
A.25 #IF2
Purpose: Format: Description: Example: #IF2 %OUT "GONE through PASS-1 #ENDIF Conditional being pass #IF2 This directive works just like except argument evaluates itself true only assembler second pass through source code.
Also:
#IF1, #IF, #ENDIF, #ELSE
A.26 #IFB
Purpose: Format: Description: Example: check MACRO param1 #IFB param1 %OUT param1" #ELSE %OUT param1 #ENDIF MEND check check Conditional argument being blank. #IFB <arg> This directive works just like except doesn't evaluate argument: simply checks empty blank. Spaces count blank.
Also:
#IF2, #ELSE, #IF, #END
60/92
UM0144
Assembler Linker
A.27 #IFIDN
Purpose: Format: Description: Example: check MACRO param1 #IFIDN param1 HELLO %OUT "Hello" #ELSE %OUT Hello" #ENDIF MEND Conditional arguments being identical. #IFIDN <arg-1> <arg-2> This directive works just like except compares strings separated space. identical, result true.
Also:
#IF2, #ELSE, #IF, #END
A.28 #IFDEF
Purpose: Format: Description: Example: check MACRO param1 #IFDEF param1 %OUT "Arg #ELSE %OUT "Arg undefined" #ENDIF MEND Conditional argument being defined. #IFDEF <exp> This directive works just like except tests argument being defined.
Also:
#IF2, #ELSE, #IF, #END
UM0144
61/92
Assembler Linker
A.29 #IFLAB
Purpose: Format: Description: Example: check MACRO param1 #IFLAB param1 %OUT "LABEL" #ENDIF MEND Conditional argument being label. #IFLAB <arg> This directive works just like except tests that argument valid, predefined label.
Also:
#IF2, #ELSE, #IF, #END
A.30 #INCLUDE
Purpose: Format: Description: Insert external source code file. #INCLUDE "<filename>" INCLUDE files source code files same format normal modules with important differences: first line usually reserved processor name like other source line, they have directive. They used contain #DEFINE macro definitions that used many different modules your program. Instead having each module declare #DEFINE macro definitions, each module just includes contents same #INCLUDE file. assembler goes named INCLUDE file assembles this file before returning line after #INCLUDE directive former source code file. benefit that alterations made macro must done once, include file; you'll still have reassemble modules referring changed entry. NOTE that filename must inside double-quotes. Example: st7/ #include "defst7.h" Also:
62/92
UM0144
Assembler Linker
A.31 INTEL
Purpose: Format: Description: Force Intel-style radix specifier. INTEL Intel style: 0ABh 100b Hexadecimal Octal Binary Decimal (default) Current program counter
This directive forces Intel format required during assembly. Example: INTEL X,0FFFFh MOTOROLA, TEXAS, ZILOG
Also:
A.32 INTERRUPT
Purpose: Format: Description: Example: Specifies debugger that routine interrupt rather than function. INTERRUPT <string> This directive used with interrupt handlers aids debugger correctly searching stack return address interrupted function. PUBLIC trap_handler INTERRUPT trap_handler trap_handler IRET Also: NEAR
A.33 .LALL
Purpose: Format: Description: List whole body macro calls. .LALL This directive forces complete listing macro expansion each time macro invoked. This default. This directive does generate assembly code data.
Example:
.LALL
Also:
.XALL, .SALL
UM0144
63/92
Assembler Linker
A.34 .LIST
Purpose: Format: Description: Enable listing (default). .LIST This directive switches listing previous .NOLIST disabled -'pa' -'li' options must also have been from command line generate listing. This directive, conjunction with directive .NOLIST, used control listing macro definitions. This directive does generate assembly code data. .LIST
Example:
Also:
.NOLIST
A.35 #LOAD
Purpose: Format: Description:
Load named object file link time.
#LOAD "pathname\filename[.ext]" This directive leaves message linker load contents named file current position current segment. file should 'straight binary' format, i.e., direct image bytes want object code. should Motorola (.s19) Intel (.hex) format.
Example:
segment byte 8000-C000 'EPROM1' #LOAD "table.bin"
Also:
64/92
UM0144
Assembler Linker
A.36 LOCAL
Purpose: Format: Description: Define labels local macro. LOCAL <arg> macro that generates loop code gives rise assembly problem since loop label would defined many times macro called. LOCAL directive enables overcome this difficulty. Consider following piece code: waiter MACRO loop A,ads jrne loop MEND this macro called twice, will creating labels called 'loop'. answer declare very early MACRO labels created macro LOCAL. This effect replacing actual name local label (here 'loop') with LOCXXXX where XXXX starts from increments each time local label used. This provides each occurrence labels created inside macro with unique identity. Example:
waiter MACRO LOCAL loop loop Aids drone loop MEND MACRO, MEND
Also:
A.37 LONG
Purpose: Format: Description: Define long word object code. LONG <exp>[,<exp>.] This directive forces long word(s) argument list into object code current address. arguments composed complex expressions, which even include external labels. argument expression value greater than FFFFFFFF then bits expression used errors generated. LONG sends long words with least significant byte first. It's generally used defining data tables. Synonymous with DC.L, except that LONG sends low-byte first. Example: DC.L 1,$12345678 LONG 1,$12345678 0000,0001,1234,5678 0100,0000,7856,3421
Also:
DC.B, DC.L, DC.W, BYTE, STRING, WORD
UM0144
65/92
Assembler Linker
A.38 LONGS
Purpose: Format: Description: Default label length long. LONGS When label defined, four SEPARATE attributes defined with scope (internally externally defined), value (actual numerical value label), relativity (absolute relative), lastly, length (BYTE, WORD LONG). these attributes except length defined explicitly before definition: force label certain length giving suffix, e.g. 'label.b' forces byte length. also define default state label length: labels created this length unless otherwise forced with suffix. default WORD start assembly, changed BYTES, WORDS LONGS appropriate length. Example: lab1 Also: LONGS
long length lab1
BYTES, WORDS
A.39 MACRO
Purpose: Format: Description: Define macro template. <macro> MACRO [param-1][,param-2]. This directive defines macro template that invoked later program. label field holds name macro: this name used invoke rest macro whenever found opcode field. arguments dummy names parameters that will passed macro when used: these dummy names will replaced actual calling line's arguments. Note: don't want definition macro listed, insert directive .NOLIST before macro definition, append directive .LIST after macro definition. Example:
cmp16
trylow
MACRO first,second,result LOCAL trylow A,first A,second A,#0 jreq trylow result,A MEND
Also:
MEND, .LALL, .SALL, .XAL
66/92
UM0144
Assembler Linker
A.40 MEND
Purpose: Format: Description: Example: macro definition. MEND macro definition.
cmp16
trylow
MACRO first,second,result LOCAL trylow A,first A,second A,#0 jreq trylow result,A MEND
Also:
MACRO
A.41 MOTOROLA
Purpose: Format: Description: Force Motorola-style radix specifier. MOTOROLA Motorola style: %100 Hexadecimal Octal Binary Decimal (default) Current program counter
This directive forces Motorola format required during assembly. default format MOTOROLA. Example:
MOTOROLA X,$FFFF INTEL, TEXAS, ZILOG
Also:
UM0144
67/92
Assembler Linker
A.42 NEAR
Purpose: Format: Description: Specifies debuggers that return address stack functions using this directive written over bytes. NEAR <"string"> This directive used with functions called CALL CALLR, whose return stack address spans bytes. Every function called CALL CALLR must classified NEAR.
Example:
PUBLIC func NEAR func func INTERRUPT
Also:
A.43 .NOCHANGE
Purpose: Format: Description: List original #define strings. .NOCHANGE Strings named first argument #DEFINE directive will changed second argument #DEFINE: default that changed strings will listed. want original source code listed instead, place .NOCHANGE directive near start your source code. This directive does generate assembly code data.
Example:
.NOCHANGE
Also:
#DEFINE
A.44 .NOLIST
Purpose: Format: Description: Turn listing. .NOLIST Certain parts your modules required listing; this directive disables listing until next .LIST directive. default listing enabled. This directive, conjunction with directive .LIST, used control listing macro definitions. This directive does generate assembly code data.
Example:
.NOLIST
Also:
LIST
68/92
UM0144
Assembler Linker
A.45 %OUT
Purpose: Format: Description: Example: Output string console. %OUT string This directive prints argument (which does need enclosed quotes) console. This directive does generate assembly code data. %OUT hello!
Also:
A.46 .PAGE
Purpose: Format: Description: Example: Perform form feed. .PAGE Forces page listing. This directive does generate assembly code data. .PAGE
Also:
A.47 PUBLIC
Purpose: Format: Description: Make labels public. PUBLIC <arg> This directive marks given labels defined during assembly 'PUBLIC', i.e., accessible other modules. This directive related EXTERN; module wants label defined another, then other module must have that label declared PUBLIC. label also declared PUBLIC definition preceding label name with dot; won't need declared PUBLIC directive then. Example: module1.asm EXTERN print.w, print1.w call print print1 module2.asm PUBLIC print print .print1 EXTERN
Also:
UM0144
69/92
Assembler Linker
A.48 REPEAT
Purpose: Format: Description: Example: Assembly-time loop initiator. REPEAT Used together with UNTIL make assembly-time loops; useful making tables etc. This directive should used within macros. REPEAT
Also:
CEQU, UNTIL
A.49 .SALL
Purpose: Format: Description: Suppress body called macro. .SALL This directive forces complete suppression listing macro expansion each time macro invoked. This instruction never listed. Note:This directive produce confusing listings. Example: .SALL
Also:
.LALL, .XALL
70/92
UM0144
Assembler Linker
A.50 SEGMENT
Purpose: Format: Description: Start segment. [<name>] SEGMENT <align> <combine> '<class>' [cod] SEGMENT directive very important: every module your program will need least one. <name> field characters length, include underscores. <align> field following: byte word para page long alignment; start byte boundaries aligned next word boundaries necessary, i.e., 8001=8002 aligned next paragraph (=16 bytes) boundary, i.e., 8001=8010 aligned next 64-byte boundary, i.e., 8001=8040 aligned next 128-byte boundary, i.e., 8001=8080 aligned next page (=256 bytes) boundary, i.e., 8001=8100 aligned next long-word(=4 bytes) boundary, i.e., 8001=8004 aligned next boundaries, i.e., 8001=8400 aligned next boundaries, i.e., 8001=9000 Introduces class that starts from goes through address Address optional. Tack this code last segment this class. segment same address than other common segments that have same name, note longest length segment. optional [cod] suffix number from decides into which. file linker sends contents this class. default chosen suffix left off. suffix will cause linker open [cod] suffix, send contents this class into file instead default. This allows bank switching supported directly link level- different code areas same address separated into different .cod files.
Align Type:
Combine:
X[-Y] <none> common
Also:
more information, Section page
UM0144
71/92
Assembler Linker
A.51 .SETDP
Purpose: Format: Description: base address direct page. .SETDP <base address> have used processor, you'll aware 'zero-page' 'direct' addressing modes. These addresses range 00.FF shorter, faster instructions than more general 0000.FFFF versions. Other processors same scheme, with twist: choose 'base page' where direct mode does have range 0000 00FF from nn00.nnFF where nn00 'base page', loaded into register run-time. Because assembler cannot track what's base page register run-time, need fill about current 'base page' with .SETDP directive. start assembly, SETDP defaults 0000.
Example:
.SETDP $400 A,$401
direct mode chosen
Also:
A.52 SKIP
Purpose: Format: Description: Inserts given number bytes with initialization value. SKIP <number bytes>,<value fill> This directive leaves message linker that want number bytes inserted into object code this point. Both arguments must absolute values rather than external relative values.
Example:
SKIP 100,$FF
insert bytes
Also:
72/92
UM0144
Assembler Linker
A.53 STRING
Purpose: Format: Description: Define byte-level string. STRING <exp "string">,[,<exp "string">.] This directive forces byte(s) argument list into object code current address. arguments composed complex expressions, which even include external labels. argument expression value greater than lower bits expression used errors generated. String argument(s) must surrounded double-quotes: these translated into ASCII processed byte byte. It's generally used defining data tables. Synonymous BYTE DC.B.
Example:
STRING 1,2,3 generates 01,02,03 STRING "HELLO" generates 48,45,4C,4C,4F STRING "HELLO",0 generates 48,45,4C,4C,4F,00
Also:
DC.B, BYTE, WORD, LONG, DC.W, DC.L,
A.54 SUBTTL
Purpose: Format: Description: Define subtitle listing heading. SUBTTL "<Subtitle string>" This directive related TITLE directive: argument used subtitle beginning each page listing. recommend that individual subtitles generated each module program, while TITLE defined once include file called modules. This directive does generate assembly code data.
Example:
SUBTTL "A/D control routines"
Also:
TITLE
UM0144
73/92
Assembler Linker
A.55 .TAB
Purpose: Format: Description: listing field lengths. .TAB Sets size four source code fields listings. defaults 80-column printer; yours wider, need tell assembler using this directive. four fields width label field, opcode field, operand comment. This directive does generate assembly code data.
Example:
.tab 10,6,16,40
Also:
.LIST, .NOLIST
A.56 TEXAS
Purpose: Format: Description: Texas Instruments-style radix specifier. TEXAS Motorola style: ?100 Hexadecimal Octal Binary Decimal (default) Current program counter
This directive forces Texas Instruments format required during assembly. Example:
TEXAS X,>FFFF INTEL, MOTOROLA, ZILOG
Also:
74/92
UM0144
Assembler Linker
A.57 TITLE
Purpose: Format: Description: Define main title listing. TITLE "<Title string>" first fifty-nine characters argument (which must enclosed doublequotes) will included first line each page listing main title listing. suggest title include file called each module your program, give each module separate subtitle (see SUBTTL section). This directive does generate assembly code data.
Example:
TITLE "ST7 controller program"
Also:
SUBTTL
A.58 UNTIL
Purpose: Format: Description: Assembly time loop terminator. UNTIL <exp> Related REPEAT directive: expression argument resolves zero value then assembler returns line following last REPEAT directive. This directive cannot used inside macros.
Example:
CEQU REPEAT DC.L mult val} CEQU {val+1} UNTIL {val
Also:
CEQU, REPEAT
UM0144
75/92
Assembler Linker
A.59 WORD
Purpose: Format: Description: Define word object code. WORD <exp>[, <exp>.] This directive forces word(s) argument list into object code current address. arguments composed complex expressions that even include external labels. argument expression value greater than FFFF then lower bits expression used errors generated. WORD sends words with least significant byte first. It's generally used defining data tables. Synonymous with DC.W. Example:
WORD 1,2,3,4,$1234
;0001,0002,0003,0004,1234
Also:
DC.B, BYTE, STRING, DC.W, LONG, DC.L
A.60 WORDS
Purpose: Format: Description: Default label length word. WORDS When label defined, four SEPARATE attributes defined with scope (internal external defined) value (actual numerical value label) relativity (the label ABSOLUTE RELATIVE), lastly length (BYTE, WORD, LONG). these attributes except length defined explicitly before definition: force label certain length giving suffix, e.g. 'label.b' forces byte length. also define default state label length: label created this length unless otherwise forced with suffix. default WORD start assembly, CHANGED BYTES, WORDS LONGS appropriate length. Example: lab1 Also:
WORDS
word length lab1
BYTES, WORDS
76/92
UM0144
Assembler Linker
A.61 .XALL
Purpose: Format: Description: List only code producing macro lines. .XALL This directive forces reduced listing macro expansion each time macro invoked. Only those lines macro that generated object code listed. This instruction itself listed. This directive does generate assembly code data.
Example:
.XALL
Also:
.LALL,.SALL
A.62 ZILOG
Purpose: Format: Description: Force Zilog-style radix specifiers. ZILOG Motorola style: %(8)17 %(2)100 Hexadecimal Octal Binary Decimal (default) Current program counter
This directive forces Zilog format required during assembly. Example:
ZILOG X,%FFFF INTEL, MOTOROLA, TEXAS
Also:
UM0144
77/92
Assembler Linker
Appendix Error Messages
Format error messages
There classes errors trapped assembler: fatal recoverable. fatal error stops assembly there then, returning caller (which DOS; also invoke assembler) with message error number describing problem. actual format error messages follows: file.asm(line): as<pass> Error <errno> <message> '<text>' Example:
prog.asm(10): Error Doubly defined label 'fred'
error number
string describing error
name program that handled error line number file name file where error found
Note:
name program that handled error (third field), depending pass progress when error found. error number (fourth field) used index find more complete description error next section (fatal errors read 'FATAL nn', instead 'ERROR nn').
File CBE.ERR
Fatal recoverable errors both copied into file CBE.ERR they occur. this error file give automatic error-finding. Most linker errors also copied into CBE.ERR. LINKER errors described page
Assembler errors
Empty file
assembler couldn't read even first line given source code file.
while Macro Definition
file ended while macro being defined; should last macro definition properly with MEND statement.
Couldn't return place source file 'X.asm'
78/92
UM0144
Assembler Linker
This error should never occur; implies have disk fault some kind. After #include, assembler returns line after #include itself. cannot return that line this error produced.
Illegal Source
Main source code files must with directive carriage-return.
before line terminator
directive must have least after example <TAB> <EOF> will generate this error while <TAB> <EOF> will work fine.
Code produced outside Segment
code produced assembler going have placed given address target system day. Since segments assemblers allocating addresses lumps code, code generated before first SEGMENT directive nonsense.
Move line current window Move last line current window Undo changes last edited line Drop start black marker Drop black marker Find Source Code address Report value given label Report address current Editor line
These functions mostly explain themselves; Alternate functions same original functions same name: having indexes same allows cursor keys control codes move cursor, whichever user prefers. Some indexes used default sequence matrix; these allow some WordStar-like commands implemented with more meaning. Multiple-key sequences, such those found WordStar format control codes need implemented follows: take sequence <^Y><L>, i.e., CTRL-Y followed letter should coded ^Y+L where denotes that following character needs CTRL SHIFT.
File capture Error
#Include problems finding named file.
Can't find position Source File
Again with #include, another 'impossible' error reporting that couldn't find current position source file remember after #include.
Can't have more than 4096 #defines
Each #define checked each possible position each source line: having many them slows assembly noticeably. Although have 4096 #defines, there also limits storage space both arguments (error 23); average eight characters both arguments recommended.
UM0144
79/92
Assembler Linker
#define storage space
Error
#define second argument
#define requires space between parts argument delimit
#define storage space
Errors above; you've reached limit storage space aside second argument #defines.
strings DC.W
Strings only allowed parts BYTE, DC.B STRING directives.
strings DC.L
Strings only allowed parts BYTE, DC.B STRING directives.
Illegal External Suffix
Only suffixes legal after external label external directive. suffix left then default label size used BYTES, WORDS LONGS; default WORDS).
Character public line More than four characters single quotes
This assembler uses double-quotes surround string items single-quotes surround character constants. Section page
Uneven Single Quotes
Single-quoted items must have closing quote delimit.
Sequential operator error
does allow arithmetic operators hard against each other.
lvalue Expression.
lvalue left-hand argument operator: lvalue. would cause this error.
Divide zero
Attempt divide number zero, numeric expression.
nested past levels
Exceeded maximum number nested statements.
Spurious ELSE
ELSE discovered when active force.
Spurious ENDIF
ENDIF discovered when active force.
Only allowed inside Macros
LOCAL directive attempted outside Macro definition.
strings Word
Error
string Long
Error
80/92
UM0144
Assembler Linker
REPEAT this UNTIL
UNTIL directive found with matching REPEAT directive.
Couldn't return place Source
Similar Error generated UNTIL instead #include.
Syntax Error SKIP arguments
SKIP expects numeric arguments, separated comma.
First SKIP argument extern/relative; SKIP aborted
SKIP arguments must known assembler absolutely. Extern relative arguments allowed, although arithmetic need move page, example, SEGMENT same class with page align type.
Second SKIP argument extern/Relative; SKIP aborted
Error
Undefined label
This error happens when reference made undefined label.
label space
maximum 1024 labels allowed module, aside contain their names. either these limits exceeded, this error results. module into smaller ones; assemblies will happen twice fast you'll only have reassemble half you've made changes speeding things
Label more than characters
Labels longer than characters allowed.
Label defined PUBLIC twice
This warning occurs same label appears more than once PUBLIC statement. It's trapped because second appearance typographical error slightly different label wanted declared public.
Doubly Defined label
This happens when label defined twice more.
Phase Inconsistency (P1=X,P2=Y) 'label'
Reports that named label allocated different values from pass-1 pass-2, implies awful things. It's generally caused when some reason assembler generated different lengths same instruction between pass-1 pass-2. Sometimes assembler problems identifying which addressing mode wanted particular instruction because typographical errors, labels that discovered undefined during second pass give error (see Error create object code that line. labels after that line will then allocated different values seeing object code that many bytes shorter, causing tons Phase Inconsistency errors. Because this mass Error sometimes hide real cause error, special assembler switch phase [errors]' used switch them off. strongly suggest that don't always your assemblies; only when need might miss critical phase errors.
Public Symbol Undefined
defined symbol PUBLIC directive that defined module.
Missing Number
assembler expect number found zero length.
UM0144
81/92
Assembler Linker
Can't match Addressing Mode
This error catchall assembler cannot anything wrong with your line cannot match known addressing mode either. There main causes errors: significant ordering numeric range errors. significant ordering error simple typographical error: what should have been (val),y coded (valy, whatever. components addressing mode properly formed; it's just that ordering wrong. numeric range errors harder detect. example, 8-bit relative branch branching range would trapped addressing mode error. diagnostics what went wrong assembler dumps model line screen just before error. Numerics printed value followed attribute string: INTernal, EXTernal, ABSolute, RELative Significands printed characters they represent, strings printed with their string. Numeric range errors also trapped link stage (See Section page 35).
PSIG Index
'impossible' error that could only occur through corruption .TAB file.
Un-recognized Opcode
Opcode (second field) could matched against opcode names this instruction set, could matched against macro names directives.
closing quote
String must have closing double-quote before line.
more than Numerics allowed line
These's limit Numeric units allowed line: this usually only matters long DC.B-type directives where data tables being defined. it's problem, simply offending long line into shorter lines.
space Macro Definition
Macro Storage area 64K) been overflowed. must have some really macros!
many Macros Attempted
There limit Macros allowed source code module.
Mend only allowed Macro
MEND directive found with matching MACRO directive.
closing single Quote
error
Ending
Another 'impossible' error, saying that source code line missing.
Character line
each source code line read into assembler it's checked non-ASCII characters (i.e., >128).
Parameter Mismatch
macro definition implies that there different number parameters than there actually were this calling line.
82/92
UM0144
Assembler Linker
Currently Unknown Numeric type
error your Tabgen File, corrupted .TAB file: numeric handler asked check number against undefined numeric type. using latest version ASM.EXE your .TAB file?
Improper Characters
Unusual characters have been spotted source file, value >127.
Label used before EXTERN definition
Labels must declared EXTERNAL before their use, preferably group file.
Ambiguous Label Name
label name single-quotes error-line confused with register name this instruction set. Change name.
Cannot have DS.X segments containing code/data! (only [void] segs!)
DS.X does produce code; simply advances assembler's notional Program Counter. cannot used same segment real 'code' data.
Cannot have code segments previously containing DS.X (only non-void segs!)
DS.X does produce code; simply advances assembler's notional Program Counter. cannot used same segment real 'code' data.
Constant large directive 'value'
DC.B cannot given argument >255, example. OFFSET operators truncate wild arguments.
Couldn't find entry segment mapfile
This listings produced with '-fi' option. Complex include file structures empty segments sometimes throw assembler track.
index only allowed Introduction
When you're using multiple linker output file scheme, only specify linker output file number particular class time that class's introduction.
#LOAD before Segment!
#load given address! Before first segment assembler won't know what address Shift #load after SEGMENT directive.
#LOAD before Segment!
assembler problems finding file you've named #LOAD directive.
EQUs Involving External args must before first segment! Cannot nest #includes levels Couldn't find label list mapfile
Happens with option '-fi' Implies problem with mapfile itself, unsuccessful previous link, etc.
Couldn't find label mapfile
above. Mapfile date with your Edits? label declared EXTERN, never used.
Couldn't find label mapfile
date info stored given address before SEGMENT there address information assembler work
UM0144
83/92
Assembler Linker
string given line?
used defining strings. there string this line? intend that? DC.B BYTE.
Address WORD boundary
68000 certain other genuine 16-bit, Opcodes must word boundary. This error occurs have assembled instruction address. Your processor would crash!
Byte size label value >255 (need WORDS?) Word size label value 65535 (need LONGS?) Over Macline Pull
Internal Error.
Source File
Internal Error.
arguments incorrect
Must order num, num, num, example,
Illegal suffix
unknown suffix been used with label. Recognized suffixes
Label defined NEAR INTERRUPT Label defined NEAR twice Label defined INTERRUPT twice
Linker errors
following list linker error numbers their definitions: File List must supplied Incomplete Object File
Fatal error linker identified that given object file been truncated. disk space?
Size mismatch EXTERN from says PUBLIC from says
When declared PUBLIC file label given size attribute However, when came file EXTERN statement named being size they didn't tally. They must. Find which incorrect alter
info start address class 'class'
first time linker sees class (remember goes through object files order given link command line), must given full 'introduction' class, with start stop addresses. Section page
many secondary externals (32)
Secondary Externals ought occur only rarely your code you're using then your structure something seriously wrong with Hint your labels that used over place, like constants, addresses like: make module just them, just containing EQUs and/or DS.Xs, declared public. arithmetic needs doing more than
84/92
UM0144
Assembler Linker
once throughout your code, there, declare result with public label. Then refer these PUBLICs using simple EXTERNs each module.
Corrupted Object File
Disk Nastiness. Reassemble. There object code inconsistency: re-assemble files, link again.
Public same name secondary EXTERN already exists!
This error cannot seen until link time. Rename other.
many XREFs link (12048) Undefined EXTERN (from Couldn't seek back file 'F1'
Internal Error. Should never occur.
Unexpected
Disk nastiness. Reassemble.
Byte size >Offh 'value'
Needs looking what intended, either operator upper bits, change size attribute.
UM0144
85/92
Assembler Linker
Appendix Revision History
Date 1-Jul-2001 30-Jun-2005 Revision Initial release Updated Introduction Updated Getting Started installation procedure Added Revision History Description changes
86/92
UM0144
Assembler Linker
Appendix Product Support
experience problems with this product, contact distributor STMicroelectronics sales office where purchased product. Phone numbers major sales regions provided Contact List, below. addition, Internet site www.st.com/mcu, will find complete listing sales offices distributors, well documentation, software downloads user discussion groups help answer questions stay date with latest product developments.
Software updates
latest software related documentation available download from Internet site, www.st.com/mcu.
Contact List
North America Canada East Coast STMicroelectronics Lexington Corporate Center Maguire Road, Building floor Lexington, 02421 Phone: (781) 402-2650 West coast STMicroelectronics, Inc. 1060 Brokaw Road Jose, 95131 Phone: (408) 452-8585 West STMicroelectronics 1300 East Woodfield Road, Suite Schaumburg, 60173 Phone: (847) 585-3000
Note:
American Canadian customers seeking technical support US/Canada split territories. According your area, contact appropriate sales office from list above transferred 8-bit microcontroller Field Applications Engineer.
Europe
France (0)1 Germany U.K. 0800 Asia/Pacific Region Japan 3280 4120 Hong-Kong 2861 5700 Shanghai 52574828 Sydney 9580 3811 Taipei 2378 8088
UM0144
87/92
Assembler Linker
Index
Symbols
.asm .cod .fin .lib. .map .obj .rsp .s19 .sym. .tab assembler switch. sign (linker) character labels
attributes byte externally. internally. linker relative absolute long relativity scope. size. word
cbe.err class-names combine common Combine argument segment comments. conditional assembly conditionals (nesting) constants. copied code. cross-references
Numerics
128-byte boundary 16-byte boundary 1k-byte boundary 256-byte boundary characters 4-byte boundary 4K-byte boundary. 64-byte boundary 80-column printer
directives #DEFINE #ELSE #ENDIF #IF1 #IF2 #IFB. #IFDEF. #IFIDN. #IFLAB #INCLUDE #LOAD %OUT .BELL .CTRL. .FORM. .LALL. .LIST. .NOCHANGE .NOLIST .PAGE .SALL .SETDP .TAB .XALL BYTE. BYTES CEQU. DATE. DC.B. DC.L DC.W. DS.B.
address representation align byte long page para word Align argument segments. ampersand ('&') character. asli.bat assembler options -li= -obj -sym
88/92
UM0144
Assembler Linker
DS.L DS.W. END. EXTERN. GROUP INTEL INTERRUPT. LOCAL LONG LONGS. MACRO. MEND. MOTOROLA. NEAR PUBLIC REPEAT. SEGMENT SKIP STRING. SUBTTL TEXAS TITLE UNTIL. WORD. WORDS ZILOG
errors #define second argument. #LOAD before Segment!. Address WORD boundary. EQUs Involving External args must. Ambiguous Label Name. Character line. Character public line Ending. PSIG Index Byte size >Offh 'value'. Byte size label value >255 Can't find position Source File. Can't have more than #defines Can't match Addressing Mode Cannot have code segments previously containing DS.X. Cannot have DS.X segments containing code/data!. Cannot nest #includes levels index only allowed Introduction Code produced outside Segment. Constant large directive 'value' Corrupted Object File Couldn't find entry segment mapfile. Couldn't find label mapfile Couldn't find label list mapfile. Couldn't return place Source Couldn't return place source file 'X.asm' Couldn't seek back file 'F1'. Currently Unknown Numeric type Divide zero
Doubly Defined label Empty file before line terminator. while Macro Definition. File capture Error File List must supplied. First SKIP argument extern/relative. nested past levels. Illegal External Suffix. Illegal Source Illegal suffix Improper Characters Incomplete Object File Label defined PUBLIC twice. Label more than characters Label used before EXTERN definition. Mend only allowed Macro. Missing Number. More than four characters single quotes closing quote closing single Quote info start address class 'class' lvalue Expression. more than Numerics allowed line REPEAT this UNTIL string given line? string Long strings DC.L strings DC.W. strings Word. Only allowed inside Macros label space space Macro Definition. Over Macline Pull Parameter Mismatch Phase Inconsistency (P1=X,P2=Y) 'label'. Public same name secondary EXTERN already exists!. Public Symbol Undefined #define storage space (1). #define storage space (2). Source File Second SKIP argument extern/Relative Sequential operator error Size mismatch EXTERN. Spurious ELSE. Spurious ENDIF Syntax Error SKIP arguments arguments incorrect many XREFs link (12048) many Macros Attempted many secondary externals (32). Undefined EXTERN (from Undefined label Uneve

Other recent searches


SP8527 - SP8527   SP8527 Datasheet
S29GL128P - S29GL128P   S29GL128P Datasheet
PHB66NQ03LT - PHB66NQ03LT   PHB66NQ03LT Datasheet
MSM5117805F - MSM5117805F   MSM5117805F Datasheet
MPX4250A - MPX4250A   MPX4250A Datasheet
MIC68400 - MIC68400   MIC68400 Datasheet
MIC68400s - MIC68400s   MIC68400s Datasheet
IS61WV20488ALL - IS61WV20488ALL   IS61WV20488ALL Datasheet
GU256X128D-3xxx - GU256X128D-3xxx   GU256X128D-3xxx Datasheet
FAN7383 - FAN7383   FAN7383 Datasheet
DS1033 - DS1033   DS1033 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive