English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 19 November 2013, 22:20   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
De-compiler

Hello, is there a C decompiler for the Amiga? There is a game I wish to decompile in order to see its logic and also just for the fun of it. However I do not know what is the best tool for the job.

Last edited by Sim085; 19 November 2013 at 22:56.
Sim085 is offline  
Old 20 November 2013, 06:42   #2
AnimaInCorpore
Registered User
 
Join Date: Nov 2012
Location: Willich/Germany
Posts: 232
I'm afraid there's no such tool.

The best way to understand the logic of a (68k) program is to disassemble it. So assembler knowledge is highly recommended.

Cheers
Sascha
AnimaInCorpore is offline  
Old 21 November 2013, 00:52   #3
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Quote:
Originally Posted by AnimaInCorpore View Post
I'm afraid there's no such tool.

The best way to understand the logic of a (68k) program is to disassemble it. So assembler knowledge is highly recommended.

Cheers
Sascha
If you disassemble something then can you make changes and assemble it again?
Sim085 is offline  
Old 21 November 2013, 11:15   #4
AnimaInCorpore
Registered User
 
Join Date: Nov 2012
Location: Willich/Germany
Posts: 232
Quote:
Originally Posted by Sim085 View Post
If you disassemble something then can you make changes and assemble it again?
Well, yes but most likely you have to do some work before.

The best way is trying to rename all the labels with appropriate names like function name or data type, etc. This makes it really easier to understand the code.

Then have a look at the labels and its addresses. Sometimes there are offsets being used in combination with a label so its seems there's something wrong. Then you need to change the label like in the following example from Galaga 88:

Code:
MFP_KEY_INTERRUPT_HANDLER:
    movem.l %D0-%D1,-(%A7)

    moveq   #0,%D1
    move.b  L_00E88000+0x2F.l,%D1
    bmi.s   L_0002010E

    move.b  KEY_BIT_TRANSLATION_TABLE(%pc,%D1.w),%D1
    move.w  TRANSLATED_KEY_BITS.l,%D0
    bset    %D1,%D0
    move.w  %D0,TRANSLATED_KEY_BITS.l

    movem.l (%A7)+,%D0-%D1

    rte

L_0002010E:
    move.b  KEY_BIT_TRANSLATION_TABLE-0x80(%pc,%D1.w),%D1
    move.w  TRANSLATED_KEY_BITS.l,%D0
    bclr    %D1,%D0
    move.w  %D0,TRANSLATED_KEY_BITS.l

    movem.l (%A7)+,%D0-%D1

    rte

KEY_BIT_TRANSLATION_TABLE:
    dc.b    0x1F
    dc.b    0x08
    dc.b    0x1F
    dc.b    0x1F
    dc.b    0x1F
    dc.b    0x1F
[...]
Please note the red calculated address which has been an own label after the disassembling process. The label address was 128 bytes below the table pointing to a code address which was strange. Leaving this label unchanged is fatal when you add code within those 128 bytes so you need to change it to a label with offset.

However, there are some more requirements like having a non-modifying code but I think this gives you a good idea on the problems you might face. At least this is what I've learned while porting Galaga 88 and Pacmania from the X68000.

Cheers
Sascha
AnimaInCorpore 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
Storm C Compiler 4 XDelusion request.Apps 3 04 August 2012 05:03
amiga c/c++ compiler Fissuras request.Apps 41 18 June 2012 20:50
Pascal compiler bx20 support.Apps 10 20 August 2010 13:45
Lattice C Compiler Help redblade support.Apps 4 21 December 2008 05:57
C compiler raptor_13 Coders. General 14 27 May 2008 09:40

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 23:05.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11472 seconds with 13 queries