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.

Donkey Kong Country (Game Boy Color)/Notes: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(Created page with "==Compression== ===Maps=== DKC (GBC) uses a different format from the DKL games to compress maps, and it is much simpler. The data is read one byte at a time, and the two mos...")
 
No edit summary
Line 9: Line 9:
* <tt>10xxxxxx yyyyyyyy...</tt>: Uncompressed data. Read the next <tt>xxxxxx</tt> bytes. This length can range from 0x00 to 0x3F, since this is a 6-bit value.
* <tt>10xxxxxx yyyyyyyy...</tt>: Uncompressed data. Read the next <tt>xxxxxx</tt> bytes. This length can range from 0x00 to 0x3F, since this is a 6-bit value.
** Example: A byte stream of <tt>83 01 02 03</tt> (in hexadecimal) will write the next 0x03 bytes, which are:<br /><tt>01 02 03</tt>
** Example: A byte stream of <tt>83 01 02 03</tt> (in hexadecimal) will write the next 0x03 bytes, which are:<br /><tt>01 02 03</tt>
* <tt>11xxxxxx yyyyyyyy</tt>: Read a byte sequence already written earlier, write it again. <tt>xxxxxx</tt> denotes the length of the data to repeat, which can range from 0x00 to 0x3F, since it is a 6-bit value. <tt>yyyyyyyy</tt> represents the distance to go back, which can range from 0x00 to 0xFF, since this is an 8-bit value.
* <tt>11xxxxxx yyyyyyyy</tt>: Read a byte sequence already written earlier, then write it again. <tt>xxxxxx</tt> denotes the length of the data to repeat, which can range from 0x00 to 0x3F, since it is a 6-bit value. <tt>yyyyyyyy</tt> represents the distance to go back, which can range from 0x00 to 0xFF, since this is an 8-bit value.
** Example: A byte stream of <tt>C4 1C</tt> (in hexadecimal) will read four bytes. Assuming that the current RAM address to be written to is <tt>1:D100</tt>, then the offset that should be read from is <tt>1:D100 - 1C</tt>, or <tt>1:D0E4</tt>. Assuming that the data from <tt>1:D0E4-D0E7</tt> is <tt>10 11 12 13</tt>, then the data from <tt>1:D100</tt> to <tt>1:D103</tt> will also be <tt>10 11 12 13</tt>.
** Example: A byte stream of <tt>C4 1C</tt> (in hexadecimal) will read four bytes. Assuming that the current RAM address to be written to is <tt>1:D100</tt>, then the offset that should be read from is <tt>1:D100 - 1C</tt>, or <tt>1:D0E4</tt>. Assuming that the data from <tt>1:D0E4-D0E7</tt> is <tt>10 11 12 13</tt>, then the data from <tt>1:D100</tt> to <tt>1:D103</tt> will also be <tt>10 11 12 13</tt>.
{{Internal Data|game=Donkey Kong Country (Game Boy Color)}}

Revision as of 05:41, 21 May 2016

Compression

Maps

DKC (GBC) uses a different format from the DKL games to compress maps, and it is much simpler.

The data is read one byte at a time, and the two most significant bits determine one of three cases.

  • 0xxxxxxx yyyyyyyy: Run-length encoding. Write a certain byte (yyyyyyyy) xxxxxxx times. xxxxxxx can range from 0x00 to 0x7F, since this is a 7-bit value.
    • Example: A byte stream of 10 30 (in hexadecimal) will write the value 0x30 for 0x10 (16 decimal) bytes:
      30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
  • 10xxxxxx yyyyyyyy...: Uncompressed data. Read the next xxxxxx bytes. This length can range from 0x00 to 0x3F, since this is a 6-bit value.
    • Example: A byte stream of 83 01 02 03 (in hexadecimal) will write the next 0x03 bytes, which are:
      01 02 03
  • 11xxxxxx yyyyyyyy: Read a byte sequence already written earlier, then write it again. xxxxxx denotes the length of the data to repeat, which can range from 0x00 to 0x3F, since it is a 6-bit value. yyyyyyyy represents the distance to go back, which can range from 0x00 to 0xFF, since this is an 8-bit value.
    • Example: A byte stream of C4 1C (in hexadecimal) will read four bytes. Assuming that the current RAM address to be written to is 1:D100, then the offset that should be read from is 1:D100 - 1C, or 1:D0E4. Assuming that the data from 1:D0E4-D0E7 is 10 11 12 13, then the data from 1:D100 to 1:D103 will also be 10 11 12 13.