TrackMaster V1.0a ====================== ©1991 by BrainTrace Design Software. This program is free to copy and use as long as nobody makes any kind of profit with it, and the program is unchanged and spreaded together with the doc- and example-files. If you want to include it to a comercial pd-library or product, or if you want to use it for a game, you need the written permission of Cranium Software. A general permission for distribution is granted to Fred Fish. Mister S.O. , Germany, will never get a permission of any kind ( I warn you ). BrainTrace Design Software Carsten Schlote Egelseeweg 52 6302 Lich 1 / Germany Phone: ++49-(0)6404-7996 Purpose: ======== TrackMaster is a small program, which will help all game coders to create trackdisk-loading game disks. TrackMaster copies a list of files, which are listened in a scriptfile, to a empty disk in a specified drive. The files are written with the trackdisk.device. Also a bootblock is written, who will load the first program on disk. An optional feature of TrackMaster is the possibility to compact the file before writting them to disk. By default the file are written unpacked. Look at section 'Scripts' for additional info. As long as the system is left intact, you can now write a trackloading (FAST) game, without writting all files by hand to this disks. Be sure to use only Forbid(), Permit(), Disable() and Enable(). Also use AllocMem to get your memory. Technical info: =============== The first program must be a binary image and pc-relative. You can use the included program HunkWizzard to convert an amiga executable to a binary image. This program will be loaded and started as your game-loader. Therefore it must handle all further loading, decrunching and so on by itself. The pointer to current StdIOReq is available in register A1. The maximum number of fileentries is available in d0. The offsets and lengths of the files on disk are stored as an array of LONGs at offset 1024 ( Block 2 ) on the disk. This looks like this: dc.l 1536, ???? ; Offset and Length of first program ( YOUR loader ) dc.l x1, y1 ; Offset and Length of second file dc.l x2, y2 ; Offset and Length of third file dc.l x3, y3 ; Offset and Length of fourth file dc.l ..... ; and so on I sugest you to do the following in the loader: Examine how many drives are installed in the system. This can be done simply by opening all trackdisk units and checking the OpenDevice result. Your current bootdrive unit number you can find in the StdIoReq ( look at exec/io.h for more info. The pointer to the StdIOReq is stored in A1 !!) Remember that with Kick 2.0 EACH drive can be the boot drive. I know a lot of bad-written games, which force the user to use the drive 0. If you have two different drives installed, for example an 3.5" and a 5.25" drive, this can become VERY nasty. Use now your knowledge about the installed drive for your game loading system, please ! Of course you can use the loader as the main part of your game. Then you can use the remaining files for graphics. This is much simpler as writing all code pc-relative or use a relocator for executable while loading. The last program in the dirtable is an array of the filenames used by trackmaster as fileentries before. Each filename ocupies 30 characters of space. So you can find each filename with the following formula : filenamestart = 30 * index You can use the filenames for your own filesystem. This will allow you to use filenames instead of indexes, which is fairly transparent to your programs. It makes it possible to use a harddisk loader for developing and a trackdisk driver for the final game or program, without worrying about the indexes or fileordering on disk. The script file =============== The script file is very simple. Empty lines and lines starting with a '#' are comments. Everything else is used as a path/filename. All files are stored to disk in the same order as in the scriptfile. The first file must be a binary image and pc-relative. The remaining files can be of any type you want ( Gfx, Code, Executables, ... ). The '#' can be a switch introducer. It must be followed by a character and the numbers 0 or 1 ( means FALSE(0) or TRUE(1) ). The following switch exist : #o - Continues writing of the following files at the given disk block number. Number must be decimal. #@ - Write seek offset & length for following files at direntry . This allows to skip some already written files, e.g. if you want to update level data etc. This functions expects the disk in drive to BE a trackmaster disk - no checks ! You must use this function in conjunction with the #o directive - be sure to give the right offset - no checks ! You may use this function only once per script file. The first file in table has the number 0 (Zero) - count right ! #c0 - Switch compressing for following file off. #c1 - Switch compressing for following file on. #r1 x - Relocate executable to address x (hexadecimal) on. HunkWizard must be available in current path setting. #r0 - Relocate off #s1 <@d> > - Execute a doscommand on following files. the '@s @d' is important. the first is a placeholder for the original filename. The second is for original filename with a '.rel' extention. The placeholder can also be divided by special keyword like 'to'. E.g. '@s to @d'. the placeholders are optional, and they may be used in any order and in multiple places. #s0 - Special off #l x filename - join the x following files to filename Compressed files ================ For the compression the lh.library by Olaf Bartels is used. The packed data will be proceded by three long words. The first is a pack-identifier, the last two are the lengths before and after crunching. dc.l 'PACK', OriginalSize, PackedSize, ... < Packed data follows > Keep the header in mind if you call the recruncher !!!! Usage ===== Write your scriptfile and then call TrackMaster with the path/filename of your script as first, and the number of the destination drive ( 0..3 ) as second Command-Line-argument. The rest is done by the program.