Classic Computer Magazine Archive COMPUTE! ISSUE 77 / OCTOBER 1986 / PAGE 10

Apple Renumber And Merge

I have been unable to find a renumber program and a merge program that can be used with my Apple IIc system. I would prefer typing the program rather than purchasing software. Any suggestions?

Robert Carney

COMPUTE! has never published a renumbering program for the Apple. You may, however, come across such a program in the public domain or in another publication. Be forewarned, however, that renumbering programs sometimes contain obscure bugs that cause problems only in rare instances.

One renumbering program that has been thoroughly tested and debugged is Applesoft Programmer's Assistant, known as APA. This program adds several useful commands to BASIC and is available through your Apple dealer in DOS 3.3 as well as in ProDOS format. It includes both renumber and merge commands.

You can also merge programs without APA using the built-in BASIC command EXEC. Although it takes a little more work than APA's merge command, this technique is just as effective. For instance, suppose you wish to merge two programs named A and B. First, you must make sure the two programs do not share any line numbers. Otherwise, the program being merged will overwrite the corresponding lines of the program in memory. Thus, you may need to do some renumbering before you perform the merge.

After you have eliminated all shared line numbers, list program B to disk as a text file. This is done by putting the following lines at the beginning of program B:

6 PRINT CHR$ (4) "OPEN B. TEXT" : PRINT CHR$ (4)"WRITE B. T EXT"
7 LIST 100, 32767
8 PRINT CHR$ (4) "CLOSE B. TEXT" : END
100 REM PROGRAM B BEGINS HERE

Then, load program A into memory, type this line in immediate mode (without a line number), and press RETURN:

EXEC B.TEXT

The computer reads program B from disk, displaying each line as it is merged into memory. When this process ends, programs A and B are merged just as if you have added every line of program B manually.