1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 23:32:28 +00:00

Fix border lengths.

This commit is contained in:
Thomas Harte 2023-01-08 17:04:19 -05:00
parent cb19c2ffb0
commit b522d65c50

View File

@ -470,23 +470,31 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
} }
template <Personality personality> template <Personality personality>
void Base<personality>::output_border(int cycles, uint32_t cram_dot) { void Base<personality>::output_border(int cycles, [[maybe_unused]] uint32_t cram_dot) {
cycles *= 4; cycles = this->clock_converter_.to_crt_clock(cycles);
const uint32_t border_colour = const uint32_t border_colour =
is_sega_vdp(personality) ? is_sega_vdp(personality) ?
master_system_.colour_ram[16 + background_colour_] : master_system_.colour_ram[16 + background_colour_] :
palette[background_colour_]; palette[background_colour_];
if constexpr (is_sega_vdp(personality)) {
if(cram_dot) { if(cram_dot) {
uint32_t *const pixel_target = reinterpret_cast<uint32_t *>(crt_.begin_data(1)); uint32_t *const pixel_target = reinterpret_cast<uint32_t *>(crt_.begin_data(1));
if(pixel_target) { if(pixel_target) {
*pixel_target = border_colour | cram_dot; *pixel_target = border_colour | cram_dot;
} }
// Four CRT cycles is one pixel width, so this doesn't need clock conversion.
// TODO: on the Mega Drive it may be only 3 colour cycles, depending on mode.
crt_.output_level(4); crt_.output_level(4);
cycles -= 4; cycles -= 4;
} }
}
if(!cycles) {
return;
}
if(cycles) {
// If the border colour is 0, that can be communicated // If the border colour is 0, that can be communicated
// more efficiently as an explicit blank. // more efficiently as an explicit blank.
if(border_colour) { if(border_colour) {
@ -499,7 +507,6 @@ void Base<personality>::output_border(int cycles, uint32_t cram_dot) {
crt_.output_blank(cycles); crt_.output_blank(cycles);
} }
} }
}
template <Personality personality> template <Personality personality>
void TMS9918<personality>::write(int address, uint8_t value) { void TMS9918<personality>::write(int address, uint8_t value) {