ARCHITECTURE
AND
INSTRUCTIONS
statements. Each statement normally occu-
pies one line.
If
succeeding lines are needed,
they start with
"&".
The structure of an
ASM-86 program
is:
NAME1
NAME1
NAME2.
NAME2
SEGMENT
statement
statement
ENDS
SEGMENT
statement
statement
ENDS
END
The programs presented here all display a
consistent tabular pattern.
Such tabulation
is
not part of the program
structure; it
is
optional to the assembler, but
highly recommended to make programs eas-
ier to read and understand.
In
the untabulated version of the IN_AND_
IN_AND_OUT SEGMENT
ASSUME CS:IN_AND...OUT
CYCLE:IN
AX,5
INCAX
OUT2,AX
JUMP
CYCLE
IN_AND_OUT
ENDS
END CYCLE
2-23
OUT program below, the assembler would
assemble faster,
but
the program would be
much less-comprehensible to us.
Tokens
Before examining the kinds of statements
from which ASM-86 programs are built,
we
must become familiar .with the building
blocks of statements. Statements are
com-:-
posed of such things as identifiers, reserved
words, delimiters, constants,
and comments.
These building blocks, sometimes called tok-
ens,
are described below.
IDENTIFIERS
Identifiers are names that you, the pro-
grammer, are free to make up. Identifiers in
the sample program are SUM, CYCLE, and
PORT
_VAL.
An identifier
is
a sequence of
letters, numbers, and underscore characters
(_),
but
may not start with a number. An
identifier may be up to
31
characters long,
which means the length
is
practically unlim-
ited. Examples of identifiers are:
X
GAMMA
JACKS
THIS_NODE
THISNODE
The last two examples are indeed different
identifiers.
;start of segment
;that's what's in
CS
;end of seg ment
;end of assembly