mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Adjust layout inner loop.
This commit is contained in:
parent
f22aa6eb36
commit
96896f838c
@ -31,6 +31,8 @@ Base<personality>::Base() :
|
|||||||
// into whether there's a more natural form. It feels unlikely given the diversity of chips modelled.
|
// into whether there's a more natural form. It feels unlikely given the diversity of chips modelled.
|
||||||
|
|
||||||
if constexpr (is_sega_vdp(personality)) {
|
if constexpr (is_sega_vdp(personality)) {
|
||||||
|
// TODO: all these relate to the old line timing; resource and review.
|
||||||
|
|
||||||
mode_timing_.line_interrupt_position = 64;
|
mode_timing_.line_interrupt_position = 64;
|
||||||
|
|
||||||
mode_timing_.end_of_frame_interrupt_position.column = 63;
|
mode_timing_.end_of_frame_interrupt_position.column = 63;
|
||||||
@ -39,13 +41,13 @@ Base<personality>::Base() :
|
|||||||
|
|
||||||
if constexpr (is_yamaha_vdp(personality)) {
|
if constexpr (is_yamaha_vdp(personality)) {
|
||||||
// TODO: start of sync, or end of sync?
|
// TODO: start of sync, or end of sync?
|
||||||
mode_timing_.line_interrupt_position = Timing<personality>::StartOfSync;
|
mode_timing_.line_interrupt_position = 0;//Timing<personality>::StartOfSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish that output is delayed after reading by `output_lag` cycles,
|
// Establish that output is delayed after reading by `output_lag` cycles,
|
||||||
// i.e. the fetch pointer is currently _ahead_ of the output pointer.
|
// i.e. the fetch pointer is currently _ahead_ of the output pointer.
|
||||||
//
|
//
|
||||||
// Start at a random position.
|
// TODO: Start at a random position.
|
||||||
output_pointer_.row = output_pointer_.column = 0;
|
output_pointer_.row = output_pointer_.column = 0;
|
||||||
// output_pointer_.row = rand() % 262;
|
// output_pointer_.row = rand() % 262;
|
||||||
// output_pointer_.column = rand() % (Timing<personality>::CyclesPerLine - output_lag);
|
// output_pointer_.column = rand() % (Timing<personality>::CyclesPerLine - output_lag);
|
||||||
@ -508,43 +510,40 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
|||||||
output_sync(Timing<personality>::CyclesPerLine);
|
output_sync(Timing<personality>::CyclesPerLine);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Right border.
|
|
||||||
border(0, Timing<personality>::EndOfRightBorder);
|
|
||||||
|
|
||||||
// Blanking region: output the entire sequence when the cursor
|
// Blanking region: output the entire sequence when the cursor
|
||||||
// crosses the start-of-border point.
|
// crosses the start-of-border point.
|
||||||
if(
|
if(
|
||||||
this->output_pointer_.column < Timing<personality>::StartOfLeftBorder &&
|
this->output_pointer_.column < LineLayout<personality>::EndOfLeftErase &&
|
||||||
end_column >= Timing<personality>::StartOfLeftBorder
|
end_column >= LineLayout<personality>::EndOfLeftErase
|
||||||
) {
|
) {
|
||||||
output_blank(Timing<personality>::StartOfSync - Timing<personality>::EndOfRightBorder);
|
output_sync(LineLayout<personality>::EndOfSync);
|
||||||
output_sync(Timing<personality>::EndOfSync - Timing<personality>::StartOfSync);
|
output_blank(LineLayout<personality>::StartOfColourBurst - LineLayout<personality>::EndOfSync);
|
||||||
output_blank(Timing<personality>::StartOfColourBurst - Timing<personality>::EndOfSync);
|
output_default_colour_burst(LineLayout<personality>::EndOfColourBurst - LineLayout<personality>::StartOfColourBurst);
|
||||||
output_default_colour_burst(Timing<personality>::EndOfColourBurst - Timing<personality>::StartOfColourBurst);
|
output_blank(LineLayout<personality>::EndOfLeftErase - LineLayout<personality>::EndOfColourBurst);
|
||||||
output_blank(Timing<personality>::StartOfLeftBorder - Timing<personality>::EndOfColourBurst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Border colour for the rest of the line.
|
// Border colour until beginning of right erase.
|
||||||
border(Timing<personality>::StartOfLeftBorder, Timing<personality>::CyclesPerLine);
|
border(LineLayout<personality>::EndOfLeftErase, LineLayout<personality>::EndOfRightBorder);
|
||||||
|
|
||||||
|
// Right erase.
|
||||||
|
if(this->output_pointer_.column == Timing<personality>::CyclesPerLine) {
|
||||||
|
output_blank(Timing<personality>::CyclesPerLine - LineLayout<personality>::EndOfRightBorder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Right border.
|
|
||||||
border(0, Timing<personality>::EndOfRightBorder);
|
|
||||||
|
|
||||||
// Blanking region.
|
// Blanking region.
|
||||||
if(
|
if(
|
||||||
this->output_pointer_.column < Timing<personality>::StartOfLeftBorder &&
|
this->output_pointer_.column < LineLayout<personality>::EndOfLeftErase &&
|
||||||
end_column >= Timing<personality>::StartOfLeftBorder
|
end_column >= LineLayout<personality>::EndOfLeftErase
|
||||||
) {
|
) {
|
||||||
output_blank(Timing<personality>::StartOfSync - Timing<personality>::EndOfRightBorder);
|
output_sync(LineLayout<personality>::EndOfSync);
|
||||||
output_sync(Timing<personality>::EndOfSync - Timing<personality>::StartOfSync);
|
output_blank(LineLayout<personality>::StartOfColourBurst - LineLayout<personality>::EndOfSync);
|
||||||
output_blank(Timing<personality>::StartOfColourBurst - Timing<personality>::EndOfSync);
|
output_default_colour_burst(LineLayout<personality>::EndOfColourBurst - LineLayout<personality>::StartOfColourBurst);
|
||||||
output_default_colour_burst(Timing<personality>::EndOfColourBurst - Timing<personality>::StartOfColourBurst);
|
output_blank(LineLayout<personality>::EndOfLeftErase - LineLayout<personality>::EndOfColourBurst);
|
||||||
output_blank(Timing<personality>::StartOfLeftBorder - Timing<personality>::EndOfColourBurst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Left border.
|
// Left border.
|
||||||
border(Timing<personality>::StartOfLeftBorder, this->draw_line_buffer_->first_pixel_output_column);
|
border(LineLayout<personality>::EndOfLeftErase, this->draw_line_buffer_->first_pixel_output_column);
|
||||||
|
|
||||||
#define draw(function, clock) { \
|
#define draw(function, clock) { \
|
||||||
const int relative_start = from_internal<personality, clock>(start - this->draw_line_buffer_->first_pixel_output_column); \
|
const int relative_start = from_internal<personality, clock>(start - this->draw_line_buffer_->first_pixel_output_column); \
|
||||||
@ -588,9 +587,12 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
|||||||
|
|
||||||
#undef draw
|
#undef draw
|
||||||
|
|
||||||
// Additional right border, if called for.
|
// Right border.
|
||||||
if(this->draw_line_buffer_->next_border_column != Timing<personality>::CyclesPerLine) {
|
border(this->draw_line_buffer_->next_border_column, LineLayout<personality>::EndOfRightBorder);
|
||||||
border(this->draw_line_buffer_->next_border_column, Timing<personality>::CyclesPerLine);
|
|
||||||
|
// Right erase.
|
||||||
|
if(this->output_pointer_.column == Timing<personality>::CyclesPerLine) {
|
||||||
|
output_blank(Timing<personality>::CyclesPerLine - LineLayout<personality>::EndOfRightBorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,25 +70,6 @@ template <Personality personality> struct StandardTiming {
|
|||||||
|
|
||||||
/// The final internal cycle at which pixels will be output text mode.
|
/// The final internal cycle at which pixels will be output text mode.
|
||||||
constexpr static int LastTextCycle = 334 * CyclesPerLine / 342;
|
constexpr static int LastTextCycle = 334 * CyclesPerLine / 342;
|
||||||
|
|
||||||
// For the below, the fixed portion of line layout is:
|
|
||||||
//
|
|
||||||
// [0, EndOfRightBorder): right border colour
|
|
||||||
// [EndOfRightBorder, StartOfSync): blank
|
|
||||||
// [StartOfSync, EndOfSync): sync
|
|
||||||
// [EndOfSync, StartOfColourBurst): blank
|
|
||||||
// [StartOfColourBurst, EndOfColourBurst): the colour burst
|
|
||||||
// [EndOfColourBurst, StartOfLeftBorder): blank
|
|
||||||
//
|
|
||||||
// The region from StartOfLeftBorder until the end is then filled with
|
|
||||||
// some combination of pixels and more border, depending on the vertical
|
|
||||||
// position of this line and the current screen mode.
|
|
||||||
constexpr static int EndOfRightBorder = 15 * CyclesPerLine / 342;
|
|
||||||
constexpr static int StartOfSync = 23 * CyclesPerLine / 342;
|
|
||||||
constexpr static int EndOfSync = 49 * CyclesPerLine / 342;
|
|
||||||
constexpr static int StartOfColourBurst = 51 * CyclesPerLine / 342;
|
|
||||||
constexpr static int EndOfColourBurst = 65 * CyclesPerLine / 342;
|
|
||||||
constexpr static int StartOfLeftBorder = 73 * CyclesPerLine / 342;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Provides concrete, specific timing for the nominated personality.
|
/// Provides concrete, specific timing for the nominated personality.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user