By: Graou Map number X is associated with palettes X, tileset X etc ... A) Tiles, Palettes and Tilesets ---------------------------------------------------------------------------------------------------------------------------------------- Palettes- Palettes Pointers 719A Palettes starts at 727A ---------------------------------------------------------------------------------------------------------------------------------------- Loading 8*8 tiles into the PPU- The game uses tables to load 64 8*8 tiles into PPU. Each level has its own table. A table is made of 96 bytes. Tiles are loaded 4 by 4. Pointers to these tables: 6010h Those tables are beginning just after the pointers. ------------------- The first 64 bytes are the low bits of the tile adress in the graphics bank. tile[64] : 7 6 5 4 3 2 1 0 The last 32 bytes are used to specify the high bits of these adresses and a special loading method. 32 special_bytes[] : d c b a | -->1byte: XY where hinibble X is for tile[n] and lownibble Y for tile[n+1] The highest bit (d) of each nibble indicates if the tile is to load "inversed" (case 1) or not (case 0). normal : the 4 tiles will be loaded as follows: A B C D inversed: C D A B (don't remember very well but it's something like that ^^) The three lower bytes are to be concateneted with the corresponding byte tile[n]. c b a 7 6 5 4 3 2 1 0 This gives you the adress of the tiles to load from the start of the graphics bank. -> load the 4 consecutives 8*8 tiles located at (tile[n]+(X mod 4)*$100) + 10010 into PPU. ---------------------------------------------------------------------------------------------------------------------------------------- Tilesets- Each map uses a tileset composed of $FF (256) 32*32 different tiles. These tiles are made of 4*(16*16) blocks. Each block is made of 4 consecutive 8*8 tiles in PPU. The tileset pointers table begins at $84D9. The first pointer is for map 1, the second one for map 2 ... The tilesets begins at $8810. Each tile uses 7 bytes. AA BB CC DD PP XX YY AA BB CC and DD are the adresses in PPU from where the 4 consecutive 8*8 tiles are read. --- 32*32 tile: AA CC BB DD --- PP contains the palette informations. PP: dd cc bb aa dd: palette index for BB cc: palette index for DD bb: palette index for CC aa: palette index for AA Those palette indexes points to the 4 colors to use for each 16*16 block. (those are the 4 consecutive colors starting from index*4 in the palette) --- XX and YY are "collision bytes". When a bit is set, the corresponding 8*8 block is "solid" --- ---------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------- B) Maps ---------------------------------------------------------------------------------------------------------------------------------------- A map is composed of "screens". A screen is made of 64 32*32 tiles from the map tileset, so a screen uses 64 bytes. One screen can be used more than once, so modifying a screen can alter different places in the map. Each map has a "screen set", a table of pointers to the screens used by the map.(Screen sets are separated by FFFF) Pointer1 Pointer2 etc FFFF A main table points to the different screen sets, it is located at $10. The first pointer points to the map1's screen set. for example, map1 screen set starts at $118 (in a rom with ines header: 08 81 -> 81 08 -> 108 -> 108+10= 118). At $118 we find "00 86", which means that the screen1 starts at $610 in the rom. ---------------------------------------------------------------------------------------------------------------------------------------- The maps screen layout are defined at $8012. For each map, there is a 2 byte pointer to the screen layout (which starts just after this table), followed by 1 byte for the number of screens horizontally and another 1 byte for the number of screens vertically. The screen layout is composed of indexes of the screens to load from the map's Screen set. Screens are ordered, line per line, starting from the top left. ---------------------------------------------------------------------------------------------------------------------------------------- C)Others Starting at $FBC5 seems to be the sprite to PPU loading tables. ex: 0080 00 00 9D 308A ... | | | |_pointer to $10A30 (10A40 in Rom) | | |_ stop at 9D in PPU ? | |_Start filling PPU from Line 0 |_pointer to $10000 (10010 in Rom) Enemy data starts at $EE5B (rom) ex of enemy ID: 00- soldier <-> 01- soldier with shield 02- bomb thrower 13- Flower 16- soldier (up-down) 29- soldier coming from door 3A- Soldier with knife 40- ball 50- Neutral zone entry npc 5A- Giant cyborg soldier 60- Communicator 6E- Power generator (end lvl) 70- Albatross fight effet (screen <>) 72- Bonus 80- Nightfall