Intel 80C186XL A.1.2 String Instructions, INS source_string, port, OUTS port, destination_string

Models: 80C186XL 80C188XL

1 405
Download 405 pages 42.62 Kb
Page 309
Image 309
A.1.2 String Instructions

80C186 INSTRUCTION SET ADDITIONS AND EXTENSIONS

A.1.2 String Instructions

INS source_string, port

INS (in string) performs block input from an I/O port to memory. The port address is placed in the DX register. The memory address is placed in the DI register. This instruction uses the ES segment register (which cannot be overridden). After the data transfer takes place, the pointer reg- ister (DI) increments or decrements, depending on the value of the Direction Flag (DF). The pointer register changes by one for byte transfers or by two for word transfers.

OUTS port, destination_string

OUTS (out string) performs block output from memory to an I/O port. The port address is placed in the DX register. The memory address is placed in the SI register. This instruction uses the DS segment register, but this may be changed with a segment override instruction. After the data transfer takes place, the pointer register (SI) increments or decrements, depending on the value of the Direction Flag (DF). The pointer register changes by one for byte transfers or by two for word transfers.

A.1.3 High-Level Instructions

ENTER size, level

ENTER creates the stack frame required by most block-structured high-level languages. The first parameter, size, specifies the number of bytes of dynamic storage to be allocated for the procedure being entered (16-bit value). The second parameter, level, is the lexical nesting level of the pro- cedure (8-bit value). Note that the higher the lexical nesting level, the lower the procedure is in the nesting hierarchy.

The lexical nesting level determines the number of pointers to higher level stack frames copied into the current stack frame. This list of pointers is called the display. The first word of the display points to the previous stack frame. The display allows access to variables of higher level (lower lexical nesting level) procedures.

After ENTER creates a display for the current procedure, it allocates dynamic storage space. The Stack Pointer decrements by the number of bytes specified by size. All PUSH and POP operations in the procedure use this value of the Stack Pointer as a base.

Two forms of ENTER exist: non-nested and nested. A lexical nesting level of 0 specifies the non- nested form. In this situation, BP is pushed, then the Stack Pointer is copied to BP and decrement- ed by the size of the frame. If the lexical nesting level is greater than 0, the nested form is used. Figure A-1 gives the formal definition of ENTER.

A-2

Page 309
Image 309
Intel 80C186XL A.1.2 String Instructions, INS source_string, port, OUTS port, destination_string, ENTER size, level