Difference between revisions of "Sonic the Hedgehog (16-bit)"
From Sonic Retro
m (substub -> stub) |
(→Sprite Status Table: Added some boss-specific variables; elaborated on purpose of values using both my own knowledge, and snippets from the Sonic 2 section.) |
||
Line 252: | Line 252: | ||
{|border="1" | {|border="1" | ||
− | !Offset|| | + | !Offset||Size||Description |
|- | |- | ||
| $00 || byte || Object type | | $00 || byte || Object type | ||
|- | |- | ||
− | | $01 || byte|| Action flags | + | | $01 || byte|| Action flags. The bitfield looks like this: |
+ | *Bit 0 is the horizontal mirror flag. If set, the object will be flipped on its horizontal axis. | ||
+ | *Bit 1 is the vertical mirror flag. | ||
+ | *Bit 2 is the coordinate system flag. If clear, the object will be positioned by absolute screen coordinates. This is used for things like the HUD and menu options. If set, the object will be positioned by the playfield coordinates, i.e. where it is in a level. Sonic uses both positioning systems. | ||
+ | *Bits 3, 4, and 5 are either unused, or their purpose is unknown. | ||
+ | *Bit 6 is not used in this game. | ||
+ | *Bit 7 is the draw object flag. It will be set if the object was onscreen when it came time to draw things. Otherwise, it is clear. There should be no reason to edit this flag, but it's good to know what it does. | ||
|- | |- | ||
− | | $02 || word || VRAM | + | | $02 || word || Starting art block. |
+ | *First nybble: Palette line the sprite will use. | ||
+ | *Latter 3 nybbles: Starting art block in VRAM for which the object reads from. Multiply by $20 to get VRAM address; divide VRAM address by $20 to get this value. | ||
|- | |- | ||
| $04 || long || Mappings offset | | $04 || long || Mappings offset | ||
|- | |- | ||
− | | $08 || word || X | + | | $08 || word || If the object is Sonic, this is the X playfield coordinate. Otherwise: |
+ | *If in playfield positioning mode, it is the X playfield coordinate. | ||
+ | *If in screen positioning mode, it is the X screen coordinate. | ||
|- | |- | ||
− | | $0A || word || X | + | | $0A || word || If the object is Sonic, this is the X screen coordinate. Otherwise: |
+ | *If in playfield positioning mode, it is unused. | ||
+ | *If in screen positioning mode, it's the Y screen coordinate. | ||
|- | |- | ||
− | | $0C || word || Y | + | | $0C || word || If the object is Sonic, this is the Y playfield coordinate. Otherwise: |
+ | *If in playfield positioning mode, it is the Y playfield coordinate. | ||
+ | *If in screen positioning mode, it is unused. | ||
|- | |- | ||
− | | $0E || word || Y | + | | $0E || word || If the object is Sonic, this is the Y screen coordinate. Otherwise: |
+ | *It's unused. | ||
|- | |- | ||
− | | $10 || word || Horizontal speed | + | | $10 || word || Horizontal (X) speed |
|- | |- | ||
− | | $12 || word || Vertical speed | + | | $12 || word || Vertical (Y) speed |
|- | |- | ||
| $14 || byte || Vertical distance from middle of sprite to bottom of sprite | | $14 || byte || Vertical distance from middle of sprite to bottom of sprite | ||
Line 313: | Line 328: | ||
|- | |- | ||
| $29-$3F || || Object's scratch RAM | | $29-$3F || || Object's scratch RAM | ||
+ | |- | ||
+ | !colspan="3" | Boss Variables | ||
+ | |- | ||
+ | !Offset||Size||Description | ||
+ | |- | ||
+ | | $10(a0) || word || X speed | ||
+ | |- | ||
+ | | $12(a0) || word || Y speed | ||
+ | |- | ||
+ | | $30(a0) || word || X position | ||
+ | |- | ||
+ | | $38(a0) || word || Y position | ||
+ | |- | ||
+ | | $3E(a0) || byte || Number of times to flash when hit | ||
|} | |} | ||
− | |||
{{SCHGuides}} | {{SCHGuides}} | ||
[[Category:Sonic_Community_Hacking_Guide]] | [[Category:Sonic_Community_Hacking_Guide]] |
Revision as of 20:36, 9 April 2007
This short article is in need of work. You can help Sonic Retro by adding to it. |
Contents
ROM Hacking
Art Editing
There are several different tools that can be used to edit art besides the hex editor. SonED is probably the best tool to use for editing level art, and can also be used on palettes. HivePal is also a great tool for editing palettes. Sonik Sprite is useful for editing uncompressed art; it gets its name from its ability to edit Sonic's sprites. LOst Library is most likely the best choice for editing compressed art in the Nemesis format.
If, however, you still want to do it yourself, your best bet is to download the Sonic 1 Split disassembly. Decompress the archive into a new folder, and place your S1 ROM, in binary format and named "S1.bin", in that folder. Run the batch file "split.bat". This will split up all the art into its own binary files, which you can then decompress and edit. When you're done, run "combine.bat".
Uncompressed Art Locations
Most of this information was taken from Nemesis's guide. Please excuse any mistakes or misunderstandings, as that guide wasn't exactly well-written. A description is written in parentheses after the original name if I deem it necessary; if I don't know what it is, "Unknown" appears in that place. Please correct this if you know. It doesn't list the number of blocks taken up, so if you know, put it in. Otherwise, I'll find out eventually.
Uncompressed Art Locations
Offset | Description | # of blocks |
---|---|---|
Zone Independent | ||
$1CADA | Numbers used on counters in game | ? |
$21AFE | Sonic | ? |
$6A324 | Giant Ring | ? |
Green Hill Zone | ||
$66AD6 | Waterfall tiles | ? |
$66CD6 | Flower with pointy petals | ? |
$670D6 | Flower with curved petals | ? |
Marble Zone | ||
$6755A | Lava surface | ? |
$67836 | Lava | ? |
$67E56 | Flame torch against stone | ? |
Scrap Brain Zone | ||
$68156 | Steam in background | ? |
Compressed Art Locations - Nemesis
See SCHG:Sonic the Hedgehog/Nemesis Compressed Art.
Compressed Art Locations - Kosinski format
- $3DCF2 - GHZ main level patterns
- $414D4 - LZ main level patterns
- $46016 - MZ main level patterns
- $4A7FE - SLZ main level patterns
- $510F0 - SYZ main level patterns
- $57A66 - SBZ main level patterns
Palette Locations
Usually, it's not really necessary to edit a palette in hex. Palette editors give you instant feedback for each RGB value, and the palette can be easily saved as a separate binary and reimported into the ROM. However, it is sometimes desireable or necessary to do it in hex, and it can't hurt to know how it's done.
These are the ROM offsets of the palettes in Sonic 1, as listed by HivePal:
Name | Offset |
---|---|
Sega Logo (Background) | $2208 |
Sega Logo (SEGA) | $20C0 |
Title Screen | $2288 |
Title Screen - Water Cycle | $1B66 |
Level Select | $2308 |
Sonic | $2388 |
Green Hill | $23A8 |
Green Hill - Water Cycle | $1B86 |
Labyrinth | $2408 |
Labyrinth - Sonic Underwater | $2828 |
Labyrinth - Sonic Underwater (Alt) | $2468 |
Labyrinth - Underwater | $2488 |
Labyrinth - Water Cycle | $1BA6 |
Labyrinth - Conveyor Cycle | $1BC6 |
Labyrinth - Conveyor Cycle Underwater | $1BD8 |
Marble | $24E8 |
Star Light | $2548 |
Star Light lights | $1C52 |
Spring Yard | $25A8 |
Spring Yard - Cycle 1 | $1C76 |
Spring Yard - Cycle 2 | $1C96 |
Scrap Brain Act 1 | $2608 |
Scrap Brain Act 2/Final | $2668 |
Scrap Brain Act 3 | $2748 |
Scrap Brain Act 3 - Sonic Underwater | $2848 |
Scrap Brain Act 3 - Sonic Underwater (Alt) | $27A8 |
Scrap Brain Act 3 - Underwater | $27C8 |
Scrap Brain Act 1/Act 2 - Cycle 1 | $1D0A |
Scrap Brain Act 1/Act 2 - Cycle 2 | $1D1A |
Scrap Brain Act 1/Act 2 - Cycle 3 | $1D2A |
Scrap Brain Act 1/Act 2 - Cycle 4 | $1D3A |
Scrap Brain Act 1/Act 2 - Cycle 5 | $1D46 |
Scrap Brain Act 1/Act 2 - Cycle 6 | $1D56 |
Scrap Brain Act 1/Act 2 - Cycle 7 | $1D66 |
Scrap Brain Act 1/Act 2 - Cycle 8 | $1D86 |
Scrap Brain Act 2 - Cycle 1 | $1D90 |
Scrap Brain Act 2 - Cycle 2 | $1DA0 |
Scrap Brain Act 3 - Water Cycle | $1BEA |
Special Stage - Sonic | $26C8 |
Special Stage No. 1 | $26E8 |
Special Stage No. 2 | $2708 |
Special Stage No. 3 | $2728 |
Special Stage Title Card | $2868 |
Special Stage Cycle 1 | $4ACA |
Special Stage Cycle 2 | $4B12 |
Special Stage Cycle 3 | $4B92 |
Continue - Sonic | $28E8 |
Continue | $2908 |
Ending - Sonic | $2928 |
Ending | $2948 |
Object Editing
Object Pointer List
Mappings Editing
Object Placement
RAM Hacking
Main System Memory Locations
Sprite Status Table
The Sprite Status Table is located at RAM address $D000. Each entry is $40 bytes long. Here is a list of all the values for one entry in the SST:
Offset | Size | Description |
---|---|---|
$00 | byte | Object type |
$01 | byte | Action flags. The bitfield looks like this:
|
$02 | word | Starting art block.
|
$04 | long | Mappings offset |
$08 | word | If the object is Sonic, this is the X playfield coordinate. Otherwise:
|
$0A | word | If the object is Sonic, this is the X screen coordinate. Otherwise:
|
$0C | word | If the object is Sonic, this is the Y playfield coordinate. Otherwise:
|
$0E | word | If the object is Sonic, this is the Y screen coordinate. Otherwise:
|
$10 | word | Horizontal (X) speed |
$12 | word | Vertical (Y) speed |
$14 | byte | Vertical distance from middle of sprite to bottom of sprite |
$15 | byte | Horizontal distance from middle of sprite to bottom of sprite |
$16 | byte | Sprite priority |
$17 | byte | Width in pixels |
$18 | byte | Pattern number |
$19 | byte | Pattern counter |
$1A | byte | Current animation frame |
$1B | byte | Time until animation frame changes |
$1C | byte | Animation |
$1D | byte | Master animation |
$1E | byte | Collision size |
$1F | byte | Collision counter |
$20 | byte | 1st routine |
$21 | byte | 2nd routine |
$22 | word | Angle |
$24 | byte | Object routine counter |
$25 | byte | Sub-routine counter |
$26 | word | Collision |
$28 | byte | Object sub-type |
$29-$3F | Object's scratch RAM | |
Boss Variables | ||
Offset | Size | Description |
$10(a0) | word | X speed |
$12(a0) | word | Y speed |
$30(a0) | word | X position |
$38(a0) | word | Y position |
$3E(a0) | byte | Number of times to flash when hit |