137/317
6 - STMicroelectronics Programming Tools
The label field must start on the first character of the line. The label is a name that identifies the
address in memory of the objects defined in the current line, or, if none, on the next non-empty
line. The label name may if desired and for sake of clarity be followed by a colon, as in the ex-
ample below where both labels are correct:
MyFirstLabel: ADD A, #2
MySecondLabel ADD A, #2
The operation field may contain either an opcode, or a pseudo-op, or a macro name. The con-
cept of macro will be defined later. If there is no label in the line, there must be at least one
space or tabulation character before the operation field.
The operand field may contain various kinds of objects, according to the type of the operation
field. It must be preceded by at least one space or tabulation character.
The comment field must be preceded by at least one space or tabulation character, then a
semicolon (;). The remainder of the line is ignored by the assembler. This allows to add com-
ments in the source code to help to maintain the program by explaining the working of the in-
structions used.
The various services that the ST7 assembler provides are detailed below.
6.1.2 Instruction coding
This is the most obvious task of the assembler.
As mentioned in the chapter that discusses the instruction set, all instructions are symbolized
by their mnemonic name. For example, the add instruction is called
ADD
, the jump instruction
is called
JP
, and so on.
The role of the assembler is not as simple as that. The
ADD
instruction is not translated into one
byte; instead, the addressing mode is also coded in the opcode. For example, as shown in the
complete instruction table of the Chapter 4, the opcodes of the add instruction are:
ADD
Immediate
AB
ADD
Short
BB
ADD
Long
CB
ADD
Long, (X)
DB
ADD
Short, (X)
EB
ADD
(X)
FB