AngoLinux

80386 Programmer's Reference Manual -- Opcode CBW


CBW/CWDE -- Convert Byte to Word/Convert Word to Doubleword

OpcodeInstructionClocks DescriptionExample
98cbw 3 AX := sign-extend of ALcbw
98cwde 3 EAX := sign-extend of AXcwde

Operation




IF OperandSize = 16 (* instruction = CBW *)
THEN AX := SignExtend(AL);
ELSE (* OperandSize = 32, instruction = CWDE *)
   EAX := SignExtend(AX);
FI;

Description

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.

Flags Affected

None

Protected Mode Exceptions

None

Real Address Mode Exceptions

None

Virtual 8086 Mode Exceptions

None


[Home Page dell'ITIS "Fermi"] [80386 Programmer's Reference Manual Index] [Previous] [Next]