Jump to content



0

Tutorial: batari Basic on Ubuntu 11.04


No replies to this topic

#1 SlowCoder OFFLINE  

SlowCoder

    River Patroller

  • 2,913 posts
  • Location:Florida, US

Posted Fri Sep 16, 2011 9:23 PM

Tutorial: batari Basic on Ubuntu 11.04

Here's how to do it:
1. Open a terminal window.

2. Create a directory in the root of your home directory called "bB":
$ mkdir ~/bB

3. Download both the Linux static binary 1.0, and the Windows/DOS 1.0 packages from here: http://bataribasic.com/download.html, and save both of them to your desktop.
On this date, the Linux package is called bB_Linux_binaries_version_1.0.zip, and the Windows/DOS package is called batari_Basic_version_1.0.zip.

4. Right-click each zipped package and choose "Extract here". Two new directories will be created, one for each package.

5. Back in the terminal window, copy the entire Linux binaries package to your bB directory:
$ cp -v ~/Desktop/bB_Linux_binaries_version_1.0/* ~/bB

6. Copy ONLY the include files from the includes directory of the Windows/DOS package:
$ cp -v ~/Desktop/batari_Basic_version_1.0/includes/* ~/bB
Note that there is a difference in the Windows/DOS, and Linux packages, and the relative locations of the include files. In the Windows/DOS package, the files are in an includes subdirectory, whereas the Linux package wants the include files in the root of the bB directory.

The last thing we need to do is create the bB environment variable, and add the bB directory to the PATH environment variable.
7. While still in the terminal window, open the ~/.bashrc file for editing:
$ gedit ~/.bashrc

8. Insert (copy/paste or type) the following commands to the END of the .bashrc file:
bB="$HOME/bB"
export bB
PATH="$PATH:$bB"
export PATH

At this point the install/config of the batari Basic compiler is completed.

In order to properly compile your source to binary, you will need to copy your source .bas file to the ~/bB directory, and run
$ ./2600basic.sh filename.bas
from within the ~/bB directory to compile your code.

Hopefully you will get something like this:
$ ./2600basic.sh MyGame.bas 
Starting build of MyGame.bas
2600 Basic compilation complete.
DASM V2.20.09, Macro Assembler (C)1988-2003
  	bytes of ROM space left
  	2737 bytes of ROM space left
Complete.
Build complete.

Upon successful compile, 2 new files will be created with names similar to the original source file. If your source file was called MyGame.bas, you will find a file called MyGame.bas.asm, and MyGame.bin. MyGame.bin is your finished ROM, and you should be able to play it in a 2600 emulator such as Stella, or copy it to your Harmony cart and play on your real console! You can delete the .asm file.

Some errors you might see:
Starting build of MyGame.bas
2600basic: option requires an argument -- i
usage: 2600basic -r <variable redefs file> -i <includes path>
Compilation failed.
This is caused by incorrectly configured bB environment variable. Check that you have correctly performed step 8 of the install procedure above. Default for this tutorial is $HOME/bB. If you chose to have your directory elsewhere, you need to make sure that change is reflected in step 8.

Cannot open [filename].inc for reading
1. This is an indication that the include files did not get copied correctly. Remember that the include files need to be copied from the includes subdirectory of the Windows/DOS package, and into the root of the bB directory. In the Linux install, ALL files reside in the root of the bB directory.
2. You will also get this error if you attempt to compile from outside the bB directory. You need to copy your .bas file to the bB directory, enter the directory using the terminal and run
$ cd ~/bB
$ ./2600basic.sh filename.bas





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users