Instruction Set
4-18
AND
AND
Examples
This example converts an ASCII number to its unpacked decimal equivalent.
This example extracts the middle byte of a word so it can be used by another instruction.
Tips
To convert an ASCII number (30–39h) to its unpacked decimal equivalent, use AND with
a mask of 0Fh to clear the bits in the high nibble of the byte.
Related Instructions
If you want to
See
Toggle all bits of a component
NOT
Set particular bits of a component to 1
OR
Toggle particular bits of a component
XOR
BCD_MASK
EQU
0Fh
; ASCII-to-decimal mask
ASCII_NUM
DB
36h
; ASCII ’6’
; convert ASCII number to decimal
MOV
AL,ASCII_NUM
; AL = 36h = ASCII ”6”
AND
AL,BCD_MASK
; AL = 06h = decimal 6
SETTINGS
DW
1234h
; extract middle byte of AX and place in AH
MOV
AX,SETTINGS
; AX = 1234h
AND
AX,0FF0h
; mask middle byte: AX = 0230h
SHL
AX,4
; shift middle byte into AH: AX = 2300h
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...