Question

In: Computer Science

Write a program to find out the maximum value out of a list of ten values...

Write a program to find out the maximum value out of a list of ten values using loop. The maximum finding codes can be in a Sub Routine named MAX (optional).

easy68k assembly language

Solutions

Expert Solution

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE

CODE-

DATA SEGMENT
         ARR DB 5,3,7,1,9,2,6,8,4       ;Define byte to stote array
         LEN DW $-ARR                      ;Define word(DW)
         MIN DB ?                                ; We are initializing Min DB ? to ? (? stands for blank value).
         MAX DB ?                              
DATA ENDS                           ;End point

CODE SEGMENT
                    ASSUME DS:DATA CS:CODE      ;assume data name given to data segment
START:
             MOV AX,DATA                  ;Move DATA to AX
             MOV DS,AX                      ;Move AX to DATA

             LEA SI,ARR Load effective address which load address of second element into the first element
             MOV AL,ARR[SI]        ; move the value of Array ARR in index of SI register to AL register.
             MOV MIN,AL               ;Mov AL register to Minimum
             MOV MAX,AL             ;Mov AL register to Maximum

             MOV CX,LEN            ;Assign value of 8 to CX (8 is length of array)
REPEAT:                   ; label and all word end with (:)
             MOV AL,ARR[SI]      
             CMP MIN,AL             ;compare for minimum
             JL CHECKMAX        ;check for max

            MOV MIN,AL            ;store min in AL
CHECKMAX:       
           CMP MAX,AL            ;comapre for max
           JG DONE

           MOV MAX,AL            ;move max value in MAX
DONE:
           INC SI                        ;Increment the address value in SI
            LOOP REPEAT        ;end of loop

            MOV AH,4CH           ;if value is 4ch then return
            INT 21H             
CODE ENDS         ;end of code segment
END START           ; end of program

Related Solutions

Must be done in C Write a C program found out the maximum value between the...
Must be done in C Write a C program found out the maximum value between the three numbers? Show steps with comments or else it will be flagged.
Write a multithreaded program that calculates various statistical values for a list of numbers. This program...
Write a multithreaded program that calculates various statistical values for a list of numbers. This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the third will determine the minimum value. For example, suppose your program is passed the integers 90 81 78 95 79 72 85 The program will report The...
write a program to find the maximum possible sum such that no two chosen numbers are...
write a program to find the maximum possible sum such that no two chosen numbers are adjacent either vertically, horizontally, or diagonally. code in java
Write a program to read in a collection of integer values, and find and print the...
Write a program to read in a collection of integer values, and find and print the index of the first occurrence and last occurence of the number 12. The program should print an index value of 0 if the number 12 is not found. The index is the sequence number of the data item 12. For example if the eighth data item is the only 12, then the index value 8 should be printed for the first and last occurrence....
Write a C program that selects and displays the maximum value of five numbers to be...
Write a C program that selects and displays the maximum value of five numbers to be entered when the program is executed. (Hint : Use a for loop with both a scan_s and if statement inside the loop.)
(in java) Find the maximum value and minimum value in milesTracker. Assign the maximum value to...
(in java) Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 given code below (please bold the solution, thank you!) import java.util.Scanner; public class ArraysKeyValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_ROWS = 2; final int NUM_COLS = 2; int [][] milesTracker = new int[NUM_ROWS][NUM_COLS]; int...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 import java.util.Scanner; public class ArraysKeyValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_ROWS = 2; final int NUM_COLS = 2; int [][] milesTracker = new int[NUM_ROWS][NUM_COLS]; int i; int j; int maxMiles; // Assign with first element in...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 Java Code: Remember we can only add to the code. We cant change whats already given. Thank you. import java.util.Scanner; public class ArraysKeyValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_ROWS = 2; final int NUM_COLS = 2;...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 #include <iostream> using namespace std; int main() { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i; int j; int maxMiles = -99; // Assign with first element in milesTracker before loop int minMiles = -99; // Assign with first element in...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 import java.util.Scanner; public class ArraysKeyValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_ROWS = 2; final int NUM_COLS = 2; int [][] milesTracker = new int[NUM_ROWS][NUM_COLS]; int i; int j; int maxMiles; // Assign with first element in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT