Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!