I have an idea I am playing with, it has a simple proof of concept thrown together and I plan on expanding it more as I think it will be a useful tool. Whilst I do so I thought I'd throw it to the hounds for criticism as I continue with it. Regardless of the outcome of this thread, short of someone showing me it already exists, I'll likely finish it off as it is useful for what I'm working on at the moment.
Let me provide you with an example of the results:
This is an example of my hand made notes:
And this is an example of my programs automated notes:
It may not look like much but the automated output you see here is on the fly(ish) output generated whilst playing through Toejam and Earl in Gens. The handmade notes took me several hours to make, the automated ones a few moments. Note as well that the automated output has code I haven't even looked at yet. Sure, I don't have the understanding I do of the hand annotated code which is a large part of understanding the game but once I'm done it will be much easier to learn from. That instruction at 032E looks pretty suspect as well.
How it works is pretty simple, it reads the trace file whilst it is being written to by GENS and stores each line in a hashmap keyed by address along with the full line as the value meaning it only stores each line once (re-writing the line if it is seen again). Once you quit out it sorts the contents of the map by address and then writes all the lines out to file, adding a newline when it sees a RTE or s RTS, simple.
I'm planning to expand it, the following ways are what I have in mind at the moment:
- Output compilable code (as you can see it is currently raw lines from the trace file)
- Switch out addresses in jump statements with labels
- Capture and output data blocks (Currently ignored as obviously not seen in trace files)
- Add timestamps of when code was seen (perhaps relative to start time, perhaps both)
- Add more Megadrive specific analysis (highlight joypad reads, VRAM writes)
Anyone got any thoughts on this?