TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.21k stars 385 forks source link

Neshawk Tracelogger no longer prints incorrect addresses if a branch would overflow/underflow the PC #3964

Closed 100thCoin closed 4 months ago

100thCoin commented 4 months ago

This casts the value being printed to a ushort in order to prevent it from reading $10000 or $FFFFFFFF

This fixes #3963

Before: TraceloggerBugExample

After: TraceloggerBugFix

nattthebear commented 4 months ago

This seems correct per the answers to https://stackoverflow.com/questions/15674560/6502-relative-address-mode-wrapping, and the referenced visual 6502 behavior.

I don't think this is the "correct" way of doing that

What exactly do you mean?

YoshiRulz commented 4 months ago

It's being implicitly widened by the addition, then truncated. I believe if the operands were truncated to u16 first then the addition would also overflow (unchecked is still the default...), producing the same result. But the language's type inference fights you every step of the way.

nattthebear commented 4 months ago

I believe if the operands were truncated to u16 first then the addition would also overflow

The result of ushort + ushort in C# is int, and cannot carry, overflow, wrap, or anything like that, so I'm not sure what you're proposing.