Tue Feb 6 16:48:07 GMT 2007
alright. the assembler. finding instructions is the trivial part. the
hard part is finding addresses of jumps.
1. resolve backward references (+ find instructions)
2. resolve forward references
if there are multiple size jump instructions, and there are relative
and absolute jumps, extra passes can be added that resolve efficient
allocation of these. allocating all forward references with maximum
range, and adjusting them one by one seems to be the best approach:
3-N. shrink forward references if necessary.
things get complicated if forward small offset relative jumps are used
in compilation, since constructs to work around this are necessary. i
need to find a way to abstract this kind of behaviour. basicly mappinng
or the other way around. for PIC18 going from B to A reduces the jump
distance by 2, since the long jump is eliminated.
it can probably be just kept at 1 & 2 for now, with all jumps equal
size, and fix that later.