Jump to content
Sign in to follow this  
SlowCoder

Tutorial: batari Basic on Ubuntu 11.04

Recommended Posts

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

  • Like 2

Share this post


Link to post
Share on other sites

The 1.0 version at bataribasic.com is pretty old, and missing several bug fixes and DPC support.

 

The version referenced here has Linux x86 binaries, updated dasm, and an install script to update your profile. If you prefer compiling your own binaries, just "make" in the bB directory.

Share this post


Link to post
Share on other sites

I have encountered a problem, when I compile a .bas file on terminal but on a past compiling had a assembly error it doesn't allow to compile the file anymore, what can I do?

Share this post


Link to post
Share on other sites

Never saw that before.

 

Try posting the terminal output, the .bas, and the list file produced too.

Share this post


Link to post
Share on other sites

Look for a file named [YOURPROJECTNAME].bas.list.txt. Its a troubleshooting file that this version of bB produces by default when assembling the binary. If it's not present in the directory, it will indicate the problem happened prior to dasm taking bB's output.

 

For copying and pasting from a term window in Ubuntu, the quick way is to drag across all of the text, and then click in the place you want to paste it with your middle mouse button. This works in most Unix GUI environments.

 

If you don't have a 3 button mouse or don't like that style, you can also drag across the text, right-click on the highlighted text and choose copy, right-click in the AA submission area and choose paste.

Share this post


Link to post
Share on other sites

This happens to me every time I try to compile, the error here was a assembly code I added to the game code but I deleted it, and it still says it.

[email protected]:~/bB$ ./2600basic.sh etsrev3.bas
Found dasm version: DASM 2.20.11 unofficial 20140202a
Starting build of etsrev3.bas
batari Basic v1.01dreveng37 ©2005-2014
2600 Basic compilation complete.
etsrev3.bas.asm (2245): error: Syntax Error ''.
etsrev3.bas.asm (2245): error: Illegal Addressing mode 'lda ='.
Unrecoverable error(s) in pass, aborting assembly!
Complete.
Build complete.

etsrev3.bas.list.txt

Edited by STGraves

Share this post


Link to post
Share on other sites

I was able to successfully run img2code using wine a few times in the past.

Share this post


Link to post
Share on other sites

Dunno. That was a while back. Maybe later versions don't run under Wine.

Share this post


Link to post
Share on other sites

Can't say exactly, with just the one error, but it sounds like it can't find the bB include directory. Try re-running the install_ux.sh file in the bB directory, and close+reopen all your terminal windows.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...