Jul 30, 2018
Factorial on SubX
http://akkartik.name/images/20180730-subx-factorial.html
Ok, I think I understand calling conventions now.
Also coming face to face with the pain of debugging machine code 😀
https://github.com/akkartik/mu/commit/62c6d1638a
permalink
* *
Jul 26, 2018
Adventures in machine code #3
I just spent a couple of days separating out bitfields in my programs, and writing a translator to pack them correctly.
Then I realized that doing so makes it harder to count bytes when computing jump targets.
Luckily there's just two such bytes in the 32-bit x86 encoding, and most of the time the rule becomes, "add 1 byte if these three columns contain anything".
https://github.com/akkartik/mu/tree/6e51c60c699/subx/Readme.md
permalink
* *
Jul 9, 2018
After playing with the ELF format for a few days, it's starting to sink in that binaries need to specify the location of the data segment, but the locations of the stack and heap are the kernel's prerogative.
Obvious with hindsight.
permalink
* *
Jul 1, 2018
Lately I've been programming in raw (32-bit x86) machine code, evolving some minimal tooling for error checking rather than information hiding. A few different ways to write the same instruction ("mov ebx, 42"):
- <binary>
- `bb 2a 00 00 00`
- `bb 42/imm32` (todo: check that `bb` accepts an imm32)
- `mov_imm 42/imm32` (planned; like Forth, no overloading names)
It'll eventually start getting more high level.
- String literals.
- Function calls.
- ...
permalink
* *