

Stupid NES Tricks – Screen Wrap Detection - dustmop
http://www.dustmop.io/blog/2015/05/20/stupid-nes-tricks-screen-wrap-detection/

======
Aardwolf
> However, the carry flag produces false positives because nearly any negative
> delta will cause a carry to happen.

Correct me if I'm wrong, but I think that when going to the right, the carry
flag indicates that it wrapped, while when going to the left, the carry flag
indicates that it didn't wrap. So the flag is still usable when going to the
left, just interpret it the opposite way. Do you think that's correct?

~~~
davvid
That would work, but that means branching to handle the left/right difference.
The author mentioned that he wants to avoid branching to maximize performance.

Avoiding branching is still relevant on modern machines when optimizing
hotspots, and even moreso as cpu instruction pipelines get longer.

