aboutsummaryrefslogtreecommitdiff
path: root/whichbas.rst
blob: 472b2167c6f8254e3f67f3e5c24cc9a74b6d5ea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
========
whichbas
========

----------------------------------------------------------
Determine BASIC variant of a tokenized Atari 8-bit program
----------------------------------------------------------

.. include:: manhdr.rst

SYNOPSIS
========
whichbas [-v] *input-file*

DESCRIPTION
===========
**whichbas** reads a tokenized Atari 8-bit BASIC, Turbo BASIC,
BASIC XL, BASIC XE, or Atari Microsoft BASIC program and attempts to
discover which BASIC is required to run it.

*input-file* must be an actual file. **whichbas** can't read from
standard input, because it seeks in the input file.

OPTIONS
=======

Detection Options
-----------------

**-k**
  Keep going. The default is to stop looking at the program if the
  BASIC type gets narrowed down to either Turbo BASIC or BASIC XE.
  This option also enables **-v** (verbose). It's really only useful
  for testing, if you're hacking on **whichbas** itself.

.. include:: genopts.rst

NOTES
=====
Atari BASIC programs are detected 100% reliably.

Turbo BASIC, BASIC XL, and BASIC XE are all supersets of Atari BASIC.
If you wrote a program using one of them, but didn't use any of the
extra commands or functions, the result is still an Atari BASIC program.
Likewise, if you wrote a program using BASIC XE, but only used the
commands/functions it has in common with BASIC XL, it would be
detected as BASIC XL.

There are two types of BASIC XE programs: regular and *EXTEND*\ed. The
extended type is detected 100% reliably, because the first byte of the
file changes from **$00** to **$DD**. Non-extended programs are only
identified as BASIC XE if they use any of the extra commands BASIC XE
adds to those found in BASIC XL.

Detection of Turbo vs. BXL/BXE isn't 100% reliable, and probably
never will be. There's too much overlap between the sets of extra
tokens added by each. Programs that don't use very many of the extra
functions provided by Turbo/BXL/BXE may show up as "Not Atari BASIC;
probably either Turbo or BXL/BXE".

Atari Microsoft BASIC is detected by checking that the first two
bytes of the file are not zero, and that the last 3 are zero. This
may result in false positives (files that aren't BASIC programs at
all might show up as Microsoft). Also, no distinction is made between
Atari MS BASIC 1.0 and 2.0.

Various non-BASIC files are detected (including Mac/65 source,
ELF binaries, etc) as a convenience, but I wouldn't rely on
**whichbas**\'s non-BASIC file type detection if I were you.

LIMITATIONS
===========
Currently, **whichbas** doesn't look at the variable name or type
tables. One problem caused by this: If a program uses only Atari BASIC
tokens, but uses variable(s) with _ in the name, it will be identified
as Atari BASIC... even though _ in variable names is illegal in Atari
BASIC and pretty much guarantees the program is Turbo/BXL/BXE.

Looking at the variable types could also improve detection, since
Turbo and BXL/BXE support extended variable types (procedure labels
for Turbo, string arrays for BXL/BXE).

**whichbas** knows nothing about other BASICs such as Frost BASIC,
BASIC/A+, Altirra BASIC...

EXIT STATUS
===========

0 for success, 1 for failure.

.. include:: manftr.rst