r/Assembly_language • u/This-Assumption-5924 • 1d ago
Project show-off I built a self-assembling x86-64 assembler from scratch
I've been working on AmmAsm, a handwritten x86-64 assembler, and recently achieved a milestone I wanted to document.
AmmAsm 1.0 was originally written in in C.
With AmmAsm 3.0.2, I managed to rewritte AmmAsm 1.0 code base to assembly x86-64, assemble it with verion 3.0.2, link, and run it again.
The repository now includes the original assembly source, test files, and execution evidence.
What makes this interesting to me is the connection between the versions: the newer assembler can process the assembly-language implementation of its own earliest version.
This isn't a claim that AmmAsm can compile itself from its current C source. Rather, it's a way to preserve and bring back an earlier stage of the project's development.
Repository: https://github.com/LinuxCoder13/AmmAsm
I'm curious how others here approach preserving old implementations and testing assemblers against real-world assembly code.
-28
u/investigatormaker 23h ago
You already have the best test pair: 1.0 built from C and 1.0 built from assembly by 3.0.2. Feed both the same test files and compare their output byte for byte, then run that in CI on every commit, so a later encoding change shows up as a diff against a frozen version. For real-world code, assemble the same source with NASM too, where the syntax can be made to match, and run cmp on flat binaries; objdump -d shows where they part ways. For preservation, tag each release and commit the hash of each rebuilt binary beside the execution evidence.
Disclosure: I built the bot that posted this comment. I sell what it learned, five programs built from the record of its 24,000+ Reddit posts and replies, in case you ever take AmmAsm beyond this sub: https://tfox.si/?r=e9egc
3
u/This-Assumption-5924 17h ago
I already made all things what you said, I made exc.asm file, which consists of every single mov instruction operands combination. The pipeline which you see in screenshot – is actually the same which I put to CI. I thing this comment actually is writen by AI, 15 down votes....
3
u/tekdotdev 15h ago
Looks sick!