Difference between revisions of "Block mappings"

From Sega Retro

old>SoNick
m (Categorization)
m (Text replacement - "Sonic the Hedgehog 2" to "Sonic the Hedgehog 2")
 
(21 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 +
{{MDSpecific}}
 
'''Block mappings''' are used to arrange large amounts of 8x8 tiles into larger tiles (16x16, followed by 128x128 or 256x256). These larger tiles are then arranged into the level layout.
 
'''Block mappings''' are used to arrange large amounts of 8x8 tiles into larger tiles (16x16, followed by 128x128 or 256x256). These larger tiles are then arranged into the level layout.
  
 
==16x16 tiles==
 
==16x16 tiles==
 
===Games===
 
===Games===
*[[Sonic 1|Sonic the Hedgehog]]
+
*''[[Sonic 1|Sonic the Hedgehog]]''
*[[Sonic the Hedgehog 2]]
+
*''[[Sonic the Hedgehog 2 (Mega Drive)|Sonic the Hedgehog 2]]''
*[[Sonic 3 & Knuckles]]
+
*''[[Sonic 3 & Knuckles]]''
*[[Sonic CD]]
+
*''[[Sonic CD]]''
*[[Sonic Crackers]]
+
*''[[Sonic Crackers]]''
 +
*''[[Knuckles' Chaotix]]''
  
 
===Format===
 
===Format===
16x16 tiles consist of four 8x8 tiles. Each 8x8 tile in the 16x16 block mappings has a two-[[byte]] value in the format '''XYYY''', where '''YYY''' is the number of the tile to be loaded from the [[VRAM]], and '''X''' is the display method for the tile. These are all the possible values for '''X''':
+
16x16 tiles consist of four [[Cell|8x8 tiles]], arranged in the shape:
===================================
+
{| class="prettytable" style="text-align: center;"
value pallet orientation
+
| width="40px" | 0
===================================
+
| width="40px" | 1
0 1 normal
+
|-
1 1 y
+
| 2
2 2 normal
+
| 3
3 2 y
+
|}
4 3 normal
+
 
5 3 y
+
Each 8x8 tile is represented by one word, which, like all SEGA Genesis VDP pattern indices, is a bitmask of the form PCCY XAAA AAAA AAAA. P is the priority flag, CC is the palette line to use, X and Y indicate that the sprite should be flipped horizontally and vertically respectively, and AAA AAAA AAAA is the actual tile index, i.e. the VRAM offset of the pattern divided by $20.
6 4 normal
 
7 4 y
 
8 1 normal
 
9 1 x
 
A 2 normal
 
B 2 x
 
C 3 normal
 
D 3 x
 
E 4 normal
 
F 4 x
 
  
 
==128x128 tiles==
 
==128x128 tiles==
 
===Games===
 
===Games===
*[[Sonic the Hedgehog 2]]
+
*''[[Sonic the Hedgehog 2 (Mega Drive)|Sonic the Hedgehog 2]]''
*[[Sonic 3 & Knuckles]]
+
*''[[Sonic 3 & Knuckles]]''
*[[Sonic Crackers]]
+
*''[[Sonic Crackers]]''
 +
*''[[Knuckles' Chaotix]]''
  
 
===Format===
 
===Format===
128x128 tiles consist of sixty-four 16x16 tiles. Each 16x16 tile has a two-byte value with the format '''XYYY''', where '''YYY''' is the index number of the 16x16 tile to be displayed, and '''X''' is the [[solidity]] of the tile. These are possible values for '''X''':
+
128x128 tiles consist of sixty-four 16x16 tiles, arranged in the shape:
=======================
+
{|class="prettytable" style="text-align: center;"
value high low
+
| width="40px" | 0
=======================
+
| width="40px" | 1
0 not not
+
| width="40px" | 2
1 not top
+
| width="40px" | 3
2 not l/r
+
| width="40px" | 4
3 not all
+
| width="40px" | 5
4 top not
+
| width="40px" | 6
5 top top
+
| width="40px" | 7
6 top l/r
+
|-
7 top all
+
| 8
8 l/r not
+
| 9
9 l/r top
+
| 10
A l/r l/r
+
| 11
B l/r all
+
| 12
C all not
+
| 13
D all top
+
| 14
E all l/r
+
| 15
F all all
+
|-
Additionally, add the following values to '''YYY''' to change the display mode of the 16x16 tile:
+
| 16
400 flip x
+
| 17
800 flip y
+
| 18
C00 flip x+y
+
| 19
 +
| 20
 +
| 21
 +
| 22
 +
| 23
 +
|-
 +
| 24
 +
| 25
 +
| 26
 +
| 27
 +
| 28
 +
| 29
 +
| 30
 +
| 31
 +
|-
 +
| 32
 +
| 33
 +
| 34
 +
| 35
 +
| 36
 +
| 37
 +
| 38
 +
| 39
 +
|-
 +
| 40
 +
| 41
 +
| 42
 +
| 43
 +
| 44
 +
| 45
 +
| 46
 +
| 47
 +
|-
 +
| 48
 +
| 49
 +
| 50
 +
| 51
 +
| 52
 +
| 53
 +
| 54
 +
| 55
 +
|-
 +
| 56
 +
| 57
 +
| 58
 +
| 59
 +
| 60
 +
| 61
 +
| 62
 +
| 63
 +
|}
 +
 
 +
Each 16x16 tile has a two-byte value with the format SSTT YXII IIII IIII. SS is the [[solidity]] of the tile in the alternate collision layer - 00 means not solid, 01 means top solid, 10 means left/right/bottom solid, and 11 means all solid. TT is the solidity of the tile in the normal collision layer - 00 means not solid, 01 means top solid, 10 means left/right/bottom solid, and 11 means all solid. Y is the Y-flip flag, X is the X-flip flag, and II IIII IIII is the index of the 16x16 tile to use.
  
 
==256x256 tiles==
 
==256x256 tiles==
 
===Games===
 
===Games===
*[[Sonic 1|Sonic the Hedgehog]]
+
*''[[Sonic 1|Sonic the Hedgehog]]''
*[[Sonic CD]]
+
*''[[Sonic CD]]''
  
 
===Format===
 
===Format===
Similar to 128x128 tiles. Values for '''X''' are:
+
Similar to 128x128 tiles, except the data format is SSSY XIII IIII IIII Values for SSS are:
================
+
{| class="wikitable"
value solid
+
|-
================
+
!Value
0 not
+
!Solidity
2 top
+
|-
4 l/r
+
|0
6 all
+
|not
8 not
+
|-
A top
+
|1
C l/r
+
|top
E all
+
|-
Add the following values to '''XYYY''' to change the display mode:
+
|2
0800 flip x
+
|l/r
1000 flip y
+
|-
1800 flip x+y
+
|3
[[Category:Hacking Information]]
+
|all
 +
|-
 +
|4
 +
|not
 +
|-
 +
|5
 +
|top
 +
|-
 +
|6
 +
|l/r
 +
|-
 +
|7
 +
|all
 +
|}
 +
 
 +
[[Category:Technical information]]

Latest revision as of 14:23, 27 April 2022

This article is too Mega Drive-specific.
This is an old page originating from Sonic Retro and was originally designed to assist with Sonic the Hedgehog ROM hacking. The article should be modified to better reflect the scope of Sega Retro.

Block mappings are used to arrange large amounts of 8x8 tiles into larger tiles (16x16, followed by 128x128 or 256x256). These larger tiles are then arranged into the level layout.

16x16 tiles

Games

Format

16x16 tiles consist of four 8x8 tiles, arranged in the shape:

0 1
2 3

Each 8x8 tile is represented by one word, which, like all SEGA Genesis VDP pattern indices, is a bitmask of the form PCCY XAAA AAAA AAAA. P is the priority flag, CC is the palette line to use, X and Y indicate that the sprite should be flipped horizontally and vertically respectively, and AAA AAAA AAAA is the actual tile index, i.e. the VRAM offset of the pattern divided by $20.

128x128 tiles

Games

Format

128x128 tiles consist of sixty-four 16x16 tiles, arranged in the shape:

0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31
32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63

Each 16x16 tile has a two-byte value with the format SSTT YXII IIII IIII. SS is the solidity of the tile in the alternate collision layer - 00 means not solid, 01 means top solid, 10 means left/right/bottom solid, and 11 means all solid. TT is the solidity of the tile in the normal collision layer - 00 means not solid, 01 means top solid, 10 means left/right/bottom solid, and 11 means all solid. Y is the Y-flip flag, X is the X-flip flag, and II IIII IIII is the index of the 16x16 tile to use.

256x256 tiles

Games

Format

Similar to 128x128 tiles, except the data format is SSSY XIII IIII IIII Values for SSS are:

Value Solidity
0 not
1 top
2 l/r
3 all
4 not
5 top
6 l/r
7 all