Hardware Reference
In-Depth Information
operators. Labels are considered to be constants because at the end of the first pass
their numerical values are known.
Numerical values can be octal (starting with a 0), decimal ,or hexadecimal
(starting with 0X or 0x). Hexadecimal numbers use the letters a-f or A-F for the
values 10-15. The integer operators are +,
, *, /, and %, for addition, subtraction,
multiplication, division and remainder, respectively. The logical operators are &, ˆ,
and ~, for bitwise AND, bitwise OR and logical complement (NOT) respectively.
Expressions can use the square brackets, [ and ] for grouping.
Parentheses are
NOT used, to avoid confusion with the addressing modes.
Labels in expressions should be handled in a sensible way. Instruction labels
cannot be subtracted from data labels. The difference between comparable labels
is a numerical value, but neither labels nor their differences are allowed as con-
stants in multiplicative or logical expressions. Expressions which are allowed in
constant definitions can also be used as constants in processor instructions. Some
assemblers have macro facility, by which multiple instructions can be grouped
together and given a name, but as88 does not have this feature.
In every assembly language, there are some directives that influence the assem-
bly process itself but which are not translated into binary code. They are called
pseudoinstructions . The as88 pseudoinstructions are listed in Fig. C-8.
Instruction Description
.SECT .TEXT Assemble the following lines in the TEXT section
.SECT .DATA
Assemble the following lines in the DATA section
.SECT .BSS
Assemble the following lines in the BSS section
.BYTE
Assemble the arguments as a sequence of bytes
.WORD
Assemble the arguments as a sequence of words
.LONG
Assemble the arguments as a sequence of longs
.ASCII "str"
Store str as an ASCII string without a trailing zero byte
.ASCIZ "str"
Store str as an ASCII string with a trailing zero byte
.SPACE n
Advance the location counter n positions
.ALIGN n
Advance the location counter up to an n-byte boundary
.EXTERN
Identifier is an external name
Figure C-8. The as88 pseudoinstructions.
The first block of pseudoinstructions determines the section in which the fol-
lowing lines should be processed by the assembler. Usually such a section re-
quirement is made on a separate line and can be put anywhere in the code. For
implementation reasons, the first section to be used must be the TEXT section,
then the DATA section, then the BSS section. After these initial references, the
sections can be used in any order. Furthermore, the first line of a section should
have a global label. There are no other restrictions on the ordering of the sections.
 
 
Search WWH ::




Custom Search