Re: [A85: Re: ]
[Prev][Next][Index][Thread]
Re: [A85: Re: ]
In a message dated 10/13/99 8:24:36 PM MDT, funky_cheeze@usa.net writes:
> i asked jimmy about this once.
> i believe he said that the table is the abs. address, i.e. when you do "ld
> hl,(&whatever)", it does the same as "ld hl,(program_addr)\ld de,(whatever)\
> add hl,de" (that actually is common sense - even i know that.) anyway, i
> believe they're not relative. 'course there's a 50% chance i'm wrong.
Hmmm...well, what I think happens, is that for an instruction like:
Label:
ld hl,(&WhatEver)
The table entry equivalent would be something like:
.dw Label+1
Then Usgard would go through the table, take each address in, say, HL, add
(PROGRAM_ADDR) to HL, then add (PROGRAM_ADDR) to (HL) (ie, add the program's
address to the address *pointed* to by HL). This would be how I'd do
relocation, anyway... To derelocate, of course, you just subtract
(PROGRAM_ADDR) from all the relative addresses in the table.
The thing that gets me is how come the relocation only adds one byte to each
instruction that uses it? I'm thinking maybe this isn't the algorithm used
by Usgard ;)
JayEll
Follow-Ups: