Subject: Re: Doing mini-languages in CL
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 24 Feb 2004 09:41:23 -0600
Newsgroups: comp.lang.lisp
Message-ID: <Ua-cnfRfRqs-7abd3czS-w@speakeasy.net>
Brian Mastenbrook  <NObmastenbSPAM@cs.indiana.edu> wrote:
+---------------
| Peter Seibel <peter@javamonkey.com> wrote:
| > If all *that* is correct, does anyone have a good recomendation for a
| > good emulator to target--ideally something that runs on Linux, OS X,
| > and Windows and is free (as in beer) and easy to install.
| 
| Perhaps you can look at SIMH, which has emulators for a huge number of
| systems (including VAX, which runs NetBSD!).
| http://simh.trailing-edge.com .
+---------------

SIMH also contains an emulator for the KS-10 (DECsystem-2020) flavor
of the PDP-10/-20 family, which is capable of running [selected versions]
of the actual classic operating systems -- TOPS-10, TOPS-20, and even ITS!
In fact, since it includes an emulation of a DZ11 multi-line terminal
multiplexor implemented as a Telnet daemon, there are even a few
multi-user TOPS-10 systems running in emulation out there on the net!
Ironically, using an 800 MHz P3, it runs ~10x a real KS10!  ;-}  ;-}

Anyway, I mention this because the PDP-10 instruction set is interesting
[simple, clean, 16-register machine, with instructions constructed
in a mostly-orthogonal way -- my favorite-ever machine architecture
to code in assembler!], and is historically interesting as well [see
<URL:http://www.lispworks.com/reference/HyperSpec/Body/f_ldb.htm> and
<URL:http://www.lispworks.com/reference/HyperSpec/Body/f_dpb.htm>].

Personally, I think that the PDP-10 instruction set is a far better
ISA to use for tutorials than, say, MIX. Also, it support both stack-
oriented subroutines *and* fully-optimized tail calls.  ;-}  ;-}
I'm not kidding, actually: there was a standard convention of using the
"PJSRT" macro -- which just expanded into a JRST (unconditional jump) --
whenever the last two instructions of a subroutine would have been
"PUSHJ P,somewhere" immediately followed by "POPJ P,0". And it was
very common for assembly-language programmers to provide curried
versions of functions, with entry points that set up the constant
arg(s) and then PJRST'd (or, where convenient, fell into) to the
fully-general function. E.g., if EXPT computes register T0 raised
to the register T1 power, then:

	quarto:	movei	t1,4	; call with arg in t0
		pjrst	expt	; (cheaper than two skips)

	cube:	movei	t1,3	; call with arg in t0
		skipa
	square:	movei	t1,2	; (ditto)
	expt:	...
		 ...raise t0 to t1 power...
		  ...
		popj	p,0


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607