Create an HLA function that forces a value into all three passed parameters. This function should have the following signature: procedure makeDouble( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe; After calling this function, the value of all the driver’s variables should be changed to twice the largest of the three passed parameters. Your function should replicate the following C code: void makeDouble( int * i, int * j, int * k ) { int most = *i; if (*j > most) {   most = *j; } if (*k > most) {   most = *k; } *i = most + most; *j = most + most; *k = most + most; } 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 push the parameters to the function.  Be sure your function preserves all the registers it touches. // Reference Parameter Template Solution For CS 17 Final // CS 17 Students must use this template as the basis for their solution.  // 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 makeDouble( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe; static  dReturnAddress : dword; begin makeDouble;  // entry sequence // preserve registers used  pop( dReturnAddress ); // this is the return address // push back the return address push( dReturnAddress ); // preserve registers   // TODO: implement function // restore the registers used ret(); end makeDouble; begin ReferenceProgram;  stdout.put( "Gimme iValue1" ); stdin.get( iValue1 ); stdout.put( "Gimme iValue2" ); stdin.get( iValue2 ); stdout.put( "Gimme iValue3" ); stdin.get( iValue3 );   // TODO: push parameters to the function.  // These parameters must be passed by-reference.  call makeDouble; stdout.put( "after makeDouble!" ); stdout.newln(); stdout.put( "iValue1 = " ); stdout.put( iValue1 ); stdout.put( "iValue2 = " ); stdout.put( iValue2 ); stdout.put( "iValue3 = " ); stdout.put( iValue3 ); stdout.newln(); end ReferenceProgram;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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

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

After calling this function, the value of all the driver’s variables should be changed to twice the largest of the three passed parameters. Your function should replicate the following C code:

void makeDouble( int * i, int * j, int * k ) {

int most = *i;

if (*j > most)

{

  most = *j;

}

if (*k > most)

{

  most = *k;

}

*i = most + most;

*j = most + most;

*k = most + most;

}


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 push the parameters to the function.  Be sure your function preserves all the registers it touches.


// Reference Parameter Template Solution For CS 17 Final

// CS 17 Students must use this template as the basis for their solution. 

// 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 makeDouble( var i : int16; var j : int16; var k : int16 );@nodisplay; @noframe;

static 

dReturnAddress : dword;

begin makeDouble; 

// entry sequence

// preserve registers used 

pop( dReturnAddress );

// this is the return address

// push back the return address

push( dReturnAddress );

// preserve registers

 

// TODO: implement function

// restore the registers used

ret();

end makeDouble;

begin ReferenceProgram; 

stdout.put( "Gimme iValue1" );

stdin.get( iValue1 );

stdout.put( "Gimme iValue2" );

stdin.get( iValue2 );

stdout.put( "Gimme iValue3" );

stdin.get( iValue3 );

 

// TODO: push parameters to the function. 

// These parameters must be passed by-reference. 

call makeDouble;

stdout.put( "after makeDouble!" );

stdout.newln();

stdout.put( "iValue1 = " );

stdout.put( iValue1 );

stdout.put( "iValue2 = " );

stdout.put( iValue2 );

stdout.put( "iValue3 = " );

stdout.put( iValue3 );

stdout.newln();

end ReferenceProgram;

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education