Answered step by step
Verified Expert Solution
Question
1 Approved Answer
extern printf ; We will use this external function section . data ; Data section, initialized variables mystr: db % d , 1
extern printf ; We will use this external function
section data ; Data section, initialized variables
mystr: db d ; String format to use decimal followed by NL
myarr: dd
temp: dd
section text
global main
main:
xor eax, eax ; A
mov ecx, myarr ; C points to myarr
myloop:
mov ebx, DWORD ecxeax ; Get the value B myarrA
mov temp ebx
push rax
push rcx
; Now print the result out
mov rdi, mystr ; Format of the string to print
mov rsi, temp ; Value to print
mov rax,
call printf
pop rcx
pop rax
add eax, ; A
cmp eax, ; Does A
jl myloop ; if less, jump to myloop
mov rax,
ret
The objective for this lab is to add to the code, to determine the minimum value, the maximum value, and the average value. You will need to define storage for each of these in the data section or the bss section
Keep the part that prints each value in the array, only alter it to print the values on a single line. Also, have the program print something before the values, like "The array has the following values:".It should initialize the minimum and maximum with the first value of the array, then examine each value in the array then examine each value in the array starting with the second value and update the minimum and maximum as needed.To find the average, we can make a sum of the values. Then divide the sum by the number of values. Have the problem print "max:","min:""averg" this is being compiled with nasm f elf and gcc on snowball assembly x
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