APPLICATION ARCHITECTURE

transfered to any point in a segment. (The selector part of the far pointer replaces the value in the CS register while the offset part replaces the value in EIP) A full set of condi- tional Jump instructions, which branch based on the value of a status flag, is also available; these instructions can also transfer to locations up to 232 bytes away.

Procedures and functions (subroutines) can be invoked with the Call instruction and a called routine can return with the Return instruction. As with Jumps, Calls within a code segment have near pointer operands which specify a new value for the Instruction Pointer, while Calls to a different code segment have far pointer operands that change the CS register in addition to EIP. Call instructions push the address of the following instruction

onto the stack and then load the Instruction Pointer (and the CS register, if the transfer is to a different segment). The Return instruction pops the saved value(s) from the stack into Erp, and CS, if applicable. Calls can be indefinitely nested and recursive, subject only to the size of the stack.

For controlling loops, the 80386 provides the Loop and conditional Loop instructions in addition to conditional Jumps. The loop instructions use the ECX register as a repeti- tion counter; they decrement ECX and termi- nate the loop when the register's value becomes zero. The conditional Loop instructions termi- nate a loop prematurely when a flag takes a specified value. While the Loop instructions are designed for "bottom of loop" testing, adding a Jump If ECX Zero instruction

 

 

 

 

 

 

 

IRELATIVE

 

 

 

 

 

 

 

ADDRESSES

 

 

..."'f-----

INCREASING SIGNIFICANCE

 

79

71

I

 

 

 

3

0

(G::::J

 

 

 

I I I IPACKED DECIMAL

Q ...'S - IG - N

--------

MAGNITUDE -----------

'

 

 

 

 

31

23

 

0

 

 

 

 

11... --

________1SHORT REAL

 

 

 

 

l'•II

MAGNITUDE----....

J

 

 

 

 

 

 

BIASED EXPONENT

 

 

 

 

 

 

 

SIGN

 

 

 

63

51

 

 

 

0

 

 

LJIIL-_-LI____________---JILONG REAL

 

 

 

II

MAGNITUDE

 

 

 

 

~t

BIASED EXPONENT

 

 

 

 

 

 

 

SIGN

 

 

 

79

 

62

 

 

 

 

0

I..&..1___--11...11_________________---11 TEMPORARY REAL

tL.1_--

,-_

---llL.I-------

MAGNITUDE

 

 

 

l

t____BIASED EXPONENT

 

 

 

L - . -----

SIGN

 

 

 

 

 

Figure 2-8. Numeric Coprocessor Data Type Storage Examples

2-9

Page 22
Image 22
Intel 80386 manual Lii