A near procedure assembly Language program to convert ASCII to binary – IGNOU MCA Assignment 2013

By | April 15, 2014

BACHELOR  OF COMPUTER APPLICATIONS
Course Code : BCSL-022
Course Title : Assembly Language Programming Lab
Assignment Number : BCA(II)/BCSL022/Assign/13

 

Write and run (using appropriate calling program) a near procedure in assembly language that converts an ASCII digit passed to it on AL register to equivalent binary value. The value is returned back on the AL register itself

 

DATA SEGMENT
MSG1 DB 10,13,”ENTER ANY ASCII VALUE : $”
BIN  DB ?
DATA ENDS

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

LEA DX,MSG1
MOV AH,9
INT 21H

CALL PRINT_AL

MOV AH,4CH
INT 21H
CODE ENDS

PRINT_AL PROC NEAR

MOV AH,1
INT 21H

SUB AL,30H
MOV BIN,AL

RET
PRINT_AL ENDP
END START

 

 

program code :

  1. DATA SEGMENT
  2. MSG1 DB 10,13,"ENTER ANY ASCII VALUE : $"
  3. BIN  DB ?
  4. DATA ENDS
  5. CODE SEGMENT
  6. ASSUME DS:DATA,CS:CODE
  7. START:
  8. MOV AX,DATA
  9. MOV DS,AX
  10. LEA DX,MSG1
  11. MOV AH,9
  12. INT 21H
  13. CALL PRINT_AL
  14. MOV AH,4CH
  15. INT 21H
  16. CODE ENDS
  17. PRINT_AL PROC NEAR
  18. MOV AH,1
  19. INT 21H
  20. SUB AL,30H
  21. MOV BIN,AL
  22. RET
  23. PRINT_AL ENDP
  24. END START

Screen shots :-

Asm_program_Proc_AL_2_Bin

Output :-

Asm_program_Proc_AL_2_Bin_Var1

Asm_program_Proc_AL_2_Bin_Input

Asm_program_Proc_AL_2_Bin_Var2

Leave a Reply