4 ms·
With the description of "minimalist" I was expecting something more like http://www.terse.com/ http://www.terse.com/ but this turns out to be even more verbose
by userbinator 6y ago
With the description of "minimalist" I was expecting something more like http://www.terse.com/ http://www.terse.com/ but this turns out to be even more verbose than regular Asm, more like writing pure machine code. Also, I'm puzzled at the author calling opcode cd syscall --- that's "int imm8", and the real syscall instruction resides on the second page (0f 05).
If you're going to write x86 machine code, then memorising the instruction set is far easier in octal:
https://gist.github.com/seanjensengrey/f971c20d05d4d0efc0781f2f3c0353da https://gist.github.com/seanjensengrey/f971c20d05d4d0efc0781...
- akkartik 6y agoThe stuff after / is often just comments. 'syscall' feels more accurate for int 80 than 'interrupt', but the language doesn't encode the name. I only found out about the octal after I started on SubX. I considered switching to it, but thought it might be useful to keep the same opcodes as the Intel manual.
- akkartik 6y agoThanks for the pointer to terse! I hadn't seen it before. I think of concise as "expressive" or "cryptic". "Minimalist" usually connotes small implementation. Like chibicc or something.
- jart 6y agoHere's another octal x86 reference for comparison: https://justine.lol/blinkenlights/8086.html https://justine.lol/blinkenlights/8086.html
- akkartik 6y agoOh I'd missed that page on the blinkenlights site. Thanks!
- jart 6y agoI hope you enjoy it! Since you mentioned chibicc earlier in this thread, and you've written an assembler of your own, this might be of interest to you: https://github.com/jart/cosmopolitan/blob/master/third_party/chibicc/as.c https://github.com/jart/cosmopolitan/blob/master/third_party... Your work was brought to my attention maybe a year and a half ago and I think what you're doing is pretty cool. Feel free to reach out by email if there's anything I can do to help.
- tekknolagi 6y agoThat's a neat assembler library. Thanks for pointing it out. I have been using maximecb's https://github.com/Shopify/ruby/blob/yjit/yjit_asm.h https://github.com/Shopify/ruby/blob/yjit/yjit_asm.h
- jart 6y agoOh that's not intended as a library for things like jit. It's just a program that takes an asm file generated by chibicc and turns it into an ELF .o file. Building a library for x86 codegen would be such a rabbit hole. Intel Xed did that but it was just so huge that the only part I wanted to use was its instruction length decoder.
- akkartik 6y agoHere's another interesting one I just noticed: https://github.com/attila-lendvai/maru/blob/maru.10/source/assembler/gen-asm-x86.l https://github.com/attila-lendvai/maru/blob/maru.10/source/a...
- drudru11 6y agoThank you for making that. There are are articles that mention how we forgot the octal connection to the x86 isa. Your ascii art table is just a really clean way of visualizing it.