JohnEarnest / Octo

A Chip8 IDE
MIT License
664 stars 53 forks source link

scroll-up can scroll in pixels which aren't blank #168

Closed koorogi closed 1 year ago

koorogi commented 1 year ago

If there are pixels set near the bottom of the screen and they are scrolled off the bottom with scroll-down, a later scroll-up instruction can scroll those set pixels back onto the screen.

The XO-Chip specification does not describe how scroll-up behaves in this case, so it seemed reasonable to assume that it behaves consistently with the other scroll-* instructions, which always scroll in blank pixels.

It looks like scroll-up and scroll-down always scroll the entire framebuffer, but if this.enableXO is true and this.hires is false, then the framebuffer is larger than the viewport. scroll-down always scrolls blank pixels into the visible area, but can scroll set pixels into the region outside the viewport, which scroll-up can then scroll back into view.

JohnEarnest commented 1 year ago

I agree that the behavior of scroll-up in lores mode was incorrect. Always scrolling in empty pixels is simple and consistent. Please verify the above patch.

JohnEarnest commented 1 year ago

For the record, I have also examined c-octo, and its emulator does not exhibit the mistake this issue identifies; it already appears to correctly scroll in empty pixels.

koorogi commented 1 year ago

Yes, this patch fixes it for me. Thanks!

JohnEarnest commented 1 year ago

Excellent. Thank you for reporting this issue!