Chapter 4 Assembly Language and Cross Assembler
The values of these shift bit operators are all constant values. The
expression
is shifted right
SHR
or left
SHL
by the number of bits specified by
count.
If bits are shifted out of position, the
corresponding bits that are shifted in are zero-filled. The following are such examples:
mov A, 01110111b SHR 3 ; result ACC=00001110b
mov A, 01110111b SHL 4
; result ACC=01110000b
Bitwise operators NOT, AND, OR, XOR
-
Syntax
NOT
expression
expression1
AND
expression2
expression1
OR
expression2
expression1
XOR
expression2
NOT
AND
OR
XOR
is a bitwise complement.
is a bitwise AND.
is a bitwise inclusive OR.
is a bitwise exclusive OR.
OFFSET operator
-
Syntax
OFFSET
expression
The
OFFSET
operator returns the offset address of an
expression.
The
expression
can be
a label, a variable, or other direct memory operand. The value returned by the OFFSET operator
is an immediate operand.
LOW, MID and HIGH operator
-
Syntax
LOW
expression
MID
expression
HIGH
expression
The
LOW/MID/HIGH
operator returns the value of an
expression
if the result of the
expres-
sion
is an immediate value. The
LOW/MID/HIGH
operators will then take the low/middle/high
byte of this value. But if the
expression
is a label, the
LOW/MID/HIGH
operator will take the
values of the low/middle/high byte of the program count of this label.
BANK operator
-
Syntax
BANK
name
The
BANK
operator returns the bank number allocated to the section of the
name
declared. If the
name
is a label then it returns the rom bank number. If the
name
is a data variable then it returns
the ram bank number. The format of the bank number is the same as the BP defined. For more
information of the format, please refer to the data sheets of the corresponding MCUs. (Note: The
format of the BP might be different between MCUs.)
Example 1:
mov A, BANK start
mov BP,A
jmp start
149
Home Index Bookmark Pages Text
Previous Next
Pages: Home Index