⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s03_01.htm

📁 Programmer s Reference Manual is an improtant book on Intel processor architecture and programming.
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><HTML><HEAD><TITLE>80386 Programmer's Reference Manual -- Section 3.1</TITLE></HEAD><BODY><B>up:</B> <A HREF="c03.htm">Chapter 3 -- Applications Instruction Set</A><BR><B>prev:</B><A HREF="c03.htm">Chapter 3 -- Applications Instruction Set</A><BR> <B>next:</B> <A HREF="s03_02.htm">3.2  Binary Arithmetic Instructions</A><P><HR><P><H1>3.1  Data Movement Instructions</H1>These instructions provide convenient methods for moving bytes, words, ordoublewords of data between memory and the registers of the basearchitecture. They fall into the following classes:<OL><LI>General-purpose data movement instructions.<LI>Stack manipulation instructions.<LI>Type-conversion instructions.</OL><H2>3.1.1  General-Purpose Data Movement Instructions</H2><A HREF="MOV.htm">MOV</A> (Move) transfers a byte, word, or doubleword from the source operand tothe destination operand. The <A HREF="MOV.htm">MOV</A> instruction is useful for transferring dataalong any of these pathsThere are also variants of <A HREF="MOV.htm">MOV</A> that operate on segment registers.  Theseare covered in a later section of this chapter:<UL><LI> To a register from memory<LI> To memory from a register<LI> Between general registers<LI> Immediate data to a register<LI> Immediate data to a memory</UL>The <A HREF="MOV.htm">MOV</A> instruction cannot move from memory to memory or from segmentregister to segment register are not allowed. Memory-to-memory moves can beperformed, however, by the string move instruction <A HREF="MOVS.htm">MOVS</A>.<P><A HREF="XCHG.htm">XCHG</A> (Exchange) swaps the contents of two operands. This instruction takesthe place of three <A HREF="MOV.htm">MOV</A> instructions. It does not require a temporarylocation to save the contents of one operand while load the other is beingloaded. <A HREF="XCHG.htm">XCHG</A> is especially useful for implementing semaphores or similardata structures for process synchronization.<P>The <A HREF="XCHG.htm">XCHG</A> instruction can swap two byte operands, two word operands, or twodoubleword operands. The operands for the <A HREF="XCHG.htm">XCHG</A> instruction may be tworegister operands, or a register operand with a memory operand. When usedwith a memory operand, <A HREF="XCHG.htm">XCHG</A> automatically activates the <A HREF="LOCK.htm">LOCK</A> signal. (Refer to <A HREF="c11.htm">Chapter 11</A>   for more information on the bus lock. )<H2>3.1.2  Stack Manipulation Instructions</H2><A HREF="PUSH.htm">PUSH</A> (Push) decrements the stack pointer (ESP), then transfers the sourceoperand to the top of stack indicated by ESP (see <A HREF="#fig3-1">Figure 3-1</A>). <A HREF="PUSH.htm">PUSH</A> isoften used to place parameters on the stack before calling a procedure; itis also the basic means of storing temporary variables on the stack. The<A HREF="PUSH.htm">PUSH</A> instruction operates on memory operands, immediate operands, and register operands (including segment registers).<P><A HREF="PUSHA.htm">PUSHA</A> (Push All Registers) saves the contents of the eight generalregisters on the stack (see <A HREF="#fig3-2">Figure 3-2</A>). This instruction simplifiesprocedure calls by reducing the number of instructions required to retainthe contents of the general registers for use in a procedure. The processorpushes the general registers on the stack in the following order: EAX, ECX,EDX, EBX, the initial value of ESP before EAX was pushed, EBP, ESI, andEDI. <A HREF="PUSHA.htm">PUSHA</A> is complemented by the <A HREF="POPA.htm">POPA</A> instruction.<P><A HREF="POP.htm">POP</A> (Pop) transfers the word or doubleword at the current top of stack(indicated by ESP) to the destination operand, and then increments ESP topoint to the new top of stack. See <A HREF="#fig3-3">Figure 3-3</A>. <A HREF="POP.htm">POP</A> moves information fromthe stack to a general register, or to memoryThere are also a variant of <A HREF="POP.htm">POP</A> that operates on segment registers. Thisis covered in a later section of this chapter.<P><A HREF="POPA.htm">POPA</A> (Pop All Registers) restores the registers saved on the stack by<A HREF="PUSHA.htm">PUSHA</A>, except that it ignores the saved value of ESP. See <A HREF="#fig3-4">Figure 3-4</A>.<P><A NAME="fig3-1"><IMG align=center SRC="fig3-1.gif" border=0><P><HR><P><A NAME="fig3-2"><IMG align=center SRC="fig3-2.gif" border=0><P><H2>3.1.3  Type Conversion Instructions</H2>The type conversion instructions convert bytes into words, words intodoublewords, and doublewords into 64-bit items (quad-words). Theseinstructions are especially useful for converting signed integers, becausethey automatically fill the extra bits of the larger item with the value ofthe sign bit of the smaller item. This kind of conversion, illustrated by<A HREF="#fig3-5">Figure 3-5</A>, is called sign extension.<P>There are two classes of type conversion instructions:<OL><LI>The forms <A HREF="CWD.htm">CWD</A>, <A HREF="CWD.htm">CDQ</A>, <A HREF="CBW.htm">CBW</A>, and <A HREF="CBW.htm">CWDE</A> which operate only on data in the EAX register.<LI>The forms <A HREF="MOVSX.htm">MOVSX</A> and <A HREF="MOVZX.htm">MOVZX</A>, which permit one operand to be in anygeneral register while permitting the other operand to be in memory orin a register.</OL><A HREF="CWD.htm">CWD</A> (Convert Word to Doubleword) and <A HREF="CWD.htm">CDQ</A> (Convert Doubleword to Quad-Word)double the size of the source operand. <A HREF="CWD.htm">CWD</A> extends the sign of theword in register AX throughout register DX. <A HREF="CWD.htm">CDQ</A> extends the sign of thedoubleword in EAX throughout EDX. <A HREF="CWD.htm">CWD</A> can be used to produce a doubleworddividend from a word before a word division, and <A HREF="CWD.htm">CDQ</A> can be used to producea quad-word dividend from a doubleword before doubleword division.<P><A HREF="CBW.htm">CBW</A> (Convert Byte to Word) extends the sign of the byte in register ALthroughout AX.<P><A HREF="CBW.htm">CWDE</A> (Convert Word to Doubleword Extended) extends the sign of the word inregister AX throughout EAX.<P><A HREF="MOVSX.htm">MOVSX</A> (Move with Sign Extension) sign-extends an 8-bit value to a 16-bitvalue and a 8- or 16-bit value to 32-bit value.<P><A HREF="MOVZX.htm">MOVZX</A> (Move with Zero Extension) extends an 8-bit value to a 16-bit valueand an 8- or 16-bit value to 32-bit value by inserting high-order zeros.<P><A NAME="fig3-3"><IMG align=center SRC="fig3-3.gif" border=0><P><HR><P><A NAME="fig3-4"><IMG align=center SRC="fig3-4.gif" border=0><P><HR><P><A NAME="fig3-5"><IMG align=center SRC="fig3-5.gif" border=0><P><HR><P><B>up:</B> <A HREF="c03.htm">Chapter 3 -- Applications Instruction Set</A><BR><B>prev:</B> <A HREF="c03.htm">Chapter 3 -- Applications Instruction Set</A><BR> <B>next:</B> <A HREF="s03_02.htm">3.2  Binary Arithmetic Instructions</A></BODY>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -