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 SEGMENT statement

statement

NAME1 ENDS

NAME2. SEGMENT statement

statement

NAME2 ENDS

END

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:

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_

X

GAMMA

JACKS

THIS_NODE

THISNODE

The last two examples are indeed different identifiers.

IN_AND_OUT SEGMENT

;start of segment

ASSUME CS:IN_AND...OUT

;that'swhat'sin CS

CYCLE:IN AX,5

 

INCAX

 

OUT2,AX

 

JUMP CYCLE

 

IN_AND_OUT ENDS

;end of seg ment

END CYCLE

;end of assembly

2-23

Page 58
Image 58
Intel 210200-002 manual Inandout Segment