Original Tetris "Hybrid" Howto: Simh emulated PDP11 + real hardware terminal

The purpose of this guide is to create a dedicated linux box that boots directly into a pdp11 emulator with tetris on it.

The system is set-up to provide access to the emulator via a physical DEC terminal.

A terminal supporting cyrillic characters (a VT510 or a VT520) is needed.

STEP 1

You need a fresh install of debian wheezy.

netinstall flavour is ok, since we will not need any graphics.

STEP 1a

We've chosen to install the Debian OS on a usb pendrive.

Installing Debian on usb media goes on smoothly until the last step.

When it comes to grub2 installation, the installer fails miserably.

Just don't panic, there's an easy solution. Go on telling the installer to skip this step.

After the installation is completed, we will mount the USB drive on a working Linux system and install and configure grub manually, chrooting in the pendrive OS.

Assuming the pendrive is recognized as /dev/sdb we will proceed as follows, as root:

mount /dev/sdb1 /mnt

for i in /dev /dev/pts /proc /sys; do mount -B $i /mnt/$i;  done
chroot /mnt

grub-install /dev/sdb
update-grub
sed -i -e 's/(hd1,msdos1)/(hd0,msdos1)/g' /boot/grub/grub.cfg
exit

for i in /dev/pts /dev /proc /sys; do umount /mnt/$i ; done

STEP 2

Start the new debian system and install some required packages:

first of all, the simh emulator, as root:

aptitude install simh

then we will install a tool we will use later to "slow down" the emulator. We'll return to this later, now just do it

aptitude install cpulimit

STEP 3

Create a "pdp11" user

as root:

adduser pdp11

Login as pdp11 and download the rt11 disk images

wget http://astio.ciotoni.net/tetris/rl0.dsk
wget http://astio.ciotoni.net/tetris/games.dsk

Setup simh

cat > rt11.ini <<__EOF
set cpu 11/23+ 256K
set rl0 writeenabled
set rl0 rl02
attach rl0 rl0.dsk
set rl0 badblock
; HERE COMES THE SOVIET GAMES DISK
attach rl1 games.dsk
set tto 8b
boot rl0
quit
__EOF

STEP 4

Here's where all the shit gets automated.

Setup the pdp11 user to launch the emulator automatically after login

echo "/usr/bin/pdp11 /home/pdp11/rt11.ini" >> /home/pdp11/.bashrc

Edit /etc/inittab to activate an automatic login on the serial line, as root:

echo "T0:23:respawn:/sbin/getty -a pdp11 -L ttyS0 9600 vt52" >> /etc/inittab
init q

If you run Tetris now, you'll notice that the game plays at freakin' speed. This is because the pdp11 cpu is emulated by a processor that is waaay faster.

We know that simh natively supports cpu speed throttling, but we were unable to set it up correctly (or maybe the throttling support is just broken, who knows).

So we've found an "external" solution with cpulimit, a linux tool that is used to limit a process' CPU usage.

We've found that to get proper Tetris speed with our host processor (1Ghz PIII) we need to forbid the pdp11 process to use more than 5% of the CPU.

You'll probably need to adjust this value to suit your host hardware setup.

cat > /etc/rc.local <<__EOF
#!/bin/sh -e
cpulimit -e pdp11 -l 5 1>/dev/null 2>/dev/null &
exit 0
__EOF

STEP 5

Last step is to setup the terminal to talk the VT52 Russian lingo.

Here's the settings of our VT510

and of course you'll need to properly setup communication with the host. Here's our setup

When you're done, it's convenient to save the terminal setup:

vt510_setup.png

CategoryMuseo

OriginalTetrisHowto/Hybrid (last edited 2015-03-03 14:45:31 by fanfani)