Writing an assembler

Writing an assembler was something I always wanted to do for quite sometime now and finally wrote one.

Understanding an Assembler

An assembler is a system software program that takes a low level language like an assembly language that looks like this.

SET I, 0x8000
SET X, data
IFE [X], 0x0000
SET PC, end
SET A, [X]
BOR A, 0x7000
ADD X, 0x0001
ADD I, 0x0001
SET PC, loop

SET PC, end

DAT "Hello, World!",0

To machine code that looks like this

0x7cc1 0x8000 0x7c61 0x0011 0x8572 0x7f81 0x000f 0x2c01 0x7c0b 0x7000 0x01c1 0x8862 0x88c2 0x7f81 0x0004 0x7f81 0x000f 0x0048 0x0065 0x006c 0x006c 0x006f 0x002c 0x0020 0x0057 0x006f 0x0072 0x006c 0x0064 0x0021 0x0000

Took two days for me to get this up and running, the most part of the time was spent on understanding the DCPU 16 spec. Here is the end result.

Here we go again

Alright after a long hiatus, I’m back to blogging again. I am hoping that this blog would serve as a journal of notes to selves that help me understand few concepts clearly.

The blog is powered by Jekyll. Jekyll is a simple, blog-aware, static site generator written in Ruby. All the posts are written in markdown, like the one you are reading. If you have posted on sites like reddit or stackoverflow, you already know what markdown is. These markdown files are then committed to your repo and Bob’s your uncle - your post is published. Unlike wordpress there is no database.

The entire source of Jekyll is available on github here. Feel free to have a look see. There are also numerous tutorials like this one by Smashing Magazine or this one by the author of Jekyll, who is also the co-founder of Github on how to get started on Jekyll and start blogging like a hacker.

The site uses a minimalistic theme called Pixyll crafted by John Otander (@4lpine).

Have questions? Drop me a line at abkolan@gmail.com