(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 ;store binary digit in BH
MOV AL, CL
MOV BL, 2
MUL BL
CMP AL, BH ;compare with previous smallest digit
JB SMALLEST_FOUND ;if smaller, jump to SMALLEST_FOUND
MOV BH, AL ;else, store new smallest digit
SMALLEST_FOUND:
MOV AL, DL
MOV BL, 2
MUL BL
CMP AL, BH
JB SMALLEST_FOUND
MOV BH, AL
MOV AL, DH
MOV BL, 2
MUL BL
CMP AL, BH
JB SMALLEST_FOUND
MOV BH, AL
MOV SMALLEST, BH ;store smallest digit in SMALLEST variable
;add smallest digit to each value of byte array
MOV BX, OFFSET NUMS ;point BX to start of byte array
MOV CL, 9 ;counter for array
______ _____ __________ ___ _______ ________ _________ __________ __________ ______ _______.
__________ _________ _____ _________ ______ ____ _______.
_______ ____ _________ _____ _______ _____ __________.
________ ________ _______ ______ _______.
_________ ___ ____ _____ _____ ___ _________ ________ __________ _____ ___.
________ _______ _____ ___ _____ _____.
______ __________ ______ ___ _________ ______.
______ _____ ________ ___ __________ _____ _____ ____ _________.
_____ ________ ____ ______ ____ ___ _______ ______ ____.
______ _________ ______ _______ _______ ______.
______ ____ ______ _________ ______.
___ ________ ______ _________ ______ ________ _____ ___ ________ ________.
______ _________ _____ _____ _______ ___ ____ _________ ___ ___ ______ ______.
________ ________ _________ _________ __________ ________.
_______ _________ ___ ______ _______ _________ _____.
_____ _______ _________ __________ _____ _______ _____ ________.
_____ _________ _______ ___ _____ ___ ______ ________ ____ _________ ________.
__________ _____ __________ ______ ________ ________.
______ _____ _________ _________ _________ ___ ___.
__________ ______ _________ __________ __________ ______ __________ __________.
_______ _______ _______ _________ ______ _______ _______.
______ _______ ________ __________ _______ ________ __________ ___ __________ _______ _______.
________ _____ _____ _________ ________ _________ __________ _______ ______ __________ ______.
________ _________ ________ ________ ____ _________.
_____ _____ ___ _____ ________ ______ __________ _______ __________ _____ __________ ___.
______ __________ _______ ___ __________ ___ _____ __________ ________ ______ _________.
_________ _______ __________ _______ __________ _____ ____ _________ ________ __________ __________ _____.
_________ ___ ____ ______ _________ ______ ______ _____ ______ ____.
__________ ______ ______ _____ ____ __________ __________ _______ _____ ________ _____ ____.
________ __________ ___ ____ __________ ___ ______ ______ ___ _____.
_______ ____ __________ ___ _________ _________ __________ ______.
____ ______ _______ ___ ________ ____ _______ __________ _____ ______ ______ _________.
________ _______ ______ _________ _________ ________.
______ __________ _____ ____ __________ ______ ______ ______.
______ ____ ________ ___ _________ ______ ___ __________ ________ _______ ______ __________.
____ ______ _____ __________ __________ _______.
_______ ____ __________ ________ _______ _______ ______ _______ ______.
__________ _____ _________ ___ _______ _______.
_________ __________ ________ ___ ____ _____ ______ ______ ____ _________ _________ _________.
______ _____ __________ ________ __________.
_____ _______ _______ ______ ________ ____ _____ _______ _____ _____ _________ ___.
___ _________ _____ _____ _____.
_______ _________ ________ ____ ____.
__________ ___ _____ _________ ___ ________ _________ ___ _________ ____ ________.
_____ _____ _______ __________ _____ ____ ________ __________.
__________ _________ _______ ____ _____.
_________ _____ ________ ___ ________ ____ __________.
________ __________ ____ _______ ____ ________ ________ _________ _______ __________ ______ ________.
_________ _____ __________ ______ _________ _____ ___ ____ ___.
______ ___ ________ ______ ____ ________ ___ ______ ________ ______ _________ ________.
_______ _____ _______ ________ _____ _____ ________ ___ ___ _____.
________ _____ ____ ___ _______ ________.
_____ __________ ________ _______ ___ __________.
________ ________ ________ ___ ______.
______ ___ ________ __________ ____ _____ _______ ________ _______ _____ _______ ________.
_________ _______ ___ _______ _______ ____ __________.
_____ _________ _________ ________ ___ __________.
_________ _______ _____ _______ _______ ___ _____.
_____ _______ _____ _____ ______ _____ _______ ________.
_______ ___ ________ ________ ____ ____ ______ ____ _______ ________ ___ ____.
______ ____ ___ _____ _________ _________ ___ __________ __________.
______ ________ _________ ___ ___ ________ ________ ________ ___ __________ ______.
____ ______ ___ _________ _________ __________ ________ ____ ___ __________ ________.
____ ________ _______ ___ _____ _________ ______ ___ ____.
________ ______ ________ _____ ____ __________ ____.
_______ _______ ______ ______ __________ ___ __________ ___.
__________ ______ _________ ______ ______ _______.
__________ ____ __________ _____ ______ _________ _______ _____ ___ ______.
__________ __________ ________ ___ _______ ____ __________ ___ ________ ____.
______ ____ ____ _____ _____ ____ ________ ___ ______ ___ __________ ______.
______ ______ _________ _______ ___ __________ ________ ________ _________.
____ _____ ______ ______ _______ _________.
____ ____ _________ _________ _____ ___ ___ _______ _________ _______ ____ __________.
______ ________ _______ _____ ___ _________ ______.
_____ _______ ____ _____ __________ ________ ______ ________ ____.
_________ __________ _____ __________ ___.
_____ ________ ________ _____ _____ _____ _______ _______.
______ ___ _______ __________ ________ _______ ______ ________ ___ ___ ____.
______ ________ ______ ______ _______ ____ _________ ______ ___ __________ ______.
__________ ________ _____ ________ __________ __________ ____ _________ _____ ____ ______.
__________ ______ __________ ____ _____ _______.
__________ _____ ________ _________ ______.
________ ____ ______ ___ ___ __________ ____ ____ ________ _________.
_________ ____ _______ _______ ___ _____.
_________ __________ __________ ____ _____ ____ ______ _______ __________ __________ ___ ______.
________ _________ ____ __________ _________ ________ __________ _________ _______.
____ ________ _______ _______ ______ ___ _______ ________.
_____ ___ ________ ___ _______ _______ ___ ______ _________ _________ _______.
______ __________ _________ ________ _____.
_________ _______ ____ ______ ______ _______ __________.
____ __________ ______ _______ _________ ___.
_______ ______ _______ ___ ____ _________ _________ __________ _________ ________ ____.
_____ _________ __________ ___ _____ _______.
____ _________ _______ ________ ___ _____ ____ ________ ________ __________.
_________ ____ ______ ____ ____ ____.
_________ _______ ________ _____ ____ __________ ____ _____ _________ ______.
_________ ____ _______ ___ _______ _____ ____ _____.
__________ _____ _______ ______ __________ ______ ____ _______.
________ _____ ______ ___ _____ ___ ________ ____ ______ ___ __________.
_______ ______ ____ __________ _________ _______ __________ ____.
__________ __________ ________ ____ ___ ____.
_________ _______ _________ _____ _______ ________ ______ ____ _____ ________.
___ ___ _____ ____ _________ ______.
_____ ________ _________ ______ ___ ________ _____.
_____ _________ ______ ___ ______ _____ ______ ____ _______ ___ _________.
______ ______ _____ _________ _________ ________.
__________ ______ _____ ______ _________ ___.
_______ ____ _______ _____ ________ _______ ________ _____.
_________ ____ ________ _________ ______.
______ ___ _____ ___ ____ _____ ___.
__________ ____ _______ ___ _________ ____.
____ ____ ________ _______ ______ ___ ____ ______ ________ ____.
__________ _________ ________ ____ ____ _______ ________ ______ ___.
_________ _________ _________ _________ _____ __________ ___.
_____ ______ __________ ______ ___.
______ _______ ____ ______ _________ ______ _________ ________.
___ ____ ______ ______ ______ ________ _______ _____ _________ ________ __________.
____ ________ ____ _____ __________ __________ ___.
__________ ________ ______ _______ ________ __________ _______ ____ _____ _____.
_______ _______ ____ _________ ________ _____ _______ _____ ____.
____ __________ ____ ____ _______ ___ _____ ___ _____ ___ __________.
___ ____ ___ __________ ____ ________ __________ ________ ___ ____.
____ __________ _________ ________ _______.
__________ ____ ___ ___ ___ _____ ______ _______ _____ _____.
_____ ___ _____ __________ ______ ______ ____.
___ ______ _______ __________ ___ ____.
________ ____ ________ _____ _________ ____.
_____ __________ ____ ______ _________ _____ _________ __________.
___ _________ _________ _______ ______ ___ ____ ____ ________ _______.
_______ __________ ________ _____ ________ ____ ______ _______ _________ ______ _______ ___.
____ _______ ___ ________ _______ __________ _________ ________ _______ __________.
____ ________ ______ ________ __________ __________.
_________ _______ ______ __________ ______ ___ ________ ____ _______ _______.
______ _______ _______ _____ ________ ______ ___ __________.
____ ___ ______ _____ __________ ____ __________ ___ _________ ____ ________.
_______ ___ _________ _________ _______ ______ _______ ___ __________ _______ _________ ____.
_______ _____ _______ ___ _____ ________ ____ _____ ____ ________.
_______ ______ _________ ___ ___ _________ _______ _____ ___ _______ ________.
__________ ___ ________ ____ _________ _________ __________ _____ _____ _____ ____.
________ __________ ________ ______ __________ ____.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required