|
DevelopmentSega Master System / Mark III / Game Gear |
Home - Forums - Games - Scans - Maps - Cheats - Credits |
Slot 2 Mapping Flat Code in $00000 - $0bfff [1]
Lemmings uses a single palette for all gameplay. The only places where different palettes are used are the logo screens, the title screen and the ending scene. All of the palettes contain 16 colours which are written to both halves of CRAM.
The 16 bytes of data defining the main palette begin at offset $1be5e. The colours in the main palette are:
Index | $00 | $01 | $02 | $03 | $04 | $05 | $06 | $07 | $08 | $09 | $0a | $0b | $0c | $0d | $0e | $0f |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | $00 | $3f | $08 | $24 | $15 | $2a | $38 | $20 | $03 | $0b | $07 | $04 | $01 | $07 | $02 | $00 |
These are the other palettes used by Lemmings:
Index | $00 | $01 | $02 | $03 | $04 | $05 | $06 | $07 | $08 | $09 | $0a | $0b | $0c | $0d | $0e | $0f |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | $00 | $2b | $08 | $34 | $15 | $2a | $38 | $20 | $03 | $0b | $06 | $04 | $01 | $07 | $02 | $00 |
Index | $00 | $01 | $02 | $03 | $04 | $05 | $06 | $07 | $08 | $09 | $0a | $0b | $0c | $0d | $0e | $0f |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | $00 | $3e | $3a | $35 | $07 | $02 | $01 | $00 | $1c | $08 | $04 | $25 | $30 | $0e | $10 | $2b |
Index | $00 | $01 | $02 | $03 | $04 | $05 | $06 | $07 | $08 | $09 | $0a | $0b | $0c | $0d | $0e | $0f |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | $00 | $3e | $2a | $15 | $16 | $02 | $01 | $00 | $1c | $18 | $04 | $24 | $20 | $0b | $10 | $2b |
Index | $00 | $01 | $02 | $03 | $04 | $05 | $06 | $07 | $08 | $09 | $0a | $0b | $0c | $0d | $0e | $0f |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | $00 | $33 | $3e | $2a | $15 | $16 | $02 | $00 | $1c | $18 | $04 | $34 | $20 | $0e | $10 | $27 |
The data for these palettes are at offsets $1be7e, $1be9e, $1be6e and $1be8e respectively.
At $3f7a9 - $3ffa0 there is a 17-byte descriptor for each of the 120 levels (in order). Each descriptor contains the following information:
Offset | Length | Contents |
---|---|---|
0 | 1 byte | Number of lemmings |
1 | 1 byte | % to be saved |
2 | 1 byte | Release rate |
3 | 1 byte | Time (Minutes) |
4 | 1 byte | Number of climbers |
5 | 1 byte | Number of floaters |
6 | 1 byte | Number of bombers |
7 | 1 byte | Number of blockers |
8 | 1 byte | Number of builders |
9 | 1 byte | Number of bashers |
10 | 1 byte | Number of miners |
11 | 1 byte | Number of diggers |
12 | 1 byte | % saved per lemming [2] |
13 | 2 bytes | Address of map descriptor |
15 | 2 bytes | Slot 2 address of level name (Bank 15) |
Within $0713d - $072c2 there is a 5-byte descriptor for each of the 77 maps [3]. Each descriptor contains the following information:
Offset | Length | Contents |
---|---|---|
0 | 1 byte | Tileset index (0, 1, 2, 3, 4, 6 or 7) |
1 | 1 byte | Bank number containing map layout data |
2 | 2 bytes | Slot 2 address of map layout data |
4 | 1 byte | Maximum safe fall distance |
Each of the 77 maps is 112 x 19 tiles in size. Each tile is described by an 8-bit tile index.
In the ROM the indices are compressed using a simple RLE scheme: runs of consecutive zero bytes are stored as a single zero byte followed by a 1-byte length [4]. Any runs of more than 255 zero bytes are split into multiple runs.
During play the indices are decompressed to RAM at $ce00 - $d64f.
The game patches many of the level layouts after the data has been decompressed. Some of these are to allow later level repeats to be slightly modified; others are for less obvious reasons. These patches are all implemented in the form of explicit code that writes to the RAM buffer, rather than having data-driven code. This code is between offsets $2246
and 24a1
in the ROM.
The spinner traps in the data are three tiles tall; the lower two (which lemmings can be killed by) are redrawn to be two tiles tall.
A small obstacle is added, which makes it a little bit more like the original Amiga level.
The lowest pillar is moved one tile to the right. This is so that the lemmings can fall off the left side. All of the pillars are otherwise close enough that the lemmings cannot fall through the gap, which makes the level easier than the original design.
This level is known as "All the 6's" in the original game, and is often "censored" due to allusions to The Number of the Beast. The original level data has relatively clear "6" digits, although not in the same style as the original; the game patches over the upper part of the level to make them less obviously sixes - and changes the level title to say they are not!
The level exit is hidden in this level; the data has black tiles in its location, so the code patches over some dirt. It's not yet understood how the game then draws in the hidden exit.
The starting brick pillar is moved right one tile.
A small modification is made to the land as shown below. This seems to make the level more like the Amiga original, without it it is more difficult to win.
The gap in the floor above the exit is made smaller. This makes the level a little easier.
This level is a repeat of Tricky 3 "A Ladder Would Be Handy" but the right edge of the pit has been made smooth. It's not clear how this makes the level any harder; in the original game it is unchanged.
This is a repeat of Tricky 25 "Sega Three", with the pathway blocked to make it more difficult.
The exit and the floor below it is extended two tiles to the left.
One of the steps is raised; tiles are removed on the sloped ceiling and on the upper right of the pillars, apparently to make the level easier.
This table summarises the contents of the Lemmings ROM (Size: 256KB; CRC32: f369b2d8):
Address Range | Contents |
---|---|
$00000 - $04b7c | Unknown |
$04b7d - $05b9c | 4bpp Tiles: Font [5] |
$04b7c - $062dc | 4bpp Tiles: HUD (skills, numbers) |
$062dd - $0635c | 4bpp Tiles: Cursor |
$0635d - $064dc | 4bpp Tiles: HUD selection borders? |
$064dd - $0713c | 4bpp Tiles: Pointed lemming skill close-up |
$0b564 - $0bece | Map Layouts |
$0bed1 - $0bfe8 | 1bpp Tiles: Title screen text scroller font |
$0c000 - $0ffff | 4bpp Tiles: Lemmings |
$10000 - $10005 | "PAGE04 " |
$10006 - $13f1a | Map Layouts [6] |
$131fb - $13fff | Unused |
$14000 - $14005 | "PAGE05 " |
$14006 - $179b0 | Map Layouts [6] |
$179b1 - $17cb0 | Tile Indices: Sega Logo Screen |
$17cb1 - $17df0 | 4bpp Tiles: Release Rate Box |
$17df1 - $17fff | Unused |
$18000 - $18005 | "PAGE06 " |
$18006 - $19a05 | 4bpp Tiles: Dirt Tileset (208 Tiles) |
$19a06 - $1b985 | 4bpp Tiles: Fire Tileset (252 Tiles) |
$1b986 - $1bb5d | Compressed 4bpp Tiles: Unknown Data |
$1bb5e - $1be5d | Tile Indices: Green Textured Background |
$1be5e - $1be6d | Palette: Main |
$1be6e - $1be7d | Palette: Title Screen |
$1be7e - $1be8d | Palette: Sega Logo Screen |
$1be8e - $1be9d | Palette: Ending Scene |
$1be9e - $1bead | Palette: Lemmings Logo Screen |
$1beae - $1bfff | Unused |
$1c000 - $1c005 | "PAGE07 " |
$1c006 - $1f136 | Map Layouts [6] |
$1f137 - $1f8b6 | 4bpp Tiles: Hatch Opening |
$1f8b7 - $1ffd3 | Compressed 4bpp Tiles: Lemmings Logo Screen Lemming |
$1ffd4 - $1ffff | Unused |
$20000 - $20005 | "PAGE08 " |
$20006 - $21c85 | 4bpp Tiles: Crystal Tileset (228 Tiles) |
$21c86 - $23bc5 | 4bpp Tiles: Pillar Tileset 1 (250 Tiles) |
$23bc6 - $23f96 | Unknown Data |
$23f97 - $23fff | Unused |
$24000 - $24005 | "PAGE09 " |
$24006 - $25c05 | 4bpp Tiles: Pillar Tileset 2 (224 Tiles) |
$25c06 - $278e5 | 4bpp Tiles: Marble Tileset (231 Tiles) |
$278e6 - $27d6c | Map Layout [6] |
$27d6d - $27f5d | Unknown Data |
$27f5e - $27fff | Unused |
$28000 - $28005 | "PAGE10 " |
$28006 - $2b9cb | Map Layouts [6] |
$2b9cc - $2be4b | 4bpp Tiles: "TIMENOU%0123456789" |
$2be4c - $2bfff | Unused |
$2c000 - $2c005 | "PAGE11 " |
$2c006 - $2d7e5 | 4bpp Tiles: Sega Tileset (191 Tiles) |
$2d7e6 - $2defb | Map Layouts [6] |
$2defc - $2f6b0 | Compressed 4bpp Tiles: Lemmings Logo Screen [7] |
$2f6b1 - $2f730 | 4bpp Tiles: Lemmings Logo Screen I Dot |
$2f731 - $2fd30 | Name Table Entries: Lemmings Logo Screen |
$2fd31 - $2ffff | Unused |
$30000 - $30005 | "PAGE12 " |
$30006 - $322da | Map Layouts [6] |
$322db - $3275a | 4bpp Tiles: Sega Logo Screen Wheel |
$3275b - $3365a | 4bpp Tiles: Sega Logo Screen Lemming |
$3365b - $33fba | Unknown Data |
$33fbb - $33fff | Unused |
$34000 - $34005 | "PAGE13 " |
$34006 - $343c5 | Level Codes |
$343c6 - $35ee5 | 4bpp Tiles: traps, water, fire (animations) |
$35ee6 - $37851 | Unknown Data |
$37852 - $37efb | Compressed 4bpp Tiles: Sega Logo Screen |
$37efc - $37fff | Unused |
$38000 - $38005 | "PAGE14 " |
$38006 - $38605 | Name Table Entries: Title Screen |
$38606 - $39fb8 | Compressed 4bpp Tiles: Title Screen |
$39fb9 - $3a545 | Unknown Data |
$3a546 - $3aa70 | Compressed 4bpp Tiles: "Fun", "Tricky", "Taxing", "Mayhem" |
$3aa71 - $3ae5d | Compressed 4bpp Tiles: "1 Player", "2 Player" |
$3ae5e - $3bfff | Compressed 4bpp Tiles: Unknown Data |
$3c000 - $3d901 | Audio Sample: "Let's Go!" |
$3d902 - $3ee23 | Audio Sample: "Oh No!" |
$3ee24 - $3f7a8 | Level Names |
$3f7a9 - $3ffa0 | Level Descriptors |
$3ffa1 - $3ffff | Unused |
Much of the tile art is uncompressed in order for the game engine to work. The remainder is compressed using RLE compression.
The compressed data starts with an 8-bit count for the number of tiles, divided by 8. The following data then defines data for that many blocks of 256 bytes, each corresponding to the deinterleaved data for 8 sprite tiles. This data is deinterleaved such that the first 8 bytes are the 8x8 pixels for the least significant bitplane of the tile data, followed by the next three bitplanes. These are decompressed to a buffer at $c500, and then interleaved into the format used by the VDP into another buffer at $c600, before being copied to VRAM.
The data itself consists of flag, length and data runs:
%1nnnnnnn $dd: emit n bytes of RLE value $dd. n = 0 means 256 bytes. %0nnnnnnn $dd $dd ...: emit n bytes of raw data. n = 0 means 256 bytes.
$00 $01
.