1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
4 <TITLE>80386 Programmer's Reference Manual -- Opcode CBW
</TITLE>
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>
14 <H1>CBW/CWDE -- Convert Byte to Word/Convert Word to Doubleword
</H1>
17 Opcode Instruction Clocks Description
19 98 CBW
3 AX := sign-extend of AL
20 98 CWDE
3 EAX := sign-extend of AX
26 IF OperandSize =
16 (* instruction = CBW *)
27 THEN AX := SignExtend(AL);
28 ELSE (* OperandSize =
32, instruction = CWDE *)
29 EAX := SignExtend(AX);
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>
45 <H2>Protected Mode Exceptions
</H2>
49 <H2>Real Address Mode Exceptions
</H2>
53 <H2>Virtual
8086 Mode Exceptions
</H2>
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>