Files
oldlinux-files/Ref-docs/manual Intel386/I386Manual/POPA.HTM
2024-02-19 00:21:47 -05:00

69 lines
3.0 KiB
HTML

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>80386 Programmer's Reference Manual -- Opcode POPA</title>
</head>
<body>
<b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="POP.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/POP.HTM"> POP Pop a Word from the Stack</a><br>
<b>next:</b><a href="POPF.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/POPF.HTM"> POPF/POPFD Pop Stack into FLAGS or EFLAGS Register</a>
<p>
<hr>
<p>
<h1>POPA/POPAD -- Pop all General Registers</h1>
<pre>
Opcode Instruction Clocks Description
61 POPA 24 Pop DI, SI, BP, SP, BX, DX, CX, and AX
61 POPAD 24 Pop EDI, ESI, EBP, ESP, EDX, ECX, and EAX
</pre>
<h2>Operation</h2>
<pre>
IF OperandSize = 16 (* instruction = POPA *)
THEN
DI := Pop();
SI := Pop();
BP := Pop();
throwaway := Pop (); (* Skip SP *)
BX := Pop();
DX := Pop();
CX := Pop();
AX := Pop();
ELSE (* OperandSize = 32, instruction = POPAD *)
EDI := Pop();
ESI := Pop();
EBP := Pop();
throwaway := Pop (); (* Skip ESP *)
EBX := Pop();
EDX := Pop();
ECX := Pop();
EAX := Pop();
FI;
</pre>
<h2>Description</h2>
POPA pops the eight 16-bit general registers. However, the SP value is discarded instead of loaded into SP. POPA reverses a previous <a href="PUSHA.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/PUSHA.HTM">PUSHA</a>, restoring the general registers to their values before <a href="PUSHA.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/PUSHA.HTM">PUSHA</a> was executed. The first register popped is DI.
<p>POPAD pops the eight 32-bit general registers. The ESP value is discarded instead of loaded into ESP. POPAD reverses the previous <a href="PUSHA.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/PUSHA.HTM">PUSHAD</a>, restoring the general registers to their values before <a href="PUSHA.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/PUSHA.HTM">PUSHAD</a> was executed. The first register popped is EDI.
<h2>Flags Affected</h2>
None
<h2>Protected Mode Exceptions</h2>
#SS(0) if the starting or ending stack address is not within the stack segment; #PF(fault-code) for a page fault
<h2>Real Address Mode Exceptions</h2>
Interrupt 13 if any part of the operand would lie outside of the effective address space from 0 to 0FFFFH
<h2>Virtual 8086 Mode Exceptions</h2>
Same exceptions as in real-address mode; #PF(fault-code) for a page fault
<p>
<hr>
<p><b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="POP.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/POP.HTM"> POP Pop a Word from the Stack</a><br>
<b>next:</b><a href="POPF.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/POPF.HTM"> POPF/POPFD Pop Stack into FLAGS or EFLAGS Register</a>
</body>