Author: atsampson
Category: Christmas Challenge
System: DEC PDP-10 running ITS
Language: PDP-10 Assembler
Len source code: 435
Len exe file: 423
Len code only: 85.5
Instructions:
Connect to a public ITS machine, e.g. hactrn.org. Pick a username for
yourself -- I'm assuming XYZZY -- and log in:
:login xyzzy
Create your home directory if you haven't already done so:
:print xyzzy;..new. (udir)
Start Emacs on the source file:
:emacs cryst mid
Paste in the cryst.mid code. Save with ^X^S then exit with ^X^C.
Assemble the program with:
:midas ts cryst_cryst mid
Then run it with:
:cryst
You can also run it in a local emulator. The binary ts.cryst provided
is in ITS evacuate format.
Description:
The PDP-10 is a 36-bit machine. The executable is actually 94 words
(423 8-bit bytes) long, of which the code is 19 words (85.5 bytes).
The 36-bit architecture is very handy for this program, as the pattern
repeats with a period of 6.
The program loads a binary representation of the first line
of the pattern (101010101010 octal) into a register, then rotates it for
each successive line. Each line is then printed by shifting one bit
through this word from left to right, and another from right to left,
and printing a * where either of them match. The shifts in the inner loop
are done simultaneously using the ITS-specific CIRC instruction.
Comments:
I prototyped a few ways of doing this in C, and this one stuck out as
being well-suited to ITS because of the bidirectional shifts.