Module 2.2 - Instruction Set - Addl Instrs
Module 2.2 - Instruction Set - Addl Instrs
Module-II
Microprocessors & Microcontrollers
Dr. M Suresh
School of Electrical & Electronics Engineering
VIT BHOPAL UNIVERSITY
XLAT can perform a byte translation using look-up table containing up to 256 elements
XLAT assumes that, the 256-byte table start at the address given by DS:BX and AL is used
as the index to point to the required element in the table prior to the execution of
VIT BHOPAL UNIVERSITY
XLAT.
Syntax: DAA
Meaning: This instruction is used to convert the result [of AL] of the
VIT BHOPAL UNIVERSITY
8086 allows to add the ASCII codes for two decimal digits without masking off the “3” in
the upper nibble of each. After the addition, AAA instruction is used to make sure
that the result is correct unpacked BCD
Syntax: AAA
Meaning: This instruction is used to convert the result [of AL] of the addition of two
ASCII numbers and represent the result in unpacked BCD numbers in AX
This instruction MUST be followed by addition operation & the result has to be only in
AL [i.e. in the addition instruction, destination operand MUST be AL]
If AF=1 [carry transfer from D3 to D4] then, AH is loaded with 01H and clears the
higher nibble of AL [lower nibble is converted to decimal]
If AF=0 [carry transfer from D3 to D4] then, AH is loaded with 00H and clears the
higher nibble of AL
Example: AAA
4.4.1 LOOP
VIT BHOPAL UNIVERSITY
JNZ BACK
4.4 Iteration Control Instructions
JNZ BACK
MOV CX,n
MOV AX,0000H
L1: ADD AX, CX
LOOP L1
VIT BHOPAL UNIVERSITY
4.4 Iteration Control Instructions
1.Pushes the content of the flag register onto the stack to preserve the
status of IF and TF flags, by decrementing the stack pointer (SP) by 2
Executes ISR
Push CS and IP
Interrupt program
Interr Load CS and IP
:
upt :
Pop IP and CS :
Pop flags :
register :
IRET
:
VIT BHOPAL UNIVERSITY
4.5 Interrupt Instructions
CS = 0000H
IP = type*4 = 0000H
PA is = CS x 10H + IP = 0000H x 10H + 0000H = 00000H
CS = 0000H
IP = type*4 = 01H x 4 = 0004H
PA is = CS x 10H + IP = 0000H x 10H + 0004H = 00004H
Used for executing the program in single step mode by setting trap flag.
repeat
REP CX=0 CX=! 0
REPE / REPZ CX=0 and ZF=0 CX=! 0 and ZF=1
REPNE / REPNZ CX=0 and ZF=1 CX=! 0 and ZF=0
Example: String scan
Q: you need to scan a string to search existence of 10H and you
need to identify how many times 10H present in the string.
VIT BHOPAL UNIVERSITY
VIT BHOPAL UNIVERSITY