24 January 2020, 13:39 | #1 |
Registered User
Join Date: Jun 2016
Location: UK
Posts: 428
|
Disassembler for 68K
What is the best decompiler for 68k? I am reverse engineering the Sidewinder level format and need to look at the code.
I've only ever decompiled my own code for debugging, never anyone else's. What's good for this? Last edited by SpeedGeek; 09 January 2022 at 12:33. Reason: Title correction. |
24 January 2020, 13:45 | #2 |
Registered User
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
|
Decompiler? What you want is a disassembler. Resource is the most used Amiga one, but if you're using WinUAE the debugger might be worth checking out
|
24 January 2020, 14:13 | #3 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
IRA is very good and even has a windows port. IDA 68k is the best but not free
|
24 January 2020, 19:28 | #4 |
Registered User
Join Date: May 2017
Location: Sao Paulo
Posts: 17
|
Ghidra is similar to IDA and runs on various platforms. Disassembles and decompiles 680x0 code from raw bins, amiga hunk, sysv elf, a.out, etc. https://ghidra-sre.org
|
24 January 2020, 22:41 | #5 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
Didn't find where ghidra can load amiga hunk format. Not without extensions it can't.
|
25 January 2020, 12:21 | #6 |
Registered User
Join Date: May 2004
Location: Somewhere secret
Age: 50
Posts: 365
|
Ghidra is probably best if you don't have an IDA Pro licence (*cough*), or you could also try Radare2 (use "Cutter", recently much improved GUI for r2 - this also includes the Ghidra decompiler as a plugin).
For understanding level formats, you'll need both dynamic (WinUAE debugger) + static (tools above) analysis probably. |
25 January 2020, 14:26 | #7 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
I disassembled sidewinder a few years ago, grab it here:
http://franck.charlet.pagesperso-ora...p/side_src.zip Afair, IDA have bugs regarding m68k disassembling (pc relative mode and short variables addressing mode aren't handled correctly). |
25 January 2020, 15:48 | #8 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
yes, IDA isn't suitable if you want to rebuild your app. IRA is much better for this.
|
25 January 2020, 20:58 | #9 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,127
|
I had trouble getting the text mode to work with IRA so that it would add the text into the source files.
Some times I would disassemble a binary with ReSource and then reassemble it and it would be bigger than the origional. I never had that problem with IRA, actually the binary ended up smaller. This problem is highly likely to be me not reading the manual. |
25 January 2020, 21:02 | #10 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
IRA has bugs but I've been using it a lot and it does the job. R means "reassembler"
I remember reassembling BattleChess from IRA disassembly and it worked. It has bugs, but nothing that can't be fixed by post processing. I've already written python scripts to fix some instructions that don't work (BTST #xx,y). I've already written some code to try to recognize text in data. I can dig that up if you're interested. |
26 January 2020, 00:18 | #11 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
You're doing it wrong in both cases. The reassembled binary should have EXACTLY the same size as the original. |
|
26 January 2020, 00:50 | #12 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
|
||
26 January 2020, 01:03 | #13 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Or by reporting them to the authors, as IRA is still under active development.
Quote:
Quote:
Maybe I should make some tutorial how to use IRA, but I hope that it is clear that reassembly is not finished after a single run. You will constantly check the output, change the config file and regenerate. Until the output is perfect. |
||
26 January 2020, 08:54 | #14 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
I can't reproduce the BTST stuff with a simple example. But when I reversed big games with either POTGO tests or blitterwaits (using BTST.B) it sometimes issued DC.W instead.
I also can crash IRA/lock it with some exes. I have to switch to d68k which I don't like that much. I'm using an outdated 2010 version. Will upgrade. A tutorial would be appreciated. As much as this program is appreciated for years |
29 January 2020, 11:31 | #15 |
Registered User
Join Date: Jun 2016
Location: UK
Posts: 428
|
I'll try Ghidra. I guess WinUAE is going to be necessary too.
Fortunately it doesn't look too bad in that it probably just loads the level data into RAM and operates on it from the main loop of the game, so shouldn't be too hard to find with the game running. Sadly I think the original source code for Sidewinder is long gone, which would have made this so much easier. |
29 January 2020, 16:52 | #16 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
I posted the disassembled (with Resource) source code above, perhaps you missed it ?
|
29 January 2020, 17:01 | #17 | |
Registered User
Join Date: Jun 2016
Location: UK
Posts: 428
|
Quote:
For adding all the symbol names in it's easier to work in the disassembler I think. |
|
29 January 2020, 17:17 | #18 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
|
I use to find mainloops all the time for instance to find levelskips or insert CD-music play. I have a good technique with WinUAE. Let me explain.
Play the game and break with shift+F12. First get rid of the case where you're in an interrupt with "fi RTE", then "t". Unless there's a trap within an interrupt, that should get you back in non-VBL part of the game. Note down the value of A7. Then use "fi" instruction to find next RTS and "t" to return from it. See if A7 increases. If it doesn't, that's because the RTS is from a subroutine. So ignore that one. After a few moments, you find the highest A7 value. Means that you're in the main loop. Put breakpoints here and there to find the point beyond which the breakpoint doesn't hit. There's probably a label, and below a BRA to it. |
29 January 2020, 17:25 | #19 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
I realize that i didn't include the .rs (for Resource): http://franck.charlet.pagesperso-ora...mp/side_rs.zip
|
30 January 2020, 13:03 | #20 |
Registered User
Join Date: May 2004
Location: Somewhere secret
Age: 50
Posts: 365
|
Since the first post was about reversing the level format, if the individual levels are loaded from disk I would find the disk loader (search for writes to DFF07E/DSKSYNC, work back to find the loader entrypoint then find references to this) and breakpoint after loading to find what the game does with the loaded data (typically depack it then parse it, so it should be one of the first few subroutines called after loading).
If it doesn't load individual levels (they're all stored in RAM), use typical 'trainer techniques' to find the level counter and then find references to this for the leveldata-handling routines. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disassembler | copse | Coders. General | 86 | 01 January 2023 20:34 |
Peasauce disassembler | copse | Coders. General | 1 | 31 January 2021 20:54 |
IDA Disassembler | BippyM | Coders. General | 36 | 03 October 2018 10:51 |
68K assembler/disassembler syntax | nocash | Coders. Asm / Hardware | 13 | 23 April 2016 00:35 |
A good 68K disassembler | TikTok | request.Apps | 11 | 23 January 2002 03:49 |
|
|