Skip to main content
gamedev.net
🔒 Locked

Reverse engineering help?

Started by Vohaul 6 replies 600+ views
Original Post
Vohaul
Vohaul
A project I''m going to be working on will entail the reverse engineering of an old, obscure file format (c64 stuff). I have not been able to track down any details about the format of these files, so I''ve decided to try to reverse engineer it. Can anyone recommend any software (other than a good hex editor) or techniques to help in this process as I''ve never tried it before. I have the original editor for this type of file (c64 program) and hundreds of data files to examine, so no problem there.
LilBudyWizer
LilBudyWizer
HackMan is about the most useful tool you will find. Learn how to use it and it will do everything you need. Other than that pay whoever is providing your emulator to come in for a few weeks and help you get a start on this. If you can''t afford that then I''m inclined to think it isn''t lost source, but no copyright. If it is no copyright then all I can say is respect the rights of others.
Keys to success: Ability, ambition and opportunity.
Monder
Monder
Having a decent diff program will come is useful as well. For example you go into the editor load up a file change one little thing about it(if it was a graphic change one pixel from red to blue for example) then save it as a different file. Use the diff program to see what''s changed. Continue using this process and you should get a good overview of how the file is structured
Stary
Stary
quote:
Original post by Monder
Having a decent diff program will come is useful as well. For example you go into the editor load up a file change one little thing about it(if it was a graphic change one pixel from red to blue for example) then save it as a different file. Use the diff program to see what''s changed. Continue using this process and you should get a good overview of how the file is structured


Well, not a tool but a technique: In some cases the reverse of the above can be useful as well. That is: change a byte or two in a strategic location and see if what you hoped/expected to happen happens.
S1CA
S1CA
Which format are you trying to reverse engineer?

A big plus point you have is that all the C64''s RAM fits in 64k and its CPU is an extended MC 6502 (6510 only maps a few registers to memory differently over the vanilla chip IIRC)

Most formats you''ll find will either be very simple, already reverse engineered (you''d be surprised! - tell us) or very dependent on the hardware (well documented [i.e. $d0xxx oh look hard coded gfx registers])

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Vohaul
Vohaul
You''re right it might be documented already, but I haven''t found any on it.

The files are music files created with COMPUTE!''s Sidplayer:

http://www-personal.umich.edu/~craigch/sidplayer/

They can be found as .mus and .str (not .sid) files, and the whole CGSC collection is here:

http://www.pweighill.btinternet.co.uk/music/

They''re not just machine code rips, they are in some format (commands, notes, lengths, etc) as they are easily loaded, edited and saved by the sidplayer music system editor. A hex dump shows obvious patterns.

I looked at C source code for a sidplayer that will play these, but it just had a chunk of machine code that apparently is just emulated. No help.

I want to write a extractor / converter that will convert these to another format, such as xm, or just midi, or just dump note information to a text file.

S1CA
S1CA
Ah! - SID tunes - the problem is that around 90% of the decent SID tunes aren''t simple sequence+sample or sequence+ADSR setup, many rely on intimate details of the C64 SID chip. In fact, many SID musicians relied on **hardware bugs** relating to the oscillator and modulation modes. And the tunes themselves often contained assembly language subroutines to perform hardware tricks.

- The sequence data should be simple
- The ADSR setup should be fairly easy to generate into samples
- The hardware access/bugs probably requires emulation to be able to generate samples

I''d definately advise getting a Commodore 64 Programmers Reference Guide... As it happens I have one to hand -:

Check your disassembly (most PC emulators should probably provide a way) for the following addresses:

$D400 to $D7FF = SID hardware registers
$D500 to $D7FF = Duplicate image
$DC00 to $DCFF = CIA #1 - timers etc
$DD00 to $DDFF = CIA #2 - timers etc

Pay particular attention to anything hitting $D404 (Voice1 control register), $D407, $D412, $D417 since it may be exploiting hardware bugs (which is why people emulate and leech emulated code rather than trying to generate their own samples ;o)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Vohaul
Vohaul
Well, the thing is these aren''t typical sid tunes ripped from games or whatever. They are data files created by and editable by "COMPUTE!''s Sidplayer Music System". They aren''t sid tunes like those in for example the HVSC, they don''t contain machine code as such, they are just data files, they required a specific player.

If you want to know what I''m talking about, get this:

http://www.funet.fi/pub/cbm/c64/audio/players/musicsys-64.lzh

Unarchive it, throw the files onto a D64 image and load it into a c64 emu. The editor/player is called "sid editor.64" and there are a handful of music files included. It was basically a SID sequencer. I want to know the format of the data files it created.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.