Chapter
2.
Assembly
Language
Concepts
Instructions
as
Operands. One operand
type
was intentionally
omitted
from the list
of
operand field infor-
mation: Instructioll'> enclosed
in
parentheses may appear
in
the operands field. The operand has the value
of
the left-most byte
of
the
assembled instruction.
Label Opcode Operand
INS:
DB
(ADD
C)
The
statement
above defines a byte with the value
81
H (the object code for an
ADD
C instruction). Such
coding
is
typically used where the object program modifies itself during execution, a technique
that
is
strongly
discouraged.
Register-Type Operands. Only instructions that allow registers
as
operands may have register-type operands.
Expressions containing register-type operands are flagged
as
errors. Thus,
an
instruction like
IMP
A
i, flagged
a,
an illegal use
of
J register.
The only
assemblC'r directives that may contain register-type operands arc EQU, SET, and actual parameters
in
macro calls. Registers can
be
a,signed alternate names only by EQU or SET.
TWO'S
COMPLEMENT
REPRESENTATION
OF
DATA
Any 8-bit byte contains one
of
the 256 possible combinations
of
zeros and ones. Any particular
combination
may
be
interpreted
in
J number
of
ways. For example, the code 1
FH
may
be
interpreted
as
an
instruction (Rotate
Accumuiator Right Through
Carr'y), as the hexadecimal value 1 F, the decimal value 31, or simply the bit
pattern
00011111.
Arithmetic instructions as,ume
that
the data
byte,
upon which they operate arc
in
the
'two's
complement'
format. To understand why, let
u,
first examine two examples
of
decimal arithmetic:
35
-12
23
35
+88
123
Notice that the results
of
the two examples are equal if we disregard the carry
out
of
the high order position
in
the second example. The second example illustrates subtraction performed
by
adding the ten's complement
of
the subtrahend (the
bottom
number) to the minuend (the top number). To form the ten's
complement
of
a
decimal number, first
subtract
each digit
of
the subtrahend from 9 to form the nine's complement; then add one
to the resul
t to form the ten's complement.
Thus-,
99--12=87; 87+ 1 =88,
the
ten's
complement
of
12.
The ability to perform subtraction with
a form
of
addition
is
a great advantage
in
a
computer
since fewer cir-
cuit,
are required. Also, arithmetic operations within the
computer
are binary, which simplifies matters even more.
2·7