mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-13 22:32:03 +00:00
It appears the Vic's output is sine-ish, after all. Also adjusted centre of display, simultaneously adding some validation on that.
This commit is contained in:
parent
fdc854c0c2
commit
c18cc4c8f5
@ -25,8 +25,8 @@ MOS6560::MOS6560() :
|
|||||||
"uint yC = c & 15u;"
|
"uint yC = c & 15u;"
|
||||||
"float phaseOffset = 6.283185308 * float(yC) / 16.0;"
|
"float phaseOffset = 6.283185308 * float(yC) / 16.0;"
|
||||||
|
|
||||||
"float chroma = step(mod(phase + phaseOffset + 0.785398163397448, 6.283185308), 3.141592654);"
|
// "float chroma = step(mod(phase + phaseOffset + 0.785398163397448, 6.283185308), 3.141592654);"
|
||||||
// "float chroma = cos(phase + phaseOffset);"
|
"float chroma = cos(phase + phaseOffset);"
|
||||||
"return mix(y, step(yC, 14) * chroma, amplitude);"
|
"return mix(y, step(yC, 14) * chroma, amplitude);"
|
||||||
"}");
|
"}");
|
||||||
|
|
||||||
@ -37,10 +37,8 @@ MOS6560::MOS6560() :
|
|||||||
// 3, 7, D, F
|
// 3, 7, D, F
|
||||||
// 1
|
// 1
|
||||||
uint8_t luminances[16] = { // range is 0–4
|
uint8_t luminances[16] = { // range is 0–4
|
||||||
0, 4, 1, 3,
|
0, 4, 1, 3, 2, 2, 1, 3,
|
||||||
2, 2, 1, 3,
|
2, 1, 2, 1, 2, 3, 2, 3
|
||||||
2, 1, 2, 1,
|
|
||||||
2, 3, 2, 3
|
|
||||||
};
|
};
|
||||||
// uint8_t pal_chrominances[16] = { // range is 0–15; 15 is a special case meaning "no chrominance"
|
// uint8_t pal_chrominances[16] = { // range is 0–15; 15 is a special case meaning "no chrominance"
|
||||||
// 15, 15, 5, 13, 2, 10, 0, 8,
|
// 15, 15, 5, 13, 2, 10, 0, 8,
|
||||||
@ -55,8 +53,8 @@ MOS6560::MOS6560() :
|
|||||||
_colours[c] = (uint8_t)((luminances[c] << 4) | ntsc_chrominances[c]);
|
_colours[c] = (uint8_t)((luminances[c] << 4) | ntsc_chrominances[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the middle 90%
|
// show only the centre
|
||||||
_crt->set_visible_area(Outputs::CRT::Rect(0.05f, 0.05f, 0.9f, 0.9f));
|
_crt->set_visible_area(_crt->get_rect_for_area(16, 237, 11*4, 55*4, 4.0f / 3.0f));
|
||||||
_speaker.set_input_rate(255681.75); // assuming NTSC; clock rate / 4
|
_speaker.set_input_rate(255681.75); // assuming NTSC; clock rate / 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,6 +377,10 @@ Outputs::CRT::Rect CRT::get_rect_for_area(int first_line_after_sync, int number_
|
|||||||
unsigned int horizontal_scan_period = _horizontal_flywheel->get_scan_period();
|
unsigned int horizontal_scan_period = _horizontal_flywheel->get_scan_period();
|
||||||
unsigned int horizontal_retrace_period = horizontal_period - horizontal_scan_period;
|
unsigned int horizontal_retrace_period = horizontal_period - horizontal_scan_period;
|
||||||
|
|
||||||
|
// make sure that the requested range is visible
|
||||||
|
if(first_cycle_after_sync < horizontal_retrace_period) first_cycle_after_sync = (int)horizontal_retrace_period;
|
||||||
|
if(first_cycle_after_sync + number_of_cycles > horizontal_scan_period) number_of_cycles = (int)(horizontal_scan_period - (unsigned)first_cycle_after_sync);
|
||||||
|
|
||||||
float start_x = (float)((unsigned)first_cycle_after_sync - horizontal_retrace_period) / (float)horizontal_scan_period;
|
float start_x = (float)((unsigned)first_cycle_after_sync - horizontal_retrace_period) / (float)horizontal_scan_period;
|
||||||
float width = (float)number_of_cycles / (float)horizontal_scan_period;
|
float width = (float)number_of_cycles / (float)horizontal_scan_period;
|
||||||
|
|
||||||
@ -384,6 +388,13 @@ Outputs::CRT::Rect CRT::get_rect_for_area(int first_line_after_sync, int number_
|
|||||||
unsigned int vertical_period = _vertical_flywheel->get_standard_period();
|
unsigned int vertical_period = _vertical_flywheel->get_standard_period();
|
||||||
unsigned int vertical_scan_period = _vertical_flywheel->get_scan_period();
|
unsigned int vertical_scan_period = _vertical_flywheel->get_scan_period();
|
||||||
unsigned int vertical_retrace_period = vertical_period - vertical_scan_period;
|
unsigned int vertical_retrace_period = vertical_period - vertical_scan_period;
|
||||||
|
|
||||||
|
// make sure that the requested range is visible
|
||||||
|
// if((unsigned)first_line_after_sync * horizontal_period < vertical_retrace_period)
|
||||||
|
// first_line_after_sync = (vertical_retrace_period + horizontal_period - 1) / horizontal_period;
|
||||||
|
// if((first_line_after_sync + number_of_lines) * horizontal_period > vertical_scan_period)
|
||||||
|
// number_of_lines = (int)(horizontal_scan_period - (unsigned)first_cycle_after_sync);
|
||||||
|
|
||||||
float start_y = (float)(((unsigned)first_line_after_sync * horizontal_period) - vertical_retrace_period) / (float)vertical_scan_period;
|
float start_y = (float)(((unsigned)first_line_after_sync * horizontal_period) - vertical_retrace_period) / (float)vertical_scan_period;
|
||||||
float height = (float)((unsigned)number_of_lines * horizontal_period) / vertical_scan_period;
|
float height = (float)((unsigned)number_of_lines * horizontal_period) / vertical_scan_period;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user