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 :

[codesyntax lang=”asm” lines=”normal”]

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

[/codesyntax]

Screen shots :-

Asm_program_Procedure_Bit_Return3

After Execution :-

Asm_program_Procedure_Bit_Return3_Output