Classic Computer Magazine Archive COMPUTE! ISSUE 60 / MAY 1985 / PAGE 98

64 Tape To Disk Transfer

Clark Book

If you have just acquired a disk drive after months of using a cassette recorder, here's a valuable program you'll want to add to your library.

The ability to make backup copies of your programs as a safeguard against loss is indispensable. It's also useful to make disk copies of tape programs to speed up loading. If the program is written in BASIC, there's no problem; you simply load it from tape and save it to disk. But machine language programs are another story, especially if you don't have a machine language monitor.

"64 Tape to Disk Transfer" is listed below as a BASIC loader which puts a machine language program into memory (the unused block starting at location 679, or $02A7 hex). Be sure to save a few copies of the program before running it for the first time. When you type RUN, the BASIC portion of the program is erased from memory, leaving only the machine language portion. The machine language remains safe in memory until you turn off the computer.

Using The Program

Here are step-by-step instructions for using Tape to Disk Transfer:

  1. Clear the computer by turning it off, then on again. Then load the Transfer program.
  2. Insert the tape with the program you want to backup into the cassette recorder. Make sure it's rewound. Insert a formatted disk into the drive.
  3. Clear the screen. Type RUN and press RETURN, then SYS 679 and press RETURN. Follow the instructions which appear on the screen. When the normal screen is restored, you'll see a flashing cursor just after the word LOADING.
  4. Enter a disk filename for the program you're copying and press RETURN. Avoid using a filename that already exists on the disk, and limit the filename to five characters or less. Forgetting about these two requirements will cause the backup to fail.
  5. If the red light on the disk drive is flashing when the cursor returns, a disk error was detected and you'll have to diagnose the problem and start over. Otherwise, the transfer was successful. If you want to make another copy of the same program, clear the screen and type SYS 706. This will return you to the flashing cursor. Type another disk filename and press RETURN.
  6. When loading a program from disk that was made with Tape to Disk Transfer, use the LOAD "filename", 8, 1 command. Notice the 1 appended to the command; this specifies a nonrelocating load. We'll explain why this is necessary below.

Strange Screens

To save space in Tape to Disk Transfer, several shortcuts were taken. For example, the program saves the contents of every memory location beginning at location 828 ($033C) and ending at the last address of the program being backed up. That includes screen memory and the sprite data pointers at 2040 through 2047. This should not cause any serious problems. However, the screen will do some strange things when you reload the program after saving it. This is because the old screen image is being loaded along with the program. If you clear the screen before typing the SYS to start the backup, the effect will be somewhat less noticeable.

Starting the save at location 828 also means you must load the program from disk with the nonrelocating load command, as specified in step 6 above. If you object to this, you can change the Transfer program to save only the locations you want.

To start saving from a location other than 828, POKE location 740 with the least significant byte (LSB) of the desired address and POKE 744 with the most significant byte (MSB) of the address. You can use these formulas to convert the address into LSB/MSB bytes:

POKE 744, (INT(starting address/256))
POKE 740, (starting address-((INT(starting address/256))*256))

To change the ending address of the backup, POKE 748 with the LSB of the desired ending address and POKE 750 with the MSB of the address. You can use the same formulas above by substituting ending address for starting address.

If you change the ending address, you'll also have to make two further modifications to the machine language by typing:

POKE 747, 162:POKE 749, 169

For example, to start saving from the normal beginning of BASIC program storage (location 2049), you would enter:

POKE 740, 1: POKE 744, 8

because the integer portion of 2049 divided by 256 equals 8, the MSB, and 2049 minus the product of 8 times 256 equals 1, the LSB. After making these POKEs, run Tape to Disk Transfer as usual by entering SYS 679.

A program transferred to disk in this manner can be loaded with the usual LOAD "filename", 8 command.

Tape To Disk Transfer

Please refer to "COMPUTE!'s Guide to Typing In Programs" before entering this listing.

10 FOR I = 679 TO 767: READ X: POKE I, X: NEXT I
                                                        :rem 97
50 NEW: REM DON'T INCLUDE UNTIL YOU ARE SURE IT IS CORRECT
                                                        :rem 184
100 DATA 169, 1, 162, 1, 160, 255, 32, 186, 255, 1,
       69, 0, 162, 0, 160, 0, 32, 189, 255, 169, 0      :rem 48
200 DATA 162, 255, 160, 255, 32, 213, 255, 160, 0,
       32, 207, 255, 153, 245, 2, 200, 201, 13          :rem 231
300 DATA 208, 245, 132, 254, 169, 8, 162, 8, 160, 2,
       32, 186, 255, 165, 254, 162, 245, 160, 2         :rem 113
400 DATA 32, 189, 255, 169, 60, 133, 251, 169, 3,
       133, 252, 166, 174, 164, 174, 169, 251           :rem 241
500 DATA 32, 216, 255, 60, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0,                                      :rem 39