0
13kviews
Write 8086 assembly language program to convert two digit packed BCD number to unpacked BCD number.
1 Answer
0
693views

Let packed BCD no $\rightarrow$ unpacked BCD no

47 $\rightarrow$ 04 (upper byte) 07 (Lower byte)

ALP to covert two digit packed

BCD no eq $47_{BCD}$ into

Unpkd BCD number $04 \ 07$.

Data Segment

PKDBCDNO dB 47

UnPKD HB DB ?

UnPKDLB DB ?

Data Ends

Code Segment

Assume CS : Code, DS : data

Start : MOV AX, Data ;

MOV DS, AX ; initdata seg

MOV AL , PKDBCDMO ; AL $\leftarrow$  47

AND AL, OFH ; AL $\leftarrow$  07

MOV UNPKDLB, AL ; UNPKDLB = 07

MOV AL, PKDBCDNO ; AL $\leftarrow$  47

AND AL, F0H ; AL $\leftarrow$  40

MOV CL, 04H ; init Count

SHR AL, CL ; Shift logically

Right AL $\leftarrow$  04

MOV UNPKDHB , AL , UNPKD HB = 04

MOV AH 1 , 4CH ; 

INT 21H Terminate program 

Code ends

End start

End.

In above program we get unpkd BCD value in the variables.

UNPKDHB = 04

UNPKD LB = 07.

Please log in to add an answer.