   Palette question in Zelda remake
  Hello, I'm reprogramming the original NES zelda in C for fun and practice, and I'm trying to program it as close to the original as I can. I'm using the original tilesets and music/sound, and I've created the world map using a 3 dimentional array [screennumber][tilecolumn][tilerow] with tile id numbers.However, the problem I have is I'm not sure how to program palettes and apply them to the map I have now. I'm fairly new to game programming as I'm sure this is a pretty basic question. I was thinking about making another single array setting a palette number for each screen but it seems that there can be several different palettes on the same screen, so I wonder if I have to do it per tile. Any help or advice would be appreciated.   
  As I recall for the first Zelda, each "terrain type" (and monster) had only two possible pallettes - the orange/red/yellow pallette and the green/blue/purple pallette. It seems likely to me that the original storage format for the map used a single bit for each tile to specify which pallette was used. I'm not certain how this would interact with the terrain re-use that pops up from time to time in the overworld (in dungeons, terrain pallettes are of course specified for the entire dungeon at once).I'm sure that the map format for the first Zelda is somewhere on the Internet; I seem to recall running into a hacked ROM of the game that essentially re-made the world map, which would have required extensive knowledge of this very problem. For your own particular issue, you could just have the pallette mode be a part of the terrain object.   ;  What I was thinking of doing was making another 3 dimentional array similar to the world map one with palette indexes (1 or 2 I suppose, if there really are only two), but I wondered if there was an easier way of doing it.Also I don't quite understand how to actually program them into the game. I suppose just make a palette structure with however many colors are used in the palette and apply them to the "default" colors used in the tileset?   