Files
2024-02-19 00:25:23 -05:00

52 lines
2.4 KiB
HTML

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>80386 Programmer's Reference Manual -- Opcode NEG</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="MUL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/MUL.HTM"> MUL Unsigned Multiplication of AL or AX</a><br>
<b>next:</b><a href="NOP.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/NOP.HTM"> NOP No Operation</a>
<p>
<hr>
<p>
<h1>NEG -- Two's Complement Negation</h1>
<pre>
Opcode Instruction Clocks Description
F6 /3 NEG r/m8 2/6 Two's complement negate r/m byte
F7 /3 NEG r/m16 2/6 Two's complement negate r/m word
F7 /3 NEG r/m32 2/6 Two's complement negate r/m dword
</pre>
<h2>Operation</h2>
<pre>
IF r/m = 0 THEN CF := 0 ELSE CF := 1; FI;
r/m := - r/m;
</pre>
<h2>Description</h2>
NEG replaces the value of a register or memory operand with its two's complement. The operand is subtracted from zero, and the result is placed in the operand.
<p>The carry flag is set to 1, unless the operand is zero, in which case the carry flag is cleared to 0.
<h2>Flags Affected</h2>
CF as described above; OF, SF, ZF, and PF as described in <a href="APPC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/APPC.HTM">Appendix C</a>
<h2>Protected Mode Exceptions</h2>
#GP(0) if the result is in a nonwritable segment; #GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS 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="MUL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/MUL.HTM"> MUL Unsigned Multiplication of AL or AX</a><br>
<b>next:</b><a href="NOP.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/NOP.HTM"> NOP No Operation</a>
</body>