The Vectrex Captrex

I'll post updates on Twitter and the ACMS forums.

Twitter

 Click Home above for info and links

Hello! Our retro challenge is to take a 'screenshot' of a Vectrex in the most convoluted, nerdy and pointless way possible! The team is Cameron Bonde on concepts/programming/repair and Andrew Baxter (AJ) on analogue electronics and ideas.

Discussion about the project is at the ACMS forums here (Australian Computer Museum Society)
https://forum.acms.org.au/t/retrochallenge-2022-10-the-captrex-vectrex-screenshot-device/260

TL;DR

Here's a presentation at the Syntax Demo Party in Melbourne, which shows the finished (mostly working) machine. Spoilers! Read below for the full development process.

The Vectrex and the Plotter

The Vectrex is a pretty unique device in the home market. It's a vector based games console from 1982. The only home vector computer ever?
What's great about it is there is no resolution. No dots, only lines, like a laser show. It really looks unique in real life and seeing one on Youtube simply doesn't look the same. Possibly the only home computer you can't properly emulate!

I also have this. A Roland DXY 980a plotter from 1984, which I was going to restore. It physically draws lines with a little pen. Commonly used to draw CAD drawings in the 80s when modern style printers were even worse than they are now.
Like a 3D printer, but only 2 Ds. But what am I going to use it for?

I suspect you already know.. 

The Idea

I've got a Vectrex, I've got a vector plotter.... It's destiny!

My idea is to somehow tap the analogue x/y/intensity values going to the CRT in the Vectrex monitor and send them to the plotter to draw. The only way to take a true screenshot and printout of a Vectrex! Pixels be damned!
I suspect there will be some (many) unforseen analogue shenanegans that aren't apparent to my brain right now, but it *should* work?
I also don't want to use any modern Vectrex hardware or cartridges. Just raw Vectrex POWER.

The Plotter

First step is to see if my plotter even works. I got it recently and I don't really know the ins and outs of old school x/y plotters, but I really love how visual they are when printing out. It's hypnotising!

This one seems to have a lot wrong with it. It's seen better days for sure and it appears like the tensioning wires have broken or come loose, the buttons have been bashed in, the grabber arm Y axis is stuck and bent, it's missing the power brick and I can't see how the arm could grab the little pen it has?

On further inspection I can't really see how the original wire works. The X axis seems to be intact so it should have some sort of wheel at the end of the arm?

Ahh.. taking the arm apart, there's clearly something snapped off where a wheel probably went. That's going to be annoying to find the right size replacement and worse, make it strong enough to hold. The X axis wire is tight enough to play a note like a guitar!
I asked another plotter boffin to take a photo of his arm and sure enough, there's a little metal bearing.


The other issue is there's no power supply at all and the input I've never seen before. Plus it takes 9v AND 28v DC on the one plug?!


A full strip down and inspection later, I fixed the bashed button, reseated the arm, figured out how the thing even works and reassembled.

It seems the grabber is missing a plastic clip, which is vital. It looks like the pen holder section uses the same clips, so I'll borrow one from the 8th pen slot. I was thinking of 3d printing one, but the way it works needs a sharp point and it flexes. It's really cool how simple it is. We both thought of way over engineered solutions to how it might grab and let go of the pen, but there's no active parts at all. Just physics gripping the pen by sliding its fingers under the other grabber, then vice versa to return it.


After some ideas from AJ we hacked together the closest PSU we could find. The plotter power seems like a IEC-60320-C5, but was close enough that one could be shaved to fit. It's a bit.. terrible, but I don't have time to source a real one (whatever that even is)
Firing it up it seems the X axis works. Even this is really cool to see. Manually pressing the arrow buttons confirms both stepper motors work.

I found a little metal wheel in a box of crap which fit and has a groove for the tensioning cable. I screwed it into the plastic which is pretty thin. Will it hold? (btw I went to an actual shop that only sells bearings and they didn't have one this small!)

Fixed!

The plotter has a diagnostic built in test pattern. So let's print it and see if my wheel and cable fixing works.

And just because I think it's cool as hell. The 'paper hold' button.

IMG_1989.MOV
First fixed plotter test - IMG_2051.MOV

Software ideas - Faking a vector display beam

I'll mock up some logic in Unity, since I'm very familiar with it and it's quick to develop on.
Making a fake 'beam' move about randomly, since I don't have direct access to the actual vector data.
I've only got continuously moving x,y,z raw values to reinterpret them as vectors in my code. I tried checking the rate at which the direction changes, so if it changes quickly, it's probably a new line. Also if the 'pen' (intensity of the beam) turns on or off. This works ok, but randomness isn't a good simulation.

I'll try and draw out an actual image stored in a vector list. That'll give me a good simulation of a real Vectrex.

This worked pretty well!

Detecting a 'frame'

The Vectrex doesn't have a framerate as such. I doesn't draw 'a screen', then draw another etc etc, it just draws as many vectors as you ask it. It's completely up to the programmer to NOT draw so many that the screen flickers and to repeat the vectors in the same spot to make parts appear static. There is no frame buffer (vector buffer?)

This isn't a problem for the Vectrex, but it is for me. In order to capture an 'image' I do need a frame! For a human it's easy to see an image, but the vectors are simply drawing over the top of themselves, with some parts moving and some drawn in the same spot on the next redraw. There is no 'end' of the sequence that gets sent. I just get a stream of numbers from the x,y,z wires.

I figured for every new point I detect, I'd check to see if it was close to an existing point that I've recently read. If I do that for 3 or 4 points I can make sure that the 'image' might have started its layout again. I think MOSTLY there's some static elements on screen that would repeat with every refresh. Then I back up those 3-4 points and call that a 'frame'

This works pretty well, but I suspect a real analogue input isn't going to be so easy. Even though I've not checked the exact position, but have a distance threshold which I can tweak.

The ancient language of HPGL

Now I've got to turn my list of vector points into an obsolete 1984 X/Y Plotter command list called HPGL. A semi-standard developed for HP plotters.
It's fairly simple, with some weird stuff to do with scaling, but I like it.

Checking the HPGL output

I found a program that still loads and shows HPGL files as vectors called "Ploview". Looking good! The 'pen up/pen down' doesn't seem to be working, but I'm happy it works at all.

The real thing.
Is audio sampling enough?

Now I need to determine if I can get a similar signal from a real analogue source, ie the Vectrex.
AJ  had a go at outputting vectors as audio to his CRO as a proof of concept. It worked! (even if it's flipped upside down)
Here's his blog with the steps he used.
http://visualsynth.com/proj/plotter/

Note: Set the video below to 60fps in the cog. The CRO does actually show "Hello", but the camera shutter skips parts at 30fps, as they do with CRTs

Tapping the analogue signal

The next thing to do is see if the signal from the Vectrex makes any sense at all. We set up a CRO and soldered three wires underneath the motherboard. At the same point it gets sent to the CRT neck board. This is neat as it doesn't damage the Vectrex in any way. There's also a handy hole in the bottom where the cables can exit. Tying a knot for strain relief was the only other thing to do. We just used old motherboard header cables.

What's it look like?

Hooking the real Vectrex up to the CRO showed.. something? I think that signal looks like it might be one axis of the Vectrex? It's not just noise so that's good.

Analogue to Digital

So now I need to get the values into the computer. I figure we'll use something like an Arduino for the A to D step.  AJ has used Arduinos, unlike me. His thoughts are, yes it's possible, but is concerned about the processing speed. I'll either need to run logic to convert the rapid sampling into a small list of vectors, but it's got an insufficient amount of RAM. Streaming the data realtime might be possible, avoiding the RAM issue, but it'll be tight.

Multichannel sound card

For now I'll use my multichannel sound hardware with breakout box, to get an idea of the data rate needed to properly capture the screen update rate.
There's only maybe 200 vector lines per 'frame', so something should appear.
The Tascam US-4x4. I'll simply use 3 channels for the X, Y and intensity channels from the Vectrex.

Voltage divider

The output of the Vectrex is -5v +5v on all 3 channels. We really need that to be around line level -1v +1v for the audio input to handle it without distortion (or blowing something!).
AJ made a voltage divider on a strip board. The signal still looks pretty clean and the pattern makes sense if you imagine what the offsets for a single axis might be.

IMG_2063.MOV

ASIO input

I need three channels, so I'll have to use ASIO drivers (The pro audio driver standard for multichannel low latency audio in Windows). But.. this was awful. Trying to find out how to capture anything other than stereo is a pain in the arse. It seems no-one on the face of the earth has ever really bothered. At least with public facing plugins.
I tried FMOD thinking that's the standard. The examples were either 20 years old, didn't work, didn't exist, or simply just made some weird assumptions about 5.1 surround speaker setups etc. The API is pretty terrible too. Really surprised me as I assumed it was clean (which it probably is for anything other than what I want to do!)

I then tried the BASS plugin. And.... it just worked. The API is really straightforward and to the point. AJ helped me with some C to C# pointer conversions and we were off!

IMG_2064.MOV

What does it sound like?

You can hear the effects of the number of lines on the audio which affects the 'framerate'. Remember, there's no actual framerate at all as it just draws as many vectors as needed. Too many and it starts to flicker.

It's doing the thing!

Drawing the sound as vectors worked! Mostly! 44,100 hz was too slow making the vectors wobbly, BUT 96,000 Hz looked good! Maybe I don't need an Arduino? Text isn't visible, so I guess 192,000 Hz would be better, but my card tops out at 96,000 Hz. There's some weird lines jumping about though, mostly back to the center point, so the intensity channel is off somehow.
This also shows the Vectrex homes back to zero a lot when the intensity is off, which is what would happen if the deflection amount is zero between shapes.

IMG_2065.MOV

Sending HPGL to the plotter

So, the plotter says "Serial In" on the back. Easy! A few wasted hours later, it turns out it uses custom DB25 wiring, not a standard RS232 serial cable.. I recently gave away the manual and the very cable I needed, thinking I'd never find this exact model.
Some annoying rewiring of a custom cable later and it works! Specially with help from this blog https://martianwabbit.com/2019/10/25/notes-on-a-roland-dxy-1150.html and this Youtube video https://www.youtube.com/watch?v=Wvy2IBB9ecw

Using a terminal program to send HPGL directly proved that it worked. This part was great as I had no real idea if it was going to work at all externally (apart from the hardware there's load of dip switches and settings)

Also, I'll need a laptop for portability, but I'll need a serial port. We've got a USB serial adapter but after hours of trying, we gave up. So I fished out a super old core-2 duo laptop that has a real serial port.
Unbelievably the latest Unity still runs fast enough on it AND C# still has serial output commands! Who knew? So it looks like I can just use Unity for the whole thing. This is great as doing custom buttons, fonts and the funky glowing fake Vectrex screen is easy in Unity (for me at least)

Fixing the glitchy lines and accuracy

The random lines kept appearing, but I had a hunch that the intensity channel was.. delayed or something? I was seeing the beam direction when it was travelling back to the 0,0 point. Adding a one input buffer delay completely fixed it! Why is it offset though?

Oh and yeah... my first print out attempt didn't work.. at all. haha. Something was being sent though, so that's a start.

IMG_2067.MOV

Success!

Honestly, I don't know exactly what I did to get it to work. I played with the truncation of the scaling values, which were set way too low and moved the offset positioning.

The first recognisable print out! It works! Kind of! The accuracy is pretty low, but maybe I can get it better.

IMG_2079 - FIrst success.MOV

Full screen test

This weird and slightly sketchy demo of a Star Wars Cantina alien was the closest thing to a still, full screen 'image' I have.
After some faffing around with the plotters scale commands it's looking pretty good. Much better than I thought possible.

Note that I printed this twice, while tweaking the gain knobs on my sound card. This in effect is the x/y/z scale setting.

Also note, that my oh so clever 'frame detection' algorithm, totally fails for the real thing! There's a super weird offset, which seems to change depending on what's on the screen and where on the screen it is? DC offset? Something magical in the neck board of the CRT? Sound card automatic gain control? I don't know, but I've disabled it for now and just let you type in how many vectors you want to capture. This works ok as you get a feel for the complexity of a Vectrex scene.

Note I send commands to draw text to the plotter, which work great (my buffer overload never lets it GET to that bit though!)

IMG_2080 - First full screen.MOV

This one's going on the fridge!

Pax Australia 2022

Pax is a huge gaming expo covering just about anything remotely related to games. Video games/board games you name it. There's a great "Classic Gaming" big section that I've helped run for 4 years now. We have consoles, computers, original arcades and pinball machines. I usually take care of the really old school stuff with CRTs!
I was run off my feet restoring an original IBM 5150, setting up two beige pentium PCs networked for Duke Nukem 3D, an Amiga, a Vectrex and an iMac for good measure. Not to mention we have a great museum section that I had two cabinets to fill. It's been an insane few weeks (hence the late assembling of this blog from notes!)

So to REALLY put the pressure on, I decided this is the place to show off a working "Captrex"! Deadlines really motivate!

The empty setup. Our section inside the red. The whole place is HUGE. This is only half the main area and only a quarter of the whole place.

My 'little' corner of the Classic Gaming section

Pax setup - IMG_2097.MOV

The green is too intense!

That 21" CRT weighs 35 kilos!!!

The "Cheap computer war of the 80s". Or "What did people buy if they couldn't afford a Commodore 64"

The "Aussie made/produced/repackaged/designed" collection

Did it work? Yes! (ish)

My main trouble was I'm overloading the poor little 1984 buffer with too many commands and there's a weird offset that wasn't there before. So the images never completely finished on more complex scenes (and never printed out the messages).

But everyone thought it was bizarre and amazing and many said it was the highlight of the expo. 

Most importantly, no-one asked WHY haha! Which as every nerd knows is..
"Because I could"

Vectrex Captrex StarWars guy at Pax 2022.mov
IMG_3391.mp4

The very first person to get their own Vectrex screenshot! It's even the bugged offset version!

Someone took a real Polaroid!

Some other games printed out. Do you know which ones?

PAX is a fun time in general. She had 4 hands so I had to get her on to the Model M!

People would hit the button without paper in it. Woops!

People would hit the capture button with no paper in it when I wasn't there!

THIS is how to market kids. SEDUCTION draws the eye, then BAM, hit them with the URL.

Everyone loves the Vectrex!

Thanks to Dave (left) and AJ (middle) for helping haul my crap and man the Captrex.

Everyone at the Classic Gaming section did great as usual!

Checking the buffer

Ah HA. I found this in the manual "The DXY-980 supports a function to output buffer status to the computer". So it can send me the buffer status so I can wait to send more. The buffer is only 2.5 kilobytes (which they considered large in 1984).

This is weird. But I've had to be out of state for the last week, which is a bummer since this is mostly a hardware project... but wait! What if before I go, I hook up a laptop with TeamViewer and a webcam!

This is so dumb, but it works :)

Now to send an escape code to trigger the Plotter to return the buffer. 

There's 3 ways to do it, including a hardware cable signal, but I'll just use the one that returns the actual space left in the buffer.


Doing it in Unity seems easy enough, but it doesn't seem to work. There could be a load of reasons why, so I'll try and isolate the problem.


I'll just use 'RealTerm' a terminal program that can actually send escape codes to do a test.

Exactly 2.5kbytes as promised!

Time to get it to work in Unity. It should be easy.... but of course, it doesn't work.


Ok, isolate the problem again. Is Unity the problem? I'll write a plain C# console app that uses the exact same code and... that works?! I'm confused now.


*hours later*


After much gnashing of teeth it turns out that Unity uses a version of .net (mono) that DOESN'T support serial incoming c# events and only polling of the serial port seems to work. That was really annoying, but at least I get the buffer value now.
Now I just need to only send chunks when the buffer is big enough.

ps, my "Ploview" HPGL viewer ran out of trial period, but yay, it seems "Inkscape" supports opening and saving directly to HPGL.

Crazy idea number 1 : Paper craft Vectrex!

With the buffer 'fixed' (not entirely but close enough). It's time for some ideas. Why just print out a screen shot, when you can print it on a 3D paper Vectrex!
This guy makes great paper craft templates and is generous enough to give them out free. 

So I might trace over this and get the plotter to print the template with a real Vectrex screenshot!

Crazy idea number 2 : Flip book!

If I capture multiple 'frames' of action and print them in a ordered grid. People can cut out a little flip book to replay their greatest moment forever!
I can even print dotted lines for where to cut, since plotters have different line styles.

Crazy idea number 3 : Action replay!

Going along with storing multiple frames, why not store essentially vector video of any number of seconds and send them BACK into the real Vectrex! It should work pretty well, with the main problem being that the motherboard will still be trying to send its own signals, while I'm trying to send mine.
I guess a simple set of 3 relays between the motherboard and the plug for the crt would work. It might be nice to have a plug that does the input and output in one little box inside the unit. Relays would complicate it a bit as I'd need to signal them from the computer. Maybe there's a way to automatically click the relays if there's any signal on the x,y,z?
Would also make a great 'attract mode' like in the original arcades. A compilation of Vectrex hits!

Crazy idea number 4 : Colour!

With the Vectrex being a black and white console (except the 3d glasses games), it would be nice to add colour somehow.
My thoughts would be to try and figure out which vectors belong to specific objects. This should be possible as the beam jumps back to zero between objects I think.
Then I can just pick a random pen to draw different objects. Should look pretty trippy.

OHH actually, now I think about it, the 3D games for the Vectrex actually had colour (yes it had a spinning wheel straped to 3d glasses which enabled 3d AND colour). So I should be able to internally keep track of the rotation rate the glasses had to check what colour things should be. That'd be really great.

TODO

Done: My next job is to stream the serial data over time, not all at once. That should finally print a complete image of the more complex scenes and the text output.

I also noticed that the Vectrex doesn't just draw a complete shape with the pen down. It draws a single line then turns off the beam, then turns it back on. So my HPGL command list is way longer than needed.  I actually had some nice code to collate the commands, but that never happens as it relies on continuing lines. I'm have to detect a continuation myself and remove the extra commands. That should help the speed of the print head too.

I'll relook at the 'detect a frame' code.

I've also got some ideas on how to utilise the different pen colours and a few truly silly ideas. Hmmm

I'll post updates on Twitter and the ACMS forums.

Twitter

 Click Home above for info and links