Deving The XGameStation/Your First Program
Welcome to the first software development chapter of the book! To start this exercise you must have at least the following equipment:
- An XGameStation
- A Home PC
- The XGameStation Development Toolchain
The Development Toolchain can be found at http://www.xgamestation.com/ under the downloads section. The XGameStation itself costs $199, and you're on your own as to a Home PC. I myself have no experience with the Linux version created by a user - (Someone enter information on it here).
First of all, plug your XGS unit up to the power adaptor and into the wall. Then use the parallell cable provided with it and connect it to LPT1 of your computer. Finally, start the XGS IDE.
In this exercise we will create the most simple program possible that will give immediate feedback. First, Wire an LED up. It should be connected between rb.0 and ground. Be sure to check the datasheet for your LED so that you have it properly biased, as putting it in backwards won't work! Also, make sure to put a 330ohm resistor in series with it to limit current. Not doing that will result in a burned out LED or even damaging a battery in some cases! Let's start by entering this simple program into the IDE:
DEVICE SX52 ;The XGS uses the SX52 RESET Start ;Start at 'Start' when processor is reset FREQ 80_000_000 ;Set for debug purposes, the SX-Key will use this as operating frequency (80 Mhz) DEVICE OSCHS3, IFBD, XTLBUFD IRC_CAL IRC_FAST ;This prevents assembler warning org $0 ;Start program here Start: ;Where program begins mov !RB, #%00000000 ;Make RB output mov RB, #%11111111 ;Turn on all bits in the port. The LED will light up!
Now, hit the 'Assemble and Run' button on the Toolbar. If everything is connected correctly and you typed the program in correctly, it should say 'Programming Successful'. Now turn on your XGS and switch the SYSMODE switch to 'RUN'. Hit the Reset button. You LED should light up!
Todo - More LED's, maybe some animation with them, or something else