Getting started with Assembly Language in 2018
I started wondering about learning Assembly Language after Steve Gibson mentioned it on his Security Now podcast, many many years ago. However, I never actually started dabbling in it, because of its somewhat daunting nature. How does one get started with something as low-level as Assembly? That question has largely kept me from investing time in it, in addition to my day job, of course :).
I recently acquired a bundle of eBooks on programming through Humble Bundle, which included The Art of Assembly Language by Randall Hyde. The second edition was published in 2010, and seemed like a good place as any to start. It appears to begin from first principles, which is great for someone like me, having developed software professionally for the past 8 years, but lacking low level knowledge of assembler or machine code.
I’m only part way into the first few chapters of the book, but I wanted to share my early experiences with trying to get the HLA compiler running on my Mac, since I had a little trouble getting things to go. Installation instructions in the book are sparse, so you’re expected to find your way by yourself, using the website, which is a little dated and doesn’t mention all of the required steps.
This is my current setup:
- MacBook Pro Mid-2015
- macOS 10.13 High Sierra
- Fish shell
- Visual Studio Code for editing (not sure I’m sticking with this one, since it doesn’t come with built-in syntax grammar for HLA — and why should it)
Installing the HLA compiler
The open-source and public domain compiler is hosted on its rather nineties-feeling site, and is available for all major platforms, including macOS. I installed the latest version, 2.16 at time of writing.
Unpack the tar.gz
The compiler comes as a Linux-style archive, which unpacks into the following directory structure:
I moved the /usr/hla
directory to the /Users/<me>/Applications
directory, as there’s no actual need to install it system-wide. I needed to add this directory to the PATH, so it’s accessible from the terminal.
Fish terminal configuration
As I mentioned, I use the fish
terminal, which requires a slightly different configuration compared to bash
. Aside from the PATH variable, I also registered the hlalib
and hlainc
variables.
code ~/.config/fish/config.fish
Trying to invoke hla
on the Hello World example threw various errors, which were resolved by registering the above alias
. Compiling HLA files is now as easy as:
hla hw.hla