ROM header

From WSdev Wiki
Revision as of 06:18, 15 August 2023 by Asie (talk | contribs) (fix typo)
Jump to navigationJump to search

Every WonderSwan ROM contains a header. It is stored at the end - final sixteen bytes - of the ROM image.

ROM header

Parts of this header are validated or otherwise used by the console's boot ROM - they are marked in bold.

Header contents
Offset Length Contents
$0 5 Far jump instruction: 0xEA, offset, segment.
$5 1 Maintenance
$6 1 Developer/Publisher ID
$7 1 Color
$8 1 Game ID (binary-coded decimal)
$9 1 Game version? / Safe mode
$A 1 ROM size
$B 1 Save type/size
$C 1 Flags
$D 1 Mapper type
$E 2 Checksum (sum of all ROM bytes excluding the checksum)

$5 - Maintenance


7  bit  0
---- ----
s... 0000
|    ||||
|    ++++- Must be zero; otherwise the console will prohibit execution.
|          Purpose unknown.
+--------- (Color) Splash bypass: 0 = Disable, 1 = Enable.
           Bypasses the custom boot splash stored in the console's
           internal EEPROM; presumably used for bricked console recovery.

$6 - Developer/Publisher ID


Known official developer/publisher IDs
ID Publisher
$01 Bandai
$02 Taito
$03 ?
$04 Koei
$05 Data East
$06 Asmik Ace
$07 Media Entertainment
$08 Nichibutsu
$0A Coconuts Japan
$0B Sammy
$0C Sunsoft
$0D ?
$0E Banpresto
$10 Jaleco
$11 Imagineer
$12 Konami
$16 Kobunsha
$17 Bottom Up
$18 ?
$19 Sunrise
$1A Cyber Front
$1B Megahouse
$1D Interbec
$1E ?
$1F ?
$20 Athena
$21 KID
$22 ?
$23 ?
$24 Omega Micott
$25 ?
$26 ?
$27 ?
$28 Squaresoft
$2A ?
$2B ?
$2D Namco
$2E ?
$2F ?
$31 ?
$32 ?
$33 ?
$36 ?

Note that IDs $00 and $01 are used across a variety of commercial games. Homebrew is known to use arbitrary values in this field.

$7 - Color


7  bit  0
---- ----
???? ???c
        |
        +- 0 = Monochrome only, 1 = Supports Color mode.

$9 - Game version? / Safe mode


7  bit  0
---- ----
pvvv vvvv
|||| ||||
|+++ ++++- Game version?
+--------- Internal EEPROM write protect: 0 = Enable, 1 = Disable.
           This prohibits writing to the internal EEPROM for addresses
           0x60 and above (user settings, custom splash screen).
           Games are expected to enable write protection; however, the
           WonderWitch is factory configured with it disabled.

$A - ROM size


Unofficial ROM size values are marked in italic.

ROM size values
ID Size
$00 1 Mbit (128 KiB)
$01 2 Mbit (256 KiB)
$02 4 Mbit (512 KiB)
$03 8 Mbit (1 MiB)
$04 16 Mbit (2 MiB)
$05 24 Mbit (3 MiB)
$06 32 Mbit (4 MiB)
$07 48 Mbit (6 MiB)
$08 64 Mbit (8 MiB)
$09 128 Mbit (16 MiB)
$0A 256 Mbit (32 MiB)
$0B 512 Mbit (64 MiB)

Note that ROM sizes over 16 MiB are not supported by the Bandai 2001 mapper. The Bandai 2003 mapper is limited to 64 MiB.

$B - Save type/size


Save type values
ID Type Size
$00 None
$01 SRAM 64 Kbit (8 KiB)
$02 256 Kbit (32 KiB)
$03 1 Mbit (128 KiB)
$04 2 Mbit (256 KiB)
$05 4 Mbit (512 KiB)
$10 EEPROM 1 Kbit (128 B)
$20 16 Kbit (2 KiB)
$50 8 Kbit (1 KiB)

$C - Flags


7  bit  0
---- ----
???? ?SBv
      |||
      ||+- Starting screen orientation: 0 = Horizontal, 1 = Vertical.
      ||   Controls the splash screen's orientation.
      |+-- ROM bus width: 0 = 16-bit, 1 = 8-bit.
      +--- ROM access time: 0 = 3 CPU cycles, 1 = 1 CPU cycle.

$D - Mapper type


Known mapper types
ID Mapper
$00 Bandai 2001
$01 Bandai 2003
$02 KARNAK (Pocket Challenge V2)