Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ only , Must works with Visual Studio! Please run a program, take picture from your code and output, Thank you! Please Do NOT write

C++ only ,

Must works with Visual Studio!

Please run a program, take picture from your code and output, Thank you!

Please Do NOT write on piece of paper!

image text in transcribedimage text in transcribed
CS 230 Spring 2022 Lab Assignment 4 In this assignment, you will write a function in Intel assembly language. The function name is quad and it will perform the quadratic calculation on an array of 32-bit integers. You may use scalar or SIMD instructions. You may either code this using Microsoft Visual Studio, or Apple Xcode. Refer to the week 12 example web page to get started. You will turn in only the subroutine, not a main program. A main program is provided later in this assignment to assist you in testing. To simplify testing, the parameters will be placed in a structure, which will be passed to the quad function. The structure is named all and is described later. Prototype for quad function int quad(all* aPtr); Parameter structure struct all { int* xArray; int* resultArray; int a, b, c; int ct; Parameters: xArray Address of the array containing the x terms to be used in the calculation resultArray Address of the array of results a,b, individual terms to be used in the calculation ct Number of entries in the x array Diagram of the parameter structure and variables: EAX all struct xArray 1 -1 a 2 b 3 -2 C 3 ct 20 et cetera resultArray et cetera Processing: For each xi: calculate ax + bx + c. Place the calculated answer in result. Count the number of results which are zero. Return Value: Return the number values of x which result in a value of zero. Submission Your function should start with the following two lines: * C5230 SP22 Lab 4 Last, First Submission Type */ Replace Last, First with your last and first name. Replace Submission Type with "Visual Studio" if you developed your solution with Microsoft Visual Studio, or "Xcode" if you developed your solution with MacOS Xcode. Test Program // C5230Lab4SP22. cpp : Test driver program for 'quad' subroutine. #include struct all { int* xArray; int* resultArray; int a, b, c; int ct; extern "C" int quad(all z) ; #define arraySize 20 int main() int a = 1, b = 3, c = 0; int x[arraySize] = { 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10 }; int result [arraySize] = { 0 ); all callvalues = { &x[0], &result[0], a, b, c, arraySize }; void* aptr = &callValues; int count = quad (callvalues) ; std: :cout "Add Files to..". 4. You should now be able to add the assembly language program (.s file type) to the Xcode project

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Programming questions

Question

Find the unit vector in the opposite direction of (1,2,3)

Answered: 1 week ago