I gave an impromptu talk on assembly language programming. Here are some of my notes:
Thoughts on assembly language
- programming language
- very close to the machine
- plain text, unstructured
- low productivity for the programmer
- verbose, awkward, difficult, exacting, unhelpful (so why do we do it?)
- high performance code
- precise control over what happens when
What does close to the machine mean?
- see the Compiler Explorer to relate C to assembly
- use the programmer-visible registers
- use the available opcodes
- use the available status flags and branches
- arrange your own calling convention
- do your own register allocation and liveness analysis
- do your own software pipelining
Interesting links:
- Compiler Explorer (responsive compilation of assembly code fragments, using a variety of compilers targeting a variety of CPUs.)
- x86 assembly doesn’t have to be scary (interactive tutorial)
- Easy 6502 by skilldrick
- ODA - The Online Disassembler
- Rosetta Code for fragments of code in many languages
As a teaser for another subject or two, I showed a disassembly of a ROM and a complex ad-hoc one-liner to produce a binary file from this text.