Improved Guide To Burning Dreamcast Discs From Linux

Here is my attempt to rewrite the guide to burning dreamcast discs from Linux.

It is an updated and enhanced version of this post:

Burning Dreamcast CDRs from Linux

Which is stolen from here:

Using mkisofs and cdrecord to Burn a Dreamcast CD-R

My plan is to break down the guide a little more and give better explanations about what is happening at each stage. This was done on an Ubuntu desktop machine running the development release of Hardy Heron on 2 March 08.

Step One – Prepare Ye The Way

Visit this page:

Dreamcast Programming

Download the ip creator and 1st_read.bin scrambler.

Here is a brief description of what these files help you create.

When the Dreamcast boots a GD-ROM or CD-ROM, it reads two things from the disc before the control is passed to the program. First a bootstrap is loaded from the reserved boot area (sector 0-15) of the last data track. This strap is called the “IP.BIN”, although it of course does not have a file name on the disc. Among other things, the IP.BIN names a file in the ISO filesystem of the disc that contains the actual program to run and load. This file will here be called the “1ST_READ.BIN”, although any name is possible as long as it is correctly specified in the IP.BIN. When the 1ST_READ.BIN has been loaded, control is passed to the IP.BIN, which will in turn pass it to the 1ST_READ.BIN.

The 1ST_READ.BIN file must be scrambled. Often the download sites will tell you if the file is prescrambled or not. Here is why the file must be scrambled.

An interresting feature of the bootloader is that for normal CD:s (not GD:s) this file is not loaded continously into memory, but instead scatter-loaded in a pseudo-random manner. In order for your program to be loaded properly, the binary thus first has to be “scrambled”.

There is a linux tool here 1ST_READ.BIN Checker that will tell you if a file is scrambled or not.

All these programs have compiled easily on my Hardy Heron Ubuntu machine. After downloading build-essential.

gcc filename.c -o filename

Should leave you with three files called 1strdchk, makeip and scramble.

I tend to make a directory Gamename the use a subdirectory called cd or cdimage to make the iso image from. I put the binaries above along with ip.txt and IP.TMPL in the Gamename directory.

The plan is to burn a copy of dreamsnes to cdr and then play it on the dreamcast.

Step Two – The Web Is The Gate And The Key

Download dreamsnes.

DreamSNES is a Super Nintendo emulator based on Gary Henderson’s Snes9X. It runs directly on the Dreamcast hardware without using any SEGA or Microsoft libraries. It has been completely developed using free tools. DreamSNES was created by Marcus Comstedt, Peter Bortas, and Per Hedbor.

Download and extract dreamsnes with full paths.

The author has kindly scrambled and scrambled the 1st_read.bin file. Though in this case it is called the 1dsnes.sh4 file 🙂

Possibly not the best first example, I will soldier on though.

If we wanted to create the ip.bin file for ourselves we would go into the folder with the compiled makeip program. It should look something like this:


douglas@toughbook:~/Dreamcast/burndream/bin$ ls -l
total 60
-rw-r--r-- 1 douglas douglas 32768 2000-06-27 18:34 IP.TMPL
-rw-r--r-- 1 douglas douglas 308 2000-06-27 19:10 ip.txt
-rwxr-xr-x 1 douglas douglas 10813 2008-02-29 20:59 makeip
-rwxr-xr-x 1 douglas douglas 10227 2008-02-28 22:56 scramble
douglas@toughbook:~/Dreamcast/burndream/bin$

Edit ip.txt from this:

Hardware ID : SEGA SEGAKATANA
Maker ID : SEGA ENTERPRISES
Device Info : 0000 CD-ROM1/1
Area Symbols : JUE
Peripherals : E000F10
Product No : T0000
Version : V1.000
Release Date : 20000627
Boot Filename : 1ST_READ.BIN
SW Maker Name : YOUR NAME HERE
Game Title : TITLE OF THE SOFTWARE
douglas@toughbook:~/Dreamcast/burndream/bin$

To look like this:

Hardware ID : SEGA SEGAKATANA
Maker ID : SEGA ENTERPRISES
Device Info : 0000 CD-ROM1/1
Area Symbols : JUE
Peripherals : E000F10
Product No : T0000
Version : V0.9.8
Release Date : 20021031
Boot Filename : 1DSNES.SH4
SW Maker Name : marcus,per,peter
Game Title : DreamSNES

Then run the makeip program. Giving as arguments the ip.txt file and the output filename. There is probably nothing against creating many ip.txt files with differing names but there is not really much use.

douglas@toughbook:~/Dreamcast/burndream/bin$ ls
IP.TMPL ip.txt makeip scramble
douglas@toughbook:~/Dreamcast/burndream/bin$ ./makeip ip.txt IP.BIN
Setting CRC to 236C (was 0000)
douglas@toughbook:~/Dreamcast/burndream/bin$ ls -l
total 92
-rw-r--r-- 1 douglas douglas 32768 2008-02-29 21:42 IP.BIN
-rw-r--r-- 1 douglas douglas 32768 2000-06-27 18:34 IP.TMPL
-rw-r--r-- 1 douglas douglas 296 2008-02-29 21:41 ip.txt
-rwxr-xr-x 1 douglas douglas 10813 2008-02-29 20:59 makeip
-rwxr-xr-x 1 douglas douglas 10227 2008-02-28 22:56 scramble

Anyway back to Dreamsnes.

Step Three – Just One Step At A Time

Enter you unpacked dreamsnes directory. It should look like this.

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ ls -l
total 36
lrwxrwxrwx 1 douglas douglas 10 Mar 2 20:50 CHANGES -> cd/CHANGES
-rw-r--r-- 1 douglas douglas 32768 Oct 30 2002 IP.BIN
lrwxrwxrwx 1 douglas douglas 10 Mar 2 20:50 LICENCE -> cd/LICENCE
lrwxrwxrwx 1 douglas douglas 9 Mar 2 20:50 README -> cd/README
drwxr-xr-x 6 douglas douglas 4096 Oct 30 2002 cd
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

First of all make a blank block of data to use as any empty audio track. Use this command.

dd if=/dev/zero bs=2352 count=300 of=audio.raw

This should happen.

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ dd if=/dev/zero bs=2352 count=300 of=audio.raw
300+0 records in
300+0 records out
705600 bytes (706 kB) copied, 0.00568241 s, 124 MB/s
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

We will now record this to the start of the blank cdr (not cdrw) we have placed in the drive.

[[ERROR ERROR ERROR]]
Skip to the end if you want to miss out on me going badly awry.

Check the device of your cd writer by typing more fstab.

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ more /etc/fstab
# /etc/fstab: static file system information.
#
#

<>
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

My cd writer is at /dev/hdc. Next we burn the blank audio track to the beginning of the cd.

cdrecord dev=/dev/hdc -multi -audio audio.raw

There is probably no reason you could not have an actual audio wav file speaking a warning about it being a dreamcast disc.

I just tried it (have changed to a Hardy Heron Ubuntu box halfway through and am getting a cracking error message)

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ cdrecord dev=/dev/hdc -multi -audio audio.raw
wodim: No write mode specified.
wodim: Asuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

[[END ERROR END ERROR END ERROR]]

I try wodim –devices:

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ wodim --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
0 dev='/dev/scd0' rwrw-- : 'TSSTcorp' 'CD/DVDW SH-S182D'
-------------------------------------------------------------------------
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

cdrecord dev=/dev/scd0 -multi -audio audio.raw

Which looks much happier.

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ cdrecord dev=/dev/scd0 -multi -audio audio.raw
wodim: No write mode specified.
wodim: Asuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'CD/DVDW SH-S182D'
Revision : 'SB03'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Speed set to 8468 KB/s
Starting to write CD/DVD at speed 48.0 in real TAO mode for multi session.
Last chance to quit, starting real write i 0 seconds. Operation starts.
Track 01: Total bytes read/written: 705600/705600 (300 sectors).
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

At this point you probably want to make sure you have some roms in the dreamsnes/cd/roms directory. Finding them is your own problem.

Next we check what is happening on the cd.

cdrecord dev=/dev/scd0 -msinfo

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ cdrecord dev=/dev/scd0 -msinfo
0,11702
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

Every time I have done this I have come up with exactly the same numbers. But still I do it anyway. We use the results in the C option in the below command.

mkisofs -l -r -C 0,11702 -G IP.BIN -o tmp.iso cd/

Pleasure ensure the case of IP.BIN is correct. In fact always make sure you have your cases correct at every stage of the operation. Especially when you need to make your own ip.bin files using makeip and ip.txt.

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ mkisofs -l -r -C 0,11702 -G IP.BIN -o tmp.iso cd/
genisoimage: Warning: -C specified without -M: old session data will not be merged.
86.59% done, estimate finish Sun Mar 2 21:17:02 2008
Total translation table size: 0
Total rockridge attributes bytes: 4153
Total directory bytes: 10240
Path table size(bytes): 62
Max brk space used 0
17335 extents written (33 MB)
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ ls -l
total 12016
lrwxrwxrwx 1 douglas douglas 10 Mar 2 20:50 CHANGES -> cd/CHANGES
-rw-r--r-- 1 douglas douglas 32768 Oct 30 2002 IP.BIN
lrwxrwxrwx 1 douglas douglas 10 Mar 2 20:50 LICENCE -> cd/LICENCE
lrwxrwxrwx 1 douglas douglas 9 Mar 2 20:50 README -> cd/README
-rw-r--r-- 1 douglas douglas 705600 Mar 2 20:55 audio.raw
drwxr-xr-x 6 douglas douglas 4096 Oct 30 2002 cd
-rw-r--r-- 1 douglas douglas 11536384 Mar 2 21:17 tmp.iso
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

Step Four – And Now We Face The Final Burning
cdrecord dev=/dev/scd0 -multi -xa tmp.iso

douglas@attic:~/Dreamcast/dreamsnes-0.9.8$ cdrecord dev=/dev/scd0 -multi -xa tmp.iso
wodim: No write mode specified.
wodim: Asuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'CD/DVDW SH-S182D'
Revision : 'SB03'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Speed set to 8468 KB/s
Starting to write CD/DVD at speed 48.0 in real TAO mode for multi session.
Last chance to quit, starting real write i 0 seconds. Operation starts.
Track 02: Total bytes read/written: 11536384/11536384 (5633 sectors).
douglas@attic:~/Dreamcast/dreamsnes-0.9.8$

Time to take it downstairs and check if it works.

Step Five – The Happy Dance Of Happiness

Advertisements

3 responses to “Improved Guide To Burning Dreamcast Discs From Linux

  1. can you make a simpler sister tutorial that shows how to burn ready-to-burn dc images

  2. Could try to do a simpler one yes. I am not sure it is possible to do a simple ready to burn image though (the windows equivalent would be a discjuggler cdi image) AFAIK you must burn a blank music track first then the data image. It would be trivial for a programmer to make a frontend for these steps. Sadly I am not a programmer.

    When I have time I will do a cut down, here are the key steps type thing.

  3. Thanks Doug. When I found the original DreamSNES site I wondered how out-of-date the instructions were, given how cdrtools has evolved. This worked like a charm for me. The only thing I changed was the addition of a ROMS.LST file in the roms directory to speed the disc up. Also, while DreamSNES supports 1024 roms per disc, the authors suggest maximum 50. I tried pushing beyond that and even with the roms list it did get more sluggish. Thanks again.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s