Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an HLA function that forces a value into all three passed parameters under certain circumstances. This function should have the following signature: procedure make31IfDifference20OrMore(

Create an HLA function that forces a value into all three passed parameters under certain circumstances. This function should have the following signature:

procedure make31IfDifference20OrMore( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe;

After calling this function, the value of all the drivers variables should be

changed to 31 if the three passed parameters subtracted from one another remains more than 20. Your function should replicate the following C code:

void make31IfDifference20OrMore( int * i, int * j, int * k ) { int difference = *i - *j - *k; if (difference >= 20) { *i = 31; *j = 31; *k = 31; }

}

IN ORDER TO RECEIVE FULL CREDIT, YOU MUST USE THE TEMPLATE SOLUTION SUPPLIED BELOW. Of course, you will need to add code to the function to implement the desired algorithm explained above. In addition, you will need to prepare and push the parameters to the function.

// Reference Parameter Template Solution For CS 17 Final // CS 17 Students must use this template as the basis for their solution. I hope it will help simplify your development task. // Please look at the two TODO: notes below

program ReferenceProgram; #include( "stdlib.hhf" ); static iValue1 : int16 := 0; iValue2 : int16 := 0; iValue3 : int16 := 0; // TODO: CS 17 Students add code below to implement this function // Several hints are supplied procedure make31IfDifference20OrMore( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe; static dReturnAddress : dword; begin make31IfDifference20OrMore; // entry sequence // preserve registers used pop( dReturnAddress );

// this is the return address

// push back the return address push( dReturnAddress );

// preserve registers

// begin sub-task

// restore the registers used

ret();

end make31IfDifference20OrMore;

begin ReferenceProgram;

mov( 1, iValue1 ); mov( 7, iValue2 ); mov( 3, iValue3 );

// TODO: push parameters to the function. Please remember that these parameters must be passed by-reference. call make31IfDifference20OrMore; stdout.put( "the first parameter = " ); stdout.put( iValue1 ); stdout.put( " the second parameter = " ); stdout.put( iValue2 ); stdout.put( " the third parameter = " ); stdout.put( iValue3 ); stdout.newln();

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

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions