Question
Please use x86 Assembly Language (use 32-bit Visual Studio) 1.(5 points) Write an assembly program to find the smallest element by searching an array int
Please use x86 Assembly Language (use 32-bit Visual Studio)
1.(5 points) Write an assembly program to find the smallest element by searching an array
int ary[] = {11,15,-3,-4, 0, 60,11,-1,18,-4,-6, 9,-20}
int index = 0;
int min = ary[0];
int arraySize = sizeof array / sizeof min
while (index < arraySize) {
if (ary[index] < min)
min = ary[index];
}
- Do not use loop instruction.
Make sure you understand what int represent in C and assembly language.
- Also, make sure that variables declared and defined in C has to be in the .data section in assembly
- Use cmp instruction and the appropriate jump instruction (signed or unsigned) to translate the if and while statements.
- Use $ operator (see chapter 3) to calculate the size of the array.
- Run your program using the debugger to verify your answers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started