Porting ancient unix
Porting ancient unix
Hello all,
Background
About a month ago I came across this thread and I have read it with much interest. I had never heard of the Cortex before reading this thread, but I do own a 99/4a. I powered it up about two years ago and was overjoyed to see it still work. Back in the day I had expanded it with 32K RAM on the 16 bit bus, and built an EPROM programmer and a 5.25" floppy disk driver for it, both from scratch. 30 years ago I wanted to put a mini unix on it, but that never materialised. That dream kept itching and was the driver for reviving the 99/4a. However, including an old telly it is too big a setup to be practical. Still, a 9900 plus 64K RAM should be enough to run Xinu and LSX unix. With a MMU and 256K it should be enough for Version 6 ("Lion's") unix. A 99105 or 99110 (having separate I/D spaces) should be enough for Version 7 and perhaps even BSD 2.11.
Via Dave's website I discovered the Cortex, Marinchip and the MDEX software. What an interesting read. By the way, Dave, your site lacks the general MDEX manual, but it is available on Jim Hearn's pages. Perhaps a forgotten item? Very impressed with the Cortex emulator by the way.
All in all, a Cortex with the disk hardware installed should be able to run LSX unix. This may sound unrealistic, but some Russian hackers have it running on a BK0010, a Russian home computer from the 1980's that uses a single chip PDP11 derivative as its CPU, and has 48K RAM. The software repo for it is over on Sourceforge.
I have no intention of building or owning a Cortex, but Stuart's breadboard projects look like a practical start to get my 30 year old project speeded up a bit.
Hardware
Stuart, thank you for these captivating designs and excellent web pages. You are getting quite a following:
http://www.vaxman.de/projects/tms99xx/
I've just build the 9995 breadboard and it works like a charm. The CPU and UART came from G&C supermarket at eBay, which sells them for 7 and 3 euro respectively, free shipping via mail. The parts arrived after 19 and 28 days and turned out to be genuine. By mistake I ordered a 9902 instead of a 9902A, but it still works. I compared the datasheets and saw no obvious differences. Does anybody know the difference between the two?
I left out the MAX232 level shifter and hooked up the 9902 to a FTDI232 chip right away, using the Elektor/Circuit Cellar breakout board.
http://www.elektor.com/magazines/2011/september/ft232r-usb-serial-bridge-bob.1912360.lynkx
This way I can use the USB port as a power source and the system becomes a handy A5 sized USB peripheral. I also changed the LS04 to a LS14 (hex inverting schmitt-trigger) and used two inverters to make a (power-on) reset circuit. I have found that the LS138 is not actually needed: if one connects an inverted /MEMEN signal to the 9902 chip select it works equally well. Other adaptations are the use of an EEPROM and a 512K RAM chip. What results is a 6 chip fully functional computer (CPU, UART, RAM, ROM, LS14 and LS32).
Somebody suggested that the ROM should be bankable and that writes could always go to the RAM. I haven't tried this yet, but I think the following should work: if the RAM chip select is hooked up to /MEMEN it covers the full 64K. Its output enable becomes the OR of /DBIN and the inverted /ROM_CE. That latter becomes the OR of the original /ROM_CE and a new signal MAP. When MAP is low, the lower 32K are read from ROM, when MAP is high the ROM is disabled resulting in 64K of RAM.
Another modification I would like to try is adding the single stepping hardware. I think the Cortex circuit for this could work: decoding the external instructions with a LS138 and generating a /NMI signal with three flip-flops (two LS74's). The CKON/CKOFF instructions and the fourth flip-flop could be used to generate the MAP signal for above bank switching. This would take it from a 6 chip system to a 9 chip system, but still fitting on two strips of breadboard.
For disk I'm thinking about a microcontroller hooked up to an SD memory card, but that is for another day. Also for another day is building the 99105/99110 project.
Questions:
- any suggestions?
- connecting READY to /RESET should eliminate the automatic wait state. Has anybody done the recalculation work for the baud rate table?
- the only 99xxx I can find is a 50 euro part sold by 'timeline' on eBay, a UK source. Is that a known good source? Are there better alternatives?
- what is the best way to get software downloaded? 'Typing' a file from the terminal emulator to the breadboard seems a good way, but currently this overflows; I guess I need to hook up the hardware flow control signals.
Software
With convenient hardware now almost sorted, the next step is getting a good 9900 C compiler. This is what I lacked 30 years ago and I am still not there yet. These are the options I'm aware of:
- Clint Pulley's C99 for the 99/4a. This one is too limited for my purposes.
- Allan Beard's TI-C for the Geneve 9640. This one is based on Matthew Brandt's compiler for the 68K which is open source. A compiled version of TI-C for the 9640 is on whtech, but alas no sources. I'm trying to locate Allan Beard, but have not found him yet.
- Port the original Ritchie C compiler from PDP-11 to 9900. This is my current preferred route. With the 9900 similar to the PDP-11 in philosophy this should be feasible. I ported the version 6 compiler to modern C some 4 years ago (and the BK0010 project has done the BSD2.11 compiler). Already ported the assembler to 9900.
- Dave Pitt's GCC port. I couldn't get this to work out of the box and using GCC kinda kills the 'retro' attraction for me, as it could never run natively on a 16 bit machine.
Did the Cortex ever have a C compiler? Any other suggestions?
Thanks everybody for the wonderful preservation work!
Paul