Programming Assignment #2 Please write a program that will perform some simple math using only registers. This program should have 1. A comment at the top that contains information in this form:...

1 answer below »
Please write a program that will perform some simple math using only registers.


Programming Assignment #2 Please write a program that will perform some simple math using only registers. This program should have 1. A comment at the top that contains information in this form: ;---------------------------------------------------- ; Programmer : Fred J. Masm ; Date due : February 2, 2020 ; Description : This program will calculate a simple math ; expression using only registers ; --------------------------------------------------- Specs: 1. Please start a MASM project named SimpleMath1. Use the template you create after watching the video about setting up MASM for Visual Studio. 2. In this program, you will be using only the eax, ebx, ecx, and edx registers 3. In the code section, do the following: a. Store the value 87 into the eax register; this will be value A in the expression b. Store the value 25 into the ebx register; this will be value B in the expression c. Store the value 50 into the ecx register; this will be value C in the expression d. Store the value 75 into the edx register; this will be value D in the expression 4. The expression you will be evaluating using the registers is: � = (� + � − �) − (� + �) + 145 5. From the reading, you should know what these instructions do: mov eax, 987 add eax, ecx add ebx, 53 6. You will also need the subtract instruction: sub. I can subtract a register from a register or a literal from a register; here are some examples: sub ebx, ecx ; subtracts the contents of the ecx register from the ebx register ; and stores the result into the ebx register sub edx, 14 ; subtracts 14 from the edx register and stores the result into the ; edx register 7. Use spacing to justify the columns containing the mnemonics (mov, add, sub), the operands (registers or literals), and the comments. 8. On each line, please comment what that line of code is doing; don’t say, “it’s storing edx into eax”; rather, tell what it does in terms of the expression: “it’s subtracting C from B” 9. Run your code by stepping through it using the debugger (as shown in the reading). You should watch the registers change with each step. Confirm that register contents are correct. 10. The result should end up in the ebx register. Make sure it contains the right value! Please submit these functions in a Word document that is named in this way: Lastname, firstname – PA2.docx So, if your name were George Washington, your document would be titled: Washington, George – PA2.docx
Answered Same DayFeb 02, 2021

Answer To: Programming Assignment #2 Please write a program that will perform some simple math using only...

Sudipta answered on Feb 02 2021
149 Votes
;---------------------------------------------------------------------------------------------------------
; Programmer    : Ayah, Masm
; Date due    : February 2, 2020
; Description     : This program will calculate a simple math
;          expression using only registers
;...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here