Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello everyone I have a question for assembly language course and I need a good

ID: 3578737 • Letter: H

Question

Hello everyone I have a question for assembly language course and I need a good expert which is professional who can helps me to solve that question. Thank you.. a) write an assembly language program that uses only Mov, ADD, PUSH and POP instructions to exchange values in the EAX and EBX registers and store their sum in the EDX register. b) Test your program thoroughly using various values, screen shots and a summary table to validate your code. For what values does your program not produce a correct sum? What feature could be checked at runtime by further program enhancement? (Answer what; do not re-write your program!)

Explanation / Answer


Program to Swap contents of EAX and EBX registers and add them and store in EDX register

PUSH EAX - Push the contents of EAX to stack.
MOV EAX, EBX - Copy the contents from EBX register to EAX register
POP EBX - Pop the contents from stack to EBX register.

ADD EDX, EAX - Add the contents of EAX and EDX and store the result in EDX.
ADD EDX, EBX - Add EBX register content to EDX and store the result in EDX.

Conditions where the above program wont work correctly:

1. When either of the EAX or EBX registers or both contain memory address referring
to some other location, then this will give Unexpected results.

2. While doing this operation if the stack contents are changed by some other
program, then it will give wrong answer.

3. Since 8086 has 32 bit instruction set, if we want to operate on 64 bit numbers,
then this wont work.

To make the program work correctly, we have to take care of above points.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote