Classic Computer Magazine Archive COMPUTE! ISSUE 80 / JANUARY 1987 / PAGE 10

readers feedbackReaders' Feedback


The Editors and Readers of COMPUTE!



128 Merge Command
I recently upgraded from a VIC-20 (with a Programmer's Aid cartridge) to a 128 and have found that I no longer have a MERGE command. Since I've gotten used to writing my subroutines as separate programs to be merged later, I miss this command. Is there any way to merge two programs on the 128?
Robert Ridout

Yes. Let's say you want to merge a subroutine called QSORT into a program called FILEAWAY. First you need to create an ASCII listing of the QSORT program. Load QSORT and type this line:

OPEN 8,8,8, "QSORT.ASC,S,W": C MD8:LIST

    When the file has been written and the cursor returns to the screen, enter PRINT #8: CLOSE8. Next, load the FILEAWAY program into which you want to merge the subroutine and type this:

OPEN 8,8,8, "QSORT.ASC": BANK1
   5: SYS 65478,0,8

    The BANK command isn't necessary unless you've been changing memory configurations. When the two programs are merged, you'll probably see a ?SYNTAX ERROR message, which you can ignore. To finish up, type CLOSE2.
    The ASCII listing is essentially a typed-out version of the program. The SYS causes the 128 to look for input from the disk file instead of the keyboard, so the ASCII listing is typed into memory. If there are any duplicate line numbers, the line from the disk routine will replace the line already in memory.