Sonic and Sega Retro Message Board: 68k instruction fix for IDA Pro - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

68k instruction fix for IDA Pro Now it actually works in 6.8+!

#1 User is offline kazblox 

Posted 01 May 2015 - 03:08 PM

  • Posts: 120
  • Joined: 20-August 14
  • Gender:Male
  • Project:Sonic 3?
The current(?) versions of IDA Pro have yet to correct a problem where the 68000 disassembler module does not reference to the program counter in some instructions, breaking bit perfect builds. A patch by drx for IDA 5.x has been released years back, but only patches some cases. A fix is provided below:

FIX:

Quote

Note:

Download: http://pastebin.com/eFHu3w4U

If anything goes wrong while using this script in versions earlier than 6.8, use this as an alternative instead:
http://pastebin.com/FaSurKKx

Fix made and distributed by Flamewing. Cross-compatible, because, since it's a script, it works with all future versions of IDA. Doesn't appear to work in 5.x series.

Instructions-
1. Save it as "AddrFixup.idc" somewhere you will remember
2. When exporting the IDB to text, run the script (File -> IDC File...). The script is safe for running it multiple times in the same disassembly.


This post has been edited by kazblox: 24 March 2017 - 07:29 PM

#2 User is offline flamewing 

Posted 01 May 2015 - 04:10 PM

  • Emerald Hunter
  • Posts: 1113
  • Joined: 11-October 10
  • Gender:Male
  • Location:🇫🇷 France
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
I have been meaning to release this; guess this is as good a place as any.

I have come up with a better solution than drx's fix: using an idc script. Save this file as "AddrFixup.idc" somewhere you will remember; then, at any point you want (preferably before exporting to text) run the script (File -> IDC File...). The script is safe for running it multiple times in the same disassembly.

My script handles all problem opcodes:
	jmp	(XXX).w
	jmp	(XXX).l
	jmp	XXX(pc)
	jsr	(XXX).w
	jsr	(XXX).l
	jsr	XXX(pc)
	lea	XXX(pc)
	pea	XXX(pc)

As can be seen, this includes opcodes not handled by drx's hack. But eh more important part is that the script works for all future versions of IDA as well, instead of being restricted to 5.x.

#3 User is offline kazblox 

Posted 01 May 2015 - 04:33 PM

  • Posts: 120
  • Joined: 20-August 14
  • Gender:Male
  • Project:Sonic 3?

View Postflamewing, on 01 May 2015 - 04:10 PM, said:

<br/>I have been meaning to release this; guess this is as good a place as any.<br/><br/>I have come up with a better solution than drx's fix: using an idc script. Save <a href='http://pastebin.com/FaSurKKx' class='bbc_url' title='External link' rel='nofollow external'>this file</a> as &quot;AddrFixup.idc&quot; somewhere you will remember; then, at any point you want (preferably before exporting to text) run the script (File -&gt; IDC File...). The script is safe for running it multiple times in the same disassembly.<br/><br/>My script handles all problem opcodes:<br/>
&nbsp;&nbsp;&nbsp; jmp&nbsp;&nbsp;&nbsp; (XXX).w<br/>
&nbsp;&nbsp;&nbsp; jmp&nbsp;&nbsp;&nbsp; (XXX).l<br/>
&nbsp;&nbsp;&nbsp; jmp&nbsp;&nbsp;&nbsp; XXX(pc)<br/>
&nbsp;&nbsp;&nbsp; jsr&nbsp;&nbsp;&nbsp; (XXX).w<br/>
&nbsp;&nbsp;&nbsp; jsr&nbsp;&nbsp;&nbsp; (XXX).l<br/>
&nbsp;&nbsp;&nbsp; jsr&nbsp;&nbsp;&nbsp; XXX(pc)<br/>
&nbsp;&nbsp;&nbsp; lea&nbsp;&nbsp;&nbsp; XXX(pc)<br/>
&nbsp;&nbsp;&nbsp; pea&nbsp;&nbsp;&nbsp; XXX(pc)
<br/>As can be seen, this includes opcodes not handled by drx's hack. But eh more important part is that the script works for all future versions of IDA as well, instead of being restricted to 5.x.<br/>
<br/><br/><br/>

The problem opcodes are all fixed in Ti_'s patch. drx's only fixes lea and pea.

But for those who are using future versions of IDA, use flamewing's script above.

#4 User is offline kazblox 

Posted 09 October 2016 - 12:11 PM

  • Posts: 120
  • Joined: 20-August 14
  • Gender:Male
  • Project:Sonic 3?
Removed the IDA 5.x fix because Retro broke the link and I lost the file. Who still uses IDA 5, anyway?

EDIT:
http://ralakimus.bye...ic/IDA/mc68.w32

Well, here it is. I wouldn't recommend recommend going back to IDA 5 now due to the bugfixes and many feature improvements in the UI, but the instructions are same as before. Place it where the original mc68.w32 lies (procs folder in IDA 5's Program Files directory).
This post has been edited by kazblox: 09 October 2016 - 01:05 PM

#5 User is offline kazblox 

Posted 24 March 2017 - 07:30 PM

  • Posts: 120
  • Joined: 20-August 14
  • Gender:Male
  • Project:Sonic 3?
I have updated the top of the post to include a newer update to the script that works in future versions of IDA starting from 6.8.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users