* better
[mascara-docs.git] / hw / i386.reference / CBW.htm
blob47ffab11bfafe96bb694e78e5fb42723fc6ef05f
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode CBW</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="c17.htm">
8 Chapter 17 -- 80386 Instruction Set</A><BR>
9 <B>prev:</B><A HREF="CALL.htm"> CALL Call Procedure</A><BR>
10 <B>next:</B><A HREF="CLC.htm"> CLC Clear Carry Flag</A>
11 <P>
12 <HR>
13 <P>
14 <H1>CBW/CWDE -- Convert Byte to Word/Convert Word to Doubleword</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 98 CBW 3 AX := sign-extend of AL
20 98 CWDE 3 EAX := sign-extend of AX
21 </PRE>
23 <H2>Operation</H2>
25 <PRE>
26 IF OperandSize = 16 (* instruction = CBW *)
27 THEN AX := SignExtend(AL);
28 ELSE (* OperandSize = 32, instruction = CWDE *)
29 EAX := SignExtend(AX);
30 FI;
31 </PRE>
33 <H2>Description</H2>
35 CBW converts the signed byte in AL to a signed word in AX by extending the
36 most significant bit of AL (the sign bit) into all of the bits of AH. CWDE
37 converts the signed word in AX to a doubleword in EAX by extending the most
38 significant bit of AX into the two most significant bytes of EAX. Note that
39 CWDE is different from CWD. CWD uses DX:AX rather than EAX as a destination.
41 <H2>Flags Affected</H2>
43 None
45 <H2>Protected Mode Exceptions</H2>
47 None
49 <H2>Real Address Mode Exceptions</H2>
51 None
53 <H2>Virtual 8086 Mode Exceptions</H2>
55 None
58 <P>
59 <HR>
60 <P>
61 <B>up:</B> <A HREF="c17.htm">
62 Chapter 17 -- 80386 Instruction Set</A><BR>
63 <B>prev:</B><A HREF="CALL.htm"> CALL Call Procedure</A><BR>
64 <B>next:</B><A HREF="CLC.htm"> CLC Clear Carry Flag</A>
65 </BODY>