English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 06 December 2018, 17:15   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: Lija
Posts: 464
Assembly Hex Help

Hello, I have downloaded a hex editor on Windows and opened an Amiga binary file. I have found a string in the binary (ex at location 6E0C7). I now want to find from where that string is referenced.

How do I go about looking for reference to this address location within the rest of the binary?

I tried doing a hex search for 6E0C7 but the search returned no result
Sim085 is offline  
Old 06 December 2018, 17:17   #2
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 44
Posts: 1,134
Send a message via Yahoo to Samurai_Crow
Are you sure the Windows hex editor isn't displaying little endian byte-ordering?
Samurai_Crow is offline  
Old 06 December 2018, 17:31   #3
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 640
This can get fairly tricky and I don't think big vs little endian alone is going to be the problem.

You see, the Amiga binary format (assuming the binary is one you load through Amiga OS and not say a custom a trackloader) does it's utmost best to avoid the use of 'addresses' and 'direct references' because of it's multitasking nature (which means the program can't know in advance at what memory location it runs).

In essence, Amiga OS relocates all code that does use 'direct' addresses when it loads a binary. To support this, Amiga binaries do not store actual addresses, but rather entries in a relocation table and references to these tables. Complicating matters further is that Amiga binaries support many smaller parts, called Hunks. Each of which contains a small part of the program or data. Each of these hunks can have their own style of relocation. It's difficult (though not impossible) to see how many hunks there are visually and decode them using just a HEX editor.

To top it all off, there is yet another problem: there are many ways to get to an address or offset using 68k code so even if the above didn't apply it still would not necessarily be as easy as looking for the address/offset.

There is a lot more to be said about this, but the short version would be that it may be difficult to do this using a HEX editor (due to the relocation done). Perhaps an option is to use WinUAE's debugger and some Amiga tools to find out what part of code references the data and where this code is located in the file?
roondar is offline  
Old 06 December 2018, 17:33   #4
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,407
A windows hex editor shows the same byte order of an Amiga file as an Amiga hex editor, but a windows executable would have a different order.

The problem is that most references to strings are made PC-relative like

LEA string_blabla(PC),A0

....

string_blabla DC.B "blabla",0

You can find these references with a good Amiga disassembler.
PeterK is offline  
Old 06 December 2018, 23:07   #5
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,225
While a disassembler might be sufficient for that task, when you are willing to do some calculations (like PC-relative offsets and relocations) yourself, what you really need here is a reassembler.
phx is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hex Hanzu HOL contributions 2 13 November 2013 17:57
Little hex editing help please Aria support.Games 4 16 June 2011 21:20
Hex Comp mai support.Other 2 28 May 2010 21:00
Hex Editor Retro1234 request.Other 9 24 October 2006 12:03
Hex Editor Help misguided_fool request.Apps 5 22 March 2006 10:53

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06982 seconds with 15 queries