TinyELF Emulator for Macintosh OS X

I’ve recently become serious about learning some assembly language.  I’ve always been interested in it but deemed it far too difficult of a task to take on.  It’s usually very mind boggling to look at and sometimes doesn’t make sense at a glance.  Recently I’ve come across a system to practice and learn it relatively easy.  It’s an emulator for OS X called tinyELF.  It’s based on a 1970’s hobbyist computer called the Cosmac ELF which is based on a RCA cpu called the 1802.  The unique thing about this chip is that it has a smallish intruction set of approximately 90 commands and you can enter byte code into it manually via a special loader mode.

The nice advantage of the emulator over the real computer of the 1970’s is that you can look at the memory contents, registers and a step-by-step trace of the instructions being executed.  Also, you can save programs and enter bytes manually into memory thus bypassing the loader.  Another huge advantage over the original Cosmac ELF is that this version features hexadecimal input.  The original elf featured toggle switches and required binary input.

To get started, I HIGHLY suggest reading this book that has been published online for free.  I’m into chapter 3 and so far it’s EXCELLENT.  It’s called A Short Course in Programming by Tom Pittman.  This would be better than me trying to re-explain how to enter programs although it’s much easier than it looks at first glance.

To give you a quick run down, when you start TinyELF, go to the debug menu and check off the Memory Contents, 1802 State and Trace.  These may look daunting at first but they will make sense in a minute.  Next, try out a sample program.  This program will make the R1 register count from 0000 to FFFF and keep rolling over.

0000   11     INC 1            This command increments register 1.

0001    30    BR LOOP    This command loops to the memory location specified in the next byte.

0002   00                          This is the target location for the BR LOOP command to branch off too.

I want to get you programming right away so I’ll tell you exactly what to press to input that program.  On the hex keypad press:

load, 11, I, 30, I, 00, I, Load

As you are doing that sequence, you should see the memory contents filling up.  You will need the 1802 State window open at the very least to see the output of this program.  When you have that window open, hit Run on the hex keypad. Register 2 should be counting up like nuts.  Congratulations, you just keyed in some old school assembly language.  This is very similar to what our forefathers did with punch cards but as I stated before, we have an advantage because we can very easily see the contents of the memory.

I encourage you to read that book that I linked to.  You will learn more than you can imagine about how computers work in a well-explained format.  If you don’t have a Mac, don’t worry, there are 1802 emulators out there for windows as well.  You’ll just have to do a little searching to find one.



If you like the content on this site, please support it by using this link to order from Amazon. You know you were going to go there and buy stuff anyhow so why not help me pay the hosting bill.