In-reply-to » Alright, I have a little 8086 assembler for my toy OS going now – or rather a proof-of-concept thereof. It only supports a tiny fraction of the instruction set. It was an interesting learning experience, but I don’t think trying to “complete” this program is worth my time.

@lyse@lyse.isobeef.org Heh, thanks, yeah, reading the Intel docs takes time. I’ve been doing that on and off since September (for this blog post), so I’m almost used to it now. But doing that for the very first time is quite gnarly. They’re not super well written.

I really think (this time) that I won’t add many more features. 😅 At the moment, the program is very “generic” and basically only does some pattern matching: If it sees a mov instruction followed by some 8 bit register and then some 8 bit number, then it encodes it as a 0xB0 byte using a certain mechanism (e.g., the register number might get added to 0xB0 and then the 8 bit number might just follow verbatim). That’s what the long list in the screenshot shows. “A cmp followed by two arguments of a certain type gets encoded as …” They’re all handled exactly the same.

Adding support for more instructions mostly just means adding more entries to that table.

If I were to add “optimizations”, I guess complexity would skyrocket. 😅

⤋ Read More