-
Notifications
You must be signed in to change notification settings - Fork 29
/
LEA.htm
101 lines (80 loc) · 3.02 KB
/
LEA.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>80386 Programmer's Reference Manual -- Opcode LEA</TITLE>
</HEAD>
<BODY STYLE="width:80ch">
<B>up:</B> <A HREF="c17.htm">
Chapter 17 -- 80386 Instruction Set</A><BR>
<B>prev:</B><A HREF="LAR.htm"> LAR Load Access Rights Byte</A><BR>
<B>next:</B><A HREF="LEAVE.htm"> LEAVE High Level Procedure Exit</A>
<P>
<HR>
<P>
<H1>LEA -- Load Effective Address</H1>
<PRE>
Opcode Instruction Clocks Description
8D /r LEA r16,m 2 Store effective address for m in register r16
8D /r LEA r32,m 2 Store effective address for m in register r32
8D /r LEA r16,m 2 Store effective address for m in register r16
8D /r LEA r32,m 2 Store effective address for m in register r32
</PRE>
<H2>Operation</H2>
<PRE>
IF OperandSize = 16 AND AddressSize = 16
THEN r16 := Addr(m);
ELSE
IF OperandSize = 16 AND AddressSize = 32
THEN
r16 := Truncate_to_16bits(Addr(m)); (* 32-bit address *)
ELSE
IF OperandSize = 32 AND AddressSize = 16
THEN
r32 := Truncate_to_16bits(Addr(m));
ELSE
IF OperandSize = 32 AND AddressSize = 32
THEN r32 := Addr(m);
FI;
FI;
FI;
FI;
</PRE>
<H2>Description</H2>
LEA calculates the effective address (offset part) and stores it in the
specified register. The operand-size attribute of the instruction
(represented by OperandSize in the algorithm under "Operation" above) is
determined by the chosen register. The address-size attribute (represented
by AddressSize) is determined by the USE attribute of the segment containing
the second operand. The address-size and operand-size attributes affect the
action performed by LEA, as follows:
<PRE>
Operand Size Address Size Action Performed
16 16 16-bit effective address is calculated and
stored in requested 16-bit register
destination.
16 32 32-bit effective address is calculated. The
lower 16 bits of the address are stored in
the requested 16-bit register destination.
32 16 16-bit effective address is calculated. The
16-bit address is zero-extended and stored
in the requested 32-bit register destination.
32 32 32-bit effective address is calculated and
stored in the requested 32-bit register
destination.
</PRE>
<H2>Flags Affected</H2>
None
<H2>Protected Mode Exceptions</H2>
#UD if the second operand is a register
<H2>Real Address Mode Exceptions</H2>
Interrupt 6 if the second operand is a register
<H2>Virtual 8086 Mode Exceptions</H2>
Same exceptions as in Real Address Mode
<P>
<HR>
<P>
<B>up:</B> <A HREF="c17.htm">
Chapter 17 -- 80386 Instruction Set</A><BR>
<B>prev:</B><A HREF="LAR.htm"> LAR Load Access Rights Byte</A><BR>
<B>next:</B><A HREF="LEAVE.htm"> LEAVE High Level Procedure Exit</A>
</BODY>