Write and run following programs using 8086 assembly language.
(a) Write and run a 8086 Assembly language program that converts a three digit ASCII number stored in three consecutive byte locations in the memory, into a binary number. The output should be stored in DX register. For example, if three consecutive byte locations contain '345' (please note they are three ASCII digits), then the DX should get binary equivalent of decimal number 543, which is (0000 0010 0001 1111)2. This binary value will be stored in DX register.
(b) 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 has a value zero or not. If the value of input parameter is zero then procedure/program is terminated, otherwise a value of 1 is returned to the calling program, which then continue to execute the remaining program. Make and state suitable assumptions, if any.
(c) Write and run a 8086 assembly language program that finds the sum of first N natural numbers. The value of N is input to the assembly program. The sum is stored in DX register. Assume the value of N between 1 and 10 only.
Sure, I can provide you with assembly language code for each of the tasks you've mentioned. Below are the programs for each task:
(a) Convert ASCII to Binary:
```assembly
ORG 100h ; Set the origin of the program to 100h
MOV SI, 0000h ; Initialize SI to point to the start of the ASCII digits
MOV CX, 03h ; Set the loop counter to 3 (three digits)
MOV DX, 0000h ; Clear DX to store the result
ConvertLoop:
MOV AL, [SI] ; Load the ASCII digit into AL
SUB AL, 30h ; Convert ASCII to binary ('0' to 0, ______ ____ _______ __________ __________ _____ _____ ________ ________ ________.
__________ _______ ____ _____ _____.
________ _________ _____ __________ _______ ________ _________.
___ ___ _____ _________ _______ ______ ________ ___ ____ ____ _____.
_____ _____ ___ ___ __________ ________.
___ ____ ______ ______ __________ _______ _______ _________ _______ _______.
____ _________ __________ __________ __________ ______ ________ ___ _______.
___ __________ ____ __________ _______ ______ _____ __________ _____ __________ ___.
___ _______ ___ ____ ____ _________ ______ _________ _________.
_______ _______ ____ __________ _________ __________.
_____ ___ ______ _________ ________ ____.
_____ _____ _____ __________ ___ _____.
_____ _____ __________ _________ ___ ____ _______.
___ _______ ____ ___ ________ _____ ____ ___ ______.
___ _______ ________ ______ __________ ________.
___ __________ ________ _____ ________ _________ ________.
_____ ____ _________ ___ _________ ____ _____ __________ _________.
________ ___ ____ _____ _____ ___ _________ ______ ___.
________ _____ __________ ______ _____ ____ __________.
______ ______ __________ ______ _________ ________ ______ ______.
________ ________ _______ ______ ________ _______ _________ ________ _________ ______.
_____ ___ _____ __________ ____ _______ ___ ____ ____ _____ _________ _______.
__________ ______ _____ _______ ___.
___ _________ ____ __________ _________ ___ ____ ____ ________ _______ _______.
____ _________ ______ ______ ______ __________ __________ ____ ____ ____ ___ __________.
_____ ___ _______ ________ ______ ____ ___ __________ ______ ____.
_______ _________ _______ ______ _________ _______ ________ _____ ______ ________ _______.
______ __________ ___ _______ _______ _____ _________.
_______ ________ ______ _________ ___ __________ ____ __________ _________ _____.
_________ _________ ________ ___ ________ _________ ______ __________ ____ _____ __________ ____.
________ _____ _________ ________ ____ ______ __________ ___ __________ __________.
_______ _______ __________ ____ _________ _____ __________ ____ ________ ____ _________.
_____ ______ __________ ___ ______ ____ __________ ________ ______ ________ _____.
______ ___ __________ ______ ______ ___ ____ _____ ____ ______ _________.
________ ______ ____ ____ ____.
____ _____ _____ ________ _________ __________ _____ _______ __________.
_____ ______ ___ ________ ________ ____ ____ _______ _________.
____ _________ ___ _________ ________ ________.
______ _______ ______ ______ ___ __________ __________ _____ ____.
__________ _____ _______ ____ ______ ____.
______ _______ _____ ________ ________ _________ __________ _____ _________ _____ _________ ____.
____ ___ _______ ___ ___ __________ _______ ___ ___.
________ _________ ______ __________ ___ ________.
_______ ________ __________ __________ _________ ________ ________ _________.
______ ____ ____ ______ __________ _______ ___ _________ ______ ______.
__________ ___ _________ _______ _____ ________ _______.
________ ____ ___ ______ ________ _________.
_______ ___ _________ ___ _____.
________ _________ ____ _________ ______ __________ ___ _____ ________.
_______ ____ _____ _______ ____ __________.
______ ___ __________ ________ _______ _________ ____ ____ _________ ______ _____.
_____ _______ __________ _______ _________ ______ _____ __________ ___ _______.
______ ___ __________ ___ ____ _______ ___ __________.
Get Full Answer on WhatsApp