Question: The code I have here is fine but I need help adjusting it, when it tries to swap the first and second variable it doesn't
The code I have here is fine but I need help adjusting it, when it tries to swap the first and second variable it doesn't happen I can't use any fancy code it's mostly limited to just this. It's in Assembly 86.
INCLUDE asmlib.inc .data prompt BYTE "Enter a number ", 0 outP BYTE "The difference of your numbers is ", 0 outP2 BYTE "First variable: ", 0 outP3 BYTE "Second variable: ", 0 val1 DWORD ? val2 DWORD ? .code main PROC mov edx, OFFSET prompt call writeLine call readInt mov val1, eax mov edx, OFFSET prompt call writeLine call readInt mov val2, eax sub eax, val1 mov edx, OFFSET outP call writeLine call writeInt xor eax, val1 xor val1, eax xor eax, val1 mov val1, eax xor ebx, val2 xor val2, ebx xor ebx, val2 mov val2, ebx mov edx, OFFSET outP2 call writeLine mov eax, val1 call writeInt mov edx, OFFSET outP3 call writeLine mov eax, val2 call writeInt exit main ENDP END main
Use the code that was given in the video to perform the following tasks: Create two DWORD variables. Prompt for input and store the values input from the keyboard into the variables. Subtract the second number from the first and output the difference. Using logic swap the values in the two variables with each other. Output the swapped values. Here is an example of how your program should run
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
