So, after getting some very weird results from running Andre's test ROM v2 in my Gorgar, I decided to go and write that compare function that I had glossed over in the first place. And it was a mess.
I wrote the new function and tested it.
And it puked(showed differences)
Oh, ok, maybe something happened and it didn't write out correctly. Reburn.
And it puked again.
And now I had the location nailed down. It consistently wrote the wrong data to location 0x100. That's the hexadecimal form of the number 256. I should have figured it out from that, but I'm slow.
So, now I add some elaborate and slow checks on the write process. It all behaves normally. Compare still puked.
Using the serial interface in the arduino IDE, I could read and write to location 0x100.
But a full write still fucked up. And, watching the output of compare scroll by, it was obvious that it was entire chunks of data that were wrong.
And I think that was about when the light began to dawn.
After having hacked at the arduino firmware and my python script for hours, it suddenly occurred to me that I was likely seeing a byte written later overwriting the original. What if this whole time, I was chasing a hardware bug? I looked at the pin definitions. Nope, that was all correct.
Now, it could only be one more thing: I had to have bridged two pins together when soldering on the pin headers. And it would have to involve pin 8 (because it was breaking at decimal 256, the number of addresses capable of being represented in 8 bits). Sure enough, a minute of checking later, and there is continuity between address pins 8 & 9.
So, always recheck every bit of soldering you do. That's a note for myself.
Anyway, I'll push the new code tonight. I rewrote it to be a bit cleaner, if perhaps a bit slower. It also handles some weirdness with the serial pipe that was causing the "OK" reply to come later than expected sometimes. I suspect a race condition, but now I spin on a reread until I get a valid data chunk. I'll push it out once I finish fixing my soldering job and getting a valid ROM write.