Perl Assembler

When I was in college, I became really interested in x86 assembly. I decided to try to write a bunch of "from scratch" code - to get a better understanding of how x86 microprocessors worked under the hood, and because this low-level code was new and fun.

I decided to start out by writing an assembler, that I would use to convert all of my asm code to machine code. I decided on perl, because I figured parsing would be easier (of course if I were to do this over again, I would use a Java-based BNF grammar parser/generator, which is almost definitely better suited to the job, and would also result in much cleaner code).

At any rate, with nothing more than perl, a decent editor, technical info and a good book, I was able to succeed. The assembler itself was written in late 2003/early 2004, and was used frequently during that time.

I'm quite proud of this achievement, though I am really not proud of the code itself. While it appears to work quite well (I assembled quite a bit of code with this, and any errors I found were quickly fixed), the code is rather horrendous - take a look if you feel adventurous. When I wrote this, my general philosophy for programming was to "get it to work". Now, I worry much more about clean code, flexibility, and ease of maintenance.

AttachmentSize
asm.pl32.91 KB
IA32.dat119.66 KB