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

Corrects calculation of [NTSC, 192 line] current row.

This commit is contained in:
Thomas Harte 2018-10-10 22:15:38 -04:00
parent 9f69dbf31a
commit 062b2ae8d3

View File

@ -523,9 +523,9 @@ void TMS9918::set_register(int address, uint8_t value) {
}
uint8_t TMS9918::get_current_line() {
int source_row = (column_ < mode_timing_.line_interrupt_position) ? (row_ + mode_timing_.pixel_lines - 1)%mode_timing_.pixel_lines : row_;
int source_row = (column_ < mode_timing_.line_interrupt_position) ? (row_ + mode_timing_.total_lines - 1)%mode_timing_.total_lines : row_;
// This assumes NTSC 192-line. TODO: other modes.
if(source_row >= 0xdb) source_row -= 5;
if(source_row >= 0xdb) source_row -= 6;
return static_cast<uint8_t>(source_row);
}