A procedure in Assembly Language program that receives Alphabet ‘Z’ returns 1 or 0 – IGNOU MCA Assignment 2015-16

By | August 15, 2015

 MASTER OF COMPUTER APPLICATIONS

Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA(1)/012/Assign/2015-16
Maximum Marks : 100
Weightage : 25%

 

Write a simple near procedure in 8086 assembly language that receives an ASCII digit as parameter. It returns 1 if the ASCII digit is ‘Z’ else it returns 0. Make suitable assumptions, if any.

DATA SEGMENT
MSG1 DB “ENTER ALPHABET ‘Z’ : $”
MSG2 DB 10,13,”BIT RETURNED IS : $”
DATA ENDS

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

LEA DX,MSG1
MOV AH,9
INT 21H

MOV AH,1
INT 21H
MOV BL,AL

LEA DX,MSG2
MOV AH,9
INT 21H

CALL CHECK

ADD DL,30H
MOV AH,2
INT 21H

MOV AH,4CH
INT 21H
CODE ENDS

CHECK PROC NEAR

CMP BL,’Z’
JNE SKIP

MOV DL,1
JMP DONE
SKIP:
MOV DL,0
DONE:
RET
CHECK ENDP

END START

program code :

  1. DATA SEGMENT
  2. MSG1 DB "ENTER ALPHABET 'Z' : $"
  3. MSG2 DB 10,13,"BIT RETURNED IS : $"
  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. MOV AH,1
  14. INT 21H
  15. MOV BL,AL
  16. LEA DX,MSG2
  17. MOV AH,9
  18. INT 21H
  19. CALL CHECK
  20. ADD DL,30H
  21. MOV AH,2
  22. INT 21H
  23. MOV AH,4CH
  24. INT 21H
  25. CODE ENDS
  26. CHECK PROC NEAR
  27. CMP BL,'Z'
  28. JNE SKIP
  29. MOV DL,1
  30. JMP DONE
  31. SKIP:
  32. MOV DL,0
  33. DONE:
  34. RET
  35. CHECK ENDP
  36. END START

Screen shots :-

Asm_program_Procedure_Bit_Return3

After Execution :-

Asm_program_Procedure_Bit_Return3_Output