Sounds good, Andrew!
BitWise wrote:
I've rewritten the emulator fairly extensively to fix some memory access edge cases, like reading 16-bit words across page and bank boundaries.
I ran in to this pretty much immediately. I've been uplifting my 6502 simulator to a 65816. It's remarkably different now.
Before, I simply had an Int as the address, and things worked great.
Now I have an Address class to deal with it all, with methods like incPageWrap, and incBankWrap.
In my code every time I would see "address + 1", I had to dive down to understand what address, who was asking and and why to figure out what "+1" really means. Honestly it was a bit exhausting.
You combine the address math shenanigans on top of the 8 vs 16 bit access modes and, boy, the head swims a bit.
I felt like I've been walking on eggs every place I went as I hit each interaction. And I know in some places I just went hands up, stomped the eggs flat, "I'll fix it later" to make progress.
I still have, I dunno, 15-20 instructions to implement, including the big one "XCE".
One routine I have is "setFlagsNZ(value)", I have that everywhere. Ya know what? That doesn't work anymore, as it has to be 16b sensitive...sometimes. Now I have that and setFlagsNZ16(value), setFlagsNZAcc(value), setFlagsNZIndex(value) to handle the use cases.
I just realized I have to go and update my overflow logic too. Whee!
Sometime I think it would have been better to start it over from scratch, but I'm grinding through it.