Attached please find the patches to the code I had to make in order to make bank switching work for the Gameboy/GameboyColor.
a) I didn't change the functionality as it is in the compiler. It works as described in the manual - to the extent it is described at all. That is, I did the minimum changes necessary to make it work.
b) I also removed the start/end extra global symbols which didn't add anything but clutter to the map listing in my opinion.
c) I've used the compiler - with the attached patches on a small test program for the Gameboy as well as a large "real world" program. This program has been run on the VGB simulator and downloaded into a cartridge which supports bank switching. I quite confident that it works as one would hope.
d) Personally, I think that bank switching support could be improved a lot with different bank syntax that would permit bank switching to be resolved at compile time. When I first built my "real" program it was very slow due to bank switching in interrupts (a facility I HAD to have). I was able to resolve it by modest reorganization of my code modules. But with a different system this would not have been necessary. As currently implemented - bank switch calls are made when code is in different modules even though the code is in the same bank.
e) Needs to be added to the documentation:
"#pragma bank <bank #>" is used to specify that all code and const data in the current module will be placed in the indicated memory bank."
f) The usage of bank switching requires support from the runtime library. Currently, this support is only available in the GameboyDevelopmentKit gbdk. Note that i have my own moderatly modified version of the gbdk which supports this. I would be willing to upload this somewhere - but I'm not sure where to do it.