IP.BIN: Difference between revisions

From dreamcast.wiki
Jump to navigation Jump to search
Line 49: Line 49:
|Bootstrap 2 (Not Required [[#Bootstraps]])
|Bootstrap 2 (Not Required [[#Bootstraps]])
|}
|}
=== Meta information ===
{| class="wikitable"
{| class="wikitable"
!Offset
!Offset

Revision as of 22:16, 7 February 2020

The Dreamcast bootsector (commonly named IP.BIN) is placed on a GD-ROM or a MIL-CD in the first 16 sectors of the data track from which the Dreamcast is booting. It contains information about the software on the disc, including region protection, as well as the code that displays the Sega copyright screen and prepares the system for the launch of a game title.

Originally the bootsector was lifted from Dreamcast games to boot homebrew software, but technically using this copyrighted code was illegal in some jurisdictions. Homebrew coder LiENUS originally rewrote the IP.BIN file, replacing as much as possible with free code. The only code that remains in this homebrew IP.BIN is Sega's copyright screen code, which is required to be unmodified in order for the disc to boot (the system checks it against a copy of the code held within the BIOS ROM). It is believed by some that using this last bit of code is legal due to the legal precedent set by Sega v. Accolade.

New, additional functionality has been added to the IP.BIN in the neoIP replacement IP.BIN project. It is currently able to load homebrew and official Katana or Windows CE binaries from either GD-ROM or CD-ROM.

Basic Overview

  • Loaded and ran from Disc (GD-ROM, CD-ROM)
  • Contains basic meta information for a disc
  • Draws the Sega License Screen
  • Possibly holds an MR Image
  • Has space to run Code that is typically used in setting up the basic hardware then launching the binary on disc

General Header Information

Overview of Each piece of the IP.BIN listing file offset and memory location when loaded [1]

Offset Size Load address Contents
0x0000-00FF 0x00FF : 256 Bytes 8C008000-8C0080FF Meta information
0x0100-02FF 0x01FF : 512 Bytes 8C008100-8C0082FF Table of contents
0x0300-36FF 0x33FF : 13312 Bytes 8C008300-8C00B6FF SEGA license screen code
0x3700-37FF 0x00FF : 256 Bytes 8C00B700-8C00B7FF Area protection symbols
0x3800-5FFF 0x47FF : 18432 Bytes 8C00B800-8C00DFFF Bootstrap 1
0x6000-7FFF 8C00E000-8C00FFFF Bootstrap 2 (Not Required #Bootstraps)

Meta information

Offset Contents
000-00F Hardware ID (always "SEGA SEGAKATANA ")
010-01F Maker ID (always "SEGA ENTERPRISES")
020-02F Device Information (see below)
030-037 Area Symbols (see below)
038-03F Peripherals (see below)
040-049 Product number ("HDR-nnnn" etc.)
04A-04F Product version
050-05F Release date (YYYYMMDD)
060-06F Boot filename (usually "1ST_READ.BIN")
070-07F Name of the company that produced the disc
080-0FF Name of the software

Execution Flow Overview

bleh

Deeper Look into User Code

All IP.BIN files from Sega are generally made with the IP Maker software and follow the same basic layout codewise. Bootstrap 1 is very small and is responsible for setting some minor hardware registers then jumps immediately to Bootstrap 2. This second Bootstrap actually does the bulk of the work and handles setting up the stack, VBR, disables cpu caching and then handles the jump to 1ST_READ.BIN which is loaded to address 0x8C010000.

Bootstraps

This is the area in the IP.BIN that is completely unregulated and can be used however someone would like.

Bootstrap 1

This piece of code is generally very small, under 32 bytes and sets hardware registers.

  • A custom MR Image can also live within this section at offset 0x3820, Address 0x8C00B820 and will be displayed on the license screen.

Bootstrap 2

This is Generally where all the base setup code is kept so our binary has a known, and clean execution environment in which it starts. In Warez releases this is the area that is responsible for a very sneaky trick. The 1ST_READ.BIN binary is kept as is on the disc, but then when scramble loaded by the bios (See Dreamcast_Boot_Process for further)) it will be unusable, so code was written to unscramble, the now ruined binary, in-place. The second part of this trick also reinitializes the GD-ROM drive and passes the HOLLY bios check so that the game may access the data on the disc and execute normally.

References

  1. [1], Dreamcast Programming: IP.BIN, Marcus Comstedt