###### Assembly Programming

(5/5)

### Develop a program that uses four signed, global, short variables A, B, C, D Initialize each variable A, B, C, D to a different positive one-digit value Somehow print the four values in order A B C D, space separated Print a newline character

**INSTRUCTIONS TO CANDIDATES**
###### ANSWER ALL QUESTIONS

**Question 1 **

- Develop a program that uses four signed, global, short variables A, B, C, D

Initialize each variable A, B, C, D to a different positive one-digit value

Somehow print the four values in order A B C D, space separated

Print a newline character

Reorder the values in the variables from the order A, B, C, D to B, C, D, A

- A -> B
- B -> C
- C -> D
- D -> A

Somehow print the four values in order A B C D, space separated

### Question 2

- Convert this C++ program exactly as you see it into x86 assembly language:

**#include <iostream>**

**unsigned int x;**

**unsigned int c;**

**unsigned int result;**

**// f(x) = 8x + c**

**// Make sure to push and pop all necessary registers to the stack to **

**// ensure only the EAX register is modified upon return from the function **

**unsigned int Equation(unsigned int x, unsigned int c)**

**{**

** // You CANNOT use the mul or imul operations to perform the multiplication**

** return (8 * x) + c;**

**}**

**void main()**

**{**

** std::cout << "Enter a value for x: ";**

** std::cin >> x;**

** std::cout << "Enter a value for c: ";**

** std::cin >> c;**

** result = Equation(x, c);**

** std::cout << "f(x) = " << result << std::endl;**

** system("PAUSE");**

**}**

##### Attachments:

## Expert's Answer

136 Times Downloaded
## Related Questions

##### . Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

##### . The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

##### . Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

##### . SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of

##### . Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of