Page 2 of 2

Re: Need Help Understanding Assembly Language

Posted: Fri Nov 13, 2020 3:42 pm
by pp4me
yankees60 wrote: Thu Nov 12, 2020 9:30 pm
pp4me wrote: Thu Nov 12, 2020 2:09 pm Joe Biden told the coal miner's in Pennsylvania that they could "learn to code" if he put them out of work. How hard can it be if even a coal miner can do it?


!!!!!!!!!!!!!


Does the reverse hold true? All coders can coal mine?

Vinny
I suspect that most coders could learn to coal mine. Probably wouldn't like it very much though.

Re: Need Help Understanding Assembly Language

Posted: Sat Nov 14, 2020 1:04 pm
by Smith1776
pp4me wrote: Thu Nov 12, 2020 1:07 pm Good work.

Just a quick observation for now.

Thought they might all be the same but it appears you have 2 variations in the assembly code (I used DiffMerge to compare side by side).

The goto and do-while loops are identical
The for and while loops are identical except for some label names that don't matter.

As for the C code, I think it's more common to write "answer += i" than "answer = answer + i" unless things have changed in the last 5 years. With any modern optimizing compiler I doubt it would make any difference but it will save you some typing. Otherwise looks pretty good to me.

When all is said and done the only differences you need to explain are highlighted below. The for/while is on the left and the goto/do-while on the right.

Imageobjectives for exercise program


THANK YOU. You have been of tremendous help. Check this out!


programming assignment.png
programming assignment.png (273.28 KiB) Viewed 1676 times


Not quite a perfect score, but pretty close! I got some marks docked because I didn't provide an accompanying explanation to the graph I generated that detailed the performance improvement resulting from loop unrolling.

Still happy with the result. Thanks! ^-^ ^-^ ^-^

Re: Need Help Understanding Assembly Language

Posted: Sun Dec 27, 2020 3:15 am
by ppnewbie
Assembly language brings back bad memories!

Re: Need Help Understanding Assembly Language

Posted: Wed Feb 17, 2021 3:01 pm
by Smith1776
I just wanted to circle back to this thread and say that assembly has started to really sink in and make sense. It's that intermediary between pure binary and higher level languages. Honestly, I'm beginning to really love it. I can see now how the C programming language in particular maps directly down to the assembly level. You can intuitively see how C code will look within the assembly context.

A lot of this has given me a lot more appreciation for how computers work under the hood. My laptop is much less of an arcane black box now. Along with assembly I've learned a lot of techniques for optimizing code so that it's cache friendly, has good spatial locality, and has good temporal locality. One can even see how seemingly minor changes in code can turn a sprightly algorithm into a slow one.

Re: Need Help Understanding Assembly Language

Posted: Wed Feb 17, 2021 3:18 pm
by pp4me
Smith1776 wrote: Wed Feb 17, 2021 3:01 pm I just wanted to circle back to this thread and say that assembly has started to really sink in and make sense. It's that intermediary between pure binary and higher level languages. Honestly, I'm beginning to really love it. I can see now how the C programming language in particular maps directly down to the assembly level. You can intuitively see how C code will look within the assembly context.

A lot of this has given me a lot more appreciation for how computers work under the hood. My laptop is much less of an arcane black box now. Along with assembly I've learned a lot of techniques for optimizing code so that it's cache friendly, has good spatial locality, and has good temporal locality. One can even see how seemingly minor changes in code can turn a sprightly algorithm into a slow one.
When I first started programming we had to look up the execution times of the machine language instructions to make sure we chose the most efficient ones.

This will probably be a waste of time for you in the future, as it is now, unless we somehow get to the point again where that matters but it was good mental discipline in thinking how computers work. At least IMHO.

Re: Need Help Understanding Assembly Language

Posted: Wed Feb 17, 2021 6:49 pm
by Mark Leavy
Smith1776 wrote: Wed Feb 17, 2021 3:01 pm I just wanted to circle back to this thread and say that assembly has started to really sink in and make sense. It's that intermediary between pure binary and higher level languages. Honestly, I'm beginning to really love it. I can see now how the C programming language in particular maps directly down to the assembly level. You can intuitively see how C code will look within the assembly context.

A lot of this has given me a lot more appreciation for how computers work under the hood. My laptop is much less of an arcane black box now. Along with assembly I've learned a lot of techniques for optimizing code so that it's cache friendly, has good spatial locality, and has good temporal locality. One can even see how seemingly minor changes in code can turn a sprightly algorithm into a slow one.
You're one of the few, Smith. I think it's genetic. You either get it or you don't. Nothing you can do about it.
Congrats. There is money in it. Maybe not in assembly, per se. But whatever gene allows you to grasp cache and registers and pointers will take you far.

Bonne Chance!