Inspiration

I enjoy low level programming like operating system development and compilers.

What it does

SASM generates 32-bit machine code by reading an assembly source file in Intel syntax, and it supports generating code in raw binary or in the ELF and COFF object formats, used commonly by GNU/Linux and Windows systems respectively.

How we built it

The assembler was made using C++. The lexer is written using Flex, and a C++ source file is generated from it. The parser is written using GNU Bison, and Bison also generates a C++ source file from reading its input file.

Challenges we ran into

Relocation is complicated and was difficult to implement. In addition, the assembler needs support for referencing labels after the current instruction, which required several additional steps.

Accomplishments that we're proud of

The assembler supports over 70 instructions and generates object files that can be used on two popular operating systems: GNU/Linux and Windows.

What we learned

I learned a lot about how assemblers work and how the CPU executes machine code instructions.

What's next for sasm

I plan to add 16-bit support for raw binary, as well as support for floating-point instructions, other two-byte opcode instructions, and SSE and AVX instruction sets.

Built With

Share this project:

Updates