Sonic and Sega Retro Message Board: HEX2ASM - Sonic and Sega Retro Message Board

Jump to content

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

HEX2ASM Because it had to be done

#1 User is offline Selbi 

Posted 12 December 2010 - 11:52 AM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
Something I hate about Hex editors is, that I can't do a lot of things I could do in normal text editors. If I'm pissed so much of using them, I always dig out IDA to convert the Hex into an ASM array (with dc.X commands). This, however, is annoying as well, so I decided to make a tiny program for it.

Running the original menutext.bin file through it (level select text) looks like this:


And the output looks like this:
Syntax Highlighted Code: ASM
		dc.b	$17,$22,$15,$15,$1E,$FF,$18,$19,$1C,$1C,$FF,$10,$1F,$1E,$15,$FF,$FF,$23,$24,$11,$17,$15,$FF,$01
dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$23,$24,$11,$17,$15,$FF,$02
dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$23,$24,$11,$17,$15,$FF,$03
dc.b $1C,$11,$12,$0F,$22,$19,$1E,$24,$18,$FF,$10,$1F,$1E,$15,$FF,$FF,$FF,$23,$24,$11,$17,$15,$FF,$01
dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$23,$24,$11,$17,$15,$FF,$02
dc.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$23,$24,$11,$17,$15,$FF,$03
...



Download: http://selbi.hapisan.com/HEX2ASM.exe


Usage: Just drag'n'drop a file on it. The rest should be pretty obvious. Also download .NET Framework if you don't have it already!


Special Thanks to MarkeyJester for a 5 minutes beta testing!

#2 User is offline sonicblur 

Posted 12 December 2010 - 12:12 PM

  • Posts: 772
  • Joined: 18-February 08
  • Gender:Male
  • Wiki edits:6
What's the advantage of this over .incbin "file.bin"?


#3 User is offline Selbi 

Posted 12 December 2010 - 12:12 PM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
QUOTE (sonicblur @ Dec 12 2010, 06:12 PM)
What's the advantage of this over .incbin "file.bin"?

Technically, there is no. But it's easier to work with this way (at least for me).

#4 User is offline FraGag 

Posted 12 December 2010 - 12:14 PM

  • Posts: 656
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6
This might come in handy... if I can remember that I have it! v.png That's if I do any hacking before completing my own disassembler... I'm not fond of hex editors either, because you can't do any formatting and you can't put any comments (and if an hex editor can do that, that information has to be saved in a separate file anyway).

By the way, you didn't change the copyright and company attributes on your assembly (see Project Properties, it's Assembly Information or something like that). And ugh, VB.NET.

#5 User is offline Hanoch 

Posted 12 December 2010 - 01:05 PM

  • Also known as TheKnock, Birashot
  • Posts: 491
  • Joined: 01-June 08
  • Gender:Male
  • Location:Israel
  • Project:everything
  • Wiki edits:8
Awesome little program, selbi. I always hated to write dc.b over and over again!
But here's what it really should have:

- The ability to read from offests
- If its a music file, create channel indexes (both relative and absolute indexes)

#6 User is offline Selbi 

Posted 12 December 2010 - 01:21 PM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
QUOTE (FraGag @ Dec 12 2010, 06:14 PM)
By the way, you didn't change the copyright and company attributes on your assembly (see Project Properties, it's Assembly Information or something like that).
Totally forget that. Added them and re-uploaded.

QUOTE (Hanoch @ Dec 12 2010, 07:05 PM)
- The ability to read from offests
- If its a music file, create channel indexes (both relative and absolute indexes)
- I thought people are smart enough to highlight and press Del, even though I can do it in future releases of course.
- This program was not designed for music releated stuff but for pretty much anything, which is why I won't make anything special for Sonic Hacking. (I could provide the Source Code though, even though that will make my horrible ways of do things VB.NET public... :V)
This post has been edited by Selbi: 12 December 2010 - 01:25 PM

#7 User is offline FraGag 

Posted 12 December 2010 - 02:14 PM

  • Posts: 656
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6
QUOTE (Hanoch @ Dec 12 2010, 01:05 PM)
- If its a music file, create channel indexes (both relative and absolute indexes)

If it's a music file, use S1SMPS2ASM.

#8 User is offline MarkeyJester 

Posted 12 December 2010 - 02:57 PM

  • GO AHEAD, MAKE MY DAY.
  • Posts: 1547
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
As I said on SSRG, this sir, is one of the several most useful tools I've found to use, you wouldn't believe the number of times I've had to manually copy code from a hex editor and reorganise in the assembler's format.

#9 User is offline Hivebrain 

Posted 15 December 2010 - 02:46 PM

  • Posts: 2413
  • Joined: 15-January 03
  • Gender:Male
  • Location:53.4N, 1.5W
  • Project:HivePal 2.0
  • Wiki edits:6,176
You can copy/paste data straight from a hex editor into asm if you use the "hex" instruction.
Syntax Highlighted Code: ASM
 
hex 0001020304
 


#10 User is offline Selbi 

Posted 15 December 2010 - 03:48 PM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
I've been aware of that, but I don't like it that much. I just use dc.X whenever I can.

#11 User is offline Irixion 

Posted 16 December 2010 - 02:46 AM

  • Posts: 1382
  • Joined: 30-December 04
  • Gender:Male
  • Location:Ontario, Canada
  • Project:Life
  • Wiki edits:152
QUOTE (MarkeyJester @ Dec 12 2010, 02:57 PM)
As I said on SSRG, this sir, is one of the several most useful tools I've found to use, you wouldn't believe the number of times I've had to manually copy code from a hex editor and reorganise in the assembler's format.



This, basically this. Bravo! So simple and yet so handy! smile.png

#12 User is offline Mercury 

Posted 21 December 2010 - 05:50 AM

  • His Name Is Sonic
  • Posts: 1710
  • Joined: 13-November 08
  • Gender:Not Telling
  • Location:Location Location
  • Project:AeStHete
  • Wiki edits:130
I really like this idea, as it's something I coincidentally needed just recently.

However, there are a couple of features I think would be nice:
  • Adding labels to the beginning of each line, so you can find your way around.
  • Adding commented labels at the end of each line, so you can still find your way around if the labels are modified.
  • A progress bar
  • A preview so you can tweak the format before exporting it.
  • Not crashing on my system! =P

I got the urge to code, so I just made a version from scratch with these features myself: hexdc

#13 User is offline Selbi 

Posted 21 December 2010 - 08:32 AM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
Well now that you did that, I doubt that I will need to add those features to my program as well, but I'll probably do it anyway. The progress bar was already done before you posted, but I didn't feel like updating just because of it. v.png

EDIT: Just finished the comments at the end of the line stuff and my StreamWriter, so the update might already come today!
This post has been edited by Selbi: 21 December 2010 - 10:06 AM

#14 User is offline Selbi 

Posted 21 December 2010 - 01:25 PM

  • Tief.Tiefer
  • Posts: 1402
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
Update, v1.1:
  • Data is now directly being written to the output path (using a StreamWriter), rather than storing everything to a variable and then saving it. This allows you to convert huge files in the matter seconds!
  • Added a progress bar.
  • Reading from offsets and setting length (e.g Offset=$0001E000; Length=$2000 bytes).
  • Adding comments at the end of each line, showing you the offset of the first value in that line (Sorry Mercury, labels as well would be... unnecessary).

But I totally have no interests in working on this program anymore. The source is already fucked up so much... it was hard enough to do the things listed above (I even think that there are still bugs releated to words and longwords when reading from offsets and the progress bar only really works when you convert the entire file).


Download: http://selbi.hapisan.com/HEX2ASM-v1.1.exe


That said, here's the source (I'm pretty sure the experienced people in those modern languages will do an epic failpalm now v.png): http://selbi.hapisan.com/HEX2ASM-Source.rar

If anyone has the patience to crawl through this messy code to clean it up, fix the remaining bugs or add more handy features, just go ahead!
This post has been edited by Selbi: 21 December 2010 - 01:26 PM

#15 User is offline SegaLoco 

Posted 21 December 2010 - 09:08 PM

  • W)(at did you say?
  • Posts: 999
  • Joined: 16-August 06
  • Gender:Male
  • Location:Corpus Christi, TX
  • Wiki edits:79
QUOTE (Selbi @ Dec 21 2010, 12:25 PM)
If anyone has the patience to crawl through this messy code to clean it up, fix the remaining bugs or add more handy features, just go ahead!

I'll take you up on that offer. :P

Edit: Ugg...VB, I'll rewrite it in C

Edit2: Okay, here it is: http://www.mediafire.com/?y5unt3vt1td454k

Only thing it doesn't do is the aesthetic arrangement of data like his (I.e. x items on one line) but it does feature start at x offset and only do y lines (note lines, not bytes, I'll implement bytes in a bit *teehee*)

Edit3: Here's the patch for length of bytes, not lines http://www.mediafire.com/?fc5s3z3shknhsps
This post has been edited by SegaLoco: 21 December 2010 - 11:02 PM

Page 1 of 1
    Locked
    Locked Forum

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