GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

When working with the FPU and the variable w declared as: w…

When working with the FPU and the variable w declared as: w : int32 := 12; what instruction will correctly load the variable w into the FPU?

Read Details

When HLA Programmers try to declare reference parameters as…

When HLA Programmers try to declare reference parameters as function parameters, which of the following function signatures should be used?

Read Details

Create an HLA function that loops through a single string ar…

Create an HLA function that loops through a single string argument and verifies that it contains exactly two ‘2’ characters. This function should have the following signature:procedure two2s( stringData : dword ); @nodisplay; @noframe;This function should return into AL an int value which is either true or false, 1 or 0. To receive full credit, your two2s( ) function must not allocate any storage. You must use the utility functions gets and puts provided here by downloading this file.  Unzip it to find the .hla file inside.  These are the some of the same routines you used in Unit 15. Once you acquire the file, you can include it in your code by saying:    #include( “cs17string.hla” );Your function should replicate the following C code:bool two2s( char * stringData ){  int  i = 0;  char letter = ‘ ‘;  int  count = 0;   while ( stringData[ i ] != NULL )  {      // loop looking for all the 2s     letter = stringData[ i ];     i = i + 1;     if (letter == ‘2’)     {        count = count + 1;     }  }  return( count == 2 );}   IN ORDER TO RECEIVE FULL CREDIT, YOU MUST USE THE TEMPLATE SOLUTION SHOWN 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. // String 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 StringProgram;#include( “stdlib.hhf” );// The file cs17string.hla is downloadable from the hyperlink shown above.// Place it in the same folder as this hla file you are working on #include( “cs17string.hla” ); static  stringData : dword;  answer : int8; // TODO: CS 17 Students add code below to implement this function// Several hints are supplied procedure two2s( stringData : dword ); @nodisplay; @noframe;staticdReturnAddress : dword;begin two2s;// TODO: CS 17 Students will need to preserve registerspop( dReturnAddress ); // TODO: CS 17 Students need to get stringData off the stack // push back the return addresspush( dReturnAddress ); // preserve registers // begin function implementation // leave the answer in EAX // restore the registers used ret(); end two2s; begin StringProgram;  stdout.put( “Please enter a string to process”, nl );// this code allocates a string of size 80mov( @size( int8 ), AL );mov( 80, BL );inc( BL );mul( BL );mov( 0, EBX );mov( AX, BX );malloc( EBX );mov( EAX, stringData );// let’s try reading a value into the stringmov( stringData, EAX );push( EAX );mov( 80, CX );push( CX );call gets;// print the stringstdout.put( “—-> here is the string you entered: ” );mov( stringData, EAX );push( EAX );call puts;stdout.newln();// initialize EAX before calling the function.mov( 0, EAX ); // TODO: CS 17 Students need to pass a string parameter to the function call two2s;mov( AL, answer ); // show the resultsstdout.put( “after two2s — result=” );stdout.put( answer );stdout.newln(); // return what you malloc’edfree( stringData ); end StringProgram;

Read Details

On the 80×86 CPU floating-point hardware, FPU registers are…

On the 80×86 CPU floating-point hardware, FPU registers are 80-bits in size.

Read Details

Patti the Programmer loads the EBX register with a pointer v…

Patti the Programmer loads the EBX register with a pointer value as shown below:static:iValue : int16 := 0;dMallocAddress : dword;begin progExample; mov( &iValue, EBX ); malloc( @size( int8 ) );mov( EAX, dMallocAddress );    mov( dMallocAddress, EBX ); // Patti uses [EBX] end progExample;After she has finished using EBX, must Patti the Programmer FREE EBX?

Read Details

When HLA Programmers use the MALLOC and FREE instructions, t…

When HLA Programmers use the MALLOC and FREE instructions, they are manipulating the run-time stack.

Read Details

For the next question, please assume the following declarati…

For the next question, please assume the following declarations: iOne : int8 := 1;iFive : int8 := 5;iTen : int8 := 10;iFifteen : int8 := 15;iSixteen : int8 := 16;   NOTE: Depending on your test version, not all of these values may get used.

Read Details

The diagram below represents the various portions of a singl…

The diagram below represents the various portions of a single-precision floating-point number as represented in the Intel CPU processor. The yellow portion of this single-precision number is its

Read Details

Will the following code jump to the label myLabel? mov( iS…

Will the following code jump to the label myLabel? mov( iSixteen, AH ); cmp( AH, iFifteen ); jnb myLabel; if iSixteen has the value 16 and iFifteen has the value 15?

Read Details

The last day to take the Midterm is 06/22/26.  I understand…

The last day to take the Midterm is 06/22/26.  I understand that I have time to schedule and complete this exam.  If I wait until the day of the due date, I am putting myself at risk of technical difficulties impeding my completion of this exam.  I know that I should take this exam a couple days before the due date to ensure completion of the exam.  Please mark this date in your calendar. You must contact Ms. Richardson for any extensions. There are no retakes for this exam.  

Read Details

Posts pagination

Newer posts 1 … 15 16 17 18 19 … 86,120 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top