EASy68K
http://www.easy68k.com/EASy68Kforum/

Disassemble .bin
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1651
Page 1 of 1

Author:  VincentM3E36 [ Tue Oct 02, 2018 10:30 pm ]
Post subject:  Disassemble .bin

Hi everyone,

I disassembled a .bin file and I use EASy68K to try to understand this assembled code but do you know if it is possible to decompile this code to an higher level like C++ ?

If it is not possible I will continue to try to understand this assembled code. Here below a piece of the subroutine "subroutine_1BBE0". I have two questions about it :
- I don't understand the use of "arg_2 = 6" and "arg_7 = $B" in the code. And I don't succeed in testing this code in EASy68K. Can someone explain the use of them and what "move.w arg_2(sp),d0" does ?
- EASy68K doesn't seem to recognize "tbls" instruction. Is it possible to simulate this instruction with EASy68K ?

Code:
ROM:0001BBE0 subroutine_1BBE0: 
ROM:0001BBE0
ROM:0001BBE0 arg_2           =  6
ROM:0001BBE0 arg_7           =  $B
ROM:0001BBE0
ROM:0001BBE0                 clr.l   d0
ROM:0001BBE2                 clr.w   d1
ROM:0001BBE4                 move.w  arg_2(sp),d0
ROM:0001BBE8                 lsl.w   #3,d0
ROM:0001BBEA                 tbls.w  ($4A0BE).l,d0
ROM:0001BBF2                 move.b  arg_7(sp),d1
ROM:0001BBF6                 cmpi.b  #2,d1
ROM:0001BBFA                 beq.w   loc_1BC1E
........................


Thanks for all,
Vincent

Author:  profkelly [ Thu Oct 04, 2018 1:05 pm ]
Post subject:  Re: Disassemble .bin

arg_2 = 6 is probably how the assembler used for this code defined a constant. EASy68K uses EQU:

Code:
arg_2   EQU     6


tbls is an instruction used by the 68331 and 68332 microcontrollers:
https://www.nxp.com/products/processors-and-microcontrollers/additional-processors-and-mcus/coldfire-plus-coldfire/coldfire-microcontrollers-legacy/m683xx/32-bit-microcontroller:MC68331
It is not supported by EASy68K.

Author:  VincentM3E36 [ Thu Oct 04, 2018 5:56 pm ]
Post subject:  Re: Disassemble .bin

Ok thank you. I have another instruction that EASy68K doesn't know and I don't understand with what d0 is added :

Code:
add.l   d0,(a0,d1.w*4)

Author:  profkelly [ Thu Oct 04, 2018 7:08 pm ]
Post subject:  Re: Disassemble .bin

The address modified is A0 + (D1.W * 4).
D0 is added to the data at that address.

Author:  VincentM3E36 [ Thu Oct 04, 2018 7:59 pm ]
Post subject:  Re: Disassemble .bin

Ok thank you but what does "*4" mean in this instruction because EASy68k understands this instruction but without the "*4"

Author:  profkelly [ Thu Oct 04, 2018 11:23 pm ]
Post subject:  Re: Disassemble .bin

Multiply by 4. That syntax is not supported by the 68000. It was added to later versions of the 68K family.

Author:  VincentM3E36 [ Fri Oct 05, 2018 6:20 am ]
Post subject:  Re: Disassemble .bin

Thank you :)

Author:  Obeisance [ Sat Oct 27, 2018 5:45 pm ]
Post subject:  Re: Disassemble .bin

Alternately, I suspect that the 'arg_x' was placed by the disassembler instead of simply leaving the displacement in the assembly notation.

I don't think that variable or data declarations are typically left in binary files. (are they)? What disassembler are you using?

Is the binary that you're analyzing from the car in your username? if so, would you like to talk more about disassembly? I've spent an unfortunate amount of time looking at the assembly code from my (british) car, but have not really found anyone to talk to about it.

edit: nevermind- i found you over on the M3 forum.. this is a rabbit hole that I should probably not go down...

Author:  Obeisance [ Sat Oct 27, 2018 6:02 pm ]
Post subject:  Re: Disassemble .bin

VincentM3E36 wrote:
...do you know if it is possible to decompile this code to an higher level like C++ ?...


I don't think that this is easily done. I could conceive a path to do so if you knew what compiler was used to generate the code, but it's still a tremendous amount of work.

VincentM3E36 wrote:
...[explain] what "move.w arg_2(sp),d0" does ?...


move the 16-bit word 'arg_2' bytes past the stack pointer onto data register D0

Author:  ERIN [ Thu Apr 25, 2019 10:51 am ]
Post subject:  Re: Disassemble .bin

Multiply by 4 is now compatible in newer versions. updated your applications

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/