Answered step by step
Verified Expert Solution
Link Copied!

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",10,0 ; String format to use (decimal), followed by NL
myarr: dd 10,20,30,40,50,60
temp: dd 0
section .text
global main
main:
xor eax, eax ; A =0
mov ecx, myarr ; C points to myarr
myloop:
mov ebx, DWORD [ecx+4*eax] ; Get the value B = myarr[A]
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, 0
call printf
pop rcx
pop rax
add eax, 1 ; A++
cmp eax, 6 ; Does A ==6?
jl myloop ; if less, jump to myloop
mov rax, 0
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 64 and gcc on snowball . assembly x86

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 89 2nd Symposium On Mathematical Fundamentals Of Database Systems Visegrad Hungary June 26 30 1989 Proceedings

Authors: Janos Demetrovics ,Bernhard Thalheim

1989th Edition

3540512519, 978-3540512516

More Books

Students also viewed these Databases questions

Question

What are the guidelines for determining and using affirmations?

Answered: 1 week ago

Question

what are hte major efforts of the operations and support phase

Answered: 1 week ago