Skip to content

Converting to FastBasic

dmsc edited this page May 11, 2020 · 3 revisions

This documents what is known to date about converting Basic programming on Atari 8-bit machines, 400/800/XL/XE, XEGS. Includes versions Atari Basic, Turbo Basic XL, Basic XL, and Basic XE to Fast Atari Basic. Many of the programs that are usual to convert are written in the original Atari Basic, or Turbo Basic XL, OSS Basic XL / XE. Written before the conventions of Structured Programming became wide spread. Atari Basic does not have ELSE, ELSEIF, ENDIF, DO LOOP, WHILE WEND, REPEAT UNTIL structures.

Extracting the program code.

Use the LIST (filename)command in AtariBasic to files to disk in a separate ATR in the emulator. Then use an Atari Disk Utility to extract the files to my PC hard drive.

I discovered it is good to use a good Text Editor on your PC. I have been using "PSPAD" and know people using Visual Studio Code. I have not had time to make up a syntax file for each of these programs. It does help if your editor has a rectangle block text select as you need to removing line numbers at some point.

Variable Usage

A variable name has to be unique and cannot be the same for being used for 2 or more than one type. Cannot have A$, A%, and A in the same program. Variables should be set to their default value at the beginning of the program before any usage. Data Tables and Arrays must be declared at the beginning of the program before any executable code

Commands No Longer Supported.

GOTO, GOSUB, RETURN, RESTORE, READ, ON (variable) (GOTO, GOSUB, EXEC). PAINT, TEXT, RAND

When GOTO is used for a loop, replace with DO-LOOP.

IF THEN followed by multiple statements separated with COLONs (:) need to placed on separate lines, remove THEN and COLONs and add an ENDIF after where the last statement was on the line. FastBasic only skips the first statement following the THEN if the condition is false.

IF THEN GOTOs. If this creates a loop until condition, replace with REPEAT UNTIL (opposite condition) or WHILE WEND.

IF THEN GOTO bypass a chunk of code, test of opposite condition, and place an ENDIF when the GOTO destination was.

The program should be converted to the conventions of structured programming.

IF (Condition) THEN RETURN, or ENDPROC, Use, IF (Condition) THEN EXIT

IF (Condition) THEN GOTO pass RETURN with another RETURN... Replace RETURN with EXIT and last RETURN with ENDPROC or use IF ELSE ELIF ENDIF structure.

Line Numbers.

Before deleting line numbers, need to find any GOSUBs and the line number destination. Easiest thing to do is just create a name for the new PROC, or just put a letter + underscore + line number. Line 1000 becomes PROC S_1000 and replace the Return with ENDPROC. Also may need to use the editor's FIND + REPACE function if there are many calls to the subroutine. You can give the subroutine a more descriptive name after the program is working.

Clone this wiki locally