COMPLEX DISK COPIES
For The 64
Jim Butterfield, Associate Editor
Copying unusual disk files is easier if you know what to look for and where to find it.
Conventional programs can be easily copied, even if you have only one disk drive. You just LOAD the program, insert another disk, and SAVE. But sometimes it doesn't work quite that easily.
For example, the 64 DOS Wedge seems to give trouble. The LOAD goes easily, but the SAVE seems to hang up. Many demonstration programs come in pieces—and one program, often labeled BOOT in the name, does the job of bringing in all the various chunks so the whole program can be staged.
If you have a dual disk, the job is easy. You give the COPY command, and the disk moves the program you have named from one drive to the other. You don't need to know where the program will be located when it loads—an identical copy will be made.
On a single drive, a backup program might be used. It copies everything and takes quite a while to run. Then you'd need to delete the stuff you didn't want, and you'd need to start with a fresh disk. But you could work it that way.
You could use a copying utility. With a pair of 1541 disks, you might run COPY-ALL64. With one disk, you'd need some other kind of program.
Or you could learn a little more about how programs are loaded into memory, and arrange to do your own custom copying.
The first thing you'd need to do is to spot the special programs which need to be copied with care. Often, the word BOOT in the name suggests that something is afoot (no pun intended). If you are instructed to LOAD in nonrelocatable format (LOAD "PROG",8,1), you may be sure that there's something nonstandard about the memory addresses involved. If, when you run a program, the disk starts to run, there's a good chance that the program is loading other "overlay" program segments. Or, if you make a copy with LOAD and SAVE and it doesn't work, it's a safe bet that there's something you need to look into.
I don't plan to talk about protection schemes here. If you have a piece of commercial software that won't copy, this article won't help. If you're unhappy about not being able to make a backup copy, write the software supplier, because I'm not going to help you on that problem.
First, you need to identify if there is one program or a group that needs special treatment. If there's a BOOT program, load it and list it. You'll see that this program's job is to load in the whole set of programs to do the job. For example, the program CHAR BOOT on the Commodore Disk Bonus Pack shows that three other programs are to be loaded in:
LOAD " ROTATE.DATA", 8, 1 LOAD " STANDARD.SET", 8, 1 LOAD " CHAR EDITOR", 8
Note that the first two in the list are to be loaded without relocation (the extra, 1). CHAR BOOT and CHAR EDITOR are to be loaded in the normal, relocatable way.
Conclusion: We may copy CHAR BOOT and CHAR EDITOR with conventional LOAD and SAVE commands (be careful of the names). But we must use special techniques to copy ROTATE.DATA and STANDARD.SET.
Extracting Vital Statistics
Once you've found a program that needs special handling to copy, you must find out more about it.
The best approach is to use the program "Disk Log 64" (elsewhere in this issue). It will neatly give you the start and end addresses that you will need to make a good copy. The addresses are in hexadecimal. Don't worry about the alphabetic letters: Just note the details down carefully.
If for some reason you can't use Disk Log 64, you can try the following quick procedure. Enter this program:
100 INPUT "PROGRAM NAME";N$ 110 OPEN 1,8,2,N$ 120 GET#1,A$,B$:CLOSE 1 130 C$=CHR$(0) 140 A = ASC(A$+C$)/4096 + ASC(B$ + C$)/16 150 PRINT "PROGRAM START ADDRESS IS:" 160 FOR J=1 TO 4 170 A% = A:A = (A-A%)*16:IF A%>9 THEN A% = A% + 7 180 PRINT CHR$(48 + A%);:NEXT J
This will give you the start address, which is half of the story.
To get the end address, you must have a monitor loaded into your system (you'll need one later, anyway).
LOAD the program in question and go directly to the monitor (SYS 8 usually does the trick). Now inspect hexadecimal addresses 002D and 002E. You do this with the command ".M 002D 002E" which will give you a line starting with address $002D and containing eight two-digit hexadecimal numbers. Write down the first two numbers, but in reverse order. In other words, if the numbers are 33 4A, write down 4A33. That's the end address—one location past the end of the program.
But it's much easier to use Disk Log 64.
Making The Copy
Now you have the vital start and end addresses, the rest is easy. Be sure you have a machine language monitor in place.
Load the program in question, using the nonrelocate ",1" suffix (LOAD "NAME",8,1). Place the new disk into the drive, and be sure it's formatted. Go to the monitor. Save the program using the start and end addresses. The format for saving to disk on most monitors is:
The 0: ahead of the program name specifies drive 0; this doesn't hurt, and sometimes it helps. Make sure you get the program name right. The disk device number, 8, must be typed in as two digits, 08. The start and end addresses should be typed in as shown.
That's all there is to it. Return to BASIC with the command ".X".
Once in a while, you get a program that resides in exactly the same part of memory as the monitor. For example, Supermon64 normally takes up residence at addresses $97ED to $9FFF. If you are using this monitor and a program is loaded to the same memory area, you'll have trouble with the monitor. Change monitors or set up the monitor in a new place (Supermon can be moved by doing a little intelligent fiddling with addresses 55 and 56 [decimal] before running the Supermon builder).
You may run across programs on cassette tape that you'd like to transfer to disk using the same techniques. Not hard: LOAD the cassette tape program (use the extra ",1" again), and then PEEK addresses 829, 830, 831, and 832. Ask someone who knows about hexadecimal numbers to translate these decimal contents into hex for you; the first two give the start address, the last two give the end address. Or use the machine language monitor to display addresses $033D to $0340—it's the same place and you'll get the hex values right away. Again, reverse each pair of bytes. If the locations show as 24 68 25 69, then start is at $6824 and end is at $6925. If the program won't LOAD without automatically running, it's probably copy-protected and you shouldn't try to copy it anyway.
If you don't have a monitor, get one. Supermon64, for example, has been published in COMPUTE!, is on the Disk Bonus Pack, and is in many club libraries. Other monitors are available for sale. Even if you don't quite know how to use it yet, it's handy to have around.
We've looked at methods of spotting and copying difficult programs. And we've also had a chance to look a little further into the inner workings of the computer.