Graphic Tools GuideFormat list

Sprite Editor

Binary format

Binary File Format

■ File layout

 offset
 size
 Explanation
 $ 000
 $ 100
 Header
 $ 100
 variable
 Palette data
 variable
 variable
 Sprite data
 variable
 variable
 Pattern data 

■ Header

 offset
 size
 function
 $ 00
 $ 10
 Identifier = "SEGA_SPRED_01.00" ("_" = $ 20)
 $ 10
 long
 Palette data offset address
 $ 14
 long
 Palette data size (bytes)
 $ 20
 long
 Sprite data offset address
 $ 24
 long
 Sprite data size (bytes)
 $ 30
 long
 Pattern data offset address
 $ 34
 long
 Pattern data size (bytes)
 $ 38
 $ C8
 Dummy data (all $ 00) 

■ Palette data

offset
 size
 function
$ 00
 word
 Color RAM mode
$ 02
 $ 0E
 Dummy data (all $ 00)
$ 10
 variable
 Color code

● Color RAM mode
 Mode 0 (0x0000)
 16bit x 1024 colors
 Mode 1 (0x1000)
 16bit X 2048 colors
 Mode 2 (0x2000)
 32bit x 1024 colors

● Color code
MSB LSB
│ │ B │ G │ R │
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│ * │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
* Can be set freely (usually 1b)

■ Sprite data

 offset
 size
 function
 $ 00
 word
 Number of registered sprites
 $ 02
 $ 0E
 Dummy data (all $ 00)
 $ 10
 variable
 Sprite header x number of registered sprites
 variable
 variable
 CG data

● Sprite header
 offset
 size
 function
 $ 00
 word
 Sprite H size
 $ 02
 word
 Sprite V size
 $ 04
 word
 Color mode
 $ 06
 word
 Color offset address * 1
 $ 08
 long
 CG data offset address * 2
 $ 0C
 long
 CG data size (bytes) * 3
* 1 Relative address from the beginning of color RAM
* 2 Relative address from the beginning of CG data
* 3 Apply 0x20Byte boundary for each sprite

● CG data
When color mode = 0x0000,0x0001 (4bit / dot)
MSB LSB
│ Even coordinate code │ Odd coordinate code │
┌─┬─┬─┬─┬─┬─┬─┬─┐
│ 3 │ 2 │ 1 │ 0 │ 3 │ 2 │ 1 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┘

When color mode = 0x0002,0x0003,0x0004 (8bit / dot)
MSB LSB
│ Palette code │
┌─┬─┬─┬─┬─┬─┬─┬─┐
│ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┘

When color mode = 0x0005 (16bit / dot)
MSB LSB
│ │ B │ G │ R │
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│ * │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
* Can be set freely (usually 1b)

■ Pattern data

 offset
 size
 function
 $ 00
 word
 Number of registration patterns
 $ 02
 $ 0E
 Dummy data (all $ 00)
 $ 10
 variable
 Pattern header x number of registered patterns
 variable
 variable
 Sprite placement data

● Pattern header
 offset
 size
 function
 $ 00
 long
 Sprite placement data offset address *
 $ 04
 word
 Number of sprite entries
 $ 06
 $ 0A
 Dummy data (all $ 00)
* Relative address from the beginning of sprite placement data

● Sprite placement data
 offset
 size
 function
 $ 00
 word
 Inversion information
 $ 02
 word
 Dummy data ($ 0000)
 $ 04
 word
 Color mode
 $ 06
 word
 Color RAM offset address
 $ 08
 word
 CG data offset address
 $ 0A
 word
 Sprite size
 $ 0C
 word
 Offset A (H coordinate)
 $ 0E
 word
 Offset A (V coordinate)
 $ 10
 word
 Offset B (H coordinate)
 $ 12
 word
 Offset B (V coordinate)
 $ 14
 word
 Offset C (H coordinate)
 $ 16
 word
 Offset C (V coordinate)
 $ 18
 word
 Offset D (H coordinate)
 $ 1A
 word
 Offset D (V coordinate)
 $ 1C
 word
 Dummy data ($ FFFF)
 $ 1E
 word
 Sprite number

Inversion information
MSB LSB
│ Unused │ Inverted │ Unused │ Unused │
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ V │ H │ 0 │ 0 │ 0 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
V: VF = vertical inversion H: HF = horizontal inversion

Color mode
MSB LSB
│ Unused │ Color mode │ │ │
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┼──┬──┬──┬─┬─┬─┐
│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ b2 │ b1 │ b0 │ 0 │ 0 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴──┴──┴──┴─┴─┴─┘
b2 b1 b0
0 0 0 Mode 0 16 colors (color bank)
0 0 1 Mode 1 16 colors (look-up table)
0 1 0 Mode 2 64 colors (color bank)
0 1 1 Mode 3 128 colors (color bank)
1 0 0 Mode 4 256 colors (color bank)
1 0 1 Mode 5 32K color (RGB)

Color RAM offset address
MSB LSB
│ Color RAM offset address * / 8H 
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬─┬─┐
│ aD │ aC │ aB │ aA │ a9 │ a8 │ a7 │ a6 │ a5 │ a4 │ a3 │ a2 │ a1 │ a0 │ 0 │ 0 │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─┴─┘
* Relative address from the beginning of color RAM

CG data offset address
MSB LSB
│ CG data offset address * / 8H 
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬─┬─┐
│ aD │ aC │ aB │ aA │ a9 │ a8 │ a7 │ a6 │ a5 │ a4 │ a3 │ a2 │ a1 │ a0 │ 0 │ 0 │
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴─┴─┘
* Relative address from the beginning of CG data

Sprite size
MSB LSB
│ │ H size / 8H │ V size │
┌─┬─┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│ 0 │ 0 │ h5 │ h4 │ h3 │ h2 │ h1 │ h0 │ v7 │ v6 │ v5 │ v4 │ v3 │ v2 │ v1 │ v0 │
└─┴─┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘

Offsets A to D
The vertices of the relative coordinate values A to D between the pattern origin and each vertex of the sprite correspond to the following positions.
AB
┏━━━━━━┓ 
┃ ┃ 
┃ ┃ 
┃ ┃ 
┃ ┃ 
┃ ┃ 
┗━━━━━━┛ 
DC

Graphic Tools GuideFormat list
Copyright SEGA ENTERPRISES, LTD ,. 1997