Home ] Up ] New Stuff ] Minix Port ] Magic-2? ] Overview ] Photo Gallery ] Construction ] My Other Projects ] Links ]

Source Code

This web site is the working storage for the project, and as it progresses the build mechanism will treat this as the official sources.   Here's where I'll be placing descriptions of the software I'm doing, as well as source snapshots of the build.

All components of the software stack are written in C, Perl and M-1 assembly language.  Originally, all development was done on a Linux system (SuSE 7.x distro), but lately I've been using Visual Studio .NET (to avoid constant reboots of my dual-boot laptop).  However, in VS the projects are vanilla Win32 console projects and should easily build on any Linux/Unix system.  Note that Perl, Lynx, lex (flex) and YACC (Bison) are required.

Low-level Simulator

The Magic-1 Simulator is coded somewhere between a true gate-level simulator and a functional simulator.  Control signals are allowed to have any of five states: HI, LO, UP, DN and XX.  Busses and latches hold binary data.  The simulator was structured along the lines of the hardware design - even to the point of organizing the code to match the schematics.

Timing issues are largely ignored.  The general strategy is to have a signal level pass, in which the control signals generated on each card are are computed in a loop until nothing changes.  Then, a rising or falling clock edge is inserted and another signal generation pass in done to propogate the edge.  Next, a latch pass is done which computes new values for all edge-sensitive components.  Finally, a pass is made over the signals converting all rising edges to HI level and falling edges to LO level.  Lather, rinse, repeat.

The simulator is stunningly slow, and is only good for relatively short instruction sequences.  I'll use it to flush out bugs in the hardware design and validate the microcode.

Functional Simulator

Haven't yet started on this one, but my basic requirements are that it simulates my I/O devices and can be throttled to reasonably accurately  run a real-time speed based on input clock frequency.  In an ideal world, it would be automatically generated from a Magic-1 architecture manual as was done with the reference simulators for HP's PA-RISC and Transmeta's Crusoe devices.  However, the document generation tools that I have (Word, vim and FrontPage) are ill-suited to the job.  For something like this, FrameMaker rules.  Oh well.

Temporary Assembler

The first assembler, qas, is a quick-and-dirty hack.  It is a simple one-pass assembler with backpatching, generated using lex and YACC.  It is absolute and outputs object files in Intel Hex format.  No macro facility, but it does allows expressions.  In the test suite it uses M4 for macro preprocessing.

Macro Assembler

To be started soon.  I'll use lex & yacc with a hand-coded grammar (rather than the auto-generated one that qas uses).  As far as macro syntax, I'll follow the classic Macro-11 lead along with whatever extensions amuse me.

ANSI C Compiler (lcc)

A full ANSI C compiler, lcc, has been retargeted for m1.  Because of memory usage and size, it will be limited to cross compilation.  Details, including build instructions, are here.


Not yet begun.  I expect I'll hack something together based on GNU linker or object file manipulation code.

Architecture Validation Test Suite

There is suite of basic architectural validation tests, written directly in M-1 assembly language.  See the documentation here.  Currently using qas syntax, and will need to be adjusted when the macro assembler comes on line.

Operating System

My goal is to port Minix to Magic-1.  It is an unreastic goal, but that's consistent with the rest of the project.  If it proves too difficult, I'll probably start with a port of Jean LaBrosse's Micro C OS II.

Another possibility, which I may do in any event, is to bring up a FORTH system.  This is the easiest path - I need only define a few FORTH primitives and basic interpreter.  I then should be able run import a pre-existing FORTH environment which is itself written in FORTH.


The heart of the system is the microcode.  Here's the listing.  


I'll be using a 5  512x8 74S472 blown-fuse PROMs, and have written a simple utility program to extract the actual bits from the microcode web page and then create five data files describing the bits in Intel hex format.  That's what we'll be feeding to the PROM programmer (whilst keeping my fingers crossed that it will actually program the 74S472's that I've located.

Previous Software Page

For reference, here is the old software page, showing what was built for an earlier revision of Magic-1.