Download A51 8051 Cross-Assembler
Transcript
A51 - 8051 Cross Assembler User's Manual
Labels
A label is any sequence of alphabetic or numeric characters starting with an alphabetic. The legal
alphabetics are:
! $ % & : ? [ \ ] ^ _ ` { | } ~ A-Z a-z
The numeric characters are the digits 0-9. Note that "A" is not the same as "a" in a label. This can
explain mysterious U (undefined label) errors occurring when a label appears to be defined.
A label is permitted on any line except a line where the opcode is IF, ELSE, or ENDIF. The label is
assigned the value of the assembly program counter before any of the rest of the line is processed except
when the opcode is BIT, EQU, ORG, REG, or SET.
Labels can have the same name as opcodes, but they cannot have the same name as pre-defined bit
variables, operators, registers, or pre-defined byte addresses. The reserved names are:
Pre-defined bit variables:
AC
EX0
IT1
PX0
RI
TF1
CY
EX1
OV
PX1
SM0
TI
EA
F0
P
RS0
SM1
TR0
ES
IE0
PS
RS1
SM2
TR1
ET0
IE1
PT0
RB8
TB8
ET1
IT0
PT1
REN
TF0
EQ
LT
SHR
GE
MOD
XOR
GT
NE
HIGH
NOT
LE
OR
AB
R2
C
R3
DPTR
R4
PC
R5
R0
R6
B
P1
SCON
TL1
DPH
P2
SP
TMOD
DPL
P3
TCON
IE
PCON
TH0
Operators:
AND
LOW
SHL
Registers:
A
R1
R7
Pre-defined byte addresses:
$
IP
PSW
TH1
ACC
P0
SBUF
TL0
If a label is used in an expression before it is assigned a value, the label is said to be
"forward-referenced." For example:
L1
L2
L3
EQU
L2 + 1
; L2 is forward-referenced here.
EQU
L2 + 1
; L2 is not forward-referenced here.
Numeric Constants
Numeric constants are formed according to the Intel convention. A numeric constant starts with a
numeric character (0-9), continues with zero or more digits (0-9, A-F), and ends with an optional base
designator. The base designators are H for hexadecimal, none or D for decimal, O or Q for octal, and B
for binary. The hex digits a-f are converted to upper case by the assembler. Note that a numeric constant