Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 407 Weeks Ago, 6 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 19 Jul 2017 My Price 12.00

implementation of the function

Please complete the implementation of the function given in the question section below.

Test your functions using the main program given. Please note main program may have missing lines or code. You are required to identify missing code and complete it.

QUESTION: Write a function to change variable from little endian to big endian notation in assembly.

The basic structure of the function is given in the attached assembly language file. You are expected to complete the function int toBigEndian(int variable) which converts an integer variable passed from little endian to big endian notation. The conversion function should simply accept the number variable and flip the order of the bytes and return the resulting value. For example

Variable passed to function 0xAABBCCDD?The value returned from the function 0xDDCCBBAA

Complete the function implementation which takes a little endian notation as input and returns the big endian notation of the given value from the function as given in the above example.

The function with the basic commands for the function entry and exit / return are already given. Use the given function and fill in your implementation where it is specified as below:

TO DO: Your implementation should be here

*/

Note: The function can be implemented using the following instructions:

ANDL?

ORL?

ADDL

SUBL

XORL

SHL

SHRL

THESE ARE THREE SEPERATE FILES THAT ARE INCLUDED IN THE PROGRAM!

/*

* Assembly.S This is file 1

*/

.global _toBigEndian

_toBigEndian:

/* Function entry code */

     pushl    %ebp

     movl     %esp, %ebp

     subl $16, %esp

    

    

    

     /* TO DO: Your implementation

         should be here

     */

    

    

    

/* Function exit code */

     movl     %ebp, %esp

     popl     %ebp

     ret

    

    

    

.global _isLittleEndian

_isLittleEndian:

/* Function entry code */

     pushl    %ebp

     movl     %esp, %ebp

     subl $16, %esp

    

    

    

     /* TO DO: Your implementation

         should be here

     */

    

    

    

/* Function exit code */

     movl     %ebp, %esp

     popl     %ebp

     ret

//function.h This is file 2

extern int toBigEndian(int);

extern int isLittleEndian(int);

// This is file 3

#include stdio.h>

#include "function.h"

int main() {

    

     int in1, in2;

     int out1, out2;

    

     // Sample input value (It may be tested with other input values)

     // Do not hard code these values inside the function

     in1 = 0xAABBCCDD;

     out1 = toBigEndian(in1);

     printf("\nOutput1: %d", out1);

    

     // Sample input value (It may be tested with other input values)

     // Do not hard code these values inside the function

    

     out2 = isLittleEndian();

     printf("\nOutput2: %d", out2);

     return 0;

Answers

(5)
Status NEW Posted 19 Jul 2017 12:07 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------

Not Rated(0)