Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 用户手册

产品代码
SW006021-1
下载
页码 518
Macro Assembler
 2012 Microchip Technology Inc.
DS52053B-page 253
Labels may be used (and are preferred) in assembly code, rather than using an abso-
lute address with other instructions. Thus they can be used as the target location for 
jump-type instructions or to load an address into a register.
Like variables, labels have scope. By default, they may be used anywhere in the mod-
ule in which they are defined. They may be used by code located before their definition. 
To make a label accessible in other modules, use the GLOBAL directive. See 
Section 6.4.9.1 “GLOBAL” for more information.
6.4.7
Expressions
The operands to instructions and directives are comprised of expressions. Expressions 
can be made up of numbers, identifiers, strings and operators.
Operators can be unary (one operand, e.g., not) or binary (two operands, e.g., +). The 
operators allowable in expressions are listed in Table 6-4
The usual rules governing the syntax of expressions apply.
The operators listed may all be freely combined in both constant and relocatable 
expressions. The linker permits relocation of complex expressions, so the results of 
expressions involving relocatable identifiers may not be resolved until link time.
TABLE 6-4:
ASPIC[18] OPERATORS
Operator
 Purpose
 Example
*
Multiplication
MOVLW 4*33,w
+
Addition
BRA $+1
-
Subtraction
DB 5-2
/
Division
MOVLW 100/4
=
 or eq
Equality
IF inp eq 66
>
 or gt
Signed greater than
IF inp > 40
>=
 or ge
Signed greater than or equal to IF inp ge 66
<
 or lt
Signed less than
IF inp < 40
<=
 or le
Signed less than or equal to
IF inp le 66
<>
 or ne
Signed not equal to
IF inp <> 40
low
Low byte of operand
MOVLW low(inp)
high
High byte of operand
MOVLW high(1008h)
highword
High 16 bits of operand
DW highword(inp)
mod
Modulus
MOVLW 77mod4
&
Bitwise AND
CLRF inp&0ffh
^
Bitwise XOR (exclusive or)
MOVF inp
^80,w
|
Bitwise OR
MOVF inp|1,w
not
Bitwise complement
MOVLW not 055h,w
<<
 or shl
Shift left
DB inp>>8
>>
 or shr
Shift right
MOVLW inp shr 2,w
rol
Rotate left
DB inp rol 1
ror
Rotate right
DB inp ror 1
float24
24-bit version of real operand
DW float24(3.3)
nul
Tests if macro argument is null