Intel 80287, 80286 manual Character Translation and String Instructions, Translate Instruction

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 78
Image 78

BASIC INSTRUCTION SET

Example: INT O. Transfers control to the interrupt service routine specified by a type 0 interrupt, which is reserved for a divide error.

INTO (Interrupt on Overflow) invokes a type 4 interrupt if OF is set when the INTO instruction executes. The type 4 interrupt is reserved for this purpose.

Example: INTO. If the result of a previous operation has set OF and no intervening operation has reset OF, then INTO invokes a type 4 interrupt. The interrupt service routine terminates with an IRET instruction, which returns control to the instruction following INTO.

3.7 CHARACTER TRANSLATION AND STRING INSTRUCTIONS

The instructions in this category operate on characters or string elements rather than on logical or numeric values.

3.7.1 Translate Instruction

XLAT (Translate) replaces a byte in the AL register with a byte from a user-coded translation table. When XLAT is executed, AL should have the unsigned index to the table addressed by BX. XLAT changes the contents of AL from table index to table entry. BX is unchanged. The XLAT instruction is useful for translating from one coding system to another, such as from ASCII to EBCDIC. The translate table may be up to 256 bytes long. The value placed in the AL register serves as an index to the location of the corresponding translation value. Used with a LOOP instruction, the XLAT instruc- tion can translate a block of codes up to 64K bytes long.

Example: XLAT. Replaces the byte in AL with the byte from the translate table that is selected by the value in AL.

3.7.2 String Manipulation Instructions and Repeat Prefixes

The string instructions (also called primitives) operate on string elements to move, compare, and scan byte or word strings. One-byte repeat prefixes can cause the operation of a string primitive to be repeated

to process stiings as long as 64K bytes.

The repeated string primitives use the direction flag, DF, to specify left-to-right or right-to-left string processing, and use a count in CX to limit the processing operation. These instructions use the register pair DS:SI to point to the source string element and the register pair ES:DI to point to the destination.

One of two possible opcodes represent each string primitive, depending on whether it is operating on byte strings or word strings. The string primitives are generic and require one or more operands along with the primitive ta deter!!!.!ne tht:' si7 t:' of the string elements being processed. These operands do not determine the addresses of the strings; the addresses must already be present in the appropriate registers.

Each repetition of a string operation using the Repeat prefixes includes the following steps:

1.'Acknowledge pending interrupts.

2.Check CX for zero and stop repeating if CX is zero.

3.Perform the string operation once.

3-22

Page 78
Image 78
Intel 80287, 80286 manual Character Translation and String Instructions, Translate Instruction