CXREFBAS(1)

NAME
cxrefbas - Code cross-reference for tokenized Atari 8-bit BASIC files

SYNOPSIS

cxrefbas [-v] input-file

DESCRIPTION

cxrefbas reads an Atari 8-bit BASIC tokenized program. For each line number in the program, it prints a list of lines that reference it.

input-file must be a tokenized (SAVEd) Atari BASIC program. Use - to read from standard input, but cxrefbas will refuse to read from standard input if it's a terminal.

Each line number reference in the output is followed by a letter that indicates the type of reference:

G   GOTO (without ON) or GO TO.

S   GOSUB (without ON).

I   IF with line number only, e.g. IF X THEN 1000.

O   ON/GOTO or ON/GOSUB.

R   RESTORE.

T   TRAP.

L   LIST. It's very rare for a program to LIST parts of itself, but it's allowed by BASIC so it's supported here.

    If a line doesn't exist, but is referenced (e.g. GOTO 100, but there is no line 100), it's printed in the table, prefixed with !.

    Any command that uses a computed value for a line number will print a warning on standard error, e.g. GOTO A or GOSUB 100*A. Even GOTO 100+0 is a computed value, since BASIC doesn't do constant folding.

    Line numbers above 32767, e.g. TRAP 40000, are not listed.

    Atari BASIC allows fractional line numbers, such as GOTO 123.4. These are rounded to the nearest integer when the program is executed. cxrefbas handles these correctly, although you're not likely to run into them in real-world programs.

OPTIONS

There are no application-specific options.

  General Options

--help
    Print usage message and exit.

--version
    Print version number and exit.

-v  Verbose operation. When displaying a number in verbose mode, it will be prefixed with $ if it's in hex, or no prefix for decimal.

EXAMPLE

This program:

10 GOSUB 100:GOSUB 200
100 RESTORE 1000:IF A THEN 120
110 GOTO 200
120 ON B GOTO 300,310,320
200 RETURN
300 PRINT 1
310 PRINT 2
1000 DATA XYZ

Produces this output:

100: 10:S
120: 100:I
200: 10:S 110:G
300: 120:O
310: 120:O
!320: 120:O
1000: 100:R

Note that line 320 doesn't exist in the program, so it's shown with ! in the output. Line 120 has 100:I; if the THEN 120 were changed to THEN GOTO 120, line 120 would read 100:G.

EXIT STATUS

0 for success, 1 for failure.

COPYRIGHT

WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

AUTHOR

B.  Watson <urchlay@slackware.uk>; Urchlay on irc.libera.chat ##atari.

SEE ALSO

a8cat(1), a8eol(1), a8xd(1), atr2xfd(1), atrsize(1), axe(1), bas2aplus(1), blob2c(1), blob2xex(1), cart2xex(1), cxrefbas(1), dasm2atasm(1), diffbas(1), dumpbas(1), f2toxex(1), fenders(1), listbas(1), listamsb(1), protbas(1), renumbas(1), rom2cart(1), unmac65(1), unprotbas(1), vxrefbas(1), whichbas(1), xex1to2(1), xexamine(1), xexcat(1), xexsplit(1), xfd2atr(1), xex(5), atascii(7), fauxtari(7).

Any good Atari 8-bit book: De Re Atari, The Atari BASIC Reference Manual, the OS Users' Guide, Mapping the Atari, etc.