Question: I would like a code that is in asm.lib.inc. Your Task Now that you have seen the video, you should use what you have seen

I would like a code that is in asm.lib.inc. Your Task
Now that you have seen the video, you should use what you have seen to create the following procedure:
swapValues
This procedure should take the address of two DWORD variables and swap the values around. You must push the address of the two variables on the stack and use call to call the swapValues procedure.
In main, create some code to test your functionality. You should enter two DWORD values and pass their address to the swapValues procedure through the stack. When the procedure returns, you should output the swapped values. Please note that this is more than simply printing the values out in the opposite order in which they were input. The values in the variables should be swapped.
In the swapValues procedure, if you use any registers, I expect you to restore them just before the procedure returns. It should also be noted that you must use indirect addressing to accomplish the task because you are dealing with addresses.
Sample Run
Enter a number
5
Enter a number
8
Your numbers swapped are
8
5
NOTE:
You are not to use any .IF .ELSE, .WHILE, or .ENDW instructions.
Do not use INVOKE for your procedures. You should push values onto the stack and reference them using the stack base. This means you should use call. Your procedures should also have a prologue.
The use of legacy directives like DB and DW is not allowed in this class. A deduction of 40% will be given if you use them.
The use of indirect addressing around variables is NOT allowed in the class unless you are using indirect addressing. An example of this would be [val1]. Doing this will result in a 25% reduction in your grade.
Also, note that you must use standard calling conventions to clean up the stack.
You must comment every line of code you write or your grade will be reduced by 20%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!