Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Motocross Maniacs/Notes: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
Line 91: Line 91:
  * <b>x0C - ramp up left - (x03,x03)</b>
  * <b>x0C - ramp up left - (x03,x03)</b>
     [[Image:Motocross_Maniacs_CourseObjects0C-rampUpLeft.png |90px]]
     [[Image:Motocross_Maniacs_CourseObjects0C-rampUpLeft.png |90px]]
* <b>x0D - floor with ramps - (x03,x03)</b>
    [[Image:Motocross_Maniacs_courseObjects0D-floorWithRamps.png |90px]]


=== Metatile data ===
=== Metatile data ===

Revision as of 19:18, 1 May 2023

Motocross Maniacs
Internal Name "MOTOCROSSMANIAC"
Region Code x01 (non-Japanese)
Type Grayscale Game
SGB Support x00 (not SGB)
Cartridge Type ROM
License Code x0000 (new license)
ROM Size x00 (32 KiB)
ROM Checksum x4EEF
SRAM Size xxx
Header Checksum x57

The goal of these notes is to provide enough elements for someone to hopefully write a basic level editor. This tiny ROM only contains 2 banks. And no bank switching = less headaches for disassembly!

Course data

General idea

Courses 1 to 8 are simply sequences of course objects, such as ramps, bumps, etc.
These course objects are placed one after the other, from left to right.
Below is the beginning of course 1: floor, small triangular ramp, floor, etc.
 Motocross Maniacs ScreenData.png
A course object is an array of metatiles, where each metatile is 16x16px (each metatile is a 2x2 array of regular 8x8px tiles).
Below is a small triangular ramp object: it's made of 4 metatiles (each in a different color), and each metatile is made of 4 tiles.
 Motocross Maniacs TriangularRamp.png
When two course objects overlap, certain rules apply (todo).

Course data

Course data structure

In the ROM data, a course is defined by a sequence of 3-byte words YY XX ZZ:
 * YY XX = coordinates (from top left) of the upper-lefthand corner of the object. Units are in metatiles (= 2 tiles).
 * ZZ = objectID
Below is a sample of course 1, with 3-byte words highlighted.
 Motocross Maniacs Level1Data.png
The first object is floor (ID=x00), located at (x0F,x00).
The second object is a small triangular ramp (ID=x01), located at (x0E,x0A).

Course data location in ROM

* 0x4760-0x476F - table of 8 pointers to the 8 courses
* 0x4770-0x4908 - course 1 data
* 0x4909-0x4AE3 - course 2 data
* 0x4AE4-0x4C8E - course 3 data
* 0x4C8F-0x4E9C - course 4 data
* 0x4E9D-0x5062 - course 5 data
* 0x5063-0x52A0 - course 6 data
* 0x52A1-0x54C0 - course 7 data
* 0x54C1-0x56CB - course 8 data
Note that each chunk of course data ends with xFF.

Course object data

Course object data structure

In the ROM data, a course object is defined by a sequence of bytes XX YY AA BB....
 * XX YY define the metatile array's dimensions: XX rows and YY columns.
 * AA BB... are the metatileIDs that will fill the array, one line at a time.
Course 1 contains x87 (=103) course objects. Below are the first two: a floor object, followed by a small triangular ramp object.
  Motocross Maniacs ObjectDefinition.png
  * The floor object is a row of x0A metatiles with ID x09.
  * The small triangular ramp object is a 2x2 array of metatiles x0A, x0B, xC and x0D.

Course object data location in ROM

* x56CC-x5793 - table of pointers to course object definitions
* x5794-x579F - object x00 (floor)
* x57A0-x57A5 - object x01 (small triangular ramp)
* ...
* x5A19-x5A1E - object x63

Course objects

Below are verified course objects (ID - name - dimensions (height, length)):
* x00 - long floor - (x01,x0A)
   Motocross Maniacs CourseObject00-floor.png
* x01 - small triangular ramp - (x02,x02)
   Motocross Maniacs CourseObject01-smallTriangularRamp.png
* x02 - long ramp up left - (x03,x03)
   Motocross Maniacs CourseObject02-longRampLeft.png
* x03 - sand left - (x01,x03)
   Motocross Maniacs CourseObject03-sandLeft.png
* x04 - sand right - (x01,x03)
   Motocross Maniacs CourseObject04-sandRight.png
* x05 - circular ramp up left - (x03,x04)
   Motocross Maniacs CourseObject05-circularRampLeft.png
   Note: Objects x06, x07 and x08 seem to be exact copies of x05.
* x09 - short floor - (x01,x03)
   Motocross Maniacs CourseObject09-shortFloor.png
* x0A - sand middle - (x01,x04)
   Motocross Maniacs CourseObject0A-sandMiddle.png
* x0B - circular ramp bottom - (x03,x06)
   Motocross Maniacs CourseObject0B-circularRampBottom.png
* x0C - ramp up left - (x03,x03)
   Motocross Maniacs CourseObjects0C-rampUpLeft.png
* x0D - floor with ramps - (x03,x03)
   Motocross Maniacs courseObjects0D-floorWithRamps.png

Metatile data

Metatile data structure

Metatiles are 16x16px, and are made of 2x2 arrays of 8x8px tiles.
They are defined with 4 consecutive bytes, the first two are the top half of the array, the last two are the lower half.
Motocross Maniacs TriangularRamp.png
The top-left metatile (in red) is defined by x7F x7F x7F x1E, where x7F is blank and x1E is a chunk of ramp.
The bottom-left metatile (in yellow) is defined by x1E x1A x8E x8E, where x1A is an inner chunk of ramp, and x8E is floor.

Metatile data location in ROM

* x5A1F-5C8E

Tile data (todo)

Each of the 8 courses in the game uses the same tileset.

Tile data structure

Each 8x8px tile is defined by x0F (sixteen) consecutive bytes, so each row of a tile requires 2 bytes.
If XX YY are two such bytes, the colors of the pixels of that given line are XX + 2*YY, where white = x00 / light gray = x01 / dark gray = x02 / black = x03.
For example, if the bytes of a given tile are x53 xF4 (and the rest are x00), written bitwise that's 01010011 11110100. And with the XX + 2*YY operation we get: 23230211, which gives us the following tile:
Motocross Maniacs TileExample.png

Tile data location in ROM (todo)

It is located just before the course data. It ends at x475F.

Item data

Items are the various power-ups you can collect throughout a course: N for Nitrous boost, T for tires, S for speed, etc.
These items are placed on the course just like the other course objects.
Motocross Maniacs Items.png

Item data structure

In the ROM data, items are defined by 3-byte words YY XX ZZ:
* YY XX = coordinates from top left of the course
* ZZ = itemID
Possible IDs are:
* x02 = S for speed
* x03 = T for tire
* x04 = N for nitro
* x05 = R for traction
* x06 = mini-bikers hitbox (invisible)
* x07 = jet hitbox (invisible)

Item data location in ROM

Note that data for course 8 appears before data for course 7.

* 0x5EAB-0x5F0A - table of 8 pointers to item data for each of the 8 courses
   x5F0B x5F54 x5F91 x5FBF x5FF9 x603C x60AD x6079
* 0x5F0B-0x5F53 - course 1 item data
* 0x5F54-0x5F90 - course 2 item data
* 0x5F91-0x5FBE - course 3 item data
* 0x5FBF-0x5FF8 - course 4 item data
* 0x5FF9-0x603B - course 5 item data
* 0x603C-0x6078 - course 6 item data
* 0x6079-0x60AC - course 8 item data
* 0x60AD-0x60E9 - course 7 item data
Note that each chunk of item data ends with xFF.

Course music data

A table of 8 bytes at x677C specifies which background music to play for each of the 8 courses:
 x20 x1E x1F x1D x20 x1E x1F x1D
The musicIDs are (note the IDs are not in course order):
* x20 - course 1 music (same as course 5)
* x1E - course 2 music (same as course 6)
* x1F - course 3 music (same as course 7)
* x1D - course 4 music (same as course 8)
You can also use other (short) tunes from the game as well:
* x19 - course select menu music
* x1A - victory music, but no record
* x1B - victory music, with a record
* x1C - game over music

Computer opponent AI data

When the player passes the computer opponent and pushes it offscreen, the following data is accessed. The data is a sequence of checkpoints, which are tested against the player's current coordinates until the closest position is found. The computer's coordinates are then set to the new position.

Computer opponent AI structure

(todo) Data is organized in chunks of 5 bytes:
* 2 bytes specify various checkpoints throughout the course
* 3 bytes are used to set the computer's new position in the game

Computer opponent AI data location in ROM

* 0x60EA-0x60F9 - table of 8 pointers for offscreen computer opponent data for each of the 8 courses.
    x60FA x61AE x6230 x62A8 x633E x63D4 x644C x64E2
* 0x60FA-0x61AD - course 1 data
* 0x61AE-0x622F - course 2 data
* 0x6230-0x62A7 - course 3 data
* 0x62A8-0x633D - course 4 data
* 0x633E-0x63D3 - course 5 data
* 0x63D4-0x644B - course 6 data
* 0x644C-0x64E1 - course 7 data
* 0x64E2-0x6xxx - course 8 data (todo)

Text data

Text data structure

Below are various text elements from the game, as well as their respective ROM locations.
Text data is a sequence of words, each word structured as follows:
* 2 bytes for the display address
* a sequence of text tiles for the word
* a terminal xFE when the word is finished
* a terminal xFF when the text is finished

Text data location in ROM

Title screen

Motocross Maniacs TitleScreen.png
 * 0x0EC1-0x0EC5 "TM" (from the Motocross Maniacs logo) at x990F
 * 0x0EC6-0x0EDC "TM AND © 1989 KONAMI" at x9940
 * 0x0EDD-0x0EEF "INDUSTRY CO.,LTD." at x9960
 * 0x0EDD-0x0EEF "INDUSTRY CO.,LTD." at x9960
 * 0x0EF0-0x0F07 "LICENSED BY NINTENDO " (yes, an extra blank tile) at x9980
 * 0x0F14-0x0F1A "SOLO" at x99E6
 * 0x0F1B-0x0F28 "VS COMPUTER" at x99E6
 * 0x0F29-0x0F36 "VS 2-PLAYER" at x9A06

Game over screen

Fun fact: the game over text data is nested in the title screen text data.
* 0x0F08-0x0F13 "GAME OVER" at x98E6

Pre-race screen

Motocross Maniacs PreRaceScreen.png
 * 0x0F37-0x0F48 "QUALIFYING TIME" at x99A3
 * 0x0F49-0x0F4F ":  :" at x99E8
 * 0x0F50-0x0F5D row of 11 gray tiles at x9865
 * 0x0F5E-0x0F6B " COURSE    " at x9885
 * 0x0F6C-0x0F79 row of 11 gray tiles at x98A5
 * 0x0F7A-0x0F8A "COURSE RECORD" at x9924
 * 0x0F8B-0x0F8F  ":  :" at x9968

Time up screen

This message doesn't contain a display address, only the text itself.
* 0x2F66-0x2F6D "TIME UP"
* 0x2F6E-0x2F75 (row of 9 gray tiles)

Gameplay data

Gravity data

* 0x2143-0x214A - a table of 8 bytes that is continuously read during the game, it specifies gravity pull.
Changing all bytes to x38 creates a very slow descent for instance.

Going up ramps data

* 0x214B (todo)

Post-ramp boost behavior data

* 0x5CBF - in chunks of 4 bytes (todo)

Bike mid-air behavior data

* 0x5D8F - in chunks of 4 bytes (todo)

Nitro boost data

* 0x5E37 (todo)

Graphics data

Tile data

Sprite data

* 0x3481-0x34F1 - a table of pointers for player sprite building (todo?)

Music and sound FX data

This section is work in progress, still very incomplete.
* 0x6F1F-0x6F5F - a table of pointers to music and sound FX data (todo)
 The data itself seems to be in chunks of 4 bytes.
 Pointer offsets (to be doubled) from the above pointer table lead to the following sound FX data:
  * x00 to x06 - no nitros left (various sounds)
  * x07 - pause jingle
  * x08 - motor running
  * x09 - crossing the finish line (?)
  * x0A - nitro fired
  * x0B - no nitros left click
  * x0C - N or R item pick-up
  * x0D - T item pick-up (high pitched than the previous one)
  * x0E - when a backflip adds a small biker
  * x0F - "3,2,1" countdown at the beginning of a course
  * x10 - "Go!"
  * x11 - strange ambulance siren sound (?)
  * x12 - rolling is sand
  * x13 - short selection beep (?)
  * x14 - selection beep (?)
  * x15 - motorbike falls and rolls over
  * x16 - course selected sound ("nksh!")
  * x17 - crowd roars when you win
* 0x7050-0x706D - a table of pointers to music data for the course 1/5 song