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

*note: I am using Visual Studio 2015 and i saw this question was already posted

ID: 3776258 • Letter: #

Question

*note: I am using Visual Studio 2015 and i saw this question was already posted but to be honest i didn't understand it So if someone could explain it to a novice it would be greatly appreciated*

For this program you will find the largest element in an array of DWORDs.

The output of your program will be:

The Largest Integer In the Array is: +6

where, for the example I used, the largest element in the array is 6. You will make up your own array of integers with at least 6 integers, and including some duplicate values.

You will do all of your work using registers, i.e. NO variables appear in your code except to initialize registers once.

You code must include:

meaningful simultaneous use of EAX, EBX, ECX, EDX

at least three jump instructions

at least two compare instructions

at least one meaningful use of LENGTHOF

at least one meaningful use of TYPE

at least one meaningful use of OFFSET

at least one meaningful use of indirect addressing

use of WriteString and WriteInt from the Irvine library

Explanation / Answer

DATA SEGMENT

     ARRAY DB 1,5,2,12,9,15,6,7,5,10

     LENGTH DW $-ARRAY

     LARGEST DB ?

DATA ENDS

CODE SEGMENT

        ASSUME DS:DATA CS:CODE

START:

        MOV EAX,DATA      ->putting array into register

        MOV DS,EAX

           

        LEA SI,ARRAY

       

        MOV AL,ARRAY[SI]    ->moving every element of array 1 by 1 to AL

        MOV LARGEST,AL

               

        MOV CX,LEN

REPEAT:

        MOV AL,ARRAY[SI]

        CMP LARGEST,AL      ->let first element be larges and compare with

        JG NOCHANGEHERE        other elements.If other is larger we will

       

        MOV LARGEST,AL   ->put the new largest element in AL.If not, jump

       

NOCHANGEHERE:

        INC SI

        LOOP REPEAT

     

        MOV AH,4CH

        INT 21H     

CODE ENDS

END START