You are on page 1of 4

Register No.

: 20BCE1734 Name: Mridul Jadon

Date: 25-02-2022 Exp.6 Code Converters

Aim:

To perform the Code conversions from given values using 8086 processor by
MASM 611 assembler.
Tool Used:

Assembler - MASM 611 Algorithm:


i) BCD to ASCII conversion:

a) Start

b) As usually, moved the data to accumulator and accumulator to data segment.

c) Take the value in AL and copy to AH also.

d) And operation of AL with 0FH.

e) Extract the last number – Rotate right the number 4 times and do AND operation to it with
0F

f) Add the AX with 3030H or add 30H individually to AH and AL. g) End ii) BCD to Hexadecimal

conversion:

a) Start

b) Moved the data to accumulator and accumulator to data segment.

c) Move the BCD value to AX register and perform AND operation with 0FH.

d) Move the value of AX to BX. And again, load the AX with the same BCD number.

e) Now, again perform AND operation with 0F0H.

f) Do ROR operation 4 times to get 10th digits place value.

g) Store the CX register with 0AH (10) value and multiply with AX.

h) Add the value stored in BX register with AX

i) Hence the result stored in AX.

j) End.

Program:

i) BCD to ASCII conversion:


Register No.: 20BCE1734 Name: Mridul Jadon

ii) BCD to Hexadecimal conversion:

Procedure:

1. Mount c c:\masm611\
2. c:
3. bin
Register No.: 20BCE1734 Name: Mridul Jadon

4. edit file_name.asm
5. masm file_name.asm
6. link file_name.obj
7. debug file_name.exe

Sample Input:

i) BCD to ASCII conversion: Given

BCD = 12 ii) BCD to Hexadecimal

conversion:

Given BCD = 27 Sample

Output:

i) BCD to ASCII conversion:

Converted ASCII = 3132 ii) BCD to

Hexadecimal conversion:

Converted HEX = 001B Register/

Memory Contents for I/O:

i) BCD to ASCII conversion: ROR

operation: AX = 5 During

Conversion: AX = 12 ii) BCD to

Hexadecimal conversion: ROR

operation: AX = 5

During Conversion: AX = 27
Snapshot of the Output:

i) BCD to ASCII conversion:


Register No.: 20BCE1734 Name: Mridul Jadon

ii) BCD to Hexadecimal conversion:

Result:

Hence, we converted BCD to ASCII & HEX based on given data and verified
using MASM application using DOSBOX.

You might also like