Jeff and Jason Tranter's XGameStation Home Page
The XGameStation Micro Edition (XGS ME) is a video game console
platform developed by André Lamothe to teach computer game
hardware and software design. My son and I purchased a unit in
February 2006 and are having a blast learning how to program it.
This page lists some XGS resources that we've found useful and
describes some of our current projects.
XGS Development on Linux
The official development tools included with the XGS ME are for the
Windows platform only. As a Linux developer, I want to use my platform
of choice. There are some solutions for Linux users:
Gputils
The GNU PIC Utilities or
gputils project has developed a number of tools including an assembler
and linker that supports a number of processors including the SX
series. The assembler syntax is different from the Ubicom/Scenix
assembler that ships with the XGS, so porting existing programs is a challenge.
Gsxprog
Gsxprog is a utility to
program devices using the Parallax SX-Key or SX-Blitz. Many XGS users
have purchased the optional SX-Key programmer. This program has not
been maintained for some time but it works with the most recent model
of SX-Key that comes with the XGS.
Sxide and Sxemu
An IDE for Linux as well as a simulator are under development and
available from
Rainer Blessing's
Site.
Wine
The Wine Project allows running
many Windows programs under Linux. Wine is (finally) approaching its
1.0 release after many years in alpha testing. I have found that most
of the Windows and DOS-based tools for the XGS will work well under
Wine. In particular, the Scenix assembler shipped on the CD works
flawlessly.
The one exception is the XGS Micro Studio IDE. I spent an
evening playing with it under Wine and the first hurdle is that it
uses the winio.vxd driver which Wine does not support. One solution
would be to write a native Linux replacement for the winio.dll. I
actually tried this, creating a a stub library with the required
functions, building it and linking it with Wine. I then encountered
another crash in Wine that seemed unrelated to the winio library. I
may revisit it some day.
The SX-Key IDE works quite well under Wine. All editing and debug
features work. It occasionally loses contact with the SX-Key but I
haven't used it under Windows so that may be normal.
SX Programming API
I was able to port the SX Programming API to Linux in one
evening. This API allows you to read, write, and program the XGS using
the parallel port. I've also written a simple command line utility to
program the XGS with a hex file. You can get the source code
here.
General XGS Links
Here are some useful XGS web sites:
- Official XGameStation site
- Ubicom web page for the SX processors
- Parallax web page for SX chips and tools
- Eric's Ubicom Microcontroller Page
Our Current XGS Projects
I have a pair of original Atari joysticks which I bought around 1981 for my first computer.
I've put new connectors on them, cleaned the contacts and they work great with the XGS.
We also have a Commodore 1702 monitor which makes a great retro display.
XGS Cheat Sheet
I've created a brief cheat sheet which summarizes
the common XGS registers, I/O port assignments, and programming info.
Colour Demo
Here is a simple demo application that lists all of the
colors available. It uses the XGS Tile Engine. A screen shot is shown below.
Tank Battle
This is my first attempt at a simple tile-based game, Tank Battle.
The source code is here.
It is still pretty rough around the edges but the basic game play is there.
It is a two player game that requires two joysticks.
I wrote a similar game around 1982 on my first computer, an Ohio
Scientific Superboard which used a 6502 processor. I still have the
code on cassette tape somewhere (binary of course, it was assembled into machine code by
hand).
Vole
The source code is here. You'll want to
read the instructions below before playing the game.
On a small planet in a faraway galaxy there lives a peaceful race
known as the Voles. They have lived in harmony for 10,000 years until a
giant meteor smashed into their beloved planet. Helpless to save
themselves from extinction, they depend on you, a brave astronaut, to
deliver them to safety. After your long journey to the planet Volia,
you set out to evacuate the last survivors. An entire race depends on
you!
Scientists of Earth have supplied you with Telepads which can be used
to teleport any survivors you find to the mother ship. You must roll
the voles into the telepads (or push the telepads under the voles) to
rescue them. Here are your instructions:
- There are five (5) levels you must complete in order to save the voles from extinction.
- Each level has a certain number of voles to rescue. You must rescue them ALL!!
- You can restart a level by pressing Fire.
- Voles:
-
Voles are easily recognized by their round, fat bodies. These
peaceful creatures cannot move on their own, but they can be rolled on
the ground and into telepads. Be careful though, they can easily get
stuck in corners or against walls. Voles are also very heavy, and can
only be pushed one at a time.
- Blocks:
-
Many of the buildings and structures on Volia were destroyed when
the meteor struck. As a result, blocks lie on each level. These large,
green blocks are quite heavy, but can still be pushed around. They can
also be pushed into the telepads (to dispose of them.) Since blocks
weigh a lot, they can only be pushed one at a time.
- Walls:
-
Some structures on Volia cannot be moved. These metal frames act as
impassable barriers. You will have to find a way around these objects,
for even you telepad cannot chew through these!
- Telepads:
-
The telepads were dropped onto Volia to make it easier to evacuate voles from the planet. These mobile
teleporters serve another purpose: They can be used to demolish blocks to find hard-to-reach voles. To
rescue a vole, push the telepad into the vole or the vole into the telepad. The same applies to
demolishing blocks. Keep in mind that Walls cannot be demolished. Also, be careful not to get your telepad stuck
in a corner!
- You:
-
You (the white stick figure) will start somewhere on each level. You can move up, down, left or right by using
the joystick. You can push blocks, voles, and telepads by moving directly into them. Take care not to trap
yourself between blocks, or you and all of Volia will suffer the same fate!
Each level has several ways to beat. They start off easy, and get more
challenging as time goes on. If you get stuck somewhere, or make a
mistake, just press the Fire button to restart at the beginning of
that level. Once you complete all five levels, you win!
Good luck!!
Nintendo Zapper
I've made some progress interfacing the Nintendo light gun with the XGameStation.
Here are more details.
XGS Programming Tips
The SX52 processor on the XGS can be somewhat challenging to program,
not just because of its limited RAM and ROM but it has various
quirks. Here are some random tips I've picked up that may help others
who use this chip.
Get an SX-Key. As an XGS owner you can get it at a special price from
Nurve Networks. It will save you a lot of headaches when it comes to
debugging and you can use it to reprogram the SX20 processor on the XGS
or other SX chips you may want to use for hardware projects. Before
you use it though, you should develop some software without it so you
can experience the fun (!) of debugging programs without any debugging
tools except your own wits.
Learn how the paged ROM and banked RAM works on the SX52 chip. Even
after reading the data sheet and the various tutorials, it probably
won't be until you write some real code that it starts to sink in how
it works.
If having to generate low-level video timing scares you, start by
using the tile engine. It's not hard to use and many games can be
implemented using it. Then, later, you can read the source and
understand how it works.
Make use of the XGameStation forums to discuss ideas and problems with
other users and report your successes.
If you really get stumped during debugging, try hooking one or more
LEDs (and current limiting resistors) to unused output ports and flash
the LEDs to indicate things of interest in you code. If you have an
oscilloscope you can use it to view output ports and get accurate
timing information too. Using the sound chip is another possibility
to help in debugging.
The most common programming errors, in my experience, are:
- forgetting to set the right bank when using RAM
- putting subroutines in the upper half of a page
- jumping or branching across page boundaries
- forgetting the "#" sign when using immediate operands
The Tile Engine by default uses colours with a colour reference of 14. If you want the other colours
you can change it by setting the variable color_phase in Game_Update, e.g.
mov color_phase, #COLOR_0
You can often shorten your code by changing any instructions that add
or subtract by one to use increment and decrement instructions and
clearing instead of setting to zero, e.g.
Instead of: Use:
add foo, #1 inc foo
sub foo, #1 dec foo
mov foo, #1 clr foo
These are shorter because the ones on the left are compound instructions.
With the limited (4K words) available on the SX52, every instruction counts!
Here is a trick I used in my two player tank game to simplify the
code. I store the per player variables in different banks. The logic
operates on one player each frame, alternating frames. I use the same
code for both players, but just switch the RAM bank for the
appropriate player.
To protect your XGS from accidents like dropping metal objects on it
and shorting it out or spilling drinks on it, make a plastic cover
cover for it. Cut a square piece of clear plexiglass the same size as
the XGS circuit board, drill holes in each corner, and mount it using
metal standoffs. Make sure the standoffs are long enough so that you
can still reach the power and programming switches. If you use the
expansion connector or any of the other headers, you need to cut
openings for them. [I wanted to install my XGS inside the case of a
Nintendo NES but my son won't let me take it apart.]
Jeff Tranter, <tranter@pobox.com>