|
DevelopmentSega Master System / Mark III / Game Gear |
Home - Forums - Games - Scans - Maps - Cheats - Credits |
R Register Slot 2 Mapping Flat Code in $00000 - $0bfff [1]
The following code is present in the ROM "Alex Kidd in Miracle World [v1]" but not in "Alex Kidd in Miracle World [v0]":
3AC7: 7A LD A,D 3AC8: DD 86 0E ADD (IX+0Eh) 3ACB: FE BF CP BFh 3ACD: D0 RET NC
This code is executed when Alex is falling. If the RET NC
at $3acd
is not taken, the fall may end: Alex's falling sprite may be replaced by his walking sprite.
When the code runs, the D
register contains Alex's height (24 pixels) plus the distance to fall this frame (0-4 pixels). (IX+0Eh)
contains the the Y-coordinate of Alex's sprite (recall that this will be 0 for scanline 1, etc). Their sum, calculated at $3ac8
, is the Y-coordinate of the bottom of the sprite at the end of this frame. If this is greater than or equal to $bf
(191 decimal), the bottom of Alex's sprite will be below the bottom of the screen (Y-coordinate 190, scanline 191).
The code above, therefore, forces Alex to continue falling when he reaches the bottom of the screen. The effect of this can be seen only on those levels where it is possible to fall from one room to another. In v0, Alex will fall to the bottom of the screen and then the fall will end: the transition to the next room will occur with Alex's walking sprite shown. Once the transition is complete, Alex will resume falling correctly. In v1, thanks to the above code, the fall uses the correct animation frames throughout.
Room Transition [v0] | Room Transition [v1] |
(MEKA savestate) | (MEKA savestate) |
This is believed to be the only difference between the v0 and v1 ROMs.
The above bug fix is also present in "Alex Kidd in Miracle World [BIOS]", but not in "Alex Kidd in Miracle World [SMS-GG] (TW)", "Alex Kidd no Miracle World (JP)" nor "Alex Kidd in Miracle World [BIOS] (KR)".
Alex Kidd in Miracle World maintains a master "game state" variable[2] in the low 4 bits of the byte at $c01f. The valid values are:
Value | State |
---|---|
$0, $1 | Title Screen ($1 is never used) |
$2 | Demo |
$3 | Start the level specified at $c023 |
$4 | Level Completed |
$5 | Shop |
$6 | Life Lost |
$7 | Text Box |
$8 | Bonus Level |
$9[3] | Janken Game (Rock, Paper, Scissors) |
$a | Gameplay |
$b | Map |
For all states except state $6, bit 7 of the same byte is used to distinguish a change of state (bit 7 reset) from a continuation of the current state (bit 7 set). The main loop of the game looks up a pointer to the gamestate's main code from a table of pointers to gamestates and executes it.
The score[4] in Alex Kidd in Miracle World is always a multiple of 10. Internally, therefore, the game stores a value of score / 10
and simply adds a trailing zero for display. This value is stored as a group of three bytes in (little-endian) BCD format. The highest score attainable is thus 9,999,990.
The score value is stored in RAM at address $c020. The value for the top score is stored at $c000.
There are 8 ways to gain points during play. Each of these achievements will increase the player's score by a certain amount of points. These amounts are stored (in the same format as the score) in a lookup table at ROM address $489.
Money in Alex Kidd in Miracle World is always a multiple of 10. Internally, therefore, the game stores values of money / 10
and simply adds a trailing zero for display. This value is stored as a group of three bytes in (little-endian) BCD format. The highest amount of money attainable is thus 9,999,990.
The money value is stored in RAM at address $c030.
There are 2 different kinds of money bags. A small one and a big one. Both of these bags will increase the player's money by a certain amount. These amounts are stored (in the same format as the money) in a lookup table at ROM address $483.
If no buttons are pressed on the title screen, one of four demos will begin. Alex's movements during the demo are driven by simulated input - the data for this is in "TransBot" format and is located at $14d35-$1508d in the v1 ROM. In between the data for each demo is an unreferenced zero byte.
Levels are stored as a sequence of screens, each 256x192 pixels in size. The screens are described by arrays of 16x12 bytes, where each byte is the index of a 16x16 pixel metatile. These arrays are compressed individually, using the "Phantasy Star" RLE format (without deinterleaving), and located in the v1 ROM within $18000 - $1bdb8. At runtime, one array at a time is decompressed to RAM at $d700 - $d7bf.
Each metatile index is used to access a table of pointers. There are two of these tables, one at $14000 - $141ff and a second at $14200 - $143ff (used only for levels 14, 16 and 17). Each address in these tables is a slot 2 pointer into $14450 - $14d34; this region contains the four name table entries (8 bytes) to use for each metatile.
There are 17 pointers, one per level, at $066d6 - $066f7 within the v1 ROM. These point into $066f8 - $067c3, where there is a 12 byte descriptor for each level. Each descriptor contains the following information:
Offset | Length | Contents |
---|---|---|
0 | 1 byte | Bank number containing the level layout data (Always $86) [5] |
1 | 2 bytes | Slot 2 pointer into the level layout data |
3 | 2 bytes | A second slot 2 pointer into the level layout data |
5 | 1 byte | Start screen horizontal number |
6 | 1 byte | Start screen vertical number |
7 | 1 byte | Width in screens |
8 | 1 byte | Height in screens |
9 | 1 byte | Scrollability |
10 | 2 bytes | Slot 2 address of metatile name table entry pointer table |
There are 17 pointers, one per level, at $0b505 - $0b526 within the v1 ROM. These point into $0b527 - $0b6ec, where there are several pointers, one per screen of the level, into $0b6ed - $0be87, where there are entity descriptors for each entity. Each descriptor contains the following information:
Offset | Length | Contents |
---|---|---|
0 | 1 byte | Number of entities for the current screen |
1 + 4i | 1 byte | Type of entity i |
1 + 4i + 1 | 1 byte | Vertical screen position of entity i |
1 + 4i + 2 | 1 byte | Horizontal screen position of entity i |
1 + 4i + 3 | 1 byte | Entity specific data of entity i |
A descriptor is loaded whenever a new screen is entered. The game uses an array of structs to maintain entity data in RAM from $c300 - $c6bf. Each struct is 32 bytes long. The size of the array is stored at $c0f8. Ingame the size is frequently set to $1e. Each struct contains the following information:
Offset | Length | Contents |
---|---|---|
$0 | 1 byte | Type of the entity |
$1 | 1 byte | Flags of the entity |
$2 | 1 byte | Unknown |
$3 | 1 byte | Entity specific data[6] |
$4 | 1 byte | Current Animation Frame Number[7] |
$5 | 1 byte | Animation Timer |
$6 | 1 byte | Animation Timer Reset Value[8] |
$7 | 2 bytes | Pointer to sprite descriptor |
$9 | 2 bytes | Flags indicating if the entity is off screen. |
$b | 2 bytes | Horizontal position of the entity |
$d | 2 bytes | Vertical position of the entity |
$f | 2 bytes | Horizontal velocity of the entity |
$11 | 2 bytes | Vertical velocity of the entity |
$13 | 4 bytes | Unknown |
$17 | 1 byte | Decision in Janken Match |
$18 | 2 bytes | Unknown |
$1a | 1 byte | State of the entity |
$1b | 1 byte | Timer for the State of the entity |
$1c | 4 bytes | Unknown |
Each gamestate containing entities calls a function updating its entities (located at $2694) in its main loop. This function loops through the list of entities in RAM and per entity executes the entitiy's script, updates its position according to its velocity and calls a function to update its sprites (for details on this function see Sprite Handling section below).
The script/code of every entity either sets the pointer to sprite descriptor (ix+7 and ix+8)
directly or by calling a function that handles the animation (located at $280e). This function takes the address of an animation descriptor as parameter in register hl
. An animation descriptor is nothing more than an array of pointers to sprite descriptors. The length of this array is stored in the first byte of the animation descriptor which is then directly followed by its entries. The animation handler function is quite simple: It first decreases the animation timer (ix+5)
. If the result is zero it loads the animation timer reset value (ix+6)
into the animation timer (ix+5)
then increases the current animation frame number (ix+4)
. If the current animation frame number (ix+4)
is greater or equal to the array's length it is set to 0. In every case the pointer to the sprite descriptor indexed by the current animation frame number (ix+4)
is then loaded from the array into the entity data structure at the corresponding position (ix+7 and ix+8).
The structure of a sprite descriptor looks as follows:
Offset | Length | Contents |
---|---|---|
0 | 1 byte | Number of sprites (:= n) |
1 | 1 byte | Collision data |
2 + i | 1 byte | Signed vertical position of sprite i relative to the vertical entity position |
2 + n + 2i | 1 byte | Signed horizontal position of sprite i relative to the horizontal entity position |
2 + n + 2i + 1 | 1 byte | Character code of sprite i |
Before calling the function updating an entitys' sprites (located at $26d7) the function that updates the entites clears the SAT in RAM (Starting from $c700) by setting the pointer to sprite terminator ($c009 and $c00a)
to $c706
[9]. After clearing the SAT in RAM the function starts filling it with the data of the sprite descriptor pointed to by the entity's pointer to sprite descriptor (ix+7 and ix+8)
. The interrupt handler will then copy the SAT in RAM (excluding the unused hole) to the SAT in VRAM by calling the function located at $1f7. To handle sprite flicker the interrupt handler behaves differently for odd and even frames. For odd frames it stores a direct copy in VRAM. For even frames it copies Alex's sprites in order and the rest of sprites in reverse order by copying from the end of sprites pointed to by the pointer to sprite terminator ($c009 and $c00a)
down to Alex's sprites.
The sound engine of Alex Kidd maintains 7 software channels using structs starting from $c118. Each struct is 32 bytes long. They contain the following information:
Offset | Length | Contents |
---|---|---|
$0 | 1 byte | Flags of the software channel |
$1 | 1 byte | Hardware channel used by the software channel |
$2 | 1 byte | Duration multiplier |
$3 | 2 bytes | Pointer to sound data |
$5 | 1 byte | Transposition Value |
$6 | 1 byte | Vibrato Index |
$7 | 1 byte | Envelope Index |
$8 | 1 byte | Volume of the software channel |
$9 | 1 byte | Unknown |
$a | 2 bytes | Note duration |
$c | 2 bytes | Current play duration |
$e | 1 byte | Envelope Counter |
$f | 1 byte | Vibrato Counter |
$10 | 2 byte | Note PSG Frequency Value |
$12 | 2 byte | PSG Frequency Value to write to the hardware channel |
$14 | 2 byte | Note PSG Frequency Value 2 |
$16 | 1 byte | PSG Volume Value to write to the hardware channel |
$17 | 9 bytes | Repetition Counters |
The first 4 software channels are used for the music and the other 3 are used for sound effects.
The sound control is located at $c110. When the top most bit of the sound control is set the engine is activated. Values from $81 to $b0 request playing a sound, $b1 to $b3 request effects. For example $b2 requests a sound fade out. Values greater than $b3 are considered invalid and will disable the engine. Sound effects have priorities associated with them. The priority of the sound effect that is currently is stored at $c113. If a sound effect with higher priority is requested the current sound effect will be canceled. To synchronize the Janken Match to the music a value is stored at $c115 when its music ends.
Each sound request has its own header pointed to by a table starting from $98dd. A header consists of a variable amount of bytes depending on the value of its first byte. The first byte indicates how many software channels to use and is followed by 9 bytes per software channel that will be loaded directly into the first 9 bytes of the software channel's struct. The software channels will be loaded with data consecutively. The first software channel to start loading to is decided by the responsible request handling code.
The sound data contains indices into a table of PSG Frequency Values[10]:
PSG Frequency Value | Index | Frequency | Note | Deviation |
---|---|---|---|---|
$0000 | 00 | 0Hz | ||
$03FF | 01 | 109.346Hz | A2 | -10.329 cents |
$03C7 | 02 | 115.678Hz | A#2 | -12.867 cents |
$0390 | 03 | 122.654Hz | B2 | -11.489 cents |
$035D | 04 | 129.920Hz | C3 | -11.864 cents |
$032D | 05 | 137.590Hz | C#3 | -12.555 cents |
$02FF | 06 | 145.842Hz | D3 | -11.720 cents |
$02D4 | 07 | 154.504Hz | D#3 | -11.836 cents |
$02AB | 08 | 163.779Hz | E3 | -10.911 cents |
$0285 | 09 | 173.428Hz | F3 | -11.807 cents |
$0261 | 0A | 183.679Hz | F#3 | -12.379 cents |
$023F | 0B | 194.540Hz | G3 | -12.923 cents |
$021E | 0C | 206.385Hz | G#3 | -10.600 cents |
$0200 | 0D | 218.478Hz | A3 | -12.021 cents |
$01E3 | 0E | 231.596Hz | A#3 | -11.076 cents |
$01C8 | 0F | 245.309Hz | B3 | -11.489 cents |
$01AF | 10 | 259.538Hz | C4 | -13.874 cents |
$0196 | 11 | 275.519Hz | C#4 | -10.424 cents |
$0180 | 12 | 291.304Hz | D4 | -13.976 cents |
$016A | 13 | 309.008Hz | D#4 | -11.836 cents |
$0156 | 14 | 327.078Hz | E4 | -13.444 cents |
$0143 | 15 | 346.318Hz | F4 | -14.489 cents |
$0130 | 16 | 367.963Hz | F#4 | -9.534 cents |
$011F | 17 | 389.759Hz | G4 | -9.909 cents |
$010F | 18 | 412.770Hz | G#4 | -10.600 cents |
$0100 | 19 | 436.956Hz | A4 | -12.021 cents |
$00F2 | 1A | 462.235Hz | A#4 | -14.657 cents |
$00E4 | 1B | 490.617Hz | B4 | -11.489 cents |
$00D7 | 1C | 520.283Hz | C5 | -9.852 cents |
$00CB | 1D | 551.038Hz | C#5 | -10.424 cents |
$00C0 | 1E | 582.608Hz | D5 | -13.976 cents |
$00B5 | 1F | 618.015Hz | D#5 | -11.836 cents |
$00AB | 20 | 654.157Hz | E5 | -13.444 cents |
$00A1 | 21 | 694.787Hz | F5 | -9.121 cents |
$0098 | 22 | 735.926Hz | F#5 | -9.534 cents |
$0090 | 23 | 776.811Hz | G5 | -15.931 cents |
$0088 | 24 | 822.506Hz | G#5 | -16.976 cents |
$0080 | 25 | 873.912Hz | A5 | -12.021 cents |
$0079 | 26 | 924.469Hz | A#5 | -14.657 cents |
$0072 | 27 | 981.235Hz | B5 | -11.489 cents |
$006C | 28 | 1035.748Hz | C6 | -17.886 cents |
$0066 | 29 | 1096.674Hz | C#6 | -18.931 cents |
$0060 | 2A | 1165.216Hz | D6 | -13.976 cents |
$005B | 2B | 1229.239Hz | D#6 | -21.374 cents |
$0055 | 2C | 1316.009Hz | E6 | -3.290 cents |
$0051 | 2D | 1380.997Hz | F6 | -19.841 cents |
$004C | 2E | 1471.852Hz | F#6 | -9.534 cents |
$0048 | 2F | 1553.622Hz | G6 | -15.931 cents |
$0044 | 30 | 1645.011Hz | G#6 | -16.976 cents |
$0040 | 31 | 1747.825Hz | A6 | -12.021 cents |
$003C | 32 | 1864.346Hz | A#6 | -0.290 cents |
$0039 | 33 | 1962.470Hz | B6 | -11.489 cents |
$0036 | 34 | 2071.496Hz | C7 | -17.886 cents |
$0033 | 35 | 2193.349Hz | C#7 | -18.931 cents |
$0030 | 36 | 2330.433Hz | D7 | -13.976 cents |
$002D | 37 | 2485.795Hz | D#7 | -2.245 cents |
$002B | 38 | 2601.414Hz | E7 | -23.538 cents |
$0028 | 39 | 2796.520Hz | F7 | +1.665 cents |
$0026 | 3A | 2943.705Hz | F#7 | -9.534 cents |
$0024 | 3B | 3107.244Hz | G7 | -15.931 cents |
$0022 | 3C | 3290.023Hz | G#7 | -16.976 cents |
$0020 | 3D | 3495.649Hz | A7 | -12.021 cents |
$001E | 3E | 3728.693Hz | A#7 | -0.290 cents |
$001C | 3F | 3995.028Hz | B7 | +19.153 cents |
$001B | 40 | 4142.992Hz | C8 | -17.886 cents |
$0019 | 41 | 4474.431Hz | C#8 | +15.352 cents |
$0018 | 42 | 4660.866Hz | D8 | -13.976 cents |
$0016 | 43 | 5084.581Hz | D#8 | +36.661 cents |
$0015 | 44 | 5326.704Hz | E8 | +17.198 cents |
$0014 | 45 | 5593.039Hz | F8 | +1.665 cents |
$0013 | 46 | 5887.410Hz | F#8 | -9.534 cents |
$0012 | 47 | 6214.488Hz | G8 | -15.931 cents |
$0011 | 48 | 6580.046Hz | G#8 | -16.976 cents |
The sound data also contains control commands executed by values starting from $e0. These are commands like "repeat n times starting from nnnn", "set pointer to nnnn", "start playing underwater music", "set Janken Match variable", "set/reset a bit in the data structure of the software channel", ...
The ending sequence text is encoded as follows:
This table summarises the contents of the Alex Kidd in Miracle World [v1] ROM (Size: 128KB; CRC32: aed9aac4):
Address Range | Contents | |
---|---|---|
$00000 - $00007 | Unknown Code | |
$00008 - $0000e | Code: Set VRAM Address to the value stored in register DE | |
$0000f | Unused | |
$00010 - $00019 | Code: Load Ath[11] entry of table pointed to by register HL into register HL | |
$0001a | Unused | |
$0001b - $0001f | Unknown Code | |
$00020 - $00029 | Code: Jump to Ath[11] entry of jump table pointed to by register HL | |
$0002a - $0002f | Unused | |
$00030 - $00037 | Code: Write value of register B bytes from memory location pointed to by register HL to the VRAM address pointed to by register DE | |
$00038 - $0003a | Code: jp $00c0 | |
$0003b - $00052 | Jump Table (12 entries, indexed by game state) (Jump instruction at $0029 ) | |
$00053 - $00056 | Code: Sets game state ($c01f ) to $0 | |
$00057 - $00064 | Code: Main loop | |
$00065 | Unused | |
$00066 - $00084 | Pause Button Code: Toggle map if possible | |
$00085 - $0009e | Unknown Code | |
$0009f - $000bf | Reset Code | |
$000c0 - $00126 | Interrupt handling Code | |
$00127 - $0013e | Jump Table (12 entries, indexed by game state) (Jump instruction at $0029 [12]) | |
$0013f - $00144 | Code: Write the value of register A to the VRAM address pointed to by register DE | |
$00145 - $00158 | Code: Write value of register BC bytes from memory location pointed to by register HL to the VRAM address pointed to by register DE | |
$00159 - $00167 | Code: Write value of register B name table entries from memory location pointed to by register HL to the VRAM address pointed to by register DE using the value stored at $c10a as flags | |
$00168 - $0017b | Unused Code: Dump value of register BC bytes from VRAM pointed to by register DE to the memory location pointed to by register HL | |
$0017c - $00192 | Code: Clear Name Table | |
$00184 - $00192 [13] | Code: Write the value of register L to VRAM starting from the address pointed to by register DE the value of register BC times | |
$00193 - $001a6 | Code: Load Name Table from memory location pointed to by HL to VRAM address pointed to by DE | |
$001a7 - $001c4 | Unused Code: Similar to the code above | |
$001c5 - $001d5 | Code: Clear rectangle with width C and height B from Name Table at DE | |
$001d6 - $001f6 | Code: Load 1 BPP Tile from HL to VRAM address DE using the value stored in register A as color (Identical to 1BPPTileLoader) | |
$001f7 - $00223 | Code: Update Sprites | |
$00224 - $0026a | Code: Prevent Sprite Flicker | |
$0026b - $0027c | Code: Initialize VDP | |
$0027d - $00292 | Initial Data for VDP Registers 0-9 | |
$00293 - $002c3 | Code: Load Tiles 4 Bit RLE from HL to VRAM address DE (Identical to PhantasyStarTileDecoder) | |
$002c4 | Unknown | |
$002c5 - $002d6 | Code: Load Tile mirrored from memory location pointed to by HL to the current VRAM address | |
$002d7 - $002e5 | Unused Code: Clear Sprite Attribute Table | |
$002e6 - $002ee | Code: Wait for interrupt | |
$002ef - $00302 | Code: Disable Screen | |
$002f6 - $00302 [14] | Code: Enable Screen | |
$00303 - $00310 | Code: Clear Scroll | |
$00311 - $00340 | Code: Clear Sprite Attribute Table and Name Table and disable Screen | |
$00341 - $0034f | Unknown Code | |
$00350 - $00366 | Code: Detect Keyboard Peripheral | |
$00367 - $003ce | Code: Read Input | |
$003cf - $003ec | Code: Take Money | |
$003ed - $0040a | Code: Update Score | |
$0040b - $0041b | Code: Add the 3 byte value pointed to by register HL to the 3 byte value pointed to by register BC in BCD format and store the result at BC | |
$0041c - $0042c | Code: Subtract the 3 byte value pointed to by register HL from the 3 byte value pointed to by register BC in BCD format and store the result at BC | |
$0042d - $0043a | Code: Subtract the 3 byte value pointed to by register HL from the 3 byte value pointed to by register BC in BCD format and store the result in register A | |
$0043b - $00453 | Code: Update High Score | |
$00454 - $00482 | Code: Print the 3 Byte BCD number pointed to by register HL to the Name Table address pointed to by register DE | |
$00456 - $00482 [15] | Code: Print the value of register C Byte BCD number pointed to by register HL to the Name Table address pointed to by register DE | |
$00483 - $00488 | Money Bag Value Lookup table | |
$00489 - $004a0 | Score Lookup table | |
$004a1 - $004cd | Unused Unknown Code | |
$004ce - $004ed | Unknown Code | |
$004ee - $004fd | Jump Table (8 entries) (Jump instruction at $04ed ) | |
$004fe - $006c9 | Unknown Code | |
$006ca - $0074b | Unknown | |
$0074c - $00758 | Unknown Code | |
$00759 - $0076c | Unused Code: Divide HL by E and store the result into Quotient: HL , Remainder: A | |
$0076d - $0080b | Code: Title Screen (Game State $0 and $1 ) Main Code | |
$0080c - $00823 | Code: Initialize RAM for gameplay | |
$00824 - $00841 | Initialisers for RAM locations $c01f - $c037 at start of gameplay | |
$00842 - $00863 | Code: Title Screen (Game State $0 and $1 ) Interrupt Code | |
$00866 - $0086f | Code: Update Title Screen | |
$00870 - $00880 | Code: Show Title Screen 0 | |
$00881 - $0088f | Code: Show Title Screen 1 | |
$00890 - $0089b | Code: Show Title Screen 2 | |
$0089c - $008aa | Code: Show Title Screen 3 | |
$008ab - $008b9 | Code: Show Title Screen 4 | |
$008ba - $008c5 | Code: Show Title Screen 5 | |
$008c6 - $008e5 | Palette: Title screen | |
$008e6 - $008f1 | Jump Table (6 entries, indexed by current title screen) (Jump instruction at $0029 ) | |
$008f2 - $008f5 | Color Table: Title Screen Logo Effect | |
$008f6 - $009d8 | Unknown Code | |
$009d9 - $009e4 | Code: Clear Entity Data | |
$009e5 - $00a33 | Code: Demo (Game State $2 ) Main Code | |
$00a34 | Unknown | |
$00a35 - $00a7b | Code: Demo (Game State $2 ) Interrupt Code | |
$00a7c - $00a7f | Demo Level Table | |
$00a80 - $00a87 | Demo Input Data Pointer Table | |
$00a88 - $00ab0 | Code: Gameplay (Game State $9 and $a ) Main Code | |
$00ab1 - $00abc | Code: First part of Gameplay (Game State $9 and $a ) Interrupt Code | |
$00abd - $00c42 | Code: Gameplay (Game State $9 and $a ) Initialization Code | |
$00c43 - $00d09 | Unknown Code | |
$00d0a - $00d2b | Jump Table (17 entries, indexed by level) (Entry for current level stored at $c085 ) | |
$00d2c - $00d4d | Jump Table (17 entries, indexed by level) (Entry for current level stored at $c00e ) | |
$00d4e - $00d6f | Jump Table (17 entries, indexed by level) (Entry for current level stored at $c089 ) | |
$00d70 - $00dc4 | Unknown | |
$00dc5 - $00dd5 | Sound Control Table (17 entries, indexed by level) | |
$00dd6 - $00e40 | Unknown | |
$00e41 - $00e6b | Unknown Code | |
$00e6c - $00e7c | Code: Load Level Tilesets for current level | |
$00e7d - $00e9e | Jump Table (17 entries, indexed by level) (Jump instruction at $0029 ) | |
$00e9f - $00ec8 | Code: Load Level 1 Tilesets | |
$00ec9 - $00ede | Code: Load Level 8 Tilesets | |
$00edf - $00eff | Code: Load Level 16 Tilesets | |
$00f00 - $00e20 | Code: Load Level 10 and 15 Tilesets | |
$00f21 - $00e53 | Code: Load Level 3 Tilesets | |
$00f54 - $00e6b | Code: Load Level 4 and 11 Tilesets | |
$00f6c - $00e98 | Code: Load Level 6 and 12 Tilesets | |
$00f99 - $00ead | Code: Load Level 5 Tilesets | |
$00fae - $00ec5 | Code: Load Level 7 Tilesets | |
$00fc6 - $00ef8 | Code: Load Level 9 Tilesets | |
$00ff9 - $01021 | Code: Load Level 2 and 13 Tilesets | |
$01022 - $01057 | Code: Load Level 17 Tilesets | |
$01058 - $0107b | Code: Load Level 14 Tilesets | |
$0107c - $010d5 | Unknown Code | |
$010d6 - $010dd | Unknown | |
$010de - $010fe | Unknown Code | |
$010ff - $01111 | Code: Load Level Palette for current level | |
$01112 - $01133 | Level Palette Pointer Table | |
$01134 - $01141 | Unknown Code | |
$01142 - $01163 | Jump Table (17 entries, indexed by level) (Jump instruction at $0029 ) | |
$01164 - $0156c | Unknown Code | |
$0156d - $0158e | Jump Table (17 entries, indexed by level) (Jump instruction at $15ae ) | |
$0158f - $0161f | Unknown Code | |
$01620 - $0164f | Unknown | |
$01650 - $016a5 | Code: Bonus Level (Game State $8 ) Main Code | |
$016a6 - $01734 | Code: Bonus Level (Game State $8 ) Interrupt Code | |
$01735 - $018cc | Code: Bonus Level (Game State $8 ) Initialization Code | |
$018cd | Code: Level Completed (Game State $4 ) Interrupt Code: ret | |
$018ce - $018ec | Code: Level Completed (Game State $4 ) Main Code | |
$018ed - $0194e | Code: Level Completed (Game State $4 ) Initialization Code | |
$0194f - $01a00 | Code: Start Level (Game State $3 ) Main Code | |
$01a01 - $01a45 | Code: Start Level (Game State $3 ) Interrupt Code | |
$01a46 - $01b40 | Code: Start Level (Game State $3 ) Initialization Code | |
$01b41 - $01b96 | Unknown Code | |
$01b97 - $01ba6 | Palette: Start Level | |
$01ba7 - $01bc8 | Unknown | |
$01bc9 - $023fc | Unknown | |
$023fd - $025fc | Palette: Map | |
$025fd - $02673 | Unknown | |
$02674 - $02873 | Palette: Hirotta Stone close-up | |
$02874 - $066d5 | Unknown | |
$066d6 - $067c3 | Level Descriptors | |
$067c4 - $07fff | Unknown | |
$08000 - $097dc | Sprite Descriptors (see here) | |
$097dd - $0984e | Unknown | |
$0984f - $09ecc | Sound Engine (see here) | |
$09ecd - $0b304 | Sound Data | |
$0b305 - $0b504 | 1bpp Tiles: ASCII Characters $20 - $5a, ©SEGA [16] | |
$0b505 - $0b526 | Entity Data Pointer Table | |
$0b527 - $0b6ec | Entity Data Pointers | |
$0b6ed - $0be87 | Entity Data (see here) | |
$0be88 - $0bfff | Unused | |
$0c000 - $0c47f | 4bpp Tiles: Boxes | |
$0c480 - $0c4a1 | Level Main Tile Set Pointer Table | |
$0c4a2 - $0c582 | Compressed 4bpp Tiles: Bag of Gold Coins, Cloud | |
$0c583 - $0c9e0 | Compressed 4bpp Tiles: Additional Set for Levels 1, 3, 5, 9, 16 and 17 | |
$0c9e1 - $0ce64 | Compressed 4bpp Tiles: Additional Set for Levels 2, 6, 8, 10, 12, 13 and 15 | |
$0ce65 - $0cecd | Compressed 4bpp Tiles: Additional Set for Levels 2, 5, 9 and 13 | |
$0cece - $0d157 | Compressed 4bpp Tiles: Main Set for Levels 1, 5 and 9 | |
$0d158 - $0d316 | Compressed 4bpp Tiles: Main Set for Levels 2, 10, 13 and 15 (Also used for levels 6 & 12) | |
$0d317 - $0d569 | Compressed 4bpp Tiles: Main Set for Level 3 (Also used for level 17) | |
$0d56a - $0db81 | Compressed 4bpp Tiles: Main Set for Level 4 | |
$0db82 - $0df1c | Compressed 4bpp Tiles: Main Set for Levels 6 and 12 | |
$0df1d - $0e24b | Compressed 4bpp Tiles: Main Set for Level 7 | |
$0e24c - $0ea04 | Compressed 4bpp Tiles: Main Set for Level 8 | |
$0ea05 - $0ee32 | Compressed 4bpp Tiles: Main Set for Level 11 (Also used for level 14) | |
$0ee33 - $0f116 | Compressed 4bpp Tiles: Main Set for Level 16 | |
$0f117 - $0f49a | Compressed 4bpp Tiles: Main Set for Level 17 | |
$0f49b - $0f75b | Compressed 4bpp Tiles: Main Set for Level 14 | |
$0f75c - $0f7f5 | Compressed 4bpp Tiles: Additional Set for Level 17 | |
$0f7f6 - $0f895 | 4bpp Tiles: Additional Set for Levels 1, 3 and 5 | |
$0f896 - $0f969 | Compressed 4bpp Tiles: Additional Set for Levels 3, 5 and 9 | |
$0f96a - $0fc67 | Ending Sequence Text Data | |
$0fc68 | Unused | |
$0fc69 - $0ffdb | Compressed 4bpp Tiles: Alex Kidd Eating Rice Ball | |
$0ffdc - $0ffff | Unused | |
$10000 - $1005f | Alex Kidd Frame Description Pointers | |
$10060 - $10340 | Alex Kidd Frame Descriptions (Including pointers to tiles) [17] | |
$10341 - $118e8 | 3bpp Tiles: Alex Kidd | |
$118e9 - $11bb4 | Compressed 4bpp Tiles: Janken Match | |
$11bb5 - $11e66 | Compressed 4bpp Tiles: Stone Head | |
$11e67 - $120a7 | Compressed 4bpp Tiles: Scissors Head | |
$120a8 - $12356 | Compressed 4bpp Tiles: Paper Head | |
$12357 - $12ac1 | Compressed 4bpp Tiles: Janken the Great | |
$12ac2 - $12d9d | Janken the Great Petrifaction Data | |
$12d9e - $13331 | Name Table Entries: Title Screen | |
$13332 - $13eda | Compressed 4bpp Tiles: Title Screen | |
$13edb - $13fba | 1bpp Tiles: Sega Mark III Logo [18] | |
$13fbb - $13fff | Unused | |
$14000 - $143ff | Metatile Name Table Entry Pointer Tables | |
$14400 - $1441f | Name Table Entries: Empty Octopus Pots | |
$14420 - $1444f | Name Table Entries: Open Door (Cragg Lake) | |
$14450 - $14d34 | Metatile Name Table Entries [19] | |
$14d35 - $1508d | Demo Simulated Input Data | |
$1508e - $153f2 | Compressed Name Table Entries: Shop Interior | |
$153f3 - $157ff | Compressed 4bpp Tiles: Shop Interior | |
$15800 - $1583f | Name Table Entries: Shop Exit Door | |
$15840 - $15923 | Compressed 4bpp Tiles: Shop Exit Door | |
$15924 - $15ad3 | Name Table Entries: Hirotta Stone Close-up | |
$15ad4 - $15e44 | Compressed 4bpp Tiles: Hirotta Stone Close-up | |
$15e45 - $161d4 | Map Data | |
$161d5 - $16f10 | Compressed 4bpp Tiles: Map | |
$16f11 - $172b0 | 4bpp Tiles: Shop Items, Currency Symbol | |
$172b1 - $17852 | Compressed 4bpp Tiles: ASCII Characters $20 - $5a, ©SEGA | |
$17853 - $17ed2 | 4bpp Tiles: Water, Mud, Level 4 Lava, Level 16 Foam, Level 7 Lava | |
$17ed3 - $17fff | Unused | |
$18000 - $1bdb8 | Level Layout Data | |
$1bdb9 - $1be44 | Subscreen Item Data | |
$1be45 - $1bfaa | Shop Data | |
$1bfab - $1bfff | Unused | |
$1c000 - $1c068 | Compressed 4bpp Tiles: "Score" | |
$1c069 - $1f108 | 4bpp Tiles | |
$1f109 - $1fc9d | Text Box Data | |
$1fc9e - $1fe9d | Level Palettes [20] | |
$1fe9e - $1ff85 | Name Table Entries | |
$1ff86 - $1ffff | Unused |
This table summarises the RAM usage of the Alex Kidd in Miracle World [v1] ROM (Size: 128KB; CRC32: aed9aac4):
Address Range | Contents |
---|---|
$c000 - $c002 | High Score |
$c003 | Unknown |
$c004 | Value of VDP register 1 |
$c005 | Input flags[21] |
$c006 | Input data (Inverse of Port $DC) |
$c007 | Input data Changes |
$c008 | Interrupt flags[22] |
$c009 - $c00a | Pointer to the next free space in the temporary Sprite Attribute Table |
$c00b - $c00d | Unknown |
$c00e - $c00f | Pointer to the code that is responsible for updating the tile colors (e.g. the water color) |
$c010 | Unknown |
$c011 | Message to show in the text box |
$c012 - $c014 | Unknown |
$c015 | Flag to disable the opening of the map |
$c016 | Next Demo to play |
$c017 - $c01e | Unknown |
$c01f | Game State |
$c020 | Score (BCD) |
$c023 | Level |
$c024 | Unknown |
$c025 | Lives (BCD) |
$c026 - $c02f | Unknown |
$c030 - $c032 | Money (BCD) |
$c033 - $c037 | Unknown |
$c038 - $c039 | Pointer to current map/text data |
$c03a - $c03b | Pointer to current nametable destination for the map |
$c03c | State of loading the map |
$c03d | Flag indicating if the nametable of the map should be updated |
$c03e | Timer for the next update of the nametable of the map |
$c03f | Timer for starting the current level |
$c040 - $c045 | Unknown |
$c046 - $c04f | Inventory[23] |
$c050 - $c052 | Unknown |
$c053 | Selection State of the items in the inventory |
$c054 | Unknown |
$c055 | Shop Flags |
$c056 | Index of the item selected in the shop |
$c057 | Index of the item being bought |
$c058 - $c059 | Pointer to the nametable address of the selected item |
$c05a - $c05b | Timer for the invincibility |
$c05c | Flag indicating if the leftmost column should be blanked (only used in level $11) |
$c05d - $c05e | Timer for the color of the invincibility |
$c05f | Value of VDP register 0 |
$c060 | Unknown |
$c061 - $c062 | Pointer to entity data pointers of the current level |
$c063 | Flag indicating if added entities will be horizontaly offscreen |
$c064 | Flag indicating if added entities will be verticaly offscreen |
$c065 | Entity Index (used in non-linear levels) |
$c066 | Flag indicating if the game is currently scrolling down to the next screen |
$c067 | Vertical offset to apply to new entities |
$c068 | Unknown |
$c069 | Horizontal Position of the shop entrance |
$c06a - $c06b | Pointer to the nametable of the shop entrance door |
$c06c | Horizontal Position the shop has been entered from |
$c06d - $c06e | Pointer to the nametable of the shop entrance door where it has been entered from |
$c06f | Flag indicating if Alex should start walking to the next screen |
$c070 - $c071 | Temporary pointer to the entity of Nurari or the Old Man |
$c072 - $c073 | Temporary pointer to the animation descriptor of Nurari or the Old Man |
$c074 - $c075 | Unknown |
$c076 | Flag indicating if Nurari/the Old Man should be shown |
$c077 | Flag indicating a special level scrollability |
$c078 - $c07b | Unknown |
$c07c | Question Mark Box Index |
$c07d | Text Box Counter |
$c07e | Text Box Flags |
$c07f | Unknown |
$c080 | Level scrollability |
$c081 | Level bank number |
$c082 - $c084 | Unknown |
$c085 - $c086 | Pointer to code that is responsible for updating the scroll flags |
$c087 - $c088 | Pointer to the meta tile name table |
$c089 - $c08a | Pointer to code that is responsible for loading new entities of the level |
$c08b - $c08c | Unknown |
$c08d | Current screen number |
$c08e | Unknown |
$c08f | Counter of power bracelets that have been picked up |
$c090 | Alex's State before he got hit |
$c091 | Horizontal offset to apply to new entities |
$c092 | Flag indicating if the current level is a bonus level |
$c093 | Trigger variable to trigger toggling the map screen |
$c094 - $c095 | Pointer to the ending sequence |
$c096 | State of the reset button |
$c097 - $c09f | Unknown |
$c0a0 | Level width |
$c0a1 | Lines to load to the nametable |
$c0a2 | Unknown |
$c0a3 - $c0a4 | Level layout pointer |
$c0a5 | Level height |
$c0a6 | Columns to load to the nametable |
$c0a7 | Unknown |
$c0a8 - $c0a9 | 2nd level layout pointer |
$c0aa | UpdateNameTable Flags |
$c0ab - $c0ac | Velocity of horizontal scroll |
$c0ad - $c0ae | Unknown |
$c0af - $c0b0 | Horizontal scroll |
$c0b1 - $c0b5 | Unknown |
$c0b6 | Horizontal screen number |
$c0b7 - $c0b8 | Unknown |
$c0b9 - $c0ba | Velocity of vertical scroll |
$c0bb - $c0bc | Unknown |
$c0bd - $c0be | Vertical scroll |
$c0bf - $c0c3 | Unknown |
$c0c4 | Vertical screen number |
$c0c5 - $c0c8 | Unknown |
$c0c9 | Scroll Flags |
$c0ca - $c0f3 | Temporary copy of level data from $c0a0 - $c0c9 |
$c0f4 - $c0f7 | Unknown |
$c0f8 | Length of entity data array |
$c0f9 - $c0fa | Pointer to entity data array |
$c0fb - $c0fc | Unknown |
$c0fd - $c0fe | Pointer the nametable address of the shop door |
$c0ff | Unknown |
$c100 - $c101 | Timer for the color of the water |
$c102 | Unknown |
$c103 - $c104 | Timer for the intro |
$c105 - $c106 | Pointer to the input data for the demo |
$c107 | Current input data of the demo |
$c10a | Temporary Variable used for the nametable flags in the code starting from $159 |
$c10b | Temporary Variable used for the color in the 1BPPTileLoader starting from $1d6 |
$c10c | Unknown |
$c10d | Counter used for the code to prevent sprite flickering starting from $224 |
$c10e - $c10f | Unknown |
$c110 | Sound Control Variable |
$c111 | Sound Fade Out Volume |
$c112 | Sound Fade Out Timer |
$c113 | Sound Effect Priority |
$c114 | Sound Software Channel 7 state |
$c115 | Sound Flags for Janken Match |
$c116 | Sound Number |
$c117 | Unused |
$c118 - $c197 | Sound Software Channels for music |
$c198 - $c1f7 | Sound Software Channels for sound effects |
$c1f8 - $c1ff | Unused |
$c200 | Index of Alex Tiles |
$c201 | Index of Previous Alex Tiles |
$c202 | Nametable Change Request |
$c203 | Unknown |
$c204 - $c205 | Destination for Nametable Change |
$c206 - $c207 | Source for Nametable Change |
$c208 - $c20b | Unknown |
$c20c - $c20d | Temporary copy of Alex Horizontal Velocity |
$c20e - $c20f | Temporary copy of Alex Vertical Velocity |
$c210 | Temporary copy of Alex State |
$c211 - $c212 | Address of the nametable entry being interacted with |
$c213 | Bit 5 of the flags of the nametable entry being interacted with |
$c214 | Timer for the next spawn of a ghost |
$c215 | Flag indicating if the Janken Match has started |
$c216 | Unknown |
$c217 | Janken Match Opponent Decision Index |
$c218 - $c21f | Unknown |
$c220 | Timer for the update of level tiles |
$c221 | Index of an animated level tile with 4 frames |
$c222 | Index of an animated level tile with 6 frames |
$c223 - $c224 | Pointer to the code responsible for updating level tiles |
$c225 | Flag indicating if level tiles should be updated |
$c226 | Timer for the progress of the titlescreen |
$c227 | Index of the current titlescreen |
$c228 | Timer for the color of the logo in the titlescreen |
$c229 | Index of the riddle |
$c22a | Previous decision in the riddle |
$c22b - $c22f | Unknown |
$c230 - $c231 | Pointer to the sprite descriptor of the Janken Match Opponent |
$c232 - $c233 | Pointer to the tiles of the Janken Match Opponent |
$c234 - $c235 | Unknown |
$c236 - $c237 | Pointer to the animation descriptor of the Janken Match Opponent |
$c238 - $c239 | Pointer to the countdown animation descriptor of the Janken Match Opponent |
$c23a - $c23b | Pointer to the show-decision sprite descriptor of the Janken Match Opponent |
$c23c - $c23d | Pointer to the decisions of the Janken Match Opponent |
$c23e | Index of the message to show for the Janken Match Opponent |
$c23f | Unknown |
$c240 - $c260 | Temporary copy of the Alex entity |
$c261 - $c29f | Unknown |
$c2a0 - $c2ab | Temporary sprite descriptor (used in Janken Match) |
$c2ac - $c2ff | Unknown |
$c300 - $c6bf | Entity Data[24] |
$c6c0 - $c6ff | Unknown |
$c700 - $c7ff | Temporary Sprite Attribute Table[25] |
$c800 - $ceff | Name Table |
$cf00 - $cf77 | Metatile Name Table Entries |
$cf78 - $cfdf | Unknown |
$cfe0 - $cfff | Text Box Cursor |
$d000 - $d6ff | Copy of Name Table[26] |
$d700 - $d7bf | Decompressed Level Layout Data |
$d7c0 - $dfcf | Unknown |
$d7d0 - $d7ff | Temporary Nametable Descriptors for the Shop Window |
$d800 - $dfff | Unknown |
There's an editor in development which can be found at http://kidded.emulicious.net. See also KiddEd.
Researched by RetroSpark and Calindro