1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Update Master System horizontal counter.

This commit is contained in:
Thomas Harte 2023-04-26 22:49:46 -04:00
parent b5d9586362
commit 6c0feeedb4
2 changed files with 5 additions and 6 deletions

View File

@ -1322,15 +1322,12 @@ bool TMS9918<personality>::get_interrupt_line() const {
// TODO: [potentially] remove Master System timing assumptions in latch and get_latched below, if any other VDP uses these calls. // TODO: [potentially] remove Master System timing assumptions in latch and get_latched below, if any other VDP uses these calls.
template <Personality personality>uint8_t TMS9918<personality>::get_latched_horizontal_counter() const { template <Personality personality>uint8_t TMS9918<personality>::get_latched_horizontal_counter() const {
// Translate from internal numbering, which puts pixel output // Translate from internal numbering to the public numbering,
// in the final 256 pixels of 342, to the public numbering,
// which counts the 256 pixels as items 0255, starts // which counts the 256 pixels as items 0255, starts
// counting at -48, and returns only the top 8 bits of the number. // counting at -48, and returns only the top 8 bits of the number.
int public_counter = this->latched_column_ - (342 - 256); int public_counter = this->latched_column_ - LineLayout<personality>::EndOfLeftBorder;
if(public_counter < -46) public_counter += 342; if(public_counter < -46) public_counter += Timing<personality>::CyclesPerLine;
return uint8_t(public_counter >> 1); return uint8_t(public_counter >> 1);
// TODO: above is no longer correct.
} }
template <Personality personality> template <Personality personality>

View File

@ -172,6 +172,8 @@ template <Personality personality> struct Base: public Storage<personality> {
// Set the position, in cycles, of the two interrupts, // Set the position, in cycles, of the two interrupts,
// within a line. // within a line.
//
// TODO: redetermine where this number came from.
struct { struct {
int column = 313; int column = 313;
int row = 192; int row = 192;