An Assembly language program convert 2 digit ASCII to binary – IGNOU MCA Assignment 2014 – 15

By | July 22, 2014

BACHELOR OF COMPUTER APPLICATIONS
Course Code : BCSL-022
Course Title : Assembly Language Programming Lab
Assignment Number : BCA(II)/BCSL022/Assign/14-15
Maximum Marks : 50
Weightage : 25%

 

Write and run an assembly language program that accepts a two digit input from the keyboard, and convert this two digit ASCII to equivalent binary value. The output should be stored in the AL register.

 

DATA SEGMENT
MSG DB 10,13,’ENTER 2 DIGIT NUMBER : $’
ASC1 DB ?
ASC2 DB ?
BIN DB ?
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX

LEA DX,MSG
MOV AH,9H
INT 21H

MOV AH,1
INT 21H
MOV ASC1,AL
SUB AL,30H
MOV BL,AL

MOV AH,1
INT 21H
MOV ASC2,AL
SUB AL,30H

MOV CL,04H
ROL BL,CL
OR AL,BL

MOV BIN,AL

MOV AH,4CH
INT 21H
CODE ENDS

END START

Program Code :

  1. DATA SEGMENT
  2. MSG DB 10,13,'ENTER 2 DIGIT NUMBER : $'
  3. ASC1 DB ?
  4. ASC2 DB ?
  5. BIN DB ?
  6. DATA ENDS
  7. CODE SEGMENT
  8. ASSUME DS:DATA,CS:CODE
  9. START:
  10. MOV AX,DATA
  11. MOV DS,AX
  12. LEA DX,MSG
  13. MOV AH,9H
  14. INT 21H
  15. MOV AH,1
  16. INT 21H
  17. MOV ASC1,AL
  18. SUB AL,30H
  19. MOV BL,AL
  20. MOV AH,1
  21. INT 21H
  22. MOV ASC2,AL
  23. SUB AL,30H
  24. MOV CL,04H
  25. ROL BL,CL
  26. OR AL,BL
  27. MOV BIN,AL
  28. MOV AH,4CH
  29. INT 21H
  30. CODE ENDS
  31. END START

Screen shots :-

 Asm_program_Ascii _2digit_To_Binary

Before Execution :-

 Asm_program_Ascii _2digit_To_Binary_v1

After Execution :-

Asm_program_Ascii _2digit_To_Binary_v2

Leave a Reply