Codetapper's Amiga Site


The Mask value will perform a bit-wise AND operation on each tile index. For example, to mask out the bottom 12 bits of a word map, you would enter $fff as the mask. The highest 4 bits will become 0.

Why on earth would you want to do this? Some games use some of the bits to store extra information about each tile. Examples include setting a specific bit to draw the tile upside-down, specifying that the tile will collapse when walked on, or that that a particular enemy will spawn from that location.

The most logical way to store maps in games is to create an array of the tile numbers. For example, a small 5 by 4 map might look like this:

$11, $12, $13, $14, $15
$21, $22, $23, $24, $25
$31, $32, $33, $34, $35
$41, $42, $43, $44, $45

But if the game uses the highest 4 bits for other purposes, it may look like the following:

$8011, $12, $2013, $4014, $15
$c021, $22, $23, $24, $25
$f031, $f032, $33, $2034, $35
$f041, $f042, $c043, $8044, $1045

This poses a real problem for map ripping as the tile indexes will be difficult to locate, and the high bits need to be reset to 0 before drawing the map.

The program comes with a sophisticated map search function that will attempt to calculate the correct Mask and Shift values automatically.

When it comes time to display the map, you need to remove the extra bits, otherwise the wrong tiles will be drawn. This is where the Mask value is useful. In this example, if we specify $fff as the Mask value, each tile index will have a bit-wise AND operation performed on it, which will remove the 4 high bits and replace them with 0. The first tile would be read from memory ($8011), and masked with $fff to give $11, which is the actual tile number.

Post your comment


No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

You may enjoy these articles...



If you look inside many Amiga games, secret messages have been hidden by the programmers. Richard Aplin was the king of hiding messages in the startup-sequence file, and his Line of Fire and Final Fight startup-sequences have become legendary! The Sensible Software team were also prolific at hiding messages in their games.



A collection of technical interviews with Amiga programmers that worked on commercial software in the glory days of the Amiga (late 1980s to early 1990s!)



The Ultimate Amiga Graphics, Level and Map Ripper!


Random Rants

A random assortment of rants relating to the Amiga!


Sprite Tricks

An explanation of how many famous Amiga games utilised sprites in weird and interesting ways