ARCHITECTURE AND INSTRUCTIONS
3)Setting TF (the trap flag) puts the proces- sor into
Instruction Pointer
The
Stack Implementation
The 8088's stack is implemented in memory and is located by the stack segment register
(SS)and the stack pointer register (SP). A system may have an unlimited number of stacks, and a stack may be up to 64K bytes long, the maximum length of a segment. (An attempt to expand a stack beyond 64K bytes overwrites the beginning of the stack). One stack is directly addressable at a time; this is the current stack often referred to simply as "the" stack. SS contains the base address of the current stack and SP points to the top of the stack (TOS). In other words, SP contains the offset of the top of the stack from the stack segment's base address. Note, however, that the stack's base address (contained in SS) is not the "bottom" of the stack.
Instructions that operate on a stack add or remove one word (2 bytes) at a time. An item is pushed onto the stack by decrementing SP by 2 and writing the item at the new TOS. An
item is popped off the stack by copying it from TOS and incrementing SP by 2. In other words, the stack grows' down in memory toward its base address: Stack oper- ations never move items on the stack, nor do they t:rase them. The top of tbe stack changes only as a result of updating the stack pointer.
ADDRESSING MODES
Instructions in the 8088 usually perform operations on one or two source operands, with the result overwriting one of the oper- ands. The first operand of a
-their use does not imply directionality for data transfers). Typical formats for two- operand instructions are shown in Figure
Memory Operands,
An instruction may address an operand resid- ing in memory in one of the following ways, as determined by the "mod" and "r/ m" field in the instruction (Fig.
DIRECT ADDRESSING
INDIRECT ADDRESSI~G - optionally with an 8- or
1)through a base register (BP or BX)
2)through an index register (SI or DI)
3)through the sum of a base register and an index register