Instruction Set
4-24
CBW
Convert Byte Integer to Word
CBW
What It Does
CBW converts an 8-bit integer to a sign-extended 16-bit integer.
Syntax
Description
CBW converts the signed byte in the AL register to a signed word in the AX register by
extending the most significant bit of the AL register (the sign bit) into all of the bits of the
AH register.
Operation It Performs
Flag Settings After Instruction
Examples
This example converts an 8-bit integer to its 16-bit equivalent before adding it to another
16-bit integer.
Form
Opcode
Description
Clocks
Am186 Am188
CBW
98
Put signed extension of AL in AX
2
2
CBW
/* extend sign of AL to AX */
if (AL < 0)
AH = 0xFF;
else
AH = 0x00;
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
IF TF SF ZF
AF
PF
CF
? = undefined; – = unchanged
–
–
–
–
–
– res – res – res –
SADDEND1
DB
-106
; 96h
SADDEND2
DW
25000
; 61A8h
; add word integer to byte integer
MOV
AL,SADDEND1
; AL = 96h = -106
CBW
; AX = FF96h = -106
ADD
AX,SADDEND2
; AX = 613Eh = 24894
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...