Tag Archives: Forth
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.