We’ve talked about interlacing video, and that introduced the fundamental concept of “raster” graphics: a beam that moves across the screen in horizontal lines, and is modulated to create brighter or darker areas. But a cathode ray tube can actually draw lines at pretty much any angle; the raster is just a convenient pattern, but in theory you could draw any vector. And you better get that that’s been taken advantage of. Let’s take a look at the only vector-based home console, and what modern hackers have done with it.

The Vectrex

The Vectrex logo

The Vectrex was released by General Consumer Electronics (GCE) in 1982, and then acquired by Milton Bradley in 1983. It’s a very unique game console; a small black box with its own integrated monochrome vertically-oriented CRT monitor; usually having a built-in screen implies being portable, but in this case that’s not the point.

a Vectrex screen playing Mine Storm

Unfortunately, a monochrome CRT is very hard to photograph because of reflections. Not that this screen is the best to show off the system; when showing text like this, the Vectrex is just drawing it using lines. That’s basically like a typical television image. (This game, Mine Storm, is actually built into the console)

Where the Vectrex gets interesting is when it starts drawing things that aren’t horizontal lines.

a Vectrex screen playing Mine Storm showing a spaceship made of lines

These are perfect lines. Now, this blog is displaying on a computer screen, and the photo is an image of discrete pixels. If you zoom in, you’ll see rows of dots. But on the Vectrex, you don’t. No matter how close to the screen you look, you’ll see a diagonal line. This is very cool; it’s a level of crispness that honestly we’re only starting to reach with high-density displays in the raster world.

Mine Storm gameplay. A small ship surrounded by pointy asteroids.

Mine Storm is a fairly straightforward clone of Atari’s Asteroids. And yes, Asteroids used vector graphics back in 1979. In fact, the very first video game, Tennis For Two, made for an analog computer at Brookhaven National Laboreatory in 1958, used vector graphics. These certainly weren’t invented by GCE.

A Cathode-Ray Oscilloscope playing Tennis For Two

Where the Vectrex really stood out, though, was putting this whole package in a nice plastic box.

A Vectrex game

Star Trek the Motion Picture for Vectrex, with overlay

Here’s a boxed Vectrex game: Star Trek: The Motion Picture. You might wonder what a game based on the first Star Trek movie might look like. Long, lingering vector images of the U.S.S. Enterprise? A space shooter where you face absolutely zero enemies while playing a thirty-minute trudge to V’ger? A transporter-accident minigame where you try to put Commander Sonak back together?

Well, no.

Vectrex logo

The game comes with a colored overlay to add some color to the monochrome screen; this is pretty common, possibly universal for Vectrex games. (Mine Storm apparently did have one originally but I don’t have it, but Asteroids was a monochrome game originally anyways) They also have the controls at the bottom.

Star Trek gameplay

In this case, the yellow square shows your targeting area. In a twist Gene Roddenberry may not have approved of, Star Trek: The Motion Picture is a combat game; you fly through an area, shooting Klingons, and docking at starbases. It’s actually kind of like a real-time action version of the old BASIC unlicensed Star Trek game that came to pretty much every computer in the 1970’s.

Star Trek gameplay in BASIC on an Apple II

Of course, since this is a Vectrex game, those Klingon Birds of Prey you’re fighting are nice and crisp. Sadly, they couldn’t spare a button for self-drestruct. The game runs at 50Hz, which is typical of Vectrex games.

Star Trek Vectrex showing a Bird-of-prey

So I think now we’re getting some understanding of the Vectrex’s capabilities. It can draw crisp lines, but not too many of them; therefore, it’s no surprise that a lot of Vectrex games take place in outer space. Even moreso than the PC Engine, this was a console made for shooters. For pre-Space Invaders shooters especially.

I managed to do better in it than the BASIC version, at least.

Star Trek death screen in BASIC on the Apple II. I killed 0 Klingons in 0 stardates and the federation is now doomed

How does it work?

Successive lines being scanned on a television

The raster pattern of a standard television CRT has a major benefit: it converts the data stream into a one-dimensional field. (Of course, color makes things more complicated, but the Vectrex is monochrome) This means you just need one wire for the intensity (the shade of grey being displayed), while the x and y position of the beam is determined by a predictable timing, and so only the occasional synchronization pulses are needed.

Vectors force us to recognize reality. For just our simple monochrome image, we need three continuous signals. Two for the position (X and Y, in cartesian coordinates) and we also still need the intensity. And remember, these are analog signals.

The Vectrex has a 1.5MHz Motorola 6809 CPU. This CPU is no slouch, and GCE needed the extra speed; remember the contemporaneous Tandy Color Computer ran its 6809 at 895kHz; and even at that speed, it blew away the competition in my old “Nicole Simulator” benchmark. (Printing the word “nya” 10,000 times in BASIC)

So let’s take a look at how the Vectrex works. It’s worth noting that this is compiled from a few sources, most notably Keith Wilkins’ “INTERNAL.TXT”. I haven’t coded for the Vectrex myself, so I’m likely going to get some things wrong; please send me an email or message if I do and I’ll try to correct it.

So with that caveat, here’s my best understanding in a diagram. Note that I’ve left off things like the sound or controller reading (the Vectrex does have analog controls! and its controller is still nice to use, you hear that Atari 5200?).

Vectrex block diagram. Explained by text below

The whole Vectrex is basically controlled using a 6522 PIA. Well, it’s actually a VIA, or so I called it in the Mockingboard article; whether it’s a Peripheral Interface Adapter or a Versatile Interface Adapter seems to not matter. (The PIA acronym seems to come from the Motorola side, but it’s what I see in most Vectrex documentation)

The first signal the PIA controls is BLANK'. This signal is very simple; when it is low (remember ' means active-low) the CRT will not display a signal, regardless of what the intensity is. This signal is hooked up in such a way that it can be hooked up to a timer on the PIA as well; this allows for nice things like dotted lines by turning it off and on in succession.

The main functions, though, are the DAC (digital-to-analog converter) and the Integrator. The DAC is straightforward; one 8-bit port on the 6522 is attached to its input, which it converts to an analog voltage. (And that voltage can go negative) That voltage can be sent to different places depending on the output (and is always sent to the X input on the Integrator, which I’ve called “dx”.) The DAC can be used to control the intensity signal directly.

The Integrator is in some sense the heart of the Vectrex. And yes, this an integral in the mathematical concept; but don’t worry, as this is simply a linear output. Let’s step through a typical use case to understand how this works.

  1. The ZERO' bit is set low. This causes the integrator to enter zero-ing mode.
  2. The RAMP' bit is set low. This causes the integrator to become active. Since the zero pin is active, this will reset to the default position. (0,0) is the center of the screen.
  3. The RAMP' and ZERO' pins are set high. This disables their functions.
  4. Write an “integrator offset” value using the multiplexer and the DAC. You can think of this as a scale factor on both dx and dy.
  5. Write dy using the multiplexer and the DAC. This value will be retained when the multiplexer is redirected.
  6. Write dx. This must be done last because it’s hooked directly to the DAC output.
  7. Set RAMP' low. This will cause the integrator to change its X and Y outputs based on dx and dy. The larger the dx, the faster X grows, and vice-versa.
  8. Wait. The longer you wait with RAMP' low, the more the X and Y will keep moving.
  9. When you’ve gone on long enough, set RAMP' high.

Step 8 is the one that you might find particularly interesting. The length of the vector is a function of time. So there’s no way to just set the position of the beam (except for the special case of 0,0); you need to move it at a speed, and keep track of where you’re going. But this makes sense when you think about how a vector must move throughout the screen. The Vectrex system does contain a ROM that, in addition to the built-in game, contains some drawing routines that are frequently used to cut some boilerplate for the game developer.

Assuming direct control

You might notice something; everything the Vectrex uses to control its screen hardware is connected to the 6522 PIA. (Which makes sense, as the 6809 has no IO of its own) This includes sound and controller reading, which we left off of the above diagram. And now let’s take a look at the cartridge pinout, taken from Ombertech.

Vectrex Cartridge pinout

The cartridge port exposes the full 16-bit address bus, the 8-bit data bus, and all of the control signals. It even exposes HALT`, an important signal that allows the cartridge to disable the CPU entirely. Now, why would you want to do that? Because the Vectrex gives the cartridge all the tools to control the console itself. And what small, affordable computer has a large number of general-purpose IO lines? The Raspberry Pi, of course.

A raspberry pi shoved in a cartridge

The PiTrex is an open-source project that features a board designed to interface a Raspberry Pi Zero’s GPIO lines directly to the Vectrex’s cartridge port. This means that the 6522 is no longer being controlled by a 1.5MHz 8-bit 6809, it’s being controlled by a 1GHz 32-bit ARM CPU. As you’d expect, this opens a lot of doors.

PiTrex splash screen

One thing that really impressed me about the PiTrex project is that despite it being a bare-metal project, it’s really easy to get started with. You just need to add the files in a folder.

A quick overview of PiTrex

This won’t really do PiTrex much credit, as it’s more of a quick overview of some things that are currently integrated. I recommend you check out the wiki linked above for more details, and on implementing things yourself. This is still some of the most easily obtainable ready-to-use vector gaming available, which is part of what makes the Vectrex so interesting.

PiTrex menu showing Speedy Vectrex

Vectrex emulation

One thing you might expect from such a device is a flash cart. But that’s not actually what PiTrex offers; instead, it offers a full emulation of the 6809 CPU, based off of the VecX emulator. Why emulate a console on the console itself? Because it offers the ability to run in a “Speedy” mode, allowing you to run the code as fast as it’ll go. (Though I have to admit, when trying it in Berzerk, while the emulation felt quite accurate, it did not feel noticeably faster)

gameplay in berzerk

This environment is also a good place to try out games like Malban’s Vectorblade. Also, it turns out that the GCE rights-holders allow the Vectrex games to be freely-distributed by enthusiasts. That’s an amazing move, one I wish was more common.

Arcade emulation

Attract Mode of Tempest, in monochrome

Another cool feature this opens up is the use of emulation of vector-based games, using a real vector monitor. This is not quite “real hardware”, but it’s also more realistic than running these games on a vector-based emulator. In this case I’ve chose Atari’s Tempest; of course, this was a color game, and the color information is lost.

You might notice that the text doesn’t seem to quite line up, it’s sloping somewhat down and to the right. Because this controls the vector monitor at a low level, it has a wide array of calibration options, and when I took this photo, my calibration wasn’t quite perfect. Additionally, the emulation I tried is definitely still in a developing stage, without features like sound. Still, this is very cool stuff.

Custom programs

The PiTrex is at your control, and is quite well documented. The bare-metal interface used here has a detailed library available and documented for running software a low-level. It goes without saying that a modern ARM processor is more suited to a modern development environment than a time-limited 8-bit processor, though the “VIDE” Vectrex IDE also supports C development.

Hyperoids gameplay. It is similar to Asteroids

One example game is Kevin Koster’s Hyperoids, included in the bare-metal PiTrex distribution. You can see that it has a bit more complexity than GCE’s vintage Mine Storm. Also, I am not sure if the failure of these hearts to form a complete shape is a sign I still don’t have the calibration down pat.

Three hearts. They do not complete

Other games to look out for for the PiTrex as a platform is Malban’s upcoming port of Elite, a beta version of which is available in the current distribution at the time of this writing.

Vectors so sharp you’ll poke your eye out

The Vectrex seems to be the classic video game industry example of poor timing; while it is very cool, and offered a number of innovations, it came out at a time just as the North American video game crash seemed to render the industry dead. And a better time for it never really existed, as the home video game market moved away from the simpler arcade-style games, and vectors disappeared from the arcade as well. We’re lucky to have gotten the Vectrex at all.

I’m really excited to see that the Vectrex is still alive and kicking as a homebrew platform, both with or without the PiTrex. I’m not sure I’ll try something for it myself, as I’m not sure my game development style fits well; the Vectrex isn’t as good at the long dialogue scenes I like to use to pad out the game. Still, I’ll definitely keep an eye there, and I recommend you do as well.

If you can’t get ahold of a Vectrex, but like soldering, the ScopeTrex open-source project exists that translates Vectrex games’ output into X and Y signals for a typical analog oscilloscope. I don’t have one of those, or I might have tried it out.

Scramble on Vectrex. The player has died, and 'END' is displayed