1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Set pixel count per mode.

This commit is contained in:
Thomas Harte 2023-01-08 21:31:00 -05:00
parent 794adf470b
commit ef67205ce8
3 changed files with 7 additions and 5 deletions

View File

@ -272,12 +272,14 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
// Based on the output mode, pick a line mode.
next_line_buffer.first_pixel_output_column = Timing<personality>::FirstPixelCycle;
next_line_buffer.next_border_column = Timing<personality>::CyclesPerLine;
next_line_buffer.pixel_count = 256;
this->mode_timing_.maximum_visible_sprites = 4;
switch(this->screen_mode_) {
case ScreenMode::Text:
next_line_buffer.line_mode = LineMode::Text;
next_line_buffer.first_pixel_output_column = Timing<personality>::FirstTextCycle;
next_line_buffer.next_border_column = Timing<personality>::LastTextCycle;
next_line_buffer.pixel_count = 240;
break;
case ScreenMode::SMSMode4:
next_line_buffer.line_mode = LineMode::SMS;
@ -418,9 +420,8 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
if(!this->asked_for_write_area_) {
this->asked_for_write_area_ = true;
// TODO: how many pixels across is this mode?
this->pixel_origin_ = this->pixel_target_ = reinterpret_cast<uint32_t *>(
this->crt_.begin_data(256)
this->crt_.begin_data(line_buffer.pixel_count)
);
}
@ -435,8 +436,8 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
}
if(end == line_buffer.next_border_column) {
const int length = 256;//line_buffer.next_border_column - line_buffer.first_pixel_output_column; // TODO: proper number of pixels, as above.
this->crt_.output_data(this->clock_converter_.to_crt_clock(length), size_t(length));
const int length = line_buffer.next_border_column - line_buffer.first_pixel_output_column;
this->crt_.output_data(this->clock_converter_.to_crt_clock(length), line_buffer.pixel_count);
this->pixel_origin_ = this->pixel_target_ = nullptr;
this->asked_for_write_area_ = false;
}

View File

@ -101,6 +101,7 @@ struct LineBuffer {
*/
int first_pixel_output_column = 94;
int next_border_column = 334;
size_t pixel_count = 256;
// An active sprite is one that has been selected for composition onto
// this line.

View File

@ -743,7 +743,7 @@ class ConcreteMachine:
};
CPU::Z80::Processor<ConcreteMachine, false, false> z80_;
JustInTimeActor<TI::TMS::TMS9918<TI::TMS::Personality::V9938>> vdp_;
JustInTimeActor<TI::TMS::TMS9918<TI::TMS::Personality::TMS9918A>> vdp_;
Intel::i8255::i8255<i8255PortHandler> i8255_;
Concurrency::AsyncTaskQueue<false> audio_queue_;