1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-30 23:29:08 +00:00

Fixes medium resolution mode.

This commit is contained in:
Thomas Harte 2019-11-06 23:25:36 -05:00
parent ec68bc5047
commit 8aa425c9d8
2 changed files with 16 additions and 5 deletions

View File

@ -264,12 +264,20 @@ void Video::shift_out(int length) {
((output_shifter >> 63) & 1) | ((output_shifter >> 63) & 1) |
((output_shifter >> 46) & 2) ((output_shifter >> 46) & 2)
]; ];
output_shifter = (output_shifter << 1);// & 0xfeffffff; // This ensures that the top two words shift one to the left;
// their least significant bits are fed from the most significant bits
// of the bottom two words, respectively.
shifter_halves[1] = (shifter_halves[1] << 1) & 0xfffefffe;
shifter_halves[1] |= (shifter_halves[0] & 0x80008000) >> 15;
shifter_halves[0] = (shifter_halves[0] << 1) & 0xfffefffe;
++pixel_buffer_.pixel_pointer; ++pixel_buffer_.pixel_pointer;
} }
} else { } else {
while(length--) { while(length--) {
output_shifter = (output_shifter << 1);// & 0xfeffffff; shifter_halves[1] = (shifter_halves[1] << 1) & 0xfffefffe;
shifter_halves[1] |= (shifter_halves[0] & 0x80008000) >> 15;
shifter_halves[0] = (shifter_halves[0] << 1) & 0xfffefffe;
} }
} }
break; break;
@ -284,13 +292,13 @@ void Video::shift_out(int length) {
((output_shifter >> 29) & 4) | ((output_shifter >> 29) & 4) |
((output_shifter >> 12) & 8) ((output_shifter >> 12) & 8)
]; ];
output_shifter = (output_shifter << 1);// & 0xfefefefe; output_shifter = (output_shifter << 1) & 0xfffefffefffefffe;
++pixel_buffer_.pixel_pointer; ++pixel_buffer_.pixel_pointer;
length -= 2; length -= 2;
} }
} else { } else {
while(length) { while(length) {
output_shifter = (output_shifter << 1);// & 0xfefefefe; output_shifter = (output_shifter << 1) & 0xfffefffefffefffe;
length -= 2; length -= 2;
} }
} }

View File

@ -79,7 +79,10 @@ class Video {
int data_latch_position_ = 0; int data_latch_position_ = 0;
uint16_t data_latch_[4]; uint16_t data_latch_[4];
uint64_t output_shifter; union {
uint64_t output_shifter;
uint32_t shifter_halves[2];
};
void shift_out(int length); void shift_out(int length);
void latch_word(); void latch_word();