The generated map file (-m) contains all symbol values, including public constants which are not address related so you may have to be careful to weed those out. This is a snippet from a map file for a game compiled for the sega master system; it's 256k:
All those symbols are at $8000 but actually they are in different memory banks. This information is not in the map file - those names "bank4", etc, are filenames not banking information.
Code: Select all
_barromx = $8000 ; G fixedbank_c _bigmonster_psgcompr = $8000 ; G bank9 _boss_psg = $8000 ; G bank4 _gameover_psg = $8000 ; G bank12 _selector_psg = $8000 ; G bank10 _stage1_psg = $8000 ; G bank5 _stage1animtilesa_bin = $8000 ; G bank8 _stage2_psg = $8000 ; G bank2 _stage3_psg = $8000 ; G bank7 _stage4_psg = $8000 ; G bank3 _stage6_psg = $8000 ; G bank6 _stage8animtilesb_bin = $8000 ; G bank11
What the tools are doing is using special SECTION names to identify when code is destined for a different bank. So if "BANK_XX" where XX is in hex appears within a section name, that section is understood to be in BANK XX which is up to 64k in size. appmake, which generates large files for the target system, gets section names from the output binary names and the corresponding start address for the section from the map file.
On the spectrum, the 128's memory banks are defined as "BANK_00" through "BANK_07". For the Next things will be different.
So I think the section name may have to be added to the map file so that you can separate symbols from different banks and then sort those so that you have them in ascending order in each bank. Then it's a matter of knowing which bank is active to know which sorted list is active and then you can compare PC to the symbols to find out where you are. The filename in the map file will lead you to the corresponding .lis file containing the asm or translated asm with c source in as comments. The closest symbol name to PC will lead you to the right place in the .lis file.
I'm not sure if there should be a specific type of file generated to make things more convenient.