EASy68K  
It is currently Sat Dec 15, 2018 10:08 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Disassemble .bin
PostPosted: Tue Oct 02, 2018 10:30 pm 
Offline

Joined: Tue Oct 02, 2018 10:06 pm
Posts: 4
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


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Thu Oct 04, 2018 1:05 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
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.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Thu Oct 04, 2018 5:56 pm 
Offline

Joined: Tue Oct 02, 2018 10:06 pm
Posts: 4
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)


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Thu Oct 04, 2018 7:08 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
The address modified is A0 + (D1.W * 4).
D0 is added to the data at that address.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Thu Oct 04, 2018 7:59 pm 
Offline

Joined: Tue Oct 02, 2018 10:06 pm
Posts: 4
Ok thank you but what does "*4" mean in this instruction because EASy68k understands this instruction but without the "*4"


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Thu Oct 04, 2018 11:23 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
Multiply by 4. That syntax is not supported by the 68000. It was added to later versions of the 68K family.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Fri Oct 05, 2018 6:20 am 
Offline

Joined: Tue Oct 02, 2018 10:06 pm
Posts: 4
Thank you :)


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Sat Oct 27, 2018 5:45 pm 
Offline

Joined: Sat Jan 09, 2016 9:58 pm
Posts: 22
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...


Top
 Profile  
 
 Post subject: Re: Disassemble .bin
PostPosted: Sat Oct 27, 2018 6:02 pm 
Offline

Joined: Sat Jan 09, 2016 9:58 pm
Posts: 22
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group