Hello everyone I have a question for assembly language course and I need a good
ID: 3578967 • Letter: H
Question
Hello everyone I have a question for assembly language course and I need a good expert who can helps me to solve that question. Thank you 1. (5 points) Sequential Logic Design. 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
//declaration of values
MOV EAX
MOV EBX
// addition of values
Add EAX,EBX
//exchange contents of registers
PUSH ECX
MOV ECX, [EBX]
MOV [EBX],EAX
MOV EAX, ECX
POP ECX
MOV ECX, EDX
Failure at run time: the number of clock cycles were very high.
This program can be very easily done using XCHG(exchange) instruction.If we are not using XCHG.Then the number of clock cycles will be very high. However, the XCHG instruction creates a lock over the memory bus to prevent any interruption into the operation, but we have to used XCHG because this reduces the number of cycles at run time
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.