Odd and even byte files merge software needed
Moderator: Moderators
Odd and even byte files merge software needed
Can anyone help with fiding a software that can combine two files that were dumped from two eproms that contained one even and the other odd bytes? Thanks!
Re: Odd and even byte files merge software needed
http://www.lucasforums.com/showpost.php?p=2794290 mentions that WinHex can do this (context: interleaving the MT32 control program from its two 8-bit ROMs) It's also a perl one-liner or C two-liner.jpx72 wrote:Can anyone help with fiding a software that can combine two files that were dumped from two eproms that contained one even and the other odd bytes? Thanks!
Re: Odd and even byte files merge software needed
In Python:
Code: Select all
import io
even = io.open( "even.bin", "rb" ).read()
odd = io.open( "odd.bin", "rb" ).read()
interleaved = "".join( i for j in zip( even, odd ) for i in j )
io.open( "interleaved.bin", "wb" ).write( interleaved )
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Odd and even byte files merge software needed
Thank you guys! The Winhex (winhex.com) did it (Tools > File tools -> Unify -> Bytewise)!
Re: Odd and even byte files merge software needed
qbradq wrote:Python FTW :D
Code: Select all
interleaved = "".join( i for j in zip( even, odd ) for i in j )Surely I can't be the only one looking at that going "what the fuck?" So the next time someone tells me Perl is hard to read, I'm going to point them to that line there. I had a discussion with a fellow programmer last night about that line; he broke it down for me (which helped make more sense out of it), and stated boldly in agreement that yes the syntax is utterly retarded. For those still unable to comprehend the clusterfuck, quoting my peer:
http://wemeantwell.com/blog/wp-content/ ... up_ass.jpgyou have to read it kind of funny. it's equivalent tothe return values get built up into an unnamed list, which becomes the argument to join. the syntax is dumb but the concept is really simpleCode: Select all
for j in zip(even, odd): for i in j: i
Re: Odd and even byte files merge software needed
It's not that Python has no warts; it just has far fewer than, say, PHP.
Re: Odd and even byte files merge software needed
I actually agree, most of the time I'd write it in a more verbose way.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi