Experiment 3
Experiment 3
80x86 systems usually deals with packed BCD, however in case needed developers can
easily write a program to convert packed BCD to unpacked BCD.
Experiment:
Assume that we have two BCD vectors v1 stored in memory starting from 1200h and v2
stored in memory 1220h.
Step1 Calculate v3
v3=v1+v2
Then store v3 in memory starting from 1300h. Make sure that v3 is a BCD numbers.
Step2
Convert v3 to hexadecimal vector v4 and store it in memory location 1320h.
To convert BCD to hexadecimal use this method
Hexadecimal = BCD_high * 10 + BCD_low.
Assembly Program
MOV CX, 0009H;
MOV BX, 0000h
L1:
MOV SI, 1200h; equivalent to LEA SI, vect1
MOV AL, [BX+SI];
MOV SI, 1220h; equivalent to LEA SI, vect2
ADD AL, [BX+SI];
DAA;
MOV DI, 1300H; equivalent to LEA DI, vect3
MOV [BX+DI] AL;
Discussion:
1- The program in this experiment did not treat the case of adding 52 and 71 correctly. Do the
required to fix this issue and rewrite the program and test it using emu8086 software;
2- Discuss result of adding 99 to 61.