Classic Computer Magazine Archive COMPUTE! ISSUE 23 / APRIL 1982 / PAGE 135

Odds And Ends

The Bug In The Universal Wedge

Keith Peterson
Kansas City Computers Inc.
Independence, MO

With each CBM/PET disk drive comes a program to simplify using disk files. It's popularly called "The Wedge."

Most people are familiar with Universal Wedge, the program for easier disk access that comes on the disk with all of Commodore's disk drives. But most people don't realize that there is a bug in the Wedge that can cause some trouble when the Wedge is used on a 4.0 BASIC system.

The real cause of the problem is a small number of Original BASIC systems that required special handling when loading a file. These systems had what is known as the -04 ROMs, and several of the first Original BASIC PETs had them.

Universal Wedge checks a location in the BASIC system to see if it contains the -04 ROMs. If so, the Wedge increments the end of BASIC pointer by one, fixing the -04 ROM bug.

All this is fine until you use the Wedge in a 4.0 BASIC system. Then the Wedge, looking for the -04 ROMs, finds in the 4.0 BASIC ROM what it thinks is an indication of the Original BASIC -04 ROM, and increments the end of BASIC pointer accordingly. So now the program is one byte too long.

After loading a program, changing it, and saving it back out several times, a large number of extra bytes accumulates on the end of the program. This can interfere with or crash certain machine language routines, use up memory, and cause some confusion when you're looking for the end of the program. It will also cause some append routines to fail to function.

What's the fix? Simple. Just follow these steps:

  1. Type: LOAD "universal wedge",8
  2. Type: POKE 2109,133
  3. Type: SAVE "fixed wedge",8

You now have a version of Universal Wedge called "fixed wedge" that will work correctly on either Original BASIC or 4.0, and with the -04 ROMs as well.