1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Fixes horizontal counter wrapping.

This commit is contained in:
Thomas Harte 2018-10-11 20:37:29 -04:00
parent 52e02db5c8
commit 82b7944599

View File

@ -548,7 +548,7 @@ uint8_t TMS9918::get_latched_horizontal_counter() {
// which makes the 256 pixels the first 256 spots, but starts
// counting at -48, and returns only the top 8 bits of the number.
int public_counter = latched_column_ - 86;
if(public_counter < -48) public_counter += 342;
if(public_counter < -46) public_counter += 342;
return uint8_t(public_counter >> 1);
}