ARCHITECTURE AND INSTRUCTIONS

They might also be used to slow down a portion of the program where precise timing relationships are important.

Placeholder

NIL is the only instruction mnemonic that does not cause the assembler to generate any instructions. In contrast to NOP, which causes the assembler to generate an instruc- tion that does nothing when executed, NIL doesn't even cause an instruction to be generated.

NIL serves as a convenient placeholder for labels in the assembly-language program:

CYCLE: NIL

INC AX

Although this is equivalent to

CYCLE: INC AX

the NIL makes it much easier to insert instructions ahead of the INC instruction in the source program, if the need arises later.

INSTRUCTION PREFIXES

The 8088 instruction set permits instructions to start off with one or more prefix bytes. The three possible prefixes are:

1)segment-override

2)repeat

3)lock

ASM-86 permits the following prefixes to be included with the instruction mnemonic:

LOCK

 

REP

(repeat)

REPE

(repeat while equal)

REPNE

(repeat while not equal)

REPZ

(repeat while zero)

REPNZ

(repeat wh iIe non-zero)

Asample instruction statement using a prefix

is:

CYCLE: LOCK DEC COUNT

The segment-overriding prefix is generated automatically by the assembler whenever the assembler realizes that a memory access requires such a prefix. The asembler makes this decision in two steps.

First, it selects a segment register that will make the instruction execute properly. The assembler selects the segment register based on information it received from previous ASSUME statements. However, we can force the assembler to select a particular segment register by including that register in the instruction as in:

MOV BX,ES:SUM

Secondly, the assembler determines if a segment-overriding prefix is necessary to force execution of the instruction to use the selected segment register.

OPERAND-ADDRESSING MODES

The 8088 processor provides various operand- addressing modes. ASM-86 must therefore provide a means of expressing each mode when writing instruction statements: For example:

1) Immediate:

MOV AX,15;15 is an immediate operand

2)Register:

MOV AX,15

;AX is a register operand

3)Direct:

SUM DB ?

MOV SUM,15 ;SUM is a direct memory operand

4) Indirect through base register:

MOV AX,(BX)

MOV AX,(BP)

5) Indirect through index register:

MOV AX,(SI)

MOV AX,(DI)

2-38

Page 73
Image 73
Intel 210200-002 manual Cycle NIL INC AX