Re: Constructing a relocation page table

From: Andre Fachat (afachat_at_gmx.de)
Date: 2003-04-28 21:58:59

Hi Marko,

Marko Mäkelä wrote:
> specify an alternative loading address for the machine code, with 256 bytes
 
> Now, the problem is: how can I produce a list of all locations that need
> to be patched?  If I remember correctly, the CS-DOS code (a C128 shell
> extension made by Chris Smeets) does this by assembling the code at two
> different offsets and comparing the resulting binaries.  Is there a more
> "intelligent" way?  I'd like to use André Fachat's xa, but porting the
> code to the assembler of the cc65 compiler suite is not out of the question.

I guess you mean "is out of the question" :-)
I would not recommend reusing the xa code either for any new project,
as it is a mess and should be rewritten.

It should, however, not be too difficult to implement an algorithm in
the
assembler that creates an o65 file (or any other relocatable file for
that
matter), similar to the algorithm in xa (which is better than it's 
actual implementation....)

The base algorithm in xa works somewhat like:
1) in pass 1, when building the label table, note which offset 
the lables points to relative to the segment start
2) in pass 2, when assembling the actual code and refering to the 
labels, write an entry into a temporary relocation table
3) after pass 2, write the temporary relocation table to the file.

Well, that is assuming you want to have the relocation table at the end
of the file, but I think the o65 file format description shows the
advantages in that.... ;-)

But then again - does the cc65 assembler not already produce 
o65 files? A relocator for o65 is pretty easy to write, IIRC
xa comes with a sample implementation.

Andre

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.