SkillAgentSearch skills...

BatariBasic

batari Basic by Fred X. Quimby, with some fixes (only 1.0 works right now)

Install / Use

/learn @sehugg/BatariBasic
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Batari BASIC - a Basic Compiler for the Atari 2600 Version 1.0 Copyright 2005-2007 by Fred Quimby email: c9r@hotmail.com


batari Basic is free of charge but is not in the public domain. It may not be sold for profit, nor included in any product sold for profit, without the author's prior written consent.

See license.txt for more information.

The license does not apply to Atari 2600 games created with Batari BASIC. You may license these games however you wish. Some batari Basic games have been published and are available for sale on cartridge.


WHAT IT IS:


batari Basic (bB) is a BASIC-like language for creating Atari 2600 games. It is a compiled language that runs on a computer, and it creates a binary file that can be run on an Atari 2600 emulator or the binary file may be used to make a cartridge that will operate on a real Atari 2600.

This is version 1.0. Although this version is expected to be much more reliable than the various alpha and beta builds were released since July, 2005, it likely contains bugs. If you find any bugs, please report them to me by posting on the Atari 2600 Basic forum on Atariage, or by emailing me at c9r@hotmail.com. If you send email, please include "batari" somewhere in the subject line.

If there are a great deal of nasty bugs, a maintenance version may be released soon, so periodically check the batari Basic website for updates.

To learn how to use Batari Basic, please refer to the tutorials, the command reference (commands.html) and the example programs, all included in this release.


GETTING STARTED:


Extract the contents of the zip file to a new directory. The name of the directory doesn't matter, but for consistency with this guide and the tutorials, you may wish to use C:\Atari2600\bB.

MS-DOS/Windows:


Before you continue, you will need to move GNU sed from its subdirectory to your bB directory, e.g. C:\Atari2600\bB. Although bB will run without moving the program, sed will improve error reporting. sed is used to limit the amount of redundant warnings and bogus errors that the assembler tends to produce. sed was not placed in the same directory as bB to avoid confusion with their conflicting licensing terms.

Batari Basic is a DOS/Windows command line program which must typically be run at the Windows command prompt. It will also run under pure DOS (i.e. without Windows running) with special considerations (see DOS compatibility in the help.html file.)

The quickest way to get started is to run batari Basic from the Windows command prompt by using the batch file (2600bas.bat.) This may be found in the "bB" folder in your installation directory.

This version of bB requires that an environment variable and path are set so that you can compile your source files no matter where they are located. So before you run bB, you need to set the "bB" environment variable and path to your bB folder. There are several ways to do this. The easiest way is to just type in the commands below. This will be active for the duration of your session, but only in the window where you define it. e.g.:

set bB=c:\Atari2600\bB path=%path%;c:\Atari2600\bB

If you want this set permanently every time you start DOS or the Windows command prompt, you may add the two above lines to the autoexec.nt (Windows NT/2k/XP) or autoexec.bat (DOS/Windows 95/98/Me) file. autoexec.nt is typically located either in C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM32, and autoexec.bat is in the root directory. If the files don't exist, create them.

Alternatively, there is a way to change the path and environment variables in Windows without using autoexec. Since this procedure is quite involved, it is not covered here. Refer to the tutorials for complete instructions on how to do this.

Once the above is done, switch to a folder containing a bB source file and type:

2600bas filename

where filename is the name of the BASIC source file you wish to compile. The project folder can be any folder you create to store your files.

To test your installation, several sample programs are included in the "Samples" folder. Switch to this folder and type:

2600bas sample.bas

If successful, a file called sample.bas.bin will be generated that you can run on an emulator. The sample program is not very interesting, but note how simple it was to write. Open sample.bas in a text editor and take a look at how it was written.

Windows:


If you prefer to use a fancy Windows-based interface, you can use one of the various IDE's (Integrated development environments) available that will work with bB. Please refer to Tutorial 3 for more information about how to use Crimson Editor with bB.

Alternatively, Jacco Mintjes has written a Windows-based interface just for bB. 2600IDE is available at the batari BASIC homepage. Note that to use 2600IDE, you must use the included 2600baside.bat file and not the one that comes with 2600ide.

Please note that while we will try to ensure that bB works with the above IDE's, we can't guarantee this forever since we did not program the IDE's, there is no source and neither IDE is being actively developed.

Please see the tutorials for more detailed instructions about running the compiler.

Linux and OS X:


Mac OSX and statically-linked Linux binaries are also available for download, but these aren't covered in detail, so you will need to do some configuration yourself to get things working.

The binaries may be downloaded from the batari Basic website. Included with each download are four binaries (2600basic, preprocess, postprocess, and optimize) and a shell script (2600basic.sh) that you may use in place of the batch file to compile your bB programs. Copy the binaries and shell script to your main bB folder if you plan to use one of these builds.

In either case, you will need to set bB's path and environment variable. How you do this depends on what shell you are using. The environment variable and path should be set to the location of your bB binary files, for example:

export bB=$HOME/Atari2600/bB export PATH=$PATH:$bB

I'm sure there is a way to make the above permanent, but I don't know how to do that offhand. If you do, please let us know.

Also, Mac OSX, Linux and probably all UNIX-like operating systems will already have sed, so there is no need to download it.

Other platforms:


bB will work with some DOS/Windows emulators, namely DOSBox 0.65 or later. Some special considerations are needed here (see help.html under DOS compatibility.) Linux users might be able to use WINE to run bB, but I cannot verify that.

If none of the included binaries will work, you can get the source and compile it using a C compiler that supports makefiles. You will also need an appropriate lexical analyzer generator such as lex or GNU flex. If you have the appropriate tools, typing "make" will compile the software. It has been compiled successfully on many platforms without any issues. The source is available on the batari Basic website.

If you are building bB from source on a UNIX-like OS, you can probably still use the 2600basic.sh shell script, and so some of the section above regarding Linux and OSX may also apply. If you are building under some other platform not listed here, chances are you will need to write your own script to run bB.

HOW IT WORKS:


Not unlike other compilers, batari BASIC uses a 4-step compilation process:

  1. Preprocess

  2. Compile

  3. Link

  4. Assemble

  5. The preprocessor takes your Basic code, and reformats and tokenizes it so the compiler can understand it. Certain errors can be caught at this stage.

  6. The compiler converts your Basic code into assembly language. It will create a temporary file called bB.asm. The Basic code is preserved as comments in this file so that those wishing to study assembly language can learn by studying how the Basic code was converted.

  7. The linker splits the Basic code into sections if needed, then concatenates them, along with the kernel, modules and compilation directives into a composite assembly language file. (3a.) An optional stage is a peephole optimizer that looks for redundant and unnecessary code in the composite assembly file.

  8. The assembler converts assembly language to a binary file that contains machine code that can run on an emulator or a real Atari 2600.

Revision History


Note: Lists of changes are not comprehensive.

1.0: February 14, 2007 Official release Changes: Reinstated exotic illegal opcodes that were removed in version 0.3 pfread function for the multisprite kernel sequential data streams >256 bytes Superchip support eliminated HMOVE line above score Added score to multisprite kernel Improved flicker algorithm in multisprite kernel No longer need module for multiplication by 16, 32, 64, or 128 Ability to specify vertical resolution of playfield rows Ability to specify the overall height of the playfield rows pfscore bars HUDs (minikernels) 6 lives 6 lives + status bar Display should now have 262 scanlines Added ability to set reflection bit for sprites in multisprite kernel Optimized multisprite kernel for space reboot command: warm start of current ROM pop command: pulls out of subroutine without needing a return 7800 detection batch file invokes sed to limit DASM's output to something more meaningful Fixed bugs: playfield: command in standard kernel now work in all banks rather than just the last fixed point math assignments only worked when at the end of a line blank lines in data statements now allowed two parentheses at beginning of assignment no longer detected as function one bit assigned to another now actually wo

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated2y ago
Forks0

Languages

C

Security Score

55/100

Audited on Dec 20, 2023

No findings