Question

Write and run (using appropriate calling program) a near procedure in 8086-assembly language, which is passed a single parameter by the calling program. The procedure checks if the input parameter is divisible by 5 or not. If the input parameter is divisible by 5, then a value of 1 is returned to the calling program, else a value 0 is returned. The calling program based on the returned value prints “Divisible” or “NOT Divisible”. You may assume that the parameter value would always be greater than or equal to 1. Make and state suitable assumptions, if any.

15 Sep 2022
Answer :
Word Count : 384

code for the procedure in 8086 assembly language:

 

DivBy5 PROC NEAR

MOV AX, [BP + 4] ; Load the input parameter into AX

CMP AX, 0 ; Check if the input is zero or not

JE Exit ; If zero, jump to exit

MOV DX, 0 ; Clear DX register

DIV 5 ; Divide the input parameter by 5

CMP DX, 0 ; Check if there is any remainder

JNE NotDivisible ; If there is a remainder, jump to NotDivisible

MOV AX, 1 ; If the input parameter is divisible by 5, load 1 into AX

JMP Exit ; Jump to Exit

 

NotDivisible:

MOV AX, 0 ; If the input parameter is not divisible by 5, load 0 into AX

 

Exit:

RET 2 ; Return the result to the calling program and restore the stack pointer

DivBy5 ENDP

And

_______ ______ ____ ____ _______.
___ _________ _______ _________ __________ _____ _____ __________ _________.
_____ __________ ________ __________ ________ _______ ___ _______ ______ ___ ________.
________ __________ ______ __________ ________ ___ ______.
_____ ____ ________ ________ _________ __________ _________ _______ _________ ____.
___ _________ ____ ______ _______.
__________ ______ _______ _________ _________.
_____ __________ ________ __________ ________ _______ ___ _________ ____ _____ __________.
____ ________ _________ _________ _______.
___ _____ ________ ___ ______ __________ ______ ________ ________ ___ _______ __________.
____ __________ _________ _______ ____ ________ __________ _______ _________ _______.
_____ _________ ______ ___ ____ ___ ________ ________ ____ ________.
____ ________ ___ _________ _____.
_______ ______ _________ ____ ____ ______ _________ _______ _________.
__________ _____ ________ ________ _______ ______ _________.
_____ ________ _________ ______ ______ ________ ____ _____ _________.
______ _________ _______ ____ __________ _________.
___ _______ ______ ________ _____ _____ __________.
________ _____ _______ _______ ________.
___ _______ ___ _________ _______ __________ _______ _________ _____.
_______ _______ _______ ____ ___ ______ _____ ______ ____ _________ ______ ________.
______ ____ _______ ________ ______ __________ ____ ______ ______ ______ ___.
________ ___ ___ _______ ________ ____ _________.
________ _______ _________ __________ _________ _______ __________ _____ ________.
____ _________ _______ __________ ______ __________ ______ _______ ____ _______ ____.
______ __________ ____ ____ ___.
_________ ____ _________ ________ ______.
_______ ______ _______ ________ ___ ________.
_______ _______ _____ __________ _______.
____ _____ ____ ______ __________ ______.
________ __________ ___ ____ __________ __________.
____ ______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 17 2022 2023 - Write and run (using appropriate calling program) a near procedure in | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→