aboutsummaryrefslogtreecommitdiff
path: root/bas2aplus.rst
blob: 18e70e7534aefe9c526c5cb120645837d8b9c712 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
=========
bas2aplus
=========

---------------------------------------------------------------
Convert Atari BASIC (and some BASIC XL/XE) programs to BASIC/A+
---------------------------------------------------------------

.. include:: manhdr.rst

SYNOPSIS
========

bas2aplus *input-file* *output-file*

DESCRIPTION
===========

**bas2aplus** reads an Atari BASIC or BASIC XL/XE tokenized (SAVEd) program
and converts it to BASIC/A+.

All Atari BASIC programs can be successfully converted. Some BASIC
XL/XE tokens have no equivalent in BASIC/A+, so programs using these
can't be converted (you will see messages on standard error, in that
case).

OPTIONS
=======

.. include:: genopts.rst

BASIC
=====

BASIC/A+ is basically a later version of Atari BASIC, by the same team
that developed Atari BASIC. As such, it's source-compatible with Atari
BASIC, but *not* token-compatible.

BASIC/A+ uses a different set of token numbers, but has all but two
of the same tokens used by Atari BASIC. Conversion should always
succeed, for an Atari BASIC program.

The two missing tokens are the **COM** and **GO TO** commands, which
are converted to **DIM** and **GOTO**, respectively.

The resulting program should **LOAD** and **RUN** in BASIC/A+ and
function identically to the BASIC version, unless it uses memory
that's reserved in A+. **USR()** routines that are stored in the lower
half of Page 6 will have to be relocated, since A+ uses this area
itself. See the BASIC/A+ manual for full details.

BASIC XL
========

BASIC XL is basically the next version of BASIC/A+, by the
same developers. The token lists were rearranged so that it's
token-compatible with Atari BASIC, and includes all the extra
commands/functions/etc from BASIC/A+... with different token numbers.

BASIC XL has keywords and operators that don't exist in BASIC/A+,
which can't be translated by **bas2aplus**. These are:

**NUM**
  Rarely found in a program (usually only used in direct mode).

**FAST**
  Just doesn't exist in BASIC/A+.

**LOCAL**, **EXIT**, **PROCEDURE**, **CALL**, **SORTUP**, **SORTDOWN**
  These BASIC XL commands are provided by the disk-based Toolkit
  extension, which doesn't exist for BASIC/A+.

**String Arrays**
  BASIC/A+ doesn't support these; if your BASIC XL program uses them,
  it won't convert correctly.

**BUMP** and **FIND**
  While BASIC/A+ does support these functions, the token-level syntax
  is different; it would be possible to translate them, but it would
  require recalculating the line offset and statement offsets for
  every line that uses them. For now, they're not supported.

**%**
  The exclusive OR operator in BASIC XL. No such animal, in A+.

**HEX$**, **RANDOM**, **LEFT$**, **RIGHT$**, **MID$**
  These functions don't exist in BASIC/A+.

Also, BASIC XL supports hex constants, with a leading **$**. A+
doesn't support these, so they get converted to the equivalent decimal
constant. This is basically a cosmetic change; **A=$0600** assigns the
same value as **A=1536**.

BASIC XE
========

BASIC XE is the last in the series of OSS BASIC interpreters. It adds
a few keywords to BASIC XL, which also don't exist in A+. These are:

**EXTEND**
  This command is direct-mode only, so it will never appear in a SAVEd
  program anyway.

**HITCLR**, **INVERSE**, **NORMAL**, **BLOAD**, **BSAVE**
  Not supported in either A+ or XL.

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

0 for success, non-zero for failure.

.. include:: manftr.rst