Question: Write an x86 MASM assembly program to find the smallest element by searching an array int ary[[ ] = { 1 1 , 1 5,,

Write an x86 MASM assembly program to find the smallest element by searching an array

int ary[[ ] = { 1 1 , 1 5,, - 3,, - 4,, 0,, 6 0 ,111,, - 1 ,118 }

int i ndex = 0 ;

int max = ary[[00]] ;

int arraySize = sizeof array / sizeof max

while ( index < arraySize )

{

if (aary[[iindex]] < min )

min = ary[[iindex]];;

}

Use cmp Instruction and the appropriate jump instruction (signed or unsigned) to translate the if and while statements

Use $ operator to calculate the size of the array, and inc instruction to increment the index of the array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!