- Usage
- Converting Numbered Listings to BASIC Wrangler Format
- Writing Programs for BASIC Wrangler
- DATA Statement Reformatter
- Supported BASIC Dialects
- Altair 8800
- CP/M BASIC-80
- Microsoft BASCOM
- Generic BASIC
- Commodore BASIC
- Apple ][
- TRS-80 Models I, III, 4
- Atari 8-bit
- Texas Instruments 99/4A
- Tandy Color Computer
- Apple ///
- Sinclair BASIC
- BBC Micro
- Tangerine Oric
- MSX
- Coleco ADAM
- Amstrad CPC
- Apple IIGS
- Commodore Amiga
- Acorn Archimedes/RISC OS
- GW-BASIC
- Quick BASIC/PDS
- FreeBASIC
To load the GUI, type bw
(a harmless console window might open up behind the main window — ignore it). Type bw -h
for CLI help.
bw convert <filename>
By default, the convert subcommand will take a numbered BASIC listing and output a labeled listing. It can be used on listings that contain multiple statements per line, like so:
130 PRINT "YOU ARE VICTORIOUS.":PRINT:W=W+Y:A=Z:T=Z:IF W>=10 THEN GOSUB 190
It will output to <filename-out>.bas
unless you specify an output file name with -o
.
It will output all of the labels to a file called <filename>.lbl
. You can specify labels to replace by adding a space after the label in that file and typing in the name you wish to replace it with. For more see Converting Numbered Listings to BASIC Wrangler Format.
Warning
|
The conversion routine uses keyword lists to tokenize BASIC code, and so if it encounters a keyword that it doesn’t recognize it might misread it as a shorter keyword or output a LexerError . I will add more dialects to the keyword list in future.
|
-b <basic_type
Set the dialect of BASIC you are converting from (if known). If the BASIC dialect is not listed, it will default to a generic definition. You may need to use a Special Dialect Handler.
-o <filename>
Set the output filename.
-c
Converts a labeled listing that was originally converted to use C64List.
-d
Reformats DATA statements so that they can be crunched by the renumber routine. See DATA Statement Reformatter.
-s
Splits a crunched listing. Use this if the output ends up looking like this: FOR J=ZTOG
rather than this: FOR J=Z TO G
-l
Process a listing already in BASIC Wrangler format, for replacing label names from a list. This may mess up the formatting of your listing a little bit.
Important
|
You should use these options when processing listings from these dialects, or the listing will not be processed correctly. |
pet
vic20
c64
plus4
c128
Commodore 8-bit BASIC. You should use the -s
option if there are no spaces.
trs80l1
TRS-80 Level 1 BASIC. You should use the -s
option if there are no spaces.
atari
Atari 8-bit BASIC
ti99
or ti99xb
TI 99/4A BASIC.
zxspectrum
Sinclair ZX Spectrum BASIC.
bw renum <BASIC Type> <filename>
The BASIC Type is the dialect of BASIC that you wish to use. You can
find all the current definitions in
basdefs.yaml
with instructions in Supported BASIC Dialects.
When not in paste mode, it will output to <filename-out>.bas
unless
you specify an output file name with -o
. You can then either transfer
the file into a disk image or you can paste the code into an emulator if
you used the paste mode.
-o <filename>
Set the output filename.
Note
|
If set, it will always output to a file, regardless of whether or not you also output to the clipboard. |
-p
Sets paste to clipboard mode (Certain dialects always output to a
file).
-l <maximum line number length>
Sets a non-default maximum BASIC line
length.
-n <number to start numbering with>
Sets the line number to begin
numbering with.
-i <number to increment lines by>
Sets the increment between BASIC lines.
Check Supported BASIC Dialects for any special instructions involving a BASIC dialect.
Note
|
This section is a work in progress. |
To convert a numbered listing, you should first run it through the convert routine. It will output a labeled file, and a .lbl
file that will contain all the generated labels like this:
_4 _350 _370 _420
If you want to rename a label (and you should), open the .lbl
file and add a space after the label and type in the name of the label you wish to replace it with, like this:
_4 four _350 start _370 main_loop _420 iterate_attacker
You can then re-run the convert routine, and it will output your listing with any labels changed to the label you want. This can also be done to listings you have already converted to BASIC Wrangler format by using the -l
option when converting.
-
Write one statement per line unless you’re doing something complicated with IF statements. A statement is whatever you would write up until you hit a colon to seperate statements.
-
Write with spaces where appropriate. BASIC Wrangler will deal with the output spacing for you.
-
You should write all BASIC keywords in upper-case.
-
Labels can start with a letter or an _ (underscore) character and can consist of alphanumeric and underscores after that.
-
To indicate a jump target, you should have the label on its own with a colon afterwards on the line directly preceding the jump target (aka, QBasic-style).
-
For Sinclair BASIC, you do not need to write LET or GOTOs after THENs. BASIC Wrangler will automatically insert them. For the ZX Spectrum, you must write GO TO and GO SUB as GOTO and GOSUB, as BASIC Wrangler will fix those for you.
-
If you want to see an example of what properly formatted code might look like check out the Battle System Test I wrote.
This feature will move all the DATA statements in your program to the end of the listing, and allow BASIC Wrangler to correctly format them for the line length in your desired BASIC dialect.
To convert to this format, use the -d
option when converting to labeled format. The renumbering routine will automatically combine the values back into DATA Statements upon renumbering.
Warning
|
Do not use this feature if your program RESTOREs to a particular line number. I do plan on adding support for RESTORE statements eventually. |
- alt4k
-
Altair 8800 4K BASIC
- alt8k
-
Altair 8800 8K BASIC
- altext
-
Altair 8800 Extended BASIC
- altdisk
-
Altair 8800 Disk BASIC
These definitions output for Altair 8800 BASIC versions. Of course, this should also work if you’re running any of these BASIC versions on other S-100 systems like the IMSAI. I use the Altair32 Emulator, but there’s a version of SIMH that also works, among others. These always output to the clipboard.
- cpm4
-
CP/M BASIC-80 version 4
- cpm5
-
CP/M BASIC-80 version 5
These definitions are for BASIC-80. The main difference between them is that version 5 requires spaces between keywords and has some extra commands. You can paste it in or import it from an ASCII file.
- bascom
-
Microsoft BASIC Compiler
This definition is for BASCOM for CP/M. It is extremely similar to BASIC-80.
- generic
-
Generic BASIC
This definition is a generic BASIC definition. It makes no attempt to crunch lines, and so it should work with anything. When in doubt, use this.
- pet
-
Commodore PET BASIC
- vic20
-
Commodore VIC-20 BASIC
- c64
-
Commodore 64 BASIC
- plus4
-
Commodore PLUS/4 BASIC
- c128
-
Commodore 128 BASIC
These definitions are for different CBM dialects. The main difference with these is the line length for pasting. These format the file output for petcat, which is included with the VICE emulator. For the PET, you should run petcat
with -l 0401
to set the load address correctly.
- apple2
-
Applesoft BASIC
This definition is for Applesoft BASIC. The file output should work with any tokenizer.
- trs80l1
-
TRS-80 Level 1 BASIC
- trs80l2
-
TRS-80 Level 2 BASIC
- trs80m4
-
TRS-80 Model 4 BASIC
These cover the BASIC dialects on the TRS-80. The Level 1 definition only works with Level 1, and always outputs to clipboard for pasting in with the TRS32 emulator. It has not been tested with other emulators.
- atari
-
Atari 8-bit BASIC
When pasting with this, it will add a POKE 82,0 before pasting in your code, so it can cram a little more text into the buffer. When importing file output, you must ENTER the text file into your emulator. You can then save the file to disk or tape. There may be tokenizers for Atari BASIC out there, but I haven’t found any yet.
- ti99
-
TI 99/4A BASIC
- ti99xb
-
TI 99/4A Extended BASIC
When outputting to a file, you should tokenize the code with TIImageTool (I haven’t tested other tokenizers).
- coco
-
Tandy Color BASIC
You can either import your code by loading the file as a tape in Xroar, or you can use Toolshed’s decb
command with the -t
option to import a tokenized file to a disk image.
- apple3
-
Apple /// Business BASIC
Import the output file to a ProDOS disk image, and EXEC
the imported file. Don’t mess around with pasting, MAME isn’t very good at it.
- zx81
-
Sinclair ZX-81 BASIC
- zxspectrum
-
Sinclair ZX Spectrum BASIC
These output to .b81 and .b82 files, respectively. These are meant to be tokenized by the EightyOne emulator, but other tokenizers should also work. You do not need to write LET or GOTOs after THENs. BASIC Wrangler will automatically insert them. For the ZX Spectrum, you must write GO TO and GO SUB as GOTO and GOSUB. These will be automatically converted when converting from a numbered listing.
- bbc
-
BBC Micro BASIC
Import the output file to your emulator, and *EXEC
the file. There may be tokenizers out there, but I haven’t found any yet.
Warning
|
In-line assembler is not currently supported. |
- oric
-
Tangerine Oric BASIC
If using file mode, you should tokenize the file with txt2bas, using the appropriate tokenization setting (-v0
for the Oric-1, -v1
for the Atmos). This will produce a tape image that can be loaded into an emulator.
- msx
-
MSX BASIC
The MSX can tokenize from ASCII, so just put the file in a disc image and load it.
- adam
-
Coleco ADAM SmartBASIC
While it is possible to paste, you should use file mode, and import to a ddp or dsk image using either the ADAM Image Manager, or the EOS Disk Tools. The EOS Disk Tools only run under DOS, so you’ll need to run a DOS emulator to use them.
- cpc
-
Amstrad CPC BASIC
The Amstrad CPC can load ASCII files, so just put it in a disk image and load it in.
- gsoft
-
Apple IIGS GSoft BASIC
I like GSoft BASIC for IIGS programs. Just put the output file on a ProDOS volume, and you can LOAD
it with GSoft.
- amiga
-
Commodore Amiga ACE BASIC Compiler
As AmigaBASIC was unsupported after Workbench 1.3, you should use the ACE BASIC compiler. To compile, you should set up a shared drive with WinUAE, copy the .b file to a shared emulator directory, and compile with bas -iO <file name minus the b extension>
.
- riscos
-
BBC RISC OS BASIC
The RISC OS dialect needs to be tokenized to be runnable. To do this, copy the ,ffb file to a shared emulator directory, load it in !Edit in RISC OS by shift-double-clicking it, and then save it back with F3.
Warning
|
In-line assembler is not currently supported. |
Warning
|
I haven’t added keywords for the dialects of BASIC that come after this point, and so conversion from numbered format may not work 100% correctly. |
- qbasic
-
Microsoft Quick BASIC Compiler
Obviously, it loads directly from ASCII files.