CADR simulator 08/07/06 Brad Parker brad@heeltoe.com What is this? ------------- This is a program designed to emulate the MIT CADR microprocessor hardware. A CADR is a second generation MIT lisp machine. A good description can be found in "A.I. Memo 528" from the MIT AI Labs entitled, "CADR". The CADR was a 32 bit microcoded microprocessor designed to run the lisp language. This program interprets the microcode found in the machine starting with the "prom" microcode which runs when the machine is first powered on. The prom microcode loads additional microcode from the simulated disk and then boots the load band. There is sufficient hardware support for the disk and network to provide a reasonaly functional lisp machine experience. Quickstart ---------- Grab the pre-made disk image with a warm start file (disk-with-state.tgz) and run as "./usim -w". Enter the data and time and press "F1" and "F7" to clean up the display. You're up! If you want to use the network download and run chaosd. Read the "README" in the disks subdirectory on the http server. Recent Changes -------------- v0.9 - minor speedups. Mac OSX (little endian) fixes. Warm start support (usim.state) Mouse/microcode synchronization (thanks to Devon for the idea) v0.8 - speedups and bug fixes; chaosd/FILE server supports rebuilding sources from server. can now resize screen. v0.7 - added raw X11 support. Bjorn's new keyboard configuration code. diskmaker now takes a template file and will show info on existing disk images. v0.6 - better network support Building -------- Unix, Linus, OS X: There are three defines at the top of the Makefile you should check. They are OS, DISPLAY and KEYBOARD. OS should be set automagically. The X11 display works but the keyboard mapping is not correct yet. Both the OLD and NEW keyboard code works, I would recomment using NEW. Once the Makefile is changed just type "make". Win32: I used a VC 6.0 project to make under win32. Making a disk ------------- I would recommend using the distributed disk.img unless you understand the structure of a CADR disk. The program "diskmaker" will interpret a disk image partition table and make a new disk using a template file. The distributed disk was made using "template.disk1". The template file basically feeds all the parameters to diskmaker to build a valid disk image an populate it with microcode and a load band. Running ------- Everything basically works. The simulator will boot a load band and talk on the (simulated) network. The emulation is reasonably complete (modulo bugs). It gets through the prom code, loads the microcode band, copies the band to swap and executes the load band cleanly. The system boots and runs. The code was originally written to run on x86 linux using SDL and X Windows. It's since been ported to run on OS X and Win32, both with SDL libraries. A native X11 interface has also been added. It should compile and run on X86 linux, Win32 and and OS X. The console display is drawn into an X window (using SDL) which tracks the mouse and keyboard. The simplest way to run it is ./usim You can turn off the mouse synchronization with the "-m" option. If you want to see a trace of macrocode function names try: ./usim -n -Tl >output If you want to see a voluminous trace of every microcode instruction try: ./usim -n -t >output You can make a warm start state file with ./usim -S Run the emulator, enter the date and time. The ^C twice. The memory state will be saved in "usim.state". You can then warm start to come up quickly ./usim -w Note that the warm start state file is intimately connected to the disk image. If the two are mismatched bad things will happen. The two files should be portable across X86, Win32 and Macintosh. The disk emulation reads from a 'disk image' file which is constructed with 'diskmaker'. The disk image looks like a Trident T-300 disk to the microcode, complete with a parition table. The display board and iob are emulated. An X window displays in monochrome at 768x1024. The mouse and keyboard are tracked. The keyboard is "mapped" to the old Knight keyboard or new style depending on compilation options. The internal microsecond clock and the 60hz tv interrupt currently try and use wall clock time for a more realistic simulation. There is also emulation of the chaosnet board. Packets are sent via a unix socket to a "chaosd" daemon which distributes them to various client programs (see the chaos directory). There are some hacks for noticing unibus access but no xbus/unibus mapping support. The two machine lash-up/debug interface is not (yet) supported. I want to add this, however. There's still a long delay when booting the distributed world. The system is available right away, however, try "F2-p". If you are impatient try the warm start state file, but be sure to use it with it's matching disk.img. What needs to be done? ---------------------- - cleanup mouse emulation - speed up the network emulation - speed up the microcode simulation The keyboard mapping has been cleaned up by Bjorn Victor (thanks!). The latest (v0.7+) code uses the "keyboard.cfg" file to map the PC keyboard onto the lispm keyboard. Some default keys: f1 terminal f2 system f3 network f4 abort f5 clear_input esc Alt Mode f1 Terminal f2 System f3 Network f4 Abort f5 Clear Input f6 Help f7 Page f8 f9 f10 f11 f12 pgup Break pgdn {appears to crash usim} home Call end End backspace rubout backspace Rub Out Terminal-M Toggle **MORE** processing. Terminal-0-M Disable **MORE** processing. http://world.std.com/~jdostale/kbd/Knight1.jpeg http://world.std.com/~jdostale/kbd/SpaceCadet1.jpeg http://world.std.com/~jdostale/kbd/SpaceCadet2.jpeg The mouse emulation works but doesn't track exactly. What programs are here? ----------------------- usim - the CADR emulator diskmaker - program to make CADR disk images from .mcr files and .lod files lod - utiltity to pick apart load bands and show their insides lmfs - raw hack to read files from LMFS paritition Standing on the Shoulders of Giants ----------------------------------- I would like to thanks the following people for helping me on this, er, project: Tom Knight Howard Shrobe Richard Greenblatt Danial Weinreb Al Kossow George Carrette Steve Krueger Alastair Bridgewater John Wroclawski Bjorn Victor Devon Sean McCullough Without their support or encouragement I would probably not have done this. Certainly if Al had not sent me the prom images I would never have started. And without Dan's box-of-tapes I could never have succeeded. RG offered some good explainations when I was confused. TK and Howie were extremely supportive at the just right moment (and answered a lot of email). George offered many good suggestions and answered lots of questions. Steve helped me locate missing pages from "memo 528". Alastair did some amazing work on several explorer emulators. Bjorn has used the code, offered many suggestions, fixes and improvements. And John's office is where I first saw a 3600 console and said, "what's that?".