15 February 2024, 20:58 | #21 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 522
|
I've tried my first export of my Federation of Free Traders project to assembler, and it's painful to say the least. Ghidra clips mnemonic src/dst columns in the export and the asm appears to be corrupted..
The exported asm (sans clipping corruption) doesn't look too far off Amiga syntaxes. I suspect if I spend an hour or two looking into it, and maybe write my own export plugin I can get something out of it.. but still. |
15 February 2024, 21:07 | #22 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 522
|
Here's an example:
Code:
ram:00000930 0ab900008... eori.l #0x8000,(currentDoubleBufferOffsetMay... |
28 February 2024, 08:28 | #23 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 522
|
Ghidra 11.0.1.
How to make a function from a pointer assigned to a table. In Pool of Radiance an affects table is populated with function handlers by affect type as index (I exported my executable with symbols already defined from Resource hence the label names being Resource-created): Code:
002308e6 43 fa f7 14 lea (-0x8ec,PC)=>lbC010FFC,A1 002308ea 23 c9 00 move.l A1,(DAT_00287b26).l 28 7b 26 Code:
/* WARNING: Removing unreachable block (ram,0x0023003e) */ void UndefinedFunction_0022fffc(void) ... Code:
lbC010FFC XREF[1]: SetupAffectTables:002308e6(*) 0022fffc 4e 55 ff fc link.w A5,-0x4 00230000 bf f9 00 cmpa.l (hSPLower).l,SP 28 9d 28 The way I have found to define the standard affect handler function signature is to paste in: Code:
void Affect00E46E (character_s * char_p, effect_s * effect_p, int param_3) Hope this helps someone! Last edited by copse; 29 February 2024 at 22:22. |
29 February 2024, 22:20 | #24 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 522
|
Ghidra 11.0.1.
Here's another minor quirk that doesn't happen too often related to decompilation, local variable types and reuse of stack-based local variables. Code:
byte BuildNearTargets(character_s *char_p,byte max_range) { ... character_s *local_14; ... local_14 = (character_s *)PlayerMapPosX_Thunk4(char_p); local_10 = PlayerMapPosY_Thunk4(char_p); ... if (DAT_0028783a != 0) { for (i = 1; bVar2 = result_count, i <= bVar1; i = i + 1) { local_14 = (&g_character_array)[*(byte *)((int)&g_map_to_background_tile + (uint)i * 3 + 2)]; Related issue: https://github.com/NationalSecurityA...ra/issues/2573 Not a big deal in the scheme of things, but useful to understand. Hope this helps someone! |
01 March 2024, 10:32 | #25 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,355
|
For Ambermoon I believe they wrote an exporter plugin?
But I think you're right exporting wasn't fun and Pyrdacor said numerous times he wanted to leave Ghidra environment following a successfull disassembly and re-assembly and continue working only on the exported files as soon as possible. |
13 March 2024, 06:50 | #26 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 522
|
Ghidra 11.0.1
There's another likely m68k bug in ghidra decompilation, where the first variable of a struct is an array or pointer it will decompile references to later variables in the struct (even outside the fixed array bounds) as relative to that first variable. For example: Code:
struct character_s { char name[14]; ... ushort x; ... } Code:
void f(character_s *char_p) { ... ... (ushort)*(char_p->name + 30) ... ... } |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help disassembling Wicked | moohorse | Coders. Asm / Hardware | 33 | 04 June 2023 22:57 |
Ghidra disassembler / decompiler supports 68000 | mark_k | Coders. Asm / Hardware | 21 | 20 March 2019 12:09 |
Disassembling an A600 | Revival9001 | support.Hardware | 2 | 31 January 2017 07:01 |
Disassembling resource | copse | Coders. General | 1 | 02 April 2012 03:36 |
Disassembling and reassembling | absence | Coders. General | 7 | 22 September 2009 15:30 |
|
|