Information Technology Reference
In-Depth Information
Operand
(Required in some
instructions)
Label
(Optional)
Operation Code
(Required)
Comment
(Optional)
Figure 3.2 Assembly instruction format
label differs from one assembly language to another. Some allow up to 32 characters
in length, others may be restricted to six characters. Assembly languages for some
processors require a colon after each label while others do not. For example, SPARC
assembly requires a colon after every label, but Motorola assembly does not. The
Intel assembly requires colons after code labels but not after data labels.
The operation code (opcode) field contains the symbolic abbreviation of a given
operation. The operand field consists of additional information or data that the
opcode requires. The operand field may be used to specify constant, label, immedi-
ate data, register, or an address. The comments field provides a space for documen-
tation to explain what has been done for the purpose of debugging and maintenance.
For the simple processor described in the previous section, we assume that the
label field, which may be empty, can be of up to six characters. There is no colon
requirement after each label. Comments will be preceded by “
”. The simple
mnemonics of the ten binary instructions of Table 3.1 are summarized in Table 3.4.
Let us consider the following assembly instruction:
/
START
LD X
\ copy the contents of location X into AC
The label of the instruction LD X is START, which means that it is the memory
address of this instruction. That label can be used in a program as a reference as
shown in the following instruction:
BRA START
\ go to the statement with label START
TABLE 3.4 Assembly Language for the Simple Processor
Mnemonic
Operand
Meaning of instruction
STOP
Stop execution
LD
x
Load operand from memory (location x) into AC
ST
x
Store contents of AC in memory (location x)
MOVAC
Copy the contents AC to DR
MOV
Copy the contents of DR to AC
ADD
Add DR to AC
SUB
Subtract DR from AC
AND
And bitwise DR to AC
NOT
Complement contents of AC
BRA
adr
Jump to instruction with address adr
BZ
adr
Jump to instruction adr if AC ¼ 0
Search WWH ::




Custom Search