Classic Computer Magazine Archive ANTIC VOL. 4, NO. 5 / SEPTEMBER 1985

Power Programming

Revision C Converter

Type-in fix for buggy BASIC revision B

by Matthew Ratcliff

Save $15 (plus $2.50 for shipping) as well as a whole lot of time and aggravation. This type-in Autorun file converts into Revision C BASIC the buggy Revision B that was built into most Atari XL's. Requires 48K, a disk drive and, of course, an Atari XL computer with Revision B BASIC.

Antic has done it again. Our Antic Arcade Catalog Fix XL disk ($10, PD026) provided an improved Atari Translator Disk so you could run early software on your XL models. Now here's a type-in Revision C Converter. It's just what you've been waiting for if you own an Atari 8OOXL (or 6OOXL expanded to 64K) and want to convert your fatally buggy Revision B BASIC into Revision C-but haven't been able to get the Revision C cartridge from Atari. -ANTIC ED

Most 600XL and 800XL computer s have a defective BASIC called Revision B (Rev. B) in ROM. And most people don't know that EVERY time you save a file with Rev. B, 16 useless bytes are added to that file. If you LOAD and SAVE the file enough times, you could run out of memory even though you never added a single line of code.

The Rev. B bug can be avoided only if you use the LIST and ENTER commands instead of SAVE and LOAD. The problem with this is that another bug often causes complete system lock-up when attempting to ENTER large files.

BUGGY HISTORY

Atari has gone through three versions (or Revisions) of BASIC. The original Atari BASIC, Rev. A, was written for Atari 400/800 computer s by Optimized Systems Software (OSS). It was one of the most powerful 8K BASICs ever produced.

Unfortunately, there was a fairly nasty bug in Rev. A. Occasionally, the computer would lock while editing a program.

This syndrome became affectionately known as "keyboard lockup" since the computer would not recover, even if [RESET] was pressed. The only way to "recover" was by turning off the machine and losing everything you had been working on.

The problem resulted from the fact that this version of Atari BASIC did not handle the "carry bit" properly. The lockup occurred if you deleted lines of code in such a way that a multiple of 256 bytes of "BASIC tokens" were removed from your program.

Fortunately, this did not happen often. Out of necessity, many Atari owners soon learned the good habit of saving programs frequently. If a lockup occurred, you would only lose changes which had been made since the last SAVE.

When Atari began producing the newer 600/800XL computers, they decided to fix this bug by writing their own new Rev. B BASIC. Unfortunately, in the process the much more serious 16-bits-added bug was introduced.

In order to determine exactly which revision of Atari BASIC you own, you can perform the following test:

PRINT PEEK(43234)

VALUE / VERSION
162 / A
96 / B
234 / C

The Rev. B bug was first documented by Antic in "Exploring The XL," June, 1984. Although the old Atari knew about this bug even before the Antic article was printed, they continued to produce Rev. B computers into early 1985.

Why? Apparently they already had purchased enough Rev. B ROM's for the 1984 production year. ROM chips are usually purchased in large quantities, to achieve lower cost per unit. Atari, Inc. decided that the bug was not serious enough to warrant discarding all the defective Rev. B ROM's. This was unfortunate, to say the least...

MORE HEADACHES

Those 16 extra bytes bestowed upon your files by Rev. B can cause many other problems besides just gobbling up memory.

Many people run into Error 9, String Not DIMensioned, at the very program line where the DIM occurs. The [RESET] key, the CLR command, even LISTing and ENTERing the file cannot cure the Error 9 problem. The program becomes useless.

Most often, with fairly large files of 16K or more, keyboard lockup occurs. This happens when editing a program or just by LOADing a file that has been "SAVEd one time too many." How many times is too many? That depends on your original program.

LISTing and ENTERing files circumvents the "disappearing memory" bug, but then the Error 9 problem seems to occur much more frequently. (Our in-house experience has more often shown computer lock-up when ENTERing files of a particular size. This can be fixed by adding or deleting one or more bytes of the file-IF you can get to it!-ANTIC ED)

REVISION C

Atari BASIC Rev. C has been available since June; 1984. But it only began appearing in XL computers in late March 1985. At this writing, there are still many Rev. B computers being sold off the shelf. It is now possible to obtain Rev. C on cartridge directly from Atari. You can send $15 plus $2.50 for shipping) to:

Atari Corp.
Customer Relations Dept.
1196 Borregas Avenue
Sunnyvale, CA 94086

However, many Antic readers have found that delivery of this product is slow at best-5-week waits are not uncommon-and can be maddeningly inconsistent at times.

You also have the option of purchasing one of the excellent third party BASICS available for the Atari. Antic has been particularly impressed with BASIC XL ($79, Optimized Systems Software). Most of the independently made BASICs cost more than $15, but they also offer greater power than any BASIC yet released by Atari itself, including Rev. C.

Or if you can find a Rev. A cartridge, you can plug it into your XL and it will take over from the built-in Rev. B.

But now, for the first time you have a fourth choice. If you want Atari Rev. C BASIC right NOW and for FREE, here's how to get it.

REV. C CONVERTER

I wrote Rev. C Converter to give people a do-it-yourself debugger of Rev. B.

Listing 1 is a BASIC AUTORUN.SYS file creator. Type it in, check it with TYPO II, and SAVE or LIST a copy to disk. Before RUNning it, place a formatted, DOS 2 disk in your drive.

Antic Disk subscribers will find Listing 1 under the filename REVB2C. BAS. Also on the disk is the binary file REVB2C.EXE which can be transferred to another DOS 2 disk and renamed AUTORUN.SYS for greater convenience.

The program reads data and creates a binary file on your DOS disk. Whenever you boot up your 800XL (or 600XL with 64K), this file loads into Page 6 memory (locations 1536 to 1791) and copies your bugged Rev. B BASIC to its "shadow RAM." Once installed, Page 6 is available for your use, as long as you don't press [RESET]. If you leave Page 6 alone [RESET] will not disable your new Rev. C.

USING DISKIO

If you wish to use DISKIO (Antic, January 1984) with this program, you can append the Converter binary file to the DISKIO binary file as follows:

First, rename your Converter AUTORUN.SYS file to REVB2C.EXE, then copy it to a disk with the DISKIO AUTORUN.SYS file on it. Now, from the DOS 2 menu, append the files by typing [C] [RETURN] REVB2C.EXE, AUTORUN.SYS/A [RETURN]. Don't forget the /A.

ONLY 12 BYTES

Listing 2, REVB2C.M65, provides the MAC/65 source code for more advanced programmers. You may wish to study it to see how the ROM/RAM bank switching is done and what the actual changes are in Rev. C.

Remarkably, there are only 12 bytes different between Rev. B and Rev. C, but they make ALL the difference!

Here is a simple before-and-after program to demonstrate the problem with Rev. B and how it is fixed in Rev. C:

10 ? FRE (0):SAVE "D: JUNK": RUN "D:JUNK"

RUN this on BASIC Rev. B and you can watch your memory disappear 16 bytes at a time. If you allow this pro-gram to RUN long enough, you will get an Out Of Memory Error and maybe computer lockup too. You could also get "scrambled disk" and lose all your disk files- so be sure to use only a "junk" disk with NO files you care about losing.

Now re-start your system with the Rev. C autorun file and try the sample above. Your computer will no longer gobble up memory.

You might still consider purchasing a Rev. C cartridge since this program gives you a RAM based BASIC that is not as crash proof as ROM cartridge programs. The program does check for an "external" cartridge and takes no action if one is plugged in. This way it won't crash your non-BASIC cartridges.

RAMTOP FIX

If you have problems with programs crashing, try moving RAMTOP down by 1K for graphics modes 0-6 and by 4K for modes 7-11. It is simple to control RAMTOP:

10 POKE 106,PEEK(740)-4:REM MOVE RAMTOP DOWN 1K, 4 PAGES
20 GRAPHICS 0:REM RESET THE DISPLAY LIST

Use PEEK(740)-16 for 4K. I have run several programs in this RAM BASIC with high resolution graphics and PIM graphics without having to move RAMTOP. The OS in the old 400/800 systems would sometimes write above RAMTOP when executing certain screen control functions. This is supposed to have been fixed in the newer XL computers. If you should have a problem with BASIC programs crashing with the RAM Rev. C, moving down RAMTOP might cure it.

Matthew Ratcliff has performed yet another service for Antic readers by writing this fix for Atari BASIC Rev. B. We are eagerly awaiting reader entries in our contest based on Ratcliff's ATARI 'Toons (August 1985).

REVB2C.EXE Download

REVB2C.OBJ Download

REVB2C.M65 Download / View