Need Help Understanding Assembly Language
Posted: Tue Nov 10, 2020 1:45 pm
Hello everyone. I'm working on a computer science assignment and am having trouble making progress truly understanding assembly language.
Can anyone point me to resources or methodologies for really effectively learning assembly? Getting frustrated. Thanks!
I managed to stumble my way through parts a to d, but am having trouble completing part e. My understanding of the underlying mechanics of assembly just isn't good enough to conduct such an analysis.Using the C Programming language, write four version of a function that contain a loop. Each function should accept two numbers and calculate the sum of all numbers between the first number and last number (inclusive of the first and last number). Tip: Try to use the same number of variables and almost the same logic when writing the C code for all four functions. Once each function is written and tested for correct output, generate an assembly language version of the function using the command: $gcc -O1 -S filename.c. (where filename.c is the C program containing the function). Next, analyze and compare the assembly language version of each function. [50 marks]
a. Write a version of the function using a for loop
b. Write a version of the function using a while loop
c. Write a version of the function using a do..while loop
d. Write a version of the function using a goto loop
e. Is the assembly language version of each loop function the same or different? If different,
identify the differences. Your comparison should be based on:
Number of registers used
Number of jumps (iterations)
Total number of operations
Can anyone point me to resources or methodologies for really effectively learning assembly? Getting frustrated. Thanks!