Skip to content

Commit

Permalink
v0.7; added Bjorn's new keyboard code, tested on OS X. Has FP - bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lisper committed Dec 12, 2005
1 parent acefcc8 commit 23e8e5f
Show file tree
Hide file tree
Showing 27 changed files with 25,468 additions and 668 deletions.
38 changes: 30 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ OS = LINUX
DISPLAY = SDL
#DISPLAY = X11

#KEYBOARD = OLD
KEYBOARD = NEW

USIM_SRC = main.c decode.c ucode.c disk.c iob.c chaos.c syms.c config.c
USIM_HDR = ucode.h config.h

Expand All @@ -25,30 +28,49 @@ USIM_LIBS = -L/usr/X11R6/lib -lX11
DEFINES = -DDISPLAY_X11
endif

ifeq ($(KEYBOARD), OLD)
KEYBOARD_SRC = kbd_old.c
endif

ifeq ($(KEYBOARD), NEW)
KEYBOARD_SRC = kbd_new.c
endif

# Mac OSX
ifeq ($(OS), OSX)
USIM_LIBS = -framework SDL -lpthread
#USIM_LIBS = -lSDLmain -lSDL -lpthread -lobjc
CFLAGS = -O3 -fomit-frame-pointer -framework Cocoa $(DEFINES)
LFLAGS = -framework Cocoa
USIM_LIBS = -lSDLmain -lSDL -lpthread -lobjc
CFLAGS = -O $(DEFINES)
endif

ifeq ($(DISPLAY), X11)
LFLAGS =
USIM_LIBS = -L/usr/X11R6/lib -lX11
endif

# Linux
ifeq ($(OS), LINUX)
#CFLAGS = -g
#CFLAGS = -O -pg -g -fprofile-arcs
CFLAGS = -O3 -fomit-frame-pointer -mcpu=i686 -g $(DEFINES)
CFLAGS= -O3 -march=pentium3 -mfpmath=sse -mmmx -msse $(DEFINES)
#CFLAGS = -O3 -fomit-frame-pointer -mcpu=i686 -g $(DEFINES)
endif


#DEFINES=-DLASHUP

USIM_OBJ = $(USIM_SRC:.o=.c) $(DISPLAY_SRC:.o=.c)
USIM_OBJ = $(USIM_SRC:.c=.o) $(DISPLAY_SRC:.c=.o) $(KEYBOARD_SRC:.c=.o)

SRC = $(USIM_SRC) $(DISPLAY_SRC) $(KEYBOARD_SRC)

all: usim readmcr diskmaker lod

usim: $(USIM_SRC) $(USIM_HDR)
$(CC) -o usim $(CFLAGS) $(USIM_SRC) $(DISPLAY_SRC) $(USIM_LIBS)
# ./usim >xx
usim: $(USIM_OBJ)
$(CC) -o usim $(LFLAGS) $(USIM_OBJ) $(USIM_LIBS)
# $(CC) -o usim $(CFLAGS) $(USIM_OBJ) $(USIM_LIBS)

#usim: $(SRC) $(USIM_HDR)
# $(CC) -o usim $(CFLAGS) $(SRC) $(USIM_LIBS)

run:
./usim >xx
Expand Down
112 changes: 78 additions & 34 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CADR simulator
10/17/05
12/11/05
Brad Parker
[email protected]

Expand All @@ -14,25 +14,70 @@ entitled, "CADR".
The CADR was a 32 bit microcoded microprocessor designed to run the
lisp language.

This program attempts to interpret the microcode found in the machine
starting with the "prom" microcode which runs when the machine is
first powered on.
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.


Recent Changes
--------------

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. For the most part you should only
have to change OS and set it to LINUX, OSX or WIN32.

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.


What state is this in?
----------------------

It boots a world!
It talks on the network!
It talks to a FILE server!
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

Expand All @@ -53,7 +98,8 @@ 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.
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.
Expand All @@ -69,35 +115,32 @@ supported. I want to add this, however.
I have fixed several ALU bugs and the emulation now seems much more
stable.

There's still a long delay when booting, even though the world is
running and system-x works fine. I need to track this down - possibly
waiting for a time packet? The system is available right away,
however, try "F2-p".
There's still a long delay when booting the distributed world. The
system is available right away, however, try "F2-p".

What needs to be done?
----------------------

- cleanup keyboard emulation
- cleanup mouse emulation
- speed up the network emulation
- speed up the microcode simulation

The keyboard mapping is a bit of a crock. The mouse emulation works
but doesn't track exactly.
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.

f1 network
f2 system
f3 abort
f4 clear
f5 help
f6 end
f7 call
delete rubout
Some default keys:

I'd liketo make this programmable with a reasonable default.
f1 terminal
f2 system
f3 network
f4 abort
f5 clear_input
home Call
end End
backspace rubout

Long term I want to do some recompiling of the microcode into C and
assembler, both statically and on-the-fly. This is the interesting
part...
The mouse emulation works but doesn't track exactly.

What programs are here?
-----------------------
Expand Down Expand Up @@ -128,10 +171,11 @@ Bjorn Victor
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.
And John's office is where I first saw a 3600 console and said,
"what's that?".
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?".
8 changes: 6 additions & 2 deletions chaos.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
- desynchronize network process from CPU
*/

#ifdef linux /* until I split out the unix socket code */
#include "usim.h"

/* until I split out the unix socket code */
#if defined(LINUX) || defined(OSX)

#include <stdio.h>
#include <unistd.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -698,7 +702,7 @@ chaos_reconnect(void)
return 0;
}

#endif /* linux */
#endif /* linux || osx */

/* these are stubs; eventually I'll fix the code work with win32 sockets */
#ifdef WIN32
Expand Down
4 changes: 4 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* $Id$
*/

#include "usim.h"

#include <string.h>

#include "config.h"

static char mcrsym_filename[1024];
Expand Down
3 changes: 3 additions & 0 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* $Id$
*/

#include "usim.h"

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>

Expand Down
6 changes: 5 additions & 1 deletion disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
* $Id$
*/

#include "usim.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>

#ifdef linux
#if defined(LINUX) || defined(OSX)
#include <unistd.h>
#endif

Expand Down
Loading

0 comments on commit 23e8e5f

Please sign in to comment.