The Koneko no Daibouken Research Lab

Koneko no Daibouken is an MSX game developed by CASIO and released in 1986. On this webpage I am collecting information that I have discovered about how the game works internally, and about the game in general.




Contents


Data Formats

Background Data Format

Structure definitions:
BACKGROUND_HEADER 1x U8 Background fill pattern 1x U8 Flag indicating a grassy background BLOCK_FILL_1x1_COMMAND 1x U8 Y coordinate 1x U8 X coordinate 1x U8 Width 1x U8 Height 1x U8 Pattern index BLOCK_FILL_2x2_COMMAND 1x U8 Y coordinate 1x U8 X coordinate 1x U8 Width 1x U8 Height 1x U8 Base pattern index LINEAR_COPY_COMMAND 1x U8 Y coordinate 1x U8 X coordinate 1x U8 Number of bytes to copy 1x U8 Source address index in table BLOCK_COPY_COMMAND 1x U8 Y coordinate 1x U8 X coordinate 1x U16 Source address

Pseudocode for loading a background:
Read a BACKGROUND_HEADER. While the next byte is not equal to 0xFF or 0xFE: Read a LINEAR_COPY_COMMAND. If the next byte is equal to 0xFE: Skip the next byte. While the next byte is not equal to 0xFF: Read a BLOCK_FILL_2x2_COMMAND. Skip the next byte. While the next byte is not equal to 0xFF: Read a BLOCK_FILL_1x1_COMMAND. Skip the next byte. While the next byte is not equal to 0xFF: Read a BLOCK_COPY_COMMAND. End.

Explanation of Commands

BLOCK_FILL_1x1_COMMAND Fills a rectangular region of the nametable by repeating the given pattern index.

BLOCK_FILL_2x2_COMMAND Fills a rectangular region of the nametable with a repeating 2x2 block of patterns. The block is constructed like so:

N+0N+1
N+2N+3

Where N is the base pattern index.

LINEAR_COPY_COMMAND Writes a string of pattern indices to the nametable at the given XY position. The address of the string to copy is stored in a table located at address 0xAD85. This table of addresses is indexed by the given source address index.

BLOCK_COPY_COMMAND Fills a rectangular region of the nametable with a string of patterns read from an address. The data stored at the given address is structured like so:
1x U8 Width 1x U8 Height Nx U8 String of pattern indices
where N is equal to Width X Height.


Objects Data Format

Structure definitions:
SPRITE_OBJECT 1x U8 Y coordinate 1x U8 X coordinate 1x U8 Type NAMETABLE_OBJECT 1x U8 Y coordinate 1x U8 X coordinate 1x U8 Type 1x U8 Sub-type

Pseudocode for loading objects:
While the next byte is not equal to 0xFF: Read a SPRITE_OBJECT. Skip the next byte. While the next byte is not equal to 0xFF: Read a NAMETABLE_OBJECT. End.


Sprite Object Types

Type CodeSprite Object Type
0x01Worm enemy.
0x02Falling enemy chestnut spawn location.
0x03Randomly-placed powerup item.
0x04Pig enemy.
0x05Mouse enemy.
0x06Ground-walking bird enemy.
0x07Periodic flying bird enemy.


Nametable Object Types

Type CodeSub-Type CodeNametable Object Type
0x010x00Slingshot item on grass.
0x010x01Slingshot item on sky.
0x010x80Slingshot item on sky (duplicate).
0x020x00Bag item on grass.
0x020x01Bag item on sky.
0x020x80Bag item on sky (duplicate).
0x030x00Small coin on grass.
0x030x01Large coin on grass.
0x030x02Small coin on grass (hidden).
0x030x03Large coin on grass (hidden).
0x030x04Large coin + extra life on grass (hidden).
0x030x00Small coin on sky.
0x030x01Large coin on sky.
0x030x02Small coin on sky (hidden).
0x030x03Large coin on sky (hidden).
0x030x04Large coin + extra life on sky (hidden).
0x040x00Three-leaf clover on grass.
0x040x01Four-leaf clover on grass.
0x040x02Three-leaf clover on sky.
0x040x03Four-leaf clover on sky.




Data Tables

Screen IndexBackground Data AddressObject Data AddressNotes
0x000x42220xB0D0
0x010x424C0xB0E3
0x020x426D0xB0FA
0x030x42B50xB10D
0x040x42E30xB12F
0x050x430D0xB152
0x060x435E0xB170
0x070x43D90xB187
0x080x44070xB1AD
0x090x42B50xB10D
0x0A0x44470xB1CF
0x0B0x44850xB1F2
0x0C0x44D10xB21C
0x0D0x45250xB247
0x0E0x435E0xB26D
0x0F0x430D0xB152
0x100x457F0xB28C
0x110x46230xB2A3
0x120x46C80xB2CB
0x130x47820xB2F0
0x140x47C70xB30C
0x150x48670xB334
0x160x490C0xB359
0x170x49BA0xB382
0x180x4A0F0xB3A7
0x190x48670xB334
0x1A0x4AAB0xB3DA
0x1B0x49BA0xB382
0x1C0x457F0xB28C
0x1D0x4B790xB3FD
0x1E0x490C0xB359
0x1F0x4C260xB446
0x200x4CBC0xB47B
0x210x4CEE0xB484
0x220x4D430xB494
0x230x4D850xB4B0
0x240x4DC60xB4BD
0x250x4E150xB4D7
0x260x4E590xB4EE
0x270x4E8E0xB509
0x280x4EC20xB51C
0x290x4EEF0xB53B
0x2A0x4F120xB54E
0x2B0x4F290xB565
0x2C0x4F6A0xB57C
0x2D0x4F9F0xB598
0x2E0x4FE00xB5AF
0x2F0x4FFD0xB5CA
0x300x506A0xB5DE
0x310x50980xB5EE
0x320x50CA0xB60D
0x330x51040xB628
0x340x512E0xB643
0x350x51600xB65A
0x360x51040xB628
0x370x519E0xB678
0x380x506A0xB5DEUnused.
0x390x50980xB5EEUnused.
0x3A0x50CA0xB60DUnused.
0x3B0x51040xB628Unused.
0x3C0x512E0xB643Unused.
0x3D0x51600xB65AUnused.
0x3E0x51040xB628Unused.
0x3F0x519E0xB678Unused.
0x400x522C0x6D5D
0x410x528F0x6D69
0x420x52F80x6D78
0x430x536D0x6D9A
0x440x541F0x6DBF
0x450x548D0x6DE1
0x460x550C0x6DFF
0x470x55720x6E2A
0x480x536D0x6D9A
0x490x536D0x6D9A
0x4A0x541F0x6DBF
0x4B0x55FB0x6E47
0x4C0x565B0x6E71
0x4D0xA8400x6E9E
0x4E0xA8400x6E9E
0x4F0x55FB0x6E47
0x500xA8EE0x7D20
0x510xA9210x7D35
0x520xA94A0x7D48
0x530xA98C0x7D68
0x540xA9E20x7D7B
0x550xAA2E0x7D95
0x560xAA840x7DB0
0x570xAAD50x7DCE
0x580xAB170x7DE1
0x590xAB4A0x7DF8
0x5A0xABA50x7E0E
0x5B0xABE20x7E2D
0x5C0xAC3D0x7E3D
0x5D0xAC6B0x7E65
0x5E0xACE90x7E78
0x5F0xAD170x7E90
0x600x41E40xB28A
0x610x42050xB28A
0x620x50410xB28A
0x630x51D40xB28A
0x640xA8B00xB28A
0x650xAD5E0xB28A
0x660x4C930x6D20
0x670xBF800x6ECF


RoundLevelScreen Table AddressThemeScreen Table
1-10x000x405C0 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x60, 0x00
1-20x010x40661 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x61, 0x00
1-30x020x40702 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x62, 0x00
1-40x030x407A3 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x63, 0x00
1-50x040x40845 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x65, 0x00
1-60x050x408E4 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x64, 0x00
2-10x060x40980 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x60, 0x00
2-20x070x40A21 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x61, 0x66, 0x61, 0x00
2-30x080x40AE2 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x62, 0x00
2-40x090x40B83 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x63, 0x00
2-50x0A0x40C25 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x65, 0x00
2-60x0B0x40CC4 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x64, 0x00
3-10x0C0x40D60 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x60, 0x00
3-20x0D0x40E01 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x61, 0xFF
3-30x0E0x40EA2 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x62, 0x67, 0x62, 0xFF
3-40x0F0x40F63 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x63, 0x00
3-50x100x41005 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x65, 0x00
3-60x110x410A4 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x64, 0xFF




Tile Sets

This tileset is used for theme 0.


This tileset is used for themes 1 through 3 inclusive.


This tileset is used for themes 4 and 5. Yes, some of the tiles look corrupted like this during the normal running of the game.




Bugs




Oddities

Here are the screen index tables for each of the levels in the game.

Each entry in each table is an index into the array of screen data addresses located at 0x4114. The byte values of the entries are somewhat consistently encoded such that the first nibble of each byte roughly corresponds to the position of the level, repeating every 6 levels. A first nibble value of 6 corresponds to an end-of-level screen. However, the order of the first-nibble values follows the sequence 0,1,2,3,5,4 whereas the sequence 0,1,2,3,4,5 would be more consistent. This can also be seen in the level theme indices. Maybe the levels were re-ordered at some point during development.

Also, from this table it can also be seen that the bytes with a first nibble value of 3 always follow the same sequence, starting at 0x30 and ending at 0x37. This means that there is a gap of unused indices, those being 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E and 0x3F. The screen data addresses corresponding to these indices are duplicates though, so they do not point to any unused level data.

The game has a continues system, which is intended to allow the player to continue playing after they have lost all of their lives. However, I have not yet found a way to make use of the continues system without enabling the cheat-code which grants infinite continues.

In the town-themed tileset there are graphics for three fruits:

They are presumably a peach, an apple, and a lemon corresponding to the three towns in the game which are named after the same fruit. However, these graphics don't seem to be used by the game at all. The strings of pattern indices which would have constructed these graphics do not appear in the ROM at all.




Cheat Codes

I discovered two cheat codes in the game: The code which checks for these conditions starts at 0x8082.




Pre-Release Versions

In the following screenshots taken from the back of the box, there is a colon between the round numbers in the HUD at the top-left. In the final version of the game, this is a dash instead of a colon.

This difference can also be seen in a scan of an advert on page 14 of the 1986-10 issue of MSX Magazine:






List of Known Addresses

AddressLocationPurpose
0x4038ROMArray of screen table addresses, one for each level.
0x4114ROMArray of screen data addresses, one for each screen.
0x4222ROMStart of screen data.
0x5700ROMSprite patterns for Chibi's animation when paused.
0x6180ROMTile patterns for theme index < 4.
0x6980ROMTile patterns for theme index >= 4.
0x7180ROMTile colours for theme index < 4.
0x7980ROMTile colours for theme index >= 4.
0x8082ROMCheat-code conditions are checked here.
0x81B2ROMCode which resets in-game variables.
0x840DROMArray of 1-byte theme indices, one for each level.
0x85D5ROMHere the number of lives is decremented after losing a life.
0x85F2ROMCode which displays the GAME OVER message.
0x8A5EROMTileset-loading routine.
0x8B57ROMRoutine which fills in the HISCORE line in the nametable.
0x8B63ROMRoutine which fills in the SCORE line in the nametable.
0x8FBBROMRoutine which runs the whole CASIO logo animation.
0x94D3ROMRoutine which handles transition to the next screen or the end of a level.
0x99F7ROMLoop body which calls LDIRVM to write one new nametable row from a 64x32-tile buffer, to perform the screen transition animation.
0x9B15ROMMain level screen loading routine.
0x9C68ROMRoutine which calculates a nametable address from given X, Y coordinates.
0x9C80ROMLevel data address calculation routine.
0x9CCBROMCode which decodes level object data.
0xAD85ROMTable of linear copy command source addresses.
0xB000ROMArray of object data addresses, one for each screen.
0xE00BRAMNumber of lives remaining.
0xE010RAMFrame counter.
0xE023RAM0 -> Chibi is vulnerable, 1 -> Chibi is invulnerable.
0xE039RAM0 -> No continues, 1 -> One continue, 2 -> Infinite continues.
0xE03DRAMCurrent level index.
0xE03ERAMPage index within the current level.
0xE03FRAMIndex of the current screen.
0xE04ARAMTheme index of the current level.
0xE700RAMShadow nametable in RAM, used for collision detection.




Screen Construction Sequences

Here is a set of GIFs I made to show how each screen is constructed.

Round 1-1         00 01 02 03 04 05 06 07 08
Round 1-2         00 01 02 03 04 05 06 07 08
Round 1-3         00 01 02 03 04 05 06 07 08
Round 1-4         00 01 02 03 04 05 06 07 08
Round 1-5         00 01 02 03 04 05 06 07 08
Round 1-6         00 01 02 03 04 05 06 07 08
Round 2-1         00 01 02 03 04 05 06 07 08
Round 2-2         00 01 02 03 04 05 06 07 08 09 10
Round 2-3         00 01 02 03 04 05 06 07 08
Round 2-4         00 01 02 03 04 05 06 07 08
Round 2-5         00 01 02 03 04 05 06 07 08
Round 2-6         00 01 02 03 04 05 06 07 08
Round 3-1         00 01 02 03 04 05 06 07 08
Round 3-2         00 01 02 03 04 05 06 07 08
Round 3-3         00 01 02 03 04 05 06 07 08 09 10
Round 3-4         00 01 02 03 04 05 06 07 08
Round 3-5         00 01 02 03 04 05 06 07 08
Round 3-6         00 01 02 03 04 05 06 07 08




Complete Maps

I wrote a program to extract level data from the ROM and render it. Coins which are normally hidden are blended at 50% with the background, and hidden coins which give extra lives are indicated with a small white cross at their top-right corner.

Screen effects are also indicated. The powerup item and the flying bird effect are indicated with icons at the bottom of the screen.

Peach Town:

Round 1-1

Round 1-2

Round 1-3

Round 1-4

Round 1-5

Round 1-6

Apple Town:

Round 2-1

Round 2-2

Round 2-3

Round 2-4

Round 2-5

Round 2-6

Lemon Town:

Round 3-1

Round 3-2

Round 3-3

Round 3-4

Round 3-5

Round 3-6

Special thanks to Kegmotosiek for his help with checking the level maps.




Box






Cartridge






Manual






External Links