
EXTENDED INSTRUCTION SET
OUTS (Output String to Port) transfers a byte or a word string element to an output port from memory. Combined with the REP prefix, OUTS moves a block of information from a series of consecutive memory locations indicated by DS:SI to an output port.
Example: REP OUTS WSTRING. Assuming that the program declares WSTRING to be a word- length string element, the assembler uses the
Following each word transfer, the CPU decrements CX. The instruction terminates the block transfer when CX=O. After decrementing CX, the processor increments SI by two to point to the next word in memory if DF=O; it decrements SI by two if DF= 1.
4.2 HIGH-LEVEL INSTRUCTIONS
The instructions in this section provide
ENTER (Enter Procedure) creates the stack frame required by most
Example: ENTER 2048,3. Allocates 2048 bytes of dynamic storage on the stack and sets up pointers to two previous stack frames in the stack frame that ENTER creates for this procedure.
The ENTER instruction includes two parameters. The first parameter specifies the number of bytes of dynamic storage to be allocated on the stack for the routine being entered. The second parameter corresponds to the lexical nesting level
The specified lexical level determines hovv' many sets of stack frame pointers the CPU copies into the
new stack frame from the preceding frame. This list of stack frame pointers is sometimes called the "display." The first word of the display is a pointer to the last stack frame. This pointer enables a LEAVE instruction to reverse the action of the previous ENTER instruction by effectively discarding the last stack frame.
After ENTER creates the new display for a procedure, it allocates the dynamic storage space for that procedure by decrementing SP by the number of bytes specified in the first parameter. This new value of:SP serves as a base for aU PUSH and POP operaiions wiihin ihai pro\;!:uun:.
To enable a procedure to address its display, ENTER leaves BP pointing to the beginning of the new stack frame. Data manipUlation instructions that specify BP as a base register implicitly address locations within the stack segment instead of tpe data segment. Two forms of the ENTER instruction exist: nested and