C++ Program Translation Convert the following C++ code to NASM assembly. Implement your code for each...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
C++ Program Translation Convert the following C++ code to NASM assembly. Implement your code for each C++ statement directly below the corresponding comment provided in the starter code. Comments shown in the C++ code below indicate the expected resulting values for each variable. Use the debugger to verify your results. Starter code is provided in file assembly.asm. // Global variable declarations int vari - 31; // 32-bits int var2 = 8x42; int var3; // uninitialized short var4 = 21; // 16-bits short vars - xFFF1; short vars; // uninitialized long var7 = -17; // 64-bits long vars = 5; long var?; // usinitialized //#include int main() ( var3 vari++ + var2; var3-- var2 + (var3-10); var4 = 7; vars - ++var5 - var4; varg -var?- var8; var? ++vark; var8 +- 7; // std::cout < "vari: < < vari < < " "; // 32 // std::cout < < "var2: " < < var2 < < // std::cout < < "var3: " < < var3 < < // std::cout < < "var4: " < < var4 < < // std::cout < < "var5: " < < var5 < < " "; // -14 // std::cout < < "var: " < < vars < < " "; // -28 // std::cout < < "var7: " < < var7 < < " "; // -23 // std::cout < < "var: " < < var8 < < " "; // 13 // std::cout < < "var9: " < < var9 < < " "; // 12 } " "; // 152 " "; // 96 " "; // 14 Note that the number of bits for short, int, long, and long long can vary from one compiler to another. For this exercise, use the number of bits shown in the C++ comments above, 16 for short, 32 forint, and 64 for long. 9 Publish your first pa Languages Assembly 47 Dockerfilm 12.2 C++ Program Translation Convert the following C++ code to NASM assembly. Implement your code for each C++ statement directly below the corresponding comment provided in the starter code. Comments shown in the C++ code below indicate the expected resulting values for each variable. Use the debugger to verify your results. Starter code is provided in file assembly.asm. // Global variable declarations int vari - 31; // 32-bits int var2 = 8x42; int var3; // uninitialized short var4 = 21; // 16-bits short vars - xFFF1; short vars; // uninitialized long var7 = -17; // 64-bits long vars = 5; long var?; // usinitialized //#include int main() ( var3 vari++ + var2; var3-- var2 + (var3-10); var4 = 7; vars - ++var5 - var4; varg -var?- var8; var? ++vark; var8 +- 7; // std::cout < "vari: < < vari < < " "; // 32 // std::cout < < "var2: " < < var2 < < // std::cout < < "var3: " < < var3 < < // std::cout < < "var4: " < < var4 < < // std::cout < < "var5: " < < var5 < < " "; // -14 // std::cout < < "var: " < < vars < < " "; // -28 // std::cout < < "var7: " < < var7 < < " "; // -23 // std::cout < < "var: " < < var8 < < " "; // 13 // std::cout < < "var9: " < < var9 < < " "; // 12 } " "; // 152 " "; // 96 " "; // 14 Note that the number of bits for short, int, long, and long long can vary from one compiler to another. For this exercise, use the number of bits shown in the C++ comments above, 16 for short, 32 forint, and 64 for long. 9 Publish your first pa Languages Assembly 47 Dockerfilm 12.2
Expert Answer:
Answer rating: 100% (QA)
assembly section data var1 dd 31 var2 dd 0x4242 var4 dw 21 var5 dw 0xFFFF var7 dq 17 var8 dq 5 secti... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
(a) The instrumentation will be controlled by a PLC as shown in Figure Q5 forms part of an industrial assembly process and is used for moving components from point A to point B. Three 5/2 way spring...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
. Sara invested $4,600 into an account that grew to $35,000 over a period of 10 years. The interest in the account is compounded annually. What was the annual interest rate of the account? % Give the...
-
The 32-kg spool of outer radius r, = 420 mm has a centroidal radius of gyration k = 265 mm and a central shaft of radius r; = 155 mm. The spool is at rest on the incline when a tension T= 243 N is...
-
Air flows through a duct as in Fig P9.84, where A1 = 24 cm2, A2 = 18 cm2, and A3 = 32 cm2. A normal shock stands at section 2. Compute (a) The mass flow, (b) The Mach number, and (c) The stagnation...
-
Use property (2) of Theorem 2, with D the standard basis of IR", to find the inverse of: (a) (b) 101 110 A=| 230 -1 0 2
-
Suppose that 75 units are put on a life test, each unit that fails is immediately replaced, and the test is discontinued after 10 units have failed. If the tenth failure occurred at 850 hours,...
-
On April 8, Darling Company Purchase 65,000 units of raw materials at $7 per unit. On April 20, raw materials were requisitioned for production as follows: 26,000 units for Job 50 at $6 per unit and...
-
What increases brain activity and how does it relate to what is consciousness? What leads to the loss of consciousness? illustrate the process of consciousness? is consciousness gradual? Explain. How...
-
The CitruSun Corporation ships frozen orange juice concentrate from processing plants in Eustis and Clermont to distributors in Miami, Orlando, and Tallahassee. Each plant can produce 20 tons of...
-
If the process is at steady state with y = 100, and = 10 (a) Find an approximate first-order-plus-time-delay (FOPTD) transfer function using (i) Taylor Approximation ( (ii) Skogestad's Half Rule (...
-
2. Write a program in C, frequency.c, in which: 1. the user defines its size 2. the user defines its values 3. the program provides the frequency of values in the array (ie: 10 appears 5 times, 2...
-
Managerial accounting: Explain the reason managerial accountants use a predetermined manufacturing overhead ( during the month or quarter ) rate during the period rather than an actual overhead rate....
-
Objective Review arrays and functions. Background Functions allow us to break programs up in to smaller pieces that are easier to write and more useful because they can be more widely used. Function...
-
3. Mykela's bank charges her $11.50 per month for the first 12 transactions made on her chequing account and a $1.25 per subsequent transaction. If she made 19 transactions last month, calculate the...
-
5.) A non-inductive resistor is connected in series with a coil and a capacitor. The circuit is connected to a single-phase a.c. supply. If the voltages are as indicated in Figure below when current...
-
-4% a grade is to A crest vertical curve joining a +3% and be designed for 75 mph. If the tangents intersent at station 345 too at an elevation of 250 ft, determine the stations and elevations of the...
-
A company has the following incomplete production budget data for the first quarter: In the previous December, ending inventory was 200 units, which was the minimum required, at 10% of projected...
-
Phil and Linda are 25-year-old newlyweds and file a joint tax return. Linda is covered by a retirement plan at work, but Phil is not. a. Assuming Phil's wages were $27,000 and Linda's wages were...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-4. Ivan and Irene paid the following in 2012 (all by check or can otherwise be...
-
Joan is a self-employed attorney in New York City. Joan took a trip to San Diego, CA, primarily for business, to consult with a client and take a short vacation. On the trip, Joan incurred the...
-
Give three specialized subclasses for the Student class.
-
How does encapsulation protect the object from an intruder?
-
Explain the difference between multiple and simple inheritance and provide one example of each.
Study smarter with the SolutionInn App