|My first question is, how do I change the background that a level uses? I found some info by looking at the disassembly, for example, the table at $05:1922 determines the MAP16 tileset for the background, and a table at $04:92C7 seems to be related.|
The former table is fairly straightforward, but the latter has some discrepancies. For example, 3-1, 3-2, and 3-3 all have entries of 0x27. Yet, 3-3 has a slightly different background, and no snow (6-3 has a similar problem, with entry 0x2B instead, though the lack of snow can be explained this time by the code table at $05:E6DB, more below).
The only code I found related to changing backgrounds on a level-by-level basis is that pointed to by the table at $05:E6DB, which doesn't account for the differences in 3-3 (and 6-3 analogously). It does seem to handle everything else though. My only theory it have to do with the "green platform" setting in the header, though I haven't tested it.
My second question has to do with the level tiles. There are no tiles for the left/right sides of platforms in grass/snow/cave levels (underwater levels don't have this feature, and castle levels do this by extended objects, and there are tiles for them). I don't know if they're generated programmatically, or if the tiles are elsewhere.
If they're stored somewhere, I can't find them, and they don't use the same format as the normal tiles (I tried searching for "0C 0A 1C 0A" in a hex editor and got nothing). If it's done automatically, then it'd be pretty easy I'd imagine, you'd just have to OR the low byte of the tile number with 0x04.
My third question is also about level tiles. In the table at $03:9440, there are 0x150 bytes of extra data after the axe tile (the last tile in the table). I'm not sure what this is for. Anyone know?