Running Spacewar on the Pidp-8/i with HDMI

160 views
Skip to first unread message

Mike Katz

unread,
Aug 19, 2022, 3:04:01 PM8/19/22
to PiDP-8
I am looking for the instructions to run Spacewar on my PiDP-8/I with an
HDMI Monitor and a VT-220 Terminal via a RS-232 to USB Adapter.

I already have the PiDP-8/I booting OS/8 to the VT-220.

Thank you,

             Mike

P.S.  Don't forget VCF Midwest September 10th and 11th.  I will be there
with a running (somewhat) PDP-8/E and the PiDP-8/I.

Heinz-Bernd Eggenstein

unread,
Aug 20, 2022, 6:04:12 AM8/20/22
to PiDP-8
I haven't tried it myself yet but I always thought it was as easy as described on

So the crucial step would be to install the x-y scope emulator locally on the Raspi which would then allow you to use the HDMI video output of the Raspi for the game.

HB

Ian Schofield

unread,
Aug 29, 2022, 12:17:23 PM8/29/22
to PiDP-8
Dear All,

 I had forgotten about this issue in that SIMH does not provide a VC8 display as part of the PDP8 build. Further to this, I did a bit of work
on the SIMH sources to provide this service and Frederic Rible added a brilliant web service to the app for remote access.
Anyway, as this update required a complete rebuild of the SIMH display sub system, this was not accepted for inclusion.
I don't think that the current PiDP8I repo is worth an update despite that fact that some unused display support files are included.
Oscar has written a VC8 client specifically for Spacewars (script 4) which uses OpenVG. Unfortunately OpenVG seems to have 
fallen by the wayside and is no longer in development. So, I have attached an SDL2 based VC8 client which will work with the binary
of Spacewars in the PiDP8I repo. This is rather toytown code so apologies in advance.
It is so simple that I haven't even bothered with a makefile.
gcc -o vc8_remote vc8_remote.c -lSDL2 <optimize if you wish>
Call with vc8_remote <host> (port 2222 is assumed).
Feel free to trash/flame etc.!!!!
NB Before you say it, it runs way faster than the original so some throttling would not go amiss!
NNB I can't find the original PAL8 source for the version in the repo.
Oscar; the source you sent in Spacewar_on_HDMI seems to have some code for remote commented out. Can anyone help?

Regards, Ian.

vc8_remote.c

Mike Katz

unread,
Aug 29, 2022, 5:59:25 PM8/29/22
to Ian Schofield, PiDP-8
Thank you.

When I try to compile it I get:

vc8_remote.c:42:10: fatal error: SDL2/SDL.h no such file or directory.

Is there a debian package for SDL or do I need to install it and build
it from the git repository?

Thank again,

       Mike

Mike Katz

unread,
Aug 29, 2022, 6:31:56 PM8/29/22
to Ian Schofield, PiDP-8
Thank you.

When I try to compile it I get:

vc8_remote.c:42:10: fatal error: SDL2/SDL.h no such file or directory.

Is there a debian package for SDL or do I need to install it and build
it from the git repository?

libsdl2-2.0-0 is installed in the Pi already.

Where should I put the vc8_remote file for compiling or do I need a
special include path?

Thank again,

       Mike


On 8/29/2022 11:17 AM, Ian Schofield wrote:

Mike Katz

unread,
Aug 29, 2022, 6:42:35 PM8/29/22
to Ian Schofield, PiDP-8
I've gotten 1 step further

I installed libsdl2-dev and now when I compile i get the following errors:

pi@PiDP8:~/pidp8i $ cc -o vc8_remote vc8_remote.c -ISDL2
/usr/bin/ld: /tmp/cc6iP7FS.o: in function `thr_fade':
vc8_remote.c:(.text+0x1c4): undefined reference to `SDL_Init'
/usr/bin/ld: vc8_remote.c:(.text+0x1e8): undefined reference to `SDL_CreateWindow'
/usr/bin/ld: vc8_remote.c:(.text+0x204): undefined reference to `SDL_GetWindowSurface'
/usr/bin/ld: vc8_remote.c:(.text+0x230): undefined reference to `SDL_UpdateWindowSurface'
/usr/bin/ld: vc8_remote.c:(.text+0x23c): undefined reference to `SDL_PollEvent'
/usr/bin/ld: vc8_remote.c:(.text+0x2b8): undefined reference to `SDL_DestroyWindow'
/usr/bin/ld: /tmp/cc6iP7FS.o: in function `main':
vc8_remote.c:(.text+0x340): undefined reference to `SDL_Init'
/usr/bin/ld: vc8_remote.c:(.text+0x458): undefined reference to `SDL_CreateThread'
/usr/bin/ld: vc8_remote.c:(.text+0x468): undefined reference to `SDL_Delay'
/usr/bin/ld: vc8_remote.c:(.text+0x690): undefined reference to `SDL_PushEvent'
/usr/bin/ld: vc8_remote.c:(.text+0x69c): undefined reference to `SDL_WaitThread'
collect2: error: ld returned 1 exit status
pi@PiDP8:~/pidp8i $

What am  doing wrong.

Thanks,


          Mike

On 8/29/2022 11:17 AM, Ian Schofield wrote:
--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-8/7a0b0499-eb6d-4086-b98d-7c8314929aecn%40googlegroups.com.

Ian Schofield

unread,
Aug 30, 2022, 6:52:04 AM8/30/22
to PiDP-8
Dear All,

 Your command line has a ucase 'i' (eye) instead of lcase l (ell) in the -lSDL2 bit.
Copy this line:

gcc -o vc8_remote vc8_remote.c -lSDL2

This is a common and annoying font problem. Should have sent a makefile!!!!

Regards, Ian.

Mike Katz

unread,
Aug 30, 2022, 8:51:18 AM8/30/22
to Ian Schofield, PiDP-8
Ian,

Please forgive me for not using cut and paste.  It compiles now.

I had assumed it was include path rather than include library.

I will be trying it out later this morning.

Thank you,

                 Mike

Mike Katz

unread,
Aug 31, 2022, 12:45:27 PM8/31/22
to Ian Schofield, PiDP-8
Ian,

I decided to take my PiDP-8/I  apart and update the sd card with Raspberry Pi OS Bullseye.
Here is the process I followed to get everything working so others can follow these "easy" steps:
  1. Install a fresh copy of Rasbperry Pi OS Bullseye 32 bit (I'm running on a 3b)
  2. Install fossil (sudo apt install fossil)
  3. Cloned the pidp8i repository (fossil clone https://tangentsoft.com/pidp8i)
  4. Changed directory to pidp8i directory created by step 3. (cd pidp8i)
  5. Built and installed the pidp8i software (./configure && tools/mmake && sudo make install)
  6. Copy the vc8_remote.c file to the pidp8i directory created in step 3
  7. Install SDL2 (possibly not necessary) and the SDL2 developer kit (sudo apt install libsdl2-2.0-0 libsdl2-dev)
  8. Compile vc8_remote.c (gcc -o vc8_remote vc8_remote -lSDL2) <-- note that is a lowercase letter "L" and not an uppercase letter "I"
  9. Set the Inst Field switches to 4 (on off off)
  10. Reboot the system (sudo reboot now)
  11. login
  12. Change directory to the pidp8i directory created in step 3 (cd pidp8i)
  13. ./vc8_remote localhost

Keys for game play (hold to repeat)

                            Player 1     Player 2

Fire                           1                 9
Rotate Right            2                 0
Rotate Left              3                 -
Thrust                      4                 =
Warp                    2 & 3          0 & -

I have several questions. 
  1. The persistence of the dots is a little long making it difficult to see the outline of the ships when they are moving.  Is that a function of your code of the spacewars code itself?
  2. The x key doesn't always seem to exit the vc8_remote program.
  3. Do you recommend any particular optimization level?
  4. Oscar's documentation for spacewars mentions using the O key to see the games parameters and other keys that can change features of the game (gravity, stars, etc.)
  5. After one ship has been destroyed how to you restart the game without destroying the other ship?

Thank you again,

            Mike





Mike Katz

unread,
Aug 31, 2022, 1:44:07 PM8/31/22
to Ian Schofield, PiDP-8
Ian,

I added several more comments, the most important one, in my opinion, is in red.
  1. If vc8_remote fails to open the port on exit the terminal parameters are not restores (no echo, etc.)
  2. If I ssh in with telnet and start vc8_remote, the display starts but the keys don't work and when I control-c out of it i get a segmentation fault.
  3. When I start vc8_remote from ttyUSB0 (the VT220 attached to a USB to RS-232 adapter) the keys from the console (blue tooth keyboard) control the ships and not the keys on the VT220.  How do I get the keys vc8_remote to recognize the keys on the VT-220?

Thank you again,

            Mike





Ian Schofield

unread,
Aug 31, 2022, 5:17:32 PM8/31/22
to PiDP-8
Dear Mike,

 You have absolutely hit the nail on the head! The interface(s) to Spacewar are a bit confusing.
 (Firstly, yes, if the VC8 app fails to connect etc., the terminal window will not be reset correctly ... Fixed as below).

 In essence, there are 3!
I assume your VT220 is connected to the primary teletype channel to your PiDP8I (device code 03/04). This is the Spacewar option control channel. 
On your (presumably) remote system running Linux there are 2 further windows ( a and b)
The a window is the one where you typed ./vc8_remote <host> where <host> is the name of your PiDP8i.
The b window is the SDL graphic display.
With your VT200, you can control only the options for Spacewar. Just type ucase O (Oh!) and the options will be listed. And, eg type 'F' for a field of stars etc.
The a window on the Linux system only responds to an lcase x which exits the app. This is so you don't inadvertently exit the app with a wrong key in the graphics window.
The b window is the one that controls the ships with 1,2,3,4 - 9,0,-,=.
With the original version of the Spacewar binary ,  the way this app works was to read the PiDP8I console switches to control the ships.
The current Spacewar binary is actually built with some additional code that allows the console switches to be 'set or cleared' by sending a 2 byte command code to a second teletype interface on device code 40/41 (a convention).
This interface is provided in Simh via the TTIX/TTOX device.
Using this, it is not possible to use the VT200 keyboard to send the command codes to control the ships.
These codes are only sent by the VC8 app from the SDL graphics window.
In fact, it is very difficult to get this remote interface to behave well via a standard terminal ie your VT200 or putty etc. The reason for this is that there is no keyup event.
So if you typed '2' (rotate) into the VT220 the ship would continue to rotate even after you released the key .... v annoying!
NB Update below also contains some slowdown code. The gives a better display on a standard PC.

I hope this helps!

BW, Ian.
vc8_remote.c

Ian Schofield

unread,
Aug 31, 2022, 5:29:27 PM8/31/22
to PiDP-8
Dear Mike,

 Some additional comments re your note.

1. If I ssh in with telnet and start vc8_remote, the display starts but the keys don't work and when I control-c out of it i get a segmentation fault.

Right, you can't do this. If you wish to run the VC8 app on your PiDP8I, you need to connect with (eg) VNC so that you have a true virtual desktop. I don't suggest you do
this as the poor little Pi is quite busy enough already!!!!

2. After one ship has been destroyed how to you restart the game without destroying the other ship?

Just press enter on the VT200 and this will re-start the game.

BW, Ian.


Mike Katz

unread,
Sep 1, 2022, 9:37:59 AM9/1/22
to Ian Schofield, PiDP-8
Ian,

Thank you for all of your time and effort.

My Pi 3B+ is running in text mode (no desktop).  I have the Pi booting with a shell on both the hdmi console/keyboard and the VT-220 via a USB to RS-232 adapter.
I did forget to tell simh to use ttyUSB0 as the standard 03/04 device (I will have to look up how to do that).

I would be happy with keypress to turn on and key press again to turn off.  Maybe warp could be 5 and BackSpace?

or use a star pattern like
      w
   a  s  d
       x

Where w = fire, x = thrust start/stop, a = rotate left start/stop, d = rotate right start/stop and s = warp.

I have successfully gotten to the point that you said.
I have the VT220 setup as 03/04 in SIMH.
I start vc8_remote on the console

the O command works on the VT220 and the console keyboard controls the ships, just like you said.

Pressing any undefined key on the VT220 causes spacewars to restart.

Thank again,

           Mike
--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+un...@googlegroups.com.

Ian Schofield

unread,
Sep 4, 2022, 2:06:27 PM9/4/22
to PiDP-8
Dear Mike,

 No problem. Altering the keys is easy to do in vc8_remote.c. Make sure you match the keys in keypressed() and keyrelease().
 However, Adding the warp command is problematic. This depends upon the logic is Spacewar.pa.
 The binary we have contains some code which seems to limit the data to 8 bits ... only 4 keys per ship.
 However, it turns out the warp will happen if you press both rotate keys together ie 2/3 and 0/-.
 I have updated the app such that the w and p keys do this function.
 I will leave it to you to swap the keys around as you wish.

Regards, Ian.

vc8_remote.c
Reply all
Reply to author
Forward
0 new messages