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

53 lines
2.0 KiB
HTML

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>80386 Programmer's Reference Manual -- Opcode CBW</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="CALL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CALL.HTM"> CALL Call Procedure</a><br>
<b>next:</b><a href="CLC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CLC.HTM"> CLC Clear Carry Flag</a>
<p>
<hr>
<p>
<h1>CBW/CWDE -- Convert Byte to Word/Convert Word to Doubleword</h1>
<pre>
Opcode Instruction Clocks Description
98 CBW 3 AX := sign-extend of AL
98 CWDE 3 EAX := sign-extend of AX
</pre>
<h2>Operation</h2>
<pre>
IF OperandSize = 16 (* instruction = CBW *)
THEN AX := SignExtend(AL);
ELSE (* OperandSize = 32, instruction = CWDE *)
EAX := SignExtend(AX);
FI;
</pre>
<h2>Description</h2>
CBW converts the signed byte in AL to a signed word in AX by extending the most significant bit of AL (the sign bit) into all of the bits of AH. CWDE converts the signed word in AX to a doubleword in EAX by extending the most significant bit of AX into the two most significant bytes of EAX. Note that CWDE is different from CWD. CWD uses DX:AX rather than EAX as a destination.
<h2>Flags Affected</h2>
None
<h2>Protected Mode Exceptions</h2>
None
<h2>Real Address Mode Exceptions</h2>
None
<h2>Virtual 8086 Mode Exceptions</h2>
None
<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="CALL.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CALL.HTM"> CALL Call Procedure</a><br>
<b>next:</b><a href="CLC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CLC.HTM"> CLC Clear Carry Flag</a>
</body>