Yesterday, I presented here the GCE Vectrex game console. Although I remember that a CPU extension was supposed to be sold to convert the console into a computer, it never saw the day. But, as mentioned in my previous post, it is possible to write your own game – or general-purpose program if you are foolish enough – for the Vectrex today. One solution I tested to so is the Vectrex32 cartridge. As a follow-up, I decided to go a bit deeper on how to use the Vectrex32 to write your code!
Vectrex as co-processor
The Vectrex32 handles a lot for you so that you can focus on your game’s code. For instance, it provides a convenient way to automatically perform advanced graphic operations such as 2D and 3D transformations, play tunes, etc. The Vectrex on its side also has some ingenious capabilities for setting the scaling during the draw – an elegant way to overcome the limitation imposed by the use of 8-bit signed integers to represent coordinates and offsets. In general, the way the Vectrex draws reminds me of many graphics description languages such as PostScript – alas, without using a stack, that would have been so cool. Yeah, it’s BASIC, not FORTH. I will not get into all the finesse here, and if you are interested, you can look into the documentation on-line to learn more about I/O capabilities, user controls, timing, etc. As the last word, I will signal the ability to inject 6809 machine language into the 2KB dual-ported memory and have it executed, as-is, by the Vectrex’s CPU. And yeah, screw it up, and you will crash your Vectrex (just press reset to re-start, no harm done). I reassure you, when you operate on the PIC side, debugging the BASIC code is a bit more evolved, and you obtain explicit error messages and source code locations. So, to direct the native 6809 to load $FF into the A register and call the subroutine at $CD71, define machine_code = {$86, $FF, $BD, $71, $CD} and use codeSprite = CodeSprite(machine_code). Voila! If you have a Vectrex, now you know how you can expand its software library on your own!
' Hello World! Program call IntensitySprite(127) call ScaleSprite(50) call MoveSprite(5, 10) call TextSprite("HELLO WORLD!") square = LinesSprite({ _ {MoveTo, 5, 5}, _ {DrawTo, -5, 5}, _ {DrawTo, -5, -5}, _ {DrawTo, 5, -5}, _ {DrawTo, 5, 5}}) for i = 0.0 to 20.0 call SpriteSetMagnification(square, i) c = WaitForFrame(JoystickNone, ControllerNone, JoystickNone) next i for i = 0.0 to 360.0 call SpriteSetRotation(square, i) c = WaitForFrame(JoystickNone, ControllerNone, JoystickNone) next i for i = 1.0 to 100.0 call SetFrameRate(i) c = WaitForFrame(JoystickNone, ControllerNone, JoystickNone) next i
1 thought on “Write your Vectrex Game”