T64 Extractor/Creator

I set out to create this program based on the need for a C64 program to extract files from the T64 emulator image format. With the recent advancement of graphical web browsers like the Wave and Hyperlink, and the use of CD drives on our Commodores in the past 5 years or so, it's been getting even easier for users to receive PC emulator files onto their C64s. Several D64 solutions exist for the C64, but nothing much for the T64. Previously, scaled down versions of T64 extraction have only been available with no real total T64 solution for the humble 64 itself. This program sets out to change this (and about time too I think).

First, a few things about the T64 format and the limitations of this program.

Typically a T64 can hold a maximum of 65536 files inside itself. The original creator of the T64 set no upper limit on the number of files that could be created inside a T64 - leading to some confusion for Commodore emulation format editors to work around. To my knowledge, the largest upper limit allowed on any T64 editing PC program is 500 files (which the "Star Commander" implies). I see no reason to break with this tradition. Firstly, I find it ridiculous that anyone would want to stick more than 500 files in a T64. Secondly, there's no way possible the C64 could possible handle the maximum 65536 files anyway, out of consideration of the C64's memory and the fact that the largest CMD partition available to Commodore users doesn't quite get close to 65536 blocks, let alone be able to assign 65536 files within such a partition.

Another issue is the file entry type. There are several entry types available to files inside T64s. This program only handles type 1 (normal tape files). The VICE emulator is only capable of handling type 1 as well, and since other file entry types are rarely used anyway, I've decided to drop support for any of the others in my program.

In normal usage, only PRG (program) files are used in T64s. I've decided to be flexible here and also permit SEQ and USR files to be inserted into T64s created with my program. I have not included support for REL files however - the original Commodore datasette couldn't handle them anyway.

T64s when created also had a version number in the T64 header. I have kept this as 256 (low-byte=0, high-byte=1) for creation, and the program ignores version type on extraction.

Despite the fact that T64s are essentially "tape" files, my program has no support whatsoever for a datasette on your C64! It does support just about every other Commodore disk drive (1541 and compatibles/1571/1581), CMD partitionable devices (FD, HD, RAMLink), and possibly the IDE HD as well (but I don't have one to test it on). The program will even detect what kind of drives you have on your system.

From the menu you can select your source and target drives, and view the directory and send disk commands on either one. The filename to be used by the program is also displayed on the bottom half of the screen. The program mode (Extract or Create) selects whether you will extract programs from the displayed filename, or create a T64 using the displayed filename. The directory mode (Manual or Total) displays how you would like to select files, if at all. Having the directory mode as "Total" will extract every file on a T64 in extract mode, or select every file in the source directory in create mode. "Manual", on the other hand, will display the directory and allow you to select individual files using "Y"es or "N"o, and "B"egin to start the T64 extract/create process. The filename can be edited from the main menu. It is recommended that you end your created T64's filename with ".T64" so you don't get confused, but the program will not force you to do so.

The rest of the program is fairly self-explanatory. If you are creating a T64 file, you will also need to enter a user description of 24 characters long for the T64 file, as well as a maximum limit of file directory records.

The actual extraction and creation process is VERY SLOW, because the file is created and extracted as a sequential file (that, and the fact that the program is compiled BASIC). Really, it is almost like having a datasette again. Maybe one day if I ever get the time and motivation, I will rewrite it so that the program reads and writes files using direct access Block-read and Block-write commands. Although such a routine would be very complicated, it would probably be a lot faster than this program currently is. At the moment, I'm just glad the program works!

I have made every attempt to test the program and do error checking on the files extracted and created - and I have had no problems (yet). However, as I am releasing this program into the public domain for C64 users trying to keep a vintage machine alive, I can offer no guarantees. Use at your own risk. Having said that though, please feel free spread this program around, edit it to your liking, release alternate versions, and examine the source code (if you are interested in doing your own assembler, or GEOS version or something). I've put enough REM statements in the BASIC source to try to help you understand what I did. Hopefully someone out there will write a better program than this one!

PS. Thanks to the guys on comp.sys.cbm for their help.

Program updated May 21st to V1.1 Thanks to those people who did some testing of the program and found a few tiny bugs in it. I've reworked the program a bit and done the following.

- The core extraction and creation routines have been simplified a bit, tidied up, and placed towards the front of the program. Not much speed increase, but it all helps.
- T64 compatibility bugs ironed out (T64s created in programs other than Star Commander previously weren't recognised)
- SEQ file usage properly checked (I rushed this in v1.0)
- A slight cosmetic change to the count-down routines.
- BASIC Source code renumbered properly.
- A few other bugs that could have given the program trouble.

So the program is a bit cleaner now, but not much faster. If I figure out a way to speed the program up in its compiled BASIC form - we'll see a V1.2

If not, stiff cheese I guess....

Program updated May 29th to V1.11 Thanks to fyarra who sent in a strange T64 to test on the program. Whatever buggy T64 editor made the T64 he sent in, it forgot to put the filetype of the file in. This caused trouble for my program (which until now, expected it).

- Anyway, this "No file type" error has been fixed - so if the program sees no filetype, it will assume it to be a PRG file.

Program updated May 31st to V1.12 On closer examination, I have realised that the program didn't take locked files into account. Now it does.

- Locked files are recognized

Program updated Sept. 14th to V1.2 A small bug dealing with locked program files and the number countdown discovered and fixed.

Program updated June 5th 2004 to V1.3 Thanks to Larry for submitting a non-standard T64 on the program. It gave me the opportunity to fix a few more bugs.

- This fix deals with T64s which don't have any info on the file types within them. The default file type where none is present is now PRG files (and not SEQ files).
- T64s can now be extracted on the C64 whether they are SEQ or PRG files now.
- Some extra messages to deal with files not found.
- Starting detection messages removed (not needed, just wasted memory)
- Extracted filenames get the extra spaces truncated off them. This fix should have been done ages ago.

DOWNLOAD the T64 Extractor/Creator here