An assembly near procedure which converts the packed BCDdigits to equivalent binary number – IGNOU MCA Assignment 2017 – 18

By | December 11, 2017

MASTER OF COMPUTER APPLICATIONS

Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(1)/L-017/Assignment/17-18
Maximum Marks : 50
Weightage : 25%

Write a program in 8086 assembly Language that passes a byte containing two packed BCD digits, as parameter to anear procedure named TOBINARY, which converts the packed BCDdigits to equivalent binary number. This binary number is returned tothe calling assembly program – IGNOU MCA Assignment 2017 – 18

Code:-

DATA SEGMENT
PACKEDBCD DB 52H
BINARY DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX

MOV AH,0
MOV AL,PACKEDBCD

CALL TOBINARY

MOV BINARY,AL

MOV AH,4CH
INT 21H
CODE ENDS

TOBINARY PROC NEAR

MOV BL,AL

AND AL,0F0H
AND BL,0FH

MOV CL,04H
ROL AL,CL

MOV CL,10
MUL CL

ADD AL,BL
RET
TOBINARY ENDP

END START

DATA SEGMENT
PACKEDBCD DB 52H
BINARY DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AH,0
MOV AL,PACKEDBCD
CALL TOBINARY
MOV BINARY,AL
MOV AH,4CH
INT 21H
CODE ENDS
TOBINARY PROC NEAR
MOV BL,AL
AND AL,0F0H
AND BL,0FH
MOV CL,04H
ROL AL,CL
MOV CL,10
MUL CL
ADD AL,BL
RET
TOBINARY ENDP
END START

Screen Shots :-

Asm_program_Proc_Packed_BCD_to_Binary

Before Execution :-

Asm_program_Proc_Packed_BCD_to_Binary_v1

After Execution :-

Asm_program_Proc_Packed_BCD_to_Binary_v2

Note :- To see the variable and its value you have to click vars button in the emulator.