Wednesday, 3 November 2010

CD32 bootable discs

The console uses a special format for CDs that can automatically boot at startup, when inquiring about the method i would have to use in order to create such CD i stumbled upon the most widespread method which consist of using an old Amiga tool called "IsoCD" made by Carl Sassenrath which was part of the official Commodore CD32 Developers kit back in the day, since I'm developing the game from Windows that tool was kinda cumbersome to use (plus it have some quirks like the trademark file which needs to be reloaded each time an iso file is generated), i couldn't integrate it inside my compilation scripts.
 
For the conveniency of the project it was obvious that i had to determine what made a CD bootable on the console and make some tool that would convert standard ISOs to those CD32 bootable ones so i could use mkisofs to create the files.
 
After a quick look i noticed that there's actually 3 locations where data differ from standard ISOs:

- 17 extra bytes in the application data field containing pointers to the path table block and to a trademark file block looking like this:

   0x00
   "FS"
   0x00
   0x00
   "TM"
   0x00
   <path table block byte>
   0x00
   0x00
   0x00
   0x00
   0x00
   0x00
   0x00
   <trademark file block byte>

- A 2048 bytes trademark file (mostly containing garbage but it have to be present)
- System ID have to be "CDTV".

Both blocks byte pointers are multiplied by the blocks size (2048 bytes) to determine the offset of the relevant informations inside the file, i choosed to put the trademark file right before the path table at block 18 (offset 36684) (the path table created by mkisofs is located at block 19) as there was enough empty room there (for some reasons putting it in the boot sectors before the ISO header wouldn't work).

The command line to use with mkisofs is quite specific and goes like this:

mkisofs -quiet -V <cdname> -copyright <yourcopyright> -publisher <publishername> -o <name.iso> -relaxed-filenames -d -input-charset ASCII -output-charset ASCII -iso-level 3 -A "" -sysid CDTV <directoryname>/

It won't work with anything else than a CDTV system ID, i guess they were lazy and re-used the code they made for their CDTV product.
 
So, i made another Ruby script which does the dirty conversion job (see related files section for download), burned a CD with the ISO and it worked like a charm.

On the other news, I also had the time to implement the game saving & the characters creation process.

See you soon.

No comments:

Post a Comment