Two years ago John Doran designed and built a computer based on the 7400-series TTL chip set. A thorough description of it is on his webpage ( http://timefracture.org/D16.html). Our local computer club (the 6502 Group) was blown away by John's unique tribute to the minicomputer - that, and his craftsmanship, productivity, and professional documentation.
However some of us whined about its lack of indexed addressing. Without this it was awkward to run a high level language, which depends heavily on indexing to access local variables and array elements. Recently John saw the light and added, not just one, but three index registers along with a bunch of instructions to support them. This was all the stimulation needed to port XPL0 to it.
Next, a supporting package of runtime routines were written (D16RUN.ASM). These were built upon an existing debugger (DMON), and include essentials such as multiply and divide routines and some basic intrinsics that do things like display text and input and output integers.
The simulator (D16SIMX) was updated with the new instructions and used to verify and debug both the runtime code and the code generated by the compiler.
Although the compiler doesn't have a completely separate "back-end" code generator, it was fairly straightforward to replace the 8088 instructions with their equivalent D16 instructions. Admittedly the compiler source code is far from user-friendly, and an intimate familiarity came in handy.
The whole operation took about five days. At a 6502 Group meeting I was able to demonstrate the simulator running compiled D16 code for such classics as Hello World, the Sieve of Eratosthenes, the Fibonacci and Pi calculators, a maze generator, and even a couple large programs: Star Trek and Eliza.
You'd think this would be enough, but I didn't like the code that was compiled. Sure it worked, but it was ugly!
However I could resist no longer.
XPLX is about twice as big as XPLN, and most of that is due to the code generator. At least I'd have a working compiler with XPLN that would come in handy for tracking down and terminating any bugs that might occur in the optimized version.
Getting XPLX to work only took a few more days, but the project stretched out for a couple weeks as more and more refinements were made to the code generator. The effort seemed justified by the idea that some optimizations could be incorporated into the PC version. However the differences in architectures were such that nothing significant could be applied to the PC. The number of instructions generated for the Sieve benchmark shrank from 226 to 129, which is 57%, or almost half the size.
The simulator contains a crude profiler that counts the number of times each assembly instruction is executed. This showed that the Pi calculator was spending a lot of time doing multiplies and divides. Optimizing these two routines alone made the Pi program run twice as fast.
Because of the development that was done on the simulator, when the D16 hardware was finally ready with its new index registers, XPL0 programs were able to run without a hitch. (Actually there was one small hitch: a miswire.)
The source code for the compiler and runtime code are here, along with some example XPL0 programs. Download D16XPLX.ZIP (125k).
A third-party assembler is required which can be obtained here: http://www.datasynceng.com/c32doc.htm. Unfortunately the demo version (C32DEMO.ZIP) is crippled and will not output a valid .HEX file.
-Loren Blaney
Richard Ottosen demonstrated his chess prowess by losing his queen on the 4th move! :-)
The complete software, including a D16/M simulator that runs on a PC, can be downloaded here: CHESS03.ZIP (132k).
A description of the D16/M instruction set is available here: D16_DOC.PDF.
This is a screen shot of the chess program being run from the simulator.
(Image courtesy of Dave Eisler's CaptureWizPro.)
John explaining the operation of his D16/M.
Dave toggles in a test program.
Below are some close-ups of the D16/M.