03 February 2012, 10:58 | #1 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
question on resourcing relative addressing
Hi,
This is not a programming question. It's a question about the easiest solution for a (in my eyes) quite common problem in disassembling. I have a program file here that I want to re-source (with ReSource). As usual, the program allocates a memory block for its global data and stores the pointer in a5. Data is addressed relatively to a5, for example: Code:
... jsr OpenMainWindow move.l a0,$4(a5) ... move.l $4(a5),a0 jsr CloseMainWindow ... (and a lot of other references to other global data fields) ... If a5 pointed to a location inside the code, it would be easy. Just use the builtin functionalities of Resource for base addresses (in the "*" menu). But a5's location is not known, so I cannot set the base address. Can I have something similar for my case? I have taken a look at the documentation about custom symbol bases, but this seems to be quite cumbersome because my knowledge about the structure of the global data continuously changes when reading the code. |
03 February 2012, 12:18 | #2 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Defining your own symbol base could be the best option. But with that, you'd need to manually change each (xxx,a5) reference. (That wouldn't necessarily be very hard, you could use a macro to automate it.)
A hack/workaround would be to add a BSS hunk to the program executable. The BSS hunk size would be at least the size of the data A5 points to. Then you can tell ReSource to use A5 as base register with origin at the start of the BSS hunk. |
03 February 2012, 12:23 | #3 | |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
Quote:
|
|
03 February 2012, 18:16 | #4 | |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
Quote:
|
|
03 February 2012, 20:34 | #5 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Good work. Probably the easiest way to modify the executable for that would be to increase the length of one of its hunks (which is stored near the start of the file). Though perhaps neater/clearer would be to actually add a separate hunk (as opposed to making a BSS area at the end of a code or data hunk). That would require a little more hacking with the hex editor since you'd need to add the new hunk header etc.
|
04 February 2012, 23:42 | #6 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to have portable configuration, relative paths relative to C:\Public\... ? | Turrican | support.WinUAE | 3 | 24 June 2011 16:33 |
Memory addressing | CmdrVimes | Coders. General | 7 | 25 October 2010 22:20 |
Relative paths | Toni Wilen | request.UAE Wishlist | 0 | 16 August 2009 16:06 |
Memory Addressing Architecture | Zetr0 | support.Hardware | 2 | 10 July 2007 16:55 |
Addressing modes | BippyM | Coders. General | 17 | 03 February 2005 09:57 |
|
|