Japanese
Graphic Tools GuideFormat list

Sprite Editor

binary format

Binary File Format

■File layout

 offset
 size
 Explanation
 $000
 $100
 header
 $100
 variable
 pallet 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
*Apply 0x20Byte boundary to every 3 sprites

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

When color mode = 0x0002, 0x0003, 0x0004 (8bit/dot)
MSB           LSB
│Pallete 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 registered 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 arrangement data
 offset
 size
 function
 $00
 word
 Reversal 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

Reversal information
MSB                           LSB
│                   │Reverse │  │
│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
│                   │Color   │     │
│Unused             │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 (lookup 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│
└─┴─┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘

Offset A~D
Relative coordinate values between the pattern origin and each vertex of the sprite
Each vertex of A to D corresponds to the following position.
A        B
 ┏━━━━━━┓ 
 ┃      ┃ 
 ┃      ┃ 
 ┃      ┃ 
 ┃      ┃ 
 ┃      ┃ 
 ┗━━━━━━┛ 
D        C

Graphic Tools GuideFormat list
Copyright SEGA ENTERPRISES, LTD. 1997