Question: Code and comments for each line of code please. main.c and array _ functions.asm are provided. Write two functions in NASM assembly that are callable
Code and comments for each line of code please. main.c and arrayfunctions.asm are provided.
Write two functions in NASM assembly that are callable from C The C
prototypes are as follows:
int arraymaxint array int arraysize;
int arraysumint array int arraysize;
Function arraysum takes an array base address of int's and the size of
the array as parameters. This function is to return the sum of all elements
in the array.
Function arraymax takes an array of int's and the size of the array as
parameters. This function is to return the value of the greatest element
in the array.
Both of these function are to be implemented in assembly. The given C code
includes code to call these functions. You will need to uncomment that code
to test your functions.
main.c :
#include
int arraymaxint array int arraysize;
int arraysumint array int arraysize;
int main
int intsize sizeofint;
printfSize of int is d bytes.
intsize;
int array;
const int arraylen sizeofarray sizeofint;
int array;
const int arraylen sizeofarray sizeofint;
int max, sum;
TODO: Uncomment the following code when assembly function are in place
max arraymaxarray arraylen;
sum arraysumarray arraylen;
printfarray: sumd maxd sum, max;
max arraymaxarray arraylen;
sum arraysumarray arraylen;
printfarray: sumd maxd sum, max;
return ;
arrayfunction.asm:
section text ; start of code segment
section data ; start of initialized data segment
section bss ; start of uninitialized data segment
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
