Changing instruction that was misidentified in IDA Pro

71 views Asked by At

I am trying to compare a source code to a disassembled version of a Sega Genesis (68000 processor) game. I ran the binary through IDA Pro to disassemble it, and when I was going through the code and comparing it to the source code, I noticed that IDA Pro's disassembler labeled some instructions improperly. Is there a way to manually correct it? As it is, I cannot compile the disassembled code, because an error regarding that instruction will come up.

IDA Pro identifies the code as the following:

Code

Here is the hex view:

Hex

The hex code is -
01 3C 00 1E 4E 75

The correct instructions should be:

btst d0, #%00011110
rts

Here is a description of the BTST instruction: BTST BTST-2

Additional Information:

Here is the function in the source code:

Findhittype ;look for type of swing (forhand or backhand)
;input d0 = launch dir
;ouput  beq forhand
;   bne backhand
    neg d0
    add facedir(a3),d0
    and #7,d0
    btst    #3,attribute(a3)
    beq .1
    btst    d0,#%11110000
    rts
.1
    btst    d0,#%00011110
    rts

Here is the function in IDA Pro:


; ======S U B R O U T I N E=====================================
ROM:0000C198 ; look for type of swing (forehand or backhand)
ROM:0000C198 ; input d0 = launch dir
ROM:0000C198
ROM:0000C198 Findhittype:      ; CODE XREF: passmode+1B4↑p
ROM:0000C198                   ;ROM:0000C210↓p
ROM:0000C198                 neg.w   d0
ROM:0000C19A                 add.w   $54(a3),d0      ; facedir
ROM:0000C19E                 andi.w  #7,d0
ROM:0000C1A2                 btst    #3,4(a3)     ; attribute bit 3
ROM:0000C1A8                 beq.w   loc_C1B2
ROM:0000C1AC                         d0
ROM:0000C1AE
ROM:0000C1B2
ROM:0000C1B2 loc_C1B2:        ; CODE XREF: Findhittype+10↑j
ROM:0000C1B2                         d0
ROM:0000C1B4                 ori.b   #$75,(a6)+ ; 'u'
ROM:0000C1B4 ; End of function Findhittype

Extended screenshot of function

Screen

Dropbox Link to IDB:

Dropbox Link

0

There are 0 answers