binmunge, bihx: SDCC banking hacks
These two tools are the first parts of the hacks to make SDCC generate banked
binaries. It's not a full automatic banker but it's a first step.
sdldz80 is modified to spit out a bihx format, which is a file that contains
lines of the format
XX:Intel IHX - Intel ihex from the : for bank XX
:Intel IHX - Intel ihex for all the banks used
Bxxxx - Inter bank relocation record
Currently it is hard coded to understand the following segments
CODE "bank 1" - banked code
CODE2 "bank 2" - banked code
CODE3 "bank 3" - banked code
VIDEO "bank 3" - banked code
FONT "bank 3" - data
INITIALIZER common - data
DATA common - data
CONST common - data
COMMONMEM common - code
DISCARD "bank 3" - banked (discard) code
calls are patched from CD xx xx to use RST8/16/24 xx xx according to the
bank in question. References to banked objects that are made from data
areas or are JP rather than call instructions are fixed up by changing the
vector to point to a 4 byte stub for each problem case that is of the form
RST xx xx RET.
This generates more stubs than we really need right now. Most of them will go
away if the system call table is moved into its own file and we add some
kind of 'DATA2' segment.