Question

Write a program in Assembly language that calculates the maximum and minimum of 10 numbers stored...

Write a program in Assembly language that calculates the maximum and minimum of 10 numbers stored in memory and writes them to the memory locations.

#using loop

num: dw 56, 45, 36, 67, 76, 22, 89, 12, 29, 83

min: dw 0

max: dw 0

I wrote a codem but I got an error when I executed it

[ORG 0x0100]

jmp start

num: dw 56, 45, 36, 67, 76, 22, 89, 12, 29, 83
min: dw 0
max: dw 0

start: mov ax, [num]
mov bx, 0
mov cx, 10
move [max], ax
mov [min], ax

again:
mov ax, [num+bx]
add bx, 2
cmp ax, [max]
Jl next
mov [max], ax
next: mov [min], ax
loop again

end: mov ax, 0x4c00 ;terminate program
int 0x21

Homework Answers

Answer #1

Program[ executed and verified in emu8086 simulator]

Note:- memory values are represented in hexa decimal format

DATA SEGMENT

num dw 56, 45, 36, 67, 76, 22, 89, 12, 29, 83
min dw ?
max dw ?
DATA ends

CODE SEGMENT
ASSUME cs:code, ds:data
start: mov ax, data
mov ds, ax
mov cx, 10
lea si,num
mov bx, [si]
  
up:
mov ax, [SI]
cmp ax, bx
jge nxt
mov bx, ax
nxt:
inc si
inc si

loop up

mov min,bx   
  
mov cx, 10
lea si,num
mov bx, [si]
  
up1:
mov ax, [SI]
cmp ax, bx
jle nxt1
mov bx, ax
nxt1:
inc si
inc si

loop up1

mov max,bx
  
mov ah,4ch
int 21h
code ends
end start

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into an array and copy the integers from the array into a Binary Search Tree (BST). The program prints out the following: The number of comparisons made to search for a given integer in the BST And The number of comparisons made to search for the same integer in the array Question 3 Run the program developed in Question 2 ten times. The given values...
And need to be writing in C++ language Programm need to start with   #include<fstream> Prepare a...
And need to be writing in C++ language Programm need to start with   #include<fstream> Prepare a text file data_in.txt with the following information (highlight the piece of text below with numbers and copy it to a text file): 54, 70, 75, 63, 17, 59, 87, 16, 93, 81, 60, 67, 90, 53, 88, 9, 61, 8, 96, 98, 12, 34, 66, 76, 38, 55, 58, 27, 92, 45, 41, 4, 20, 22, 69, 77, 86, 35, 19, 32, 49, 15,...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
Statistics I – First Analysis Project You are part of a research team that is studying...
Statistics I – First Analysis Project You are part of a research team that is studying academic motivation in high school students. A question has arisen regarding the strength of the relationship between academic motivation and achievement. Some members of the team believe there is a strong positive relationship between academic motivation and achievement, while others don’t think the two variables are related much, if at all. To provide some information relevant to this discussion, a small study was designed....
Q) Over the past few years the percentage of students who leave Lakeland College at the...
Q) Over the past few years the percentage of students who leave Lakeland College at the end of the first year has increased. Last year Lakeland started a voluntary one-week orientation program to help first-year students adjust to campus life. If Lakeland is able to show that the orientation program has a positive effect on retention, they will consider making the program a requirement for all first-year students. Lakeland’s administration also suspects that students with lower GPAs have a higher...
I am making a game like Rock Paper Scissors called fire water stick where the rules...
I am making a game like Rock Paper Scissors called fire water stick where the rules are Stick beats Water by floating on top of it Water beats Fire by putting it out Fire beats Stick by burning it The TODOS are as follows: TODO 1: Declare the instance variables of the class. Instance variables are private variables that keep the state of the game. The recommended instance variables are: 1. 2. 3. 4. 5. 6. A variable, “rand” that...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership major, 30% choose a Finance major, 20% choose a Marketing major, and 10% choose no major. Does the most recent class of 200 MBA students fit that same pattern or has there been a shift in the choice of majors. Using the sample of 200 students (in the data file), conduct a Chi Square Goodness of Fit test to determine if the current distribution...
Indices   DUR   DUR (OLD) 1   6   11 2   13   14 3   11   14 4   7   10...
Indices   DUR   DUR (OLD) 1   6   11 2   13   14 3   11   14 4   7   10 5   9   9 6   7   10 7   8   11 8   5   8 9   7   6 10   7   10 11   7   13 12   3   5 13   10   13 14   3   15 15   4   12 16   9   7 17   9   8 18   10   13 19   6   10 20   8   14 21   10   14 22   8   18 23   2   10 24   4   11 25   7   16 26  ...
As part of the quarterly reviews, the manager of a retail store analyzes the quality of...
As part of the quarterly reviews, the manager of a retail store analyzes the quality of customer service based on the periodic customer satisfaction ratings (on a scale of 1 to 10 with 1 = Poor and 10 = Excellent). To understand the level of service quality, which includes the waiting times of the customers in the checkout section, he collected data on 100 customers who visited the store; see the attached Excel file: ServiceQuality. Using Data Mining > Cluster,...
A physiological experiment was concluded to study the effect of various factors on a pulse rate....
A physiological experiment was concluded to study the effect of various factors on a pulse rate. The participants took their own pulse. They then were asked to flip a coin. If their coin came up head, they were to run in place for 1 minute. Then everyone took their own pulse again. The dataset pulse.txt, available from Moodle, contains the following variables: ROW- id numbers, from 1 to 92; PULSE1- first pulse rate; PULSE2- second pulse rate; RAN-1=ran in place,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT