Apl2serial - Transferring Apple ][ Disks

Introduction

Apl2serial are a set of programs which allow files and disks to be transferred to and from Apple ][ computers which do not have a serial port. This allows the files and disks to be used (as disk images) on the growing number of Apple ][ emulators. As well, nibble copies of floppy disks can be transferred.

Requirements: You will need an Apple ][ with a 16-pin internal game port. This includes the Apple ][, ][+, and ][e computers, but not the Apple //c. The latter has a built-in serial port, so you can use ADT to transfer files from an Apple //e. The Apple ][ must be booted with DOS 3.3, although Pascal and ProDOS floppy disks can be transferred.

You will also need a server computer with a serial port to capture the files or disk images. At the moment there is a limited server for MS-DOS, and a more sophisticated server for Unix. Only the Unix server supports the transfer of nibble images from the Apple ][.

When using Apl2serial, you have 1 or 2 real floppy disk drives in slot 6, and 12 virtual floppy disk drives in slots 1-5 and 7, drives 1 and 2. The DOS 3.3 RWTS routines are patched so as to communicate with the remote server when sectors for these virtual disks need to be transferred.

Status and Future Work

Currently, Apl2serial provides 9600 bps data transfer from an Apple ][, ][+ or ][e to an MS-DOS or Unix computer. Things to do are:

Warren Toomey, wkt@tuhs.org, October 21st 1998.

Building the Cable

Because the Apple ][, ][+ or ][e computers don't have a serial port, we need to build a special cable to connect them to the serial port of the server computer. The schematic of the cable is shown in the diagram below.

Below is a picture of the internal game port in an Apple ][+, showing the location of the port relative to the video socket and slots 5, 6 and 7. As well, a picture of the pin assignments for the port is shown. Both images come from the Apple ][ Reference Manual. NOTE: In the Apple ][+, pin 1 is on the right towards the front (keyboard end) of the computer. I am not sure of the orientation for the Apple ][e, can someone tell me?

If you have any soldering skills, it should only take you only a short time to construct the cable above. The 1N914 diode prevents a negative voltage from being applied to the PB2 input, and the two 1K resistors divide the 12 volts from the RS-232 port down to around 6 volts. The RTS/CTS and DTR/DSR/CD pins are tied together on the RS-232 port to make a `null modem'.

You can also have a look at the cable that I built .

Downloading Apl2serial

There are several versions of Apl2serial:

As well, you can download:

Each main distribution comes with the bootstrap code, client assembly and machine code, and server source code. The MS-DOS version also includes the MS-DOS binary.

There are two versions of the server source code. The MS-DOS version was written in 1982, using the Microsoft Quick C compiler. The MS-DOS server is hard-coded to use the COM2: serial port. I now don't have that compiler, so this version of the server is frozen.

The Unix version of the server is currently being maintained, and should compile on any flavour of Unix which has termios support. Please email me if you have porting problems, and/or porting patches.

Bootstrapping the Client

First, connect the two computers together with the cable (watch the orientation of the game port!), and turn both on. Watch for signs of sparks and smoke etc.

The client size is 256 bytes, and you should have a binary image of the client on the server as the file apl2cli.dat. Typing this in would be arduous, and mistakes would be easy to make. Instead, the following code will transfer the full Apl2serial client into the Apple ][. Enter the following machine code at the monitor:

  300: A2 00 20 18 03 9D 00 9B
  308: E8 D0 F7 20 14 03 20 14
  310: 03 20 17 03 20 17 03 60
  318: A0 07 AD 63 C0 30 FB AD
  320: 63 C0 10 FB 20 0B 03 20
  328: 0B 03 AD 63 C0 0A 66 FF
  330: 20 0B 03 88 10 F4 A5 FF
  338: 49 FF 60

Do a dump of the locations (type 300.33A at the monitor prompt), and cross-check the code you've typed in. You might like to BSAVE APLBOOT, A$300, L$3B at this point. Once this is done, run the code by doing 300G at the monitor, or a CALL 768 from the BASIC prompt.

Go back to your server machine and run a terminal program (Kermit, Procomm, Minicom etc) set to 8-bits, no parity, 9600 bps. Use your program's upload mechanism to send the 256 bytes in apl2cli.dat to the Apple ][. Make sure that the terminal program doesn't do any character translation. If the cable and ports are working correctly, the Apple's prompt should return. You now have the full Apl2serial client loaded. You should now save the client to the floppy disk with a BSAVE APL2CLIENT,A$9B00,L$100.

If you are paranoid or cautious (which is good), then cross-check the downloaded code by doing 9B00.9BFF at the monitor prompt, and compare the hexdump with the hexdump shown in the 9,600 bps client assembly code text file.

Making a Remote Keyboard

If the above doesn't work, you might like to try setting up the server as a remote keyboard. Enter the following additional machine code in at the monitor prompt:

  33B: 20 18 03 09 80
  340: 60 A9 3B 85 38 A9 03 85
  348: 39 4C EA 03

Now run the code by doing 341G at the monitor prompt. This will replace the Apple ][ keyboard, and input will now come from the serial port. Go back to your server machine and run your terminal program set to 8-bits, no parity, 9600 bps. If the cable and ports are working correctly, characters typed on the server's keyboard will be received by the Apple ][. You now have a remote keyboard!

If not, you'll need to check things like: the cable, the correct orientation of the game port, the right speed, number of bits and parity on the serial port, and to use hardware handshaking.

Using the Virtual Disks on the Server

Once the full client code is entered at $9B00, either do B7B9:9B, or POKE 47033,155 to connect the client into DOS 3.3. Exit your terminal program and start the Apl2serial server program on the server computer. Now, you can INIT HELLO,S3 for example, and the server should show the DOS 3.3 and HELLO being written to the file disk_3a.dsk. After this you should be able to CATALOG etc. this virtual disk, as per the regular disk in slot 6.

Disk images on the server side are called disk_Xa.dsk or disk_Xb.dsk, where X is the slot number and `a' and `b' stand for the two drives in each slot. Disk images are in the standard 143,360 byte DOS 3.3 format, as used by most Apple ][ emulators. You can place existing disk images in the same directory as the server program, and then use them on the Apple ][ via the serial link.

If you plan to use Apl2serial frequently, you can write a HELLO program to BLOAD APL2CLIENT and perform the POKE 47033,155, to connect the Apple ][ to the server at boot time. Note that no data will be transferred between the client and server while you stick to the drives in slot 6. However, while the link is up, you can use slots 1-5 and 7, drives 1-2. This gives you 12 virtual floppy drives on the server computer.

Transferring Files and Disks

I use FILER or my own DISK COPY to copy whole disks or individual files from the Apple drives to the disk images on the server. Remember that you have 12 virtual drives, so you can copy 12 floppies before stopping the server. It takes about 3 mins a floppy at 9600 bps, though.

For some reason, FILER doesn't work unless you access the particular virtual floppy you want before FILER is run. To work around this, do a CATALOG on any virtual drive before running FILER.

Exiting the MS-DOS Server

You can use ctrl-C to exit the Unix server, but not the MS-DOS server. Here are the instruction to get the MS-DOS server to exit.

The server will close the current open disk image, open the new one and try to print out a message, then die because of the ctrl-break. Tacky but it works.

Other Links

Here are some other links you might find useful.


Warren Toomey
10/21/1998