AVR Assembly Section Finalizing - Atmel MCU GCC inline Asm mixing C/C++ syntax reference
Finalizing doesn't mean done, although it has taken about 2 months for me to update this section, of which consist of rewriting most parts again, so updating is really an understatement. It's more a redo of everything from scratch and redefining a new golden standard.
Assembly is full of tricks that it's only known to a few experts in the world:
Why is subtracting 0xff equivalent to +1? Why Exclusive-oring a value by itself clears it? Why adding a value to itself shifts its bit to the left? By shifting a byte to the right is equivalent to dividing it by 2... The list goes on and on. Each of these statements are not necessarily easy to see in one's head, but in order to create more complex assembly algorithms that do things as efficiently as possible, these types of tricks should be second nature to a real expert assembly coder. This is equivalent to playing chess with 100+ pieces and figuring out the best combos for the next 3 moves.
This has 2 implications: 1, majority of the assembly mnemonics are repetitive, meaning one instruction can do what other 2-10 instructions can do exactly. 2, Some mathematically simple instructions could have a more complex purpose that it seems.
PS. I have added few more sub-sections to some of the pages after this video, and few more examples. I have spotted one grammar error, and fixed it. This section is still under-development, but it has to do for now. It will most likely not going to get a new update at this point.
PPS. For using AVR-GGC, there are actually a huge amount of functions that can be called directly with a global name, so you can access a huge math library by default. Another reason why you want to use GAS instead of AVR assembler. Alternatively, you can access math functions by using inline-C in your assembly project, but this is very dumb, and is equivalent to fart only with your pants pulled-down because you are too dumb to see that you can fart with your pants on.