Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
Step 1: Setting up the development environment
Important note: even if you have already done this, please make sure you have the latest version of XC=BASIC. The code published on the following pages may not work with earlier versions.
You'll need the following tools to write a game in XC=BASIC:
- XC=BASIC and DASM. Please go to the installation instructions page and follow the steps described there. When you're done, you should already be able to run XC=BASIC from the command line.
- A text editor. in this tutorial we will be using Textadept but you can use any text editor, e.g Notepad, Vim, etc. The reason why I suggest using Textadept is that it has full support for XC=BASIC syntax highlighting and compile/run commands. This way you will not need to use the command line at all. Here you can download Textadept and the XC=BASIC language module. Please follow the installation instructions on both pages.
If you have successfully downloaded and installed everything, just start Textadept and type in a single Hello World program, then save it as hello_world.bas:
If you had set up the XC=BASIC language module in Textadept, you can compile the above program with simply pressing CTRL + SHIFT + R. Textadept will run the xcbasic64 compiler and display its output:
> xcbasic64 "hello_world.bas" "hello_world.prg" -l"hello_world.list" Memory information: =================== BASIC loader: $800 - $80c Library : $80d - $add Code : $ade - $b0d Data : $b0e - $b19 Variables* : $b1a - $b1b =================== *: uninitialized segment Complete. (0) > exit status: 0
If compiling using the keyboard shortcut didn't work for you for some reason, you can compile the program by executing the following command in the command line (you might need to write xcbasic64.exe on Windows):
xcbasic64 "hello_world.bas" "hello_world.prg"
This command will take hello_world.bas as input and create hello_world.prg as output.
Now that the program is compiled, close the Message Buffer tab in Textadept using CTRL + W and press CTRL + R to run the compiled program. This will invoke the VICE Emulator that will load and run the program. Alternatively, you can just run VICE and manually load and run the .prg file. In any way, the result will be the following:
Hooray, it works! You have successfully set up the XC=BASIC development environment.
We will start planning the game on the next page.