Question: Program in x86-64 assembly. Also if possible add comments to code. PLEASE somebody help me with this question. I've posted it so many times and
Program in x86-64 assembly. Also if possible add comments to code. PLEASE somebody help me with this question. I've posted it so many times and I get no answers. Also make sure that this works with no errors and warnings when it is in file.s form
Required data section:
.data
QArray1:
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
QArray2:
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0
For this lab, you will write an X86-64 assembly language program which has 4 functions, with the C language function prototypes shown below:
int main();
long readArrays(long *array_ptr1, long *array_ptr2);
void printQArray(long count, long *array_ptr, long *header_literal_address);
void printIntSquares(long count, long *array_ptr, long *header_literal_address);
The program should have 2 64-bit arrays, defined in the data section of the program, QArray1 and QArray2 both of which have a maximum size of 10 elements.
You need to write the main procedure to call the other three procedures at appropriate points,
The readArrays procedure will populate QArray1 and QArray2 with values:
The readArrays() function will return count to main().
The printQArray procedure will be called twice from main(): the first time with the size of the arrays, the address to QArray1 and an address to a string literal that says Elements in QArray1 . The function should then print each 8-byte value in the array in order on a separate line with a blank line following all of the values in the array. The second time that the function is called, it should be passed the size of the arrays, the address to QArray2 and an address to a string literal that says Elements in QArray2 , then printing each of the values in QArray2.
The printIntSquares() function will also be called twice from main(): the first time with the size of the arrays, the address to QArray1 and an address to a string literal that says 2- byte Squares in QArray1 ; the second time with the size of the arrays, the address of QArray2 and an address to a string literal that says 2-byte Squares in QArray2 . The printIntSquares() function will read an 8-byte element from an array, then multiply the value by itself. After the multiplication, printIntSquares() will determine whether or not the product will fit in a 2-byte integer value. If so, then printIntSquares() should print out the value. If the product will not fit in a 2-byte integer, printIntSquares() should print out the string overflow rather than a number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
