One thing led to another and without noticing today I found myself in the deep (and fun!) abyss that are tropical maths and geometry.
Tag Archives: musings
Hey, I wrote an assembler.
(It was about time I interrupted a never ending pile of drafts with something)
So, for a bit more than a month I’ve been attending a seminar on VHDL microcontroller design.
One of the workshops involved doing some simple exercises on eval boards. While the overall instruction set is small (fits on less than a page) the idea of programming and then assembling the sources using pencil and paper wasn’t very appealing at the moment.
It sure is a fun way to keep the mind fresh but given time constraints I couldn’t cope with such a long debugging cycle.
And… The obvious path was to build a tool.
I reused parts of python-lx200 because smart data structures and dumb code are nice. Most of this could be implemented with M4 too, perhaps for another code golf session.
A couple of years ago I’d probably tried to use Bison and Flex but doubt that I could manage something like this in just a handful of hours during the weekend.
There are some rough edges but as it is it supports labels, variable definitions and emits a valid IHEX file. I made a couple of dumb mistakes but they were really evident when looking at what Quartus made of the output file.
I’m quite proud of the result, I don’t know when was the last time I had so much fun doing a one off project, even if it wouldn’t be used anymore after the seminar.
The source code lives here: https://github.com/pardo-bsso/islyd-asm
Subtleties on the road to happiness.
The other day I said something along the lines of “I work with” and I realized that the last time I had to say “I work for” was about eight years ago. Yay me.