Classic Computer Magazine Archive COMPUTE! ISSUE 92 / JANUARY 1988 / PAGE 20

128 To CP/M File Transfer

I use Word Writer 128 for word processing. As you may know, it stores files in sequential format.

My question is this: Is there a way to transfer these files to a Commodore CP/M disk so they can be read in CP/M mode? I would like to be able to do this to keep from having to purchase a CP/M word processor or text editor.

I would appreciate any help you could give me.

Robert Kupfer

In the July 1986 issue of your sister publication, COMPUTE!'s Gazette, the article "A Hands-On Introduction to 128 CP/M" makes reference to downloading a program from a BBS in 64 or 128 mode, and then transferring it from a Commodore disk to a CP/M disk. Since the two disk formats are not compatible, can this transfer be accomplished using a single 128 computer and 1571 disk drive?

Paul Lynas

There are several ways to transfer files from a 128 disk to a 128 CP/M disk. First, there are programs available in the public domain that will do this for you. Programs for one- and two-drive systems are available on CompuServe, QuantumLink, and on most bulletin board systems (BBSs) that support Commodore computers. If you don't have a modem, your best bet is to contact a local user's group for one of these programs.

If you are unable to locate one of these programs, there is a simple way to accomplish the transfer (assuming your files are less than 50K in length.) This method requires only a 128, 1571, the DOS Shell program that comes with the 1571, the CP/M system disk that comes with the 128, and one short BASIC program.

In a nutshell, this technique involves loading a fileoriginally either sequential or program—into the 128 in 128 mode, booting CP/M and saving the information to a CP/M-formatted disk. It's not an especially complicated procedure, but it does involve several steps.

First, in order to be BLOADed into the 128's memory, the file you want to transfer must be a PRG file. If the file is in sequential format, there's a simple way to convert it.

Boot the DOS Shell program that came with your 1571. When the shell is in memory, press f1 to activate it. Choose the DELETE FILES option from the menu. Delete the file you want to change from SEQ format to PRG (make sure you have a backup copy of this file on another disk). Now, choose the option to RESTORE FILES. Specify the filename of the file you just deleted. When the shell asks what type of file the restored file is, simply select the PRG option.

Now that your sequential file is a PRG file, you can load the file into the 128's memory at a place where CP/M will be able to find it. Use the following command:

BLOAD "filename", B1, ,P7170

where filename is the name of the file you want to transfer. This will place the file in bank 1, at address 7170 ($1C02). Next, there are two details to which we must attend. The BLOAD command assumes the first two bytes of your file are its load address—they aren't, they're part of the file you want to transfer—so we need to read these two bytes and put them where they belong. Second, we need to determine the file's ending address. To accomplish these two tasks, type in and run the following short program, again replacing FILENAME with the name of the file you wish to transfer:

20 GET #2, A$ : IF A$ = " " THEN A$ = CHR$ (0)
30 BANK l : POKE 7168, ASC (A$)
40 GET #2, A$ : IF A$ = " " THEN A$ = CHR$ (0)
50 BANK1 : POKE 7169, ASC (A$)
60 GET #2, A$
70 BYTE = BYTE + 1
80 IF ST = 0 THEN 60
90 DCL0SE #2

Write down the ending address—you'll need it in just a moment.

Now, place your CP/M system disk in the drive and type BOOT. (Be sure not to reset your 128 or turn it off, just type BOOT.)

When the 128's CP/M is loaded, take the disk that has the CP/M command SAVE on it and put it in the drive. (SAVE is on the flip side of the CP/M system disk that came with your 128.) Now type SAVE at the A> prompt. When the prompt returns, type SAVE again. Now place the CP/M disk you want to save the file to in drive A. CP/M first asks you the filename you want to use. Supply any legal name you like. If the file is a binary or executable file, be sure to use the extension .COM. Next you're asked for the starting address. Type 1C00 and press RETURN. Finally, CP/M asks for the ending address. Type in the ending address you wrote down earlier.

If you've done everything correctly, your 128 file is now on your CP/M disk.