Hey folks, sorry the description is a bit vague.
I'm reverse engineering Toejam and Earl for the Sega Megadrive
(68K) with the initial aim of making a byte-perfect assembly. Although I'm making good progress I want to tidy up a few instructions that I believe aren't right, but I'm coming to you to see if I am correct in thinking they aren't right.
As mentioned, the code is 68K, and I'm armed with a disassembly created by running 'Disasm.exe' over the entire binary, trace logs I generate on demand as needed via Exodus, and of course opening the ROM itself in a hex editor and viewing the machinecode.
Helpfully the assembler I am using, Easy68K, is more of an IDE and lets you see the machinecode along with the lines that generated them. Sadly it doesn't allow you to do the reverse, enter machinecode and see the resultant line, which would be really useful in this situation.
Here is the section I'm questioning: MOVE.B $0025(A4),$10(A5,D0.W)
This is generating the machinecode: 1BAC 0025 0010
at address 0x3E558.
If I look at address 0x3E558 in my disassembly I see the same line: MOVE.B $0025(A4),$10(A5,D0.W)
however this claims the machinecode is: 1BAC 0025 1000
If I look in the original ROM at address 0x3E558 I can see the value reads 1BAC 0025 1000
. Meaning I am inclined to think MY assembler (or more likely ME) is getting things wrong, I'm just not sure where.
Obviously the original developer didn't use Easy68K when they made the game, so could this just be different assemblers building things slightly differently? If not then what am I missing here?
March 28, 2018, 05:18:40 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Yes! I was right to be concerned!
I just stepped through with Exodus and got the following code: MOVE.B $0025(A4),(A5,D1.W)
Which output the correct machinecode: 1BAC 0025 1000
(For those who didn't spot it, the data register has changed from D0 to D1.)
So it's something I'm going to have to be aware of as I go.