Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi there! I need help with this assembly keil uVision project v5 code. Plz make

ID: 2268451 • Letter: H

Question

Hi there! I need help with this assembly keil uVision project v5 code. Plz make sure to use notepad when you post the code here. Write an assembly program to accomplish the following: Initialize four byte size constant numbers A, B, C, and D using EQU. Add the four numbers and store the result in SUM .Find the average of the four numbers and store the result in AVG Find the maximum between the four numbers and store the result in MAX Find the minimum between the four numbers and store the result in MIN

Explanation / Answer

a equ 7

b equ 9

c equ 56

d equ 1234

DATA SEGMENT

SUM DB ?

AVG DB ?

MAX DB ?

MIN DB ?

ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START ;program starts here

MOV AX,DATA

MOV DS,AX

MOV AL,a ;copying data of a into AL register

ADD AL,b ;adding data of b with data in AL register

ADD AL,c ;adding data of c with data in AL register and the sum is stored in AL register

ADD AL,d

MOV AH,0

MOV SUM,AL ; total sum of 4 constants are stored in SUM

MOV DL,4 ;to find the average

DIV DL ;devide AL contents with number of constants

MOV AVG,AL ;moving the average value into AVG

MOV AL,a ;again moving data of a to AL

MOV MAX,AL ;the maximum value can be stored into MAX

CMP AL,b ;compare AL and data of b

JGE TEST1 ;after comparing jump if greater than or equal and ;goto TEST1 for checking

MOV AL,b

MOV MAX,AL TEST1: ;testing and again compare and jump operations ;done untill maximum value detected

MOV AL,MAX

CMP AL,c

JGE TEST2

MOV AL,c

MOV MAX,AL

TEST2:

MOV AL,MAX

CMP AL,d

JGE TEST3

MOV AL,d

MOV MAX,AL

TEST3: MOV AH,4CH

INT 21H

MOV AL,a ;for finding minimum of four numbers

MOV MIN,AL ; minimum value can be stored in MIN

CMP AL,b ;comapring data in b with AL

JLE TEST4 ;jump if less than or equal to TEST4

MOV AL,b

MOV MIN,AL

TEST4: MOV AL,MIN

CMP AL,c

JLE TEST5

MOV AL,c

MOV MIN,AL

TEST5:

MOV AL,MIN

CMP AL,d

JLE TEST6

MOV AL,d

MOV MIN,AL

TEST6:

MOV AH,4CH

INT 21H

ENDS

END START ;ends the execution

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote