![Lattice LatticeMico8 Скачать руководство пользователя страница 19](http://html2.mh-extra.com/html/lattice/latticemico8/latticemico8_user-manual_3830102019.webp)
19
LatticeMico
8
Microcontroller
Lattice Semiconductor
User’s Guide
•
Octal values
: Octal values must be prefixed with the numeric character ‘0’. (e.g. 077, 066, and 012 are valid
octal constants).
•
Character constants
: Single character constants must be enclosed in single quotation marks. (e.g. ‘A’, ‘v’, ‘9’
are all valid character constants).
•
Decimal constants
: Any sequence of decimal numbers can be a valid constant. (e.g. 123, 255, 231 are valid
decimal constants).
•
Location counter
: The special character $ (dollar sign) is used to give the current value of the location counter.
Note: The hexadecimal, octal, and decimal constants can be optionally prefixed with a ‘+’ or ‘-’ sign.
Assembler Directives
In addition to the instructions described in the Instruction Set section, the Assembler also supports the following
directives. An Assembler directive must be prefixed with a ‘.’ character.
•
.org
: This directive allows code to be placed at specific addresses. The syntax for this directive is:
.org <constant>
The constant can be of any form described in the previous section. The Assembler will terminate with an error, if
the .org directive is given a location which is less than the current “local counter” value.
•
.equ
: This directive can be used to assign symbolic names to constants. The syntax of the directive is:
.equ
<symbolic name>,<constant>
.equ newline,’\n’
...
movi r2,newline
•
.data
: This directive can be used to embed arbitrary data in the assembler. The syntax for this directive is:
.data <constant>
The following figure is an example of the listing generated by the Assembler:
Figure 4. Example of Assembler Generated Listing
Loc
Opcode
Opcode
Counter
(Hex)
(Bin)
0x0000
0x33001
110011000000000001
b
start
0x0001
start:
0x0001
0x10000
010000000000000000
nop
0x0002
add:
0x0002
0x12055
010010000001010101
movi
R00,0x55
0x0003
0x12105
010010000100000101
movi
R01,0x05
0x0004
0x12203
010010001000000011
movi
R02,0x03
0x0005
0x08110
001000000100010000
add
R01,R02
0x0006
0x0A101
001010000100000001
addi
R01,0x01
0x0007
0x10308
010000001100001000
mov
R03,R01
0x0008
0x10410
010000010000010000
mov
R04,R02
0x0009
0x12535
010010010100110101
movi
R05,0x35
0x000A
0x12643
010010011001000011
movi
R06,0x43
0x000B
0x08628
001000011000101000
add
R06,R05
0x000C
0x0A613
001010011000010011
addi
R06,0x13
0x000D
0x10728
010000011100101000
mov
R07,R05
•
•
•