
Motorola 68000 implementation of the SECD machine
================================================= 

	The files on this tape with file type ".68K" are copies of UCSD
p-system text files containing the assembler source of an SECD machine
which runs on Sage ij and Sage iv machines with p-system compatible BIOS
and p-system compatible filing system. 

	The files on the tape with names <name>.68k correspond to
p-system files called SECD.<name>.TEXT, and are referred to as such in
.INCLUDE directives in the text. There is a small Pascal program in
SECD.HOST.TEXT which suffices to interface the p-system to the 68000
code which constitutes a separately assembled procedure. The file
SECD.GUEST.TEXT is the steering file for this assembly. About a half of
the other files compose the SECD machine itself, the other half
containing some i/o routines which allow the machine to be used as a
stand-alone program, in a machine from which the p-system has been
removed. 

	I do not claim that the program is documented to a high enough
standard to be readily understood or adapted by others, so it appears on
this tape either because you have asked for it, or because it seemed a
pity to go to the trouble of leaving it off! That being said, the
following notes may be useful if you want to move the machine to another
68k machine, and if you run into difficulties you can try contacting me.

	There are a number of peculiarities of the p-system which show
themselves in the assembler source: for example, since the assembler is
essentially a 16-bit program adapted to the 32-bit 68k, constants have
to be small, and a number of odd constructions in the text are devices
to get 32-bit constants into registers at run-time using only 16-bit
constants at assembly time. In a couple of places, instructions have
been generated by .WORD constructions in line in the text, because of
this or some similar limitation - in every case, the preceding line
should be a comment which tells you what the instruction is. The
assembler will not allow equivalence-naming of the A- registers of the
68k, and since I did not know this when I wrote the program, there are a
number of places in the text where I have commented out a line, and
rewritten it on the next line with the invalid translation made by hand.

	If you are aiming at taking this machine onto a machine other
than the Sage, or under other than the p-system, then you will probably
be best advised to throw away most of the i/o and do it again for your
own machine. This program follows, fairly roughly, the Pascal
'reference' source, and the guidelins laid out for implementations in
the LispKit Manual. You need only provide the equivalents of get_char
and put_char (in SECD.INPUT and SECD.OUTPT) and a few odd things like
error reporting routines. All of the file control is done within calls
of these routines, excepting for that done in the the initialisation and
finalisation. 

	The initialisation is made more complex because there are really
two implementations of the machine in this text. The assembly switch
"stand_alone" selects between a machine which co-habits with the
p-system, using the RAM-disk of the Sage for its heap space, and a
stand-alone machine which copies itself down to the bottom of the space
left by the Sage BIOS, and uses all of the space remaining, up to the
bottom of the code of the BIOS, for its heap. The other odd thing about
the initialisation is that the 'constant' cons-cells in the heap are
initialised at run time. This is because they contain pointers which are
absolute machine addresses that cannot be determined by the assembler at
the time of assembly: there is no reason why these should not be fixed
in some other implementation, in which case the constant cells all
become read-only. 


			Geraint Jones
				Programming Research Group
				Oxford University Computing Laboratory
				8 - 11, Keble Road
				Oxford				OX1 3QD

				Oxford (0865) 54141 x 292
