(a) Write a program using 8086 assembly Language (with proper comments) that accepts four different digits input from the keyboard. Each digit is first converted to binary equivalent and then smallest of these digits is put in AL register. This AL register is to be added in each value of a byte array of size 9, which is stored in the memory. You may assume the byte array has the value 01h, 03h 02h, 03h, 00h, 01h, 02h, 01h, 04h. Make suitable assumptions, if any.
(b) Write a NEAR subroutine using 8086 assembly Language (with proper comments) that returns the largest value in a byte array of length 4-bytes. All the four values of the byte array are passed to the subroutine in a stack. You should write both the calling program and subroutine.
(c) Explain the following in the context of 8086 Microprocessor :
(i) Use of segment registers with the help of example (ii) Interrupt handling in 8086 micro-processor
(iii)Any four bit manipulation instructions in 8086 micro-processor
(a)
Here is the 8086 assembly program to accept four different digits input from the keyboard, convert them to binary, find the smallest digit and add it to each value of a byte array of size 9 stored in memory:
DATA SEGMENT
NUMS DB 01h, 03h, 02h, 03h, 00h, 01h, 02h, 01h, 04h
;byte array of size 9
SMALLEST DB 0 ;variable to store smallest digit
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX ;initialize data segment
;accept four different digits input from the keyboard
MOV AH, 01h ;function to read character from keyboard
INT 21h ;interrupt to read character from keyboard
SUB AL, 30h ;convert character to digit
MOV BL, AL ;store digit in BL
MOV AH, 01h
INT 21h
SUB AL, 30h
MOV CL, AL ;store digit in CL
MOV AH, 01h
INT 21h
SUB AL, 30h
MOV DL, AL ;store digit in DL
MOV AH, 01h
INT 21h
SUB AL, 30h
MOV DH, AL ;store digit in DH
;convert each digit to binary and find the smallest digit
MOV AL, BL
MOV BL, 2
MUL BL ;multiply by 2 to convert to binary
MOV BH, AL ___ _____ ________ ________ ____.
_____ __________ ____ __________ ______ _________ __________ _____ _________ _____.
________ ____ ____ ______ _______ ______.
__________ ________ ________ ______ ________ ______ ________ _________ ________ ____ _______ ____.
______ ___ ____ ______ ____.
___ ___ ____ ______ ________ _________ __________ _______ __________ ___.
_____ ______ __________ ______ ______ _______ ____ ________ _________ ___ _______ ______.
_____ _____ _________ _________ ___ _________ ___ ____.
_______ ________ ____ ______ ____ _________ __________ ______ ___.
_______ ______ ___ _____ _________ ___.
______ ____ __________ __________ _______.
______ _____ _____ _________ ___ ______ _____ ___ ____ _______ _______ ____.
_________ _________ _______ ___ __________ ____ _________ _________ __________ ___ _____ ____.
_________ _______ ___ _________ ____.
______ ___ ______ _________ _________ _________ ____ ______ ______ ___.
___ _____ ___ ________ ________ _______ ________ ____ __________ __________ ______ ______.
______ _______ ________ _______ ________ ______.
_______ ________ ________ __________ ____ ________ ______ _____ _______ ______ _________ ____.
__________ ______ ___ _______ _________.
_______ _________ ___ __________ ______ _________ ___ __________ ________ ________ _____ __________.
___ _________ ___ _________ _____ __________ ________ __________ _______ ___ _____ _______.
_____ ____ __________ ______ __________ ________ ___ _________ ___.
____ ________ _______ _______ ______ ______ _______ _________ ___ ________ ____.
________ ____ ______ ______ ________ __________ ________ ________ ________ _________ _______ _________.
____ ____ ____ _________ _________ ____ _____ ________ ____ ________.
__________ ______ _____ __________ __________ _______ __________ ___ ________ ___ _____ ________.
________ __________ ___ ___ _________ ________ __________ _______ ________ _________ ______.
______ __________ ________ ____ ________ ______ ______ ____ _____ ______.
________ ____ _____ ____ _____ ____.
________ ________ ___ ___ _______ ______ __________ _________ ___ _________ ___ _____.
_____ ___ ___ ________ ____.
________ _________ ________ ________ _________ ______ ____ ____ __________ __________ _______.
___ ________ ___ __________ _________ _________.
__________ _____ _________ _______ ___ ____ ________ ____ _______.
__________ ______ _____ ___ ________ ___.
_________ _________ __________ ___ ___ __________ ______.
_______ ___ _______ __________ __________ ____ _____ ______ ____ _________ ___ ________.
____ _____ ________ ___ ___ _____ ______ ___.
_________ _____ ______ __________ ____ _______.
______ _______ __________ ___ ______ ___ ________ _______ ___ ________ ______ __________.
_____ ___ _______ ________ ____ ______ ___.
_________ _____ _________ ______ _____ _______ _______.
_________ _________ ___ __________ ____ __________ ____ ________ ________ ____ ____ ____.
____ _____ ____ _____ _____ _____ _______ ____ ___ ______ __________ ______.
___ _______ ____ __________ _____ ____ _________ ____ ___.
______ ___ ________ _________ ___ __________ _____.
________ _____ _________ ______ ______ ________ _____ ______ _______ ______.
_____ __________ __________ ____ _____.
________ __________ _________ ____ ____ _______ _______ __________ ____.
____ ______ ________ __________ ______ _______.
____ ____ _______ ______ ______ ____.
_____ __________ ________ ________ ____ ________ ____ __________ __________ ___ __________.
_____ _______ ______ _____ _________ __________ ______ ____.
_________ ________ ________ ______ __________ ______ ____.
______ __________ _______ _________ __________ ______.
_____ __________ ___ ___ __________ _____ ________ ___ ___.
_______ __________ ___ ________ ___ _____ ________ _________ ______ ________.
______ ____ ________ ___ ______ _______ ______ _________ _____ __________ _____.
______ _________ _____ _____ ______ _____ ________ _________.
_______ ______ ___ ____ _____ ________ ________ ___ ____ __________.
_______ _______ ____ _________ _________.
________ _____ _______ __________ ____ ______ ______ ________.
________ ________ _______ _________ _________.
_____ ___ ______ ________ ____ _______ _______ ____.
_____ _____ _____ _________ ____ _____ __________ ______.
______ ___ ____ _____ _______.
____ ____ _______ _____ ___.
_____ _______ _____ ____ _________.
_________ _______ _____ ___ _______ ___.
__________ ____ __________ ___ ________ ______ _______ ___ ___.
__________ __________ _______ _______ __________ _________ __________.
________ ________ __________ ________ __________ ___.
_______ _______ __________ _________ ___ ________ _________ ____ ____.
_______ ______ _________ ___ _____ _____ ______ ___ ________ _______ ______.
____ ______ ___ ____ __________ ________ ________ ______ _________ ____.
__________ ____ __________ __________ ______ _____ ___ _________ _______ ___ ___.
________ ________ _______ _______ ___ __________ _______ ___ __________ ____ _____.
_______ _________ ________ ____ _________ _________ __________ __________ ____ ___ _________ __________.
_________ _______ _____ ___ __________.
_________ _______ __________ ________ ____.
_____ _______ _______ ______ ________ _____ ______ ___ ______ __________ __________ _________.
________ ________ ___ ________ ____ __________ ______.
_____ __________ _____ _____ ______ ___ ___ ______ ________ _________ _______.
_____ _______ ______ _________ ____ ___ ____.
________ _________ ______ ______ ______ ___.
____ ___ ___ _________ __________ ______ _______ ____ ___ ________ _______ _____.
______ ___ __________ ________ _____ _____ ________.
______ ___ _______ _______ _______ __________ ____ _________ _____ ______.
______ ____ ___ _____ __________ _____ ______ _______ ________ ______ _________.
______ ___ ____ _______ ____ _____ __________ ____.
___ ________ ____ ___ _____ ______.
__________ __________ _____ ______ ____ ___ __________ ________ ___ ____.
_________ _____ _____ _____ ______ ____ _______ _____.
_______ ______ ________ ___ ________ ______ _____ ______ _______ __________ _____.
__________ _____ __________ ____ _____ ________ ___ ______ __________ _______.
______ ______ _________ ______ ______ _________ _______.
_____ ___ __________ ___ _____ ___.
_____ _____ ____ ________ ______ _______ _______ ______ _____.
______ ________ __________ ____ ____ _____ _________.
__________ __________ ______ __________ __________ _______.
____ ____ ____ ________ _______ __________ __________ ____ _______.
________ ____ _______ ________ ____ __________ _____.
_______ ___ __________ ________ ________ ____ _____ ____.
_____ __________ _______ _______ ____ ____ _____ _____ _____ _______ ________.
________ ________ _______ _____ _____ ______.
_____ __________ ________ _____ _____ _______.
_______ ________ ________ __________ ________ __________ _________ _____ ______ _________.
____ ______ ____ __________ ________ ______ _______ _____ _______.
_____ __________ _________ ________ _________.
______ ______ ______ ____ _________ ____ ________ _______ _________.
_________ _______ _____ ________ ______.
________ ________ ________ ________ __________ _____ ________ _____ ______ _______ ___.
__________ _________ _____ ____ ______ ____ ______ ___ _________ _____ ____.
____ __________ ____ ____ _______ ____ ____ __________ ________.
________ _________ _______ ______ _____ ___.
______ _______ ______ _________ ___ ___ ______ _____ ______.
_____ _________ ________ _______ ______ _______ _______ ____ __________ ___ ____ _________.
__________ ______ _________ ________ ______ _______ ______ _______ _______ _______.
________ _________ _________ ________ _____ _____ ___ ___.
____ ___ _______ _____ ______ ______.
_______ _______ _______ _________ _____ _______ ________ _______.
___ _______ __________ _____ __________ ___ ________.
_______ __________ ______ ____ _________ _______ _________ ____.
_______ ___ _____ ________ ________ _________ _______ ______ ___ ________ _________ _____.
_____ __________ __________ __________ _________ _________ ___ ________ __________ _________ _____ _____.
________ ______ _____ ___ ______ _____ ___ _________ ___ ___ ___.
_____ ________ __________ __________ ___ ________ ____ ________.
____ ______ ____ _____ _____ _____.
____ _____ __________ _______ _________ _____ ______.
_____ ________ _________ ____ ______ _________ ______ _________ __________ __________.
______ __________ _________ _______ _________ _____ ___.
_____ _____ _____ ________ ______ ___ ___ _______.
_________ ______ ________ __________ ______.
______ ___ ___ __________ _____ ______.
_____ ________ ___ ______ __________ _________ ________ _____ _______ ___.
______ ____ ______ _______ _____ _________ _______.
___ ____ _________ _________ ______ ________ ____ _____.
___ _________ ___ _____ ____ __________ ______ __________ ___.
________ ______ __________ ___ _________.
_________ ____ ____ _______ ____.
__________ __________ _____ ____ _________.
_____ _______ _____ _________ _____ _______ ____ __________ ____ _________.
_____ ____ ___ _____ _______ ________ ___ ______ _______ _________ _____.
____ ________ ______ _____ ________ ___ _____ _____.
______ ____ ___ _______ ____ ________ _______.
____ _________ ______ _________ ____.
____ _________ ________ ______ _________ ____.
_______ _________ ______ _______ _______ ______ _______ ___ __________ _______.
_____ _______ ________ ___ ____ ____ __________ _________ __________ __________ __________.
___ __________ ____ _________ ____.
___ ___ ______ _______ ____ ___ ______ _________ _______.
_________ _______ ____ ________ ____ ___ _______ _________ _______ ________ _______.
___ ____ ____ ____ ________ ___ _______ ____ ___ ___ ____.
____ ___ _____ ___ ___ ____ _________ ________ ___ _______ __________ ___.
___ ______ _____ ______ ___ _____ _______ ___ ____.
___ ___ ________ _____ _________ ___ ______ ________ ___ ________ _____ ____.
_______ __________ ________ ________ ______ ________.
_______ ________ _______ __________ _________ _________ _____ ___ ___ ___ _____ __________.
__________ _______ ____ ___ _____ __________ _____ __________.
___ ___ ___ _____ ________ _______ ____ _________ _____.
_______ ______ _____ __________ ____ __________ ________ ______ ___ __________ ______.
___ ____.
Get Full Answer on WhatsApp