Implement functions using x86 assembly

Assignment Help Programming Languages
Reference no: EM131621

Implement functions using x86 assembly. In addition to implementing procedures, this assignment requires to pass arguments using the stack. Another important goal is to practice using the logic operations to do bitwise manipulation.

PART A

Implement a procedure that mimics a logic unit. The logic unit has one input, one output and a set of control flags. The input size is 32 bits (4 bytes). The output size is 8 bits (1 byte) and there are 32 bits of control signals.

The output depends on the value of the control signals. Your job is to implement the functionality of this unit as follows:

The input is a double word. The bytes are numbered as follows:

Depending on the control signals, the output is determined as indicated in the following table:

Control Signals Output

XXXX XXX0 XXXX XXX0 XXXX XXX0 XXXX XXX1 BYTE 1
XXXX XXX0 XXXX XXX0 XXXX XXX1 XXXX XXX0 BYTE 2
XXXX XXX0 XXXX XXX1 XXXX XXX0 XXXX XXX0 BYTE 3
XXXX XXX1 XXXX XXX0 XXXX XXX0 XXXX XXX0 BYTE 4

*Note: X means 0 or 1. Output for ANY OTHER control signals: Concatenate the two highest order bits of each of the input bytes to form the output byte.

The input, control signals and output are parameters to the procedure you will be implementing. You need to read the parameters from the stack. You are NOT allowed to use the parameter variable names or create new variables in your procedure.

PART B

Implement a procedure that manipulates bits in a double word input by calling four different functions. Each function will manipulate one of the bytes in the input and generate one of the output bytes. Each function takes a 32 bit input (4 bytes) and returns a 32 bit output. Within the procedure you have to call four functions to perform different bit operations on the input and generate the output. The functions to implement are the following:

1. MIRROR_BYTE(input) -- Mirrors value of Byte 4 (leftmost).

Example: IF Byte 4 is 1011 0100 THEN return 0010 1101

2. SWAP_NIBBLES(input) -- Return interchanged nibbles of input's Byte 3.

Example IF Byte 3 is 1111 0000 THEN Return 0000 1111

3. INVERT_BITS(input) -- Flip the bits at positions 7, 5, 3, 1 of Byte 2. Leave the rest of the bits unchanged.

Example: IF Byte 2 is 0000 0000 THEN return 1010 1010.
Example: IF Byte 2 is 1111 1111 THEN return 0101 0101.

4. POWER_TWO(input) -- If the number in Byte 1 is a power of 2, return 1. Otherwise return 0.

Example: IF Byte 1 is 0110 0111 THEN return 0000 0000.
Example: IF Byte 1 is 0100 0000 THEN return 0000 0001.

You have to call the four functions from inside your procedure and pass the input parameter to each function using the stack. Return the result of each function using the return register EAX. The final output of your procedure is 4 bytes. Store the result of each function in the corresponding byte of the procedure's final output, e.g. INVERT_BITS result goes into Byte 2 of the output (since it manipulates Byte 2 of the input).

Reference no: EM131621

Questions Cloud

Calculate the output value of problem : Design a program that reads in a text file with drawing commands and then outputs a bitmap with all the items drawn correctly
Intermediate programming : Design a program that reads in a text file with drawing commands and then outputs a bitmap with all the items drawn correctly
Evaluate the maximum height reached by the sphere : Evaluate the maximum height reached by the sphere, and the distance traveled by the block.
The case international coal : Write a report on International Coal
Implement functions using x86 assembly : Implement a procedure that mimics a logic unit
Case analysis: outdoor sports inc : Calculate the Du Pont ratio analysis
Calculate the elasticity of demand and elasticity of supply : Calculate the elasticity of demand and elasticity of supply at each price change in the market for financial calculators
Income adjustment : To maintain utility constant an income adjustment brought the student to consume the basket (61,92). What are substitution effects and the income ?
Retirement plans : How much will Jane have in her retirement account immediately after she makes her last contribution in Year 40, assuming a return on her investments of 9%?

Reviews

Write a Review

Programming Languages Questions & Answers

  Writing a class

Build a class for a type called Fraction

  Learn redirecting standard output

Learn redirecting standard output (stdout) to a file using the output redirection operator

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Technical project: sample website project

Technical Project: Sample Website Project , This assignment consists of three (3) sections: a narrative, a storyboard, and a business Website. You must submit all three (3) sections for the completion of this assignment.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write a program that uses the curve class hierarchy

Write a program that uses the curve class hierarchy. The program should define several different objects, output their area, circumference, etc. It should also use the printcurve function.

  Create a multi-threaded competition

Create a multi-threaded competition in which opposing Robin Hoods will attack one another and try to take each other's gold coins.

  Discussion: html/css

Discussion: HTML/CSS,  "JavaScript Placement"  Please respond to the following: Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page. If so, explain wh..

  Create a project in xcode

Create a new project in XCode using the Mac OS X/Command Line Tool template

  Write the code required to analyse and display

Engineer for a materials manufacturing research lab and have been asked to provide an automated solution to analyse data.

  Program to perform a search of an employee list

Write a /bash/bin program to perform a search of an employee list.

  Hubspot: inbound marketing and web 2.0

Hubspot: Inbound Marketing and Web 2.0

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd