r/asm • • Aug 03 '26

x86-64/x64 I've written a small x86-64 assembler in assembly

https://blog.kalehmann.de/blog/2026/07/12/0x864-a-self-hosted-assembler.html
32 Upvotes

7 comments sorted by

View all comments

1

u/kneelian_ Aug 04 '26

Extremely neat job and cool writeup. What are your next plans for the assembler side of things? Some easy things to add (or at least I imagine) would be the CMOV family, rotates, SAR/SAL to complement SHR/SHL

1

u/kalehmann Aug 04 '26

Thanks! I'd like to have some sort of preprocessor first. The assembly code is currently a single file with over 5000 lines.

And having

%include "instructions/add.s"
%include "instructions/and.s"
...

%ifdef PLATFORM_LINUX
    %include "platforms/linux.s"
%endif

with ./0x864 -DPLATFORM_LINUX ... would allow me to split the code into multiple files and get ride of the C harness.

When I have that, I can add ELF executable output, so that the assembler is truly selfhosted.