Re: A85: Re: Re: What am I doing wrong?


[Prev][Next][Index][Thread]

Re: A85: Re: Re: What am I doing wrong?




>I have thought of a very simple and effective solution that works
>guarenteed, every time :) I even brought it to Andreas Ess and he agreed
>with me that it was a neat idea.
>You see, in the Usgard relocation table, which is added to the end of the
>program (trust me, I have done much research on this) Each relocation
>pointer points to what it thinks of as a word that needs to be relocated in
>your program.  So, the SRcWiz program replaces all lines with & in them 
>with
>a special label, before it is run through the tasm program.  At the end, a
>special label table file is created by a special invocation of tasm, and 
>the
>string85 program uses these label values as what needs to be in the reloc
>table.  But, since these labels point to a beginning of an instruction, 
>like
>this:
>
>R_5:
>    call MyLabel
>
>if used directly, the loader engine on the calc would adjust the first word
>at that address, meaning the actual call opcode and the first byte of the
>word.  So, what the string85 program does is put an entry into the reloc
>table for the value of the label +1 byte for the call opcode.  for certain
>other instructions, it is +2, but the default is +1.  So, we can use this 
>in
>our programs for .dw tables.
>if we have:
>..dw &Address1
>..dw &Address2
>..dw &Address3
>in our program, srcwiz replaces it with:
>R_1:
>..dw Address1
>R_2:
>..dw Address2
>R_3:
>..dw Address3
>then, when string85 sees those labels, it adds one to there value and 
>stores
>them in the reloc table.  BUT, in this case, since there is no leading
>opcode, the reloc table is wrong, these three relocs point to one byte too
>far from where they shouyld.
>So, to correct this, i simply use this, adding no more bytes whatsoever to
>the code:
>..org $-1
>..dw &Address1
>..dw &Address2
>..dw &Address3
>..org $+1
>
>This simple change makes all those R_N labels srcwiz creates to be wrong, 
>by
>one byte backwords.  So, when string85 adds the one extra byte, the reloc
>table becomes correct again.
>
>very simple, very efficient, and doesnt hurt source readability very much
>either.
>
>-Jonathan Kaus

  Thanks a LOT! Your information has been extremely helpful.
    Sam


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com