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...
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,...
Using the pivot table that you just created, determine which of the color types sold the...
Using the pivot table that you just created, determine which of the color types sold the least amount of yards using =MIN() Using the pivot table that you just created, determine which of the color types sold the largest amount of yards using =MAX() If Saeko wants to expand the colors in both the best selling and the worst selling color type, which two color types should she buy? Least amount sold: 5194 Largest amount sold: 7229 What colors should...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Ross Hopkins, president of Hopkins Hospitality, has developed the tasks, durations, and predecessor relationships in the...
    asked 6 minutes ago
  • A trapezoidal channel is needed for a location where the bed slope is 0.008 ft/ft, discharge...
    asked 9 minutes ago
  • List and briefly explain each step in the ABCDE technique for examining irrational beliefs that contribute...
    asked 28 minutes ago
  • 1. Find the general solution of the first order linear differential equation: 2*x*dy/dx -y-3/sqrt(x)=0. sqrt() =...
    asked 50 minutes ago
  • Fairfield Homes is developing two parcels near Pigeon Fork, Tennessee. In order to test different advertising...
    asked 55 minutes ago
  • . For each of the following questions, say whether the random process is reasonably a binomial...
    asked 1 hour ago
  • Please discuss why empathy is so important in light of current events. Please give specific examples
    asked 1 hour ago
  • Describe ONE thing you learned from either Peter singer or Tibor Machan author that compelled you...
    asked 1 hour ago
  • Global logistics firms such as DHL Supply Chain and Global Forwarding or C. H. Robinson Worldwide...
    asked 1 hour ago
  • Please match each factor in adoption of a new product or service to the best match...
    asked 1 hour ago
  • Fatty Acid Synthesis Assignment Explain how the activation of acetyl-CoA carboxylase prevents excess citrate in the...
    asked 2 hours ago
  • 1. Discuss and give an example of how a person might “constructively” enter a building of...
    asked 2 hours ago