BASIC INSTRUCTION SET

Example: STI. Sets IF= 1, which enables the processing of maskable external interrupts.

Example: CLI. Sets IF=O to disable maskable interrupt processing.

HLT (Halt) causes the processor to suspend processing operations pending an interrupt or a system reset. This trusted instruction provides an alternative to an endless software loop in situations where a program must wait for an interrupt. The return address saved after the interrupt will point to the instruction immediately following HLT. This instruction may be executed only when CPL = O.

Example: HLT

LOCK (Assert Bus Lock) is a i-byteprefix code that causes the processor to assert the bus LOCK signal during execution of the instruction that follows. LOCK does not affect any flags. LOCK may be used only when CPL :5 IOPL. A protection exception will occur if LOCK is used when CPL > 10PL.

3.11.3 Input and Output Instructions

These trusted instructions provide access to the processor's I/O ports to transfer data to and from peripheral devices. In Protected Mode, these instructions may be executed only when CPL :5 IOPL.

IN (Input/rom Port) transfers a byte or a word from an input port to AL or AX. If a program specifies AL with the IN instruction, the processor transfers 8 bits from the selected port to AL. Alternately, if a program specifies AX with the IN instruction, the processor transfers 16 bits from the port to AX.

The program can specify the number of the port in two ways. Using an immediate byte constant, the program can specify 256 8-bit ports numbered 0 through 255 or 128 16-bit ports numbered 0,2,4,...,252,254. Using the current value contained in DX, the program can specify 8-bit ports numbered othrough 65,535, or 16-bit ports using even-numbered ports in the same range.

Example: IN AL,

BYTEYORT_NUMBER. Transfers 8 bits to AL from the port identified by the immediate constant BYTEYORT_NUMBER.

OUT (Output to Port) transfers a byte or a word to an output port from AL or AX. The program can specify the number of the port using the same methods of the IN instruction.

Example: OUT AX, DX. Transfers 16 bits from AX to the port identified by the Hi-bit number contained in DX.

INS and OUTS (Input String and Output String) cause block input or output operations using a Repeat prefix. See Chapter 4 for more information on INS and OUTS.

3.12 PROCESSOR EXTENSION INSTRUCTIONS

Processor Extension provides an extension to the instruction set of the base architecture (e.g., 80287). The NPX extends the instruction set of the CPU-based architecture to support high-precision integer and floating-point calculations. This extended instruction set includes arithmetic, comparison, transcen- dental, and data transfer instructions. The NPX also contains a set of useful constants to enhance the speed of numeric calculations.

3-29

Page 85
Image 85
Intel 80286, 80287 manual Input and Output Instructions, Processor Extension Instructions