Tag Archives: 1802
1802 Emulator
In a previous post I talked about the 1802 Assembler I was playing with when I revisited an ancient 1802-based FIG-Forth implementation.
Since it was a pain to get that code running on real hardware, I also threw together an emulator. This was done in Objective-C for the Mac.
Note that the core emulation code is written in ‘C’ however, so it should be quite portable.
It is fairly quick, although I have not tried to quantify it’s equivalent speed.
It will build under recent Xcode versions such as Xcode 6 or Xcode 7.
Listing files can be loaded and executed. There is application-specific code to treat some of the IO ports as serial input/output to a simple terminal facility.
This is in no way a polished final product, but it is made available on the off chance that someone else might find the code useful or interesting.
Cosmac 1802 Assembler in Python
So back in the day, one of my Cosmac 1802 projects was getting FIG-Forth up and running on the 1802.
I laboriously converted the printed listings to a digital assembler source file. This file was then assembled with a cross-assembler that was written in BASIC.
As part of that effort I also modified the Forth system to run from EPROM.
Since I wanted to get Forth running on the 1802 Membership Card (see earlier blog post), I needed the ability to assemble that source, and do some updates etc.
In the same way it’s been a long time since I’ve had a computer with a parallel port, it’s been a long time since I’ve had a computer with a BASIC interpreter installed.
The obvious next step was to write an assembler in a more modern language. Again Python was my tool of choice.
This is a fairly simple assembler, just sufficient to assemble my ancient FIG-Forth listings. It is not a macro-assembler and I’m sure has other limitations relative to a “real” 1802 assembler.
The source is available here: https://github.com/donmeyer/cosmac-assembler
This plays nicely with my 1802 Membership Card Loader. The loader can invoke the assembler automatically when given a source file, allowing you to give one single simple command line that assembles the source and downloads it to the Membership Card.
1802 Membership Card Loader
So I built Lee Hart’s slick little 1802 Membership Card and its Front Panel card. Next I wanted to load some programs onto it! There was that nice DB-25 connector all ready to connect to my PC’s parallel port. However… I’ve got a Mac, and haven’t seen a computer parallel port in perhaps a decade.
My solution to this problem was to create my own interface hardware based on an Arduino. I considered using a Spark Core to allow doing things wirelessly via WiFi, but decided that for this purpose the Arduino was something more people were likely to have, and it was just a somewhat simpler solution.
The final design uses an Arduino, a 16-line I2C port expander chip, and some software. The software consists of the Arduino program and a Python program that runs on my Mac. Since it’s Python, it should also run on a Windows system, a Linux box, etc.
You can also forego the Python side of things and directly control the Arduino loader from a terminal, or from your own software if you prefer.
Why go to all this trouble? Just a fun little project!
It’s been a good mental exercise and a nice trip down memory lane.
Here is the Git repository with the source code and documentation: https://github.com/donmeyer/membership-card
Coming up next – an 1802 Emulator