
510 THE x86 MICROPROCESSORS
MOV AX, [ESI] ;AX = 0560H
BSR BX, AX ;BX = 000AH meaning that D10 = 1
BSF CX, AX ;CX = 0005 meaning that D5 = 1
END STRT
15.4.3 | MOVSX and MOVZX Instructions
Two other new and useful instructions are the MOVSX and MOVZX instructions. In MOVSX,
the sign bit of a register (or memory) can be extended to any register. MOVZX zero extends the
contents of a register or memory location. e MOVSX instruction is used for signed arithme-
tic and MOVZX for unsigned arithmetic.
Example 15.5
.386
.MODEL FLAT, STDCALL
.CODE
DAT1 DW −269
DAT2 DB 56
DAT3 DB − 123
STRT: MOV AX, DAT1 ;AX = FEF3H
MOVSX ECX, AX ;ECX = FFFFFEF3H ...