mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-21 02:17:08 +00:00
Adds first, incomplete attempts to talk to a ScanTarget from the CRT.
Does away with the hassle of `unsigned` while I'm here; that was a schoolboy error.
This commit is contained in:
+14
-14
@@ -68,19 +68,19 @@ template <class BusHandler> class MOS6560 {
|
||||
audio_generator_(audio_queue_),
|
||||
speaker_(audio_generator_)
|
||||
{
|
||||
crt_->set_svideo_sampling_function(
|
||||
"vec2 svideo_sample(usampler2D texID, vec2 coordinate, float phase, float amplitude)"
|
||||
"{"
|
||||
"vec2 yc = texture(texID, coordinate).rg / vec2(255.0);"
|
||||
|
||||
"float phaseOffset = 6.283185308 * 2.0 * yc.y;"
|
||||
"float chroma = step(yc.y, 0.75) * cos(phase + phaseOffset);"
|
||||
|
||||
"return vec2(yc.x, chroma);"
|
||||
"}");
|
||||
// crt_->set_svideo_sampling_function(
|
||||
// "vec2 svideo_sample(usampler2D texID, vec2 coordinate, float phase, float amplitude)"
|
||||
// "{"
|
||||
// "vec2 yc = texture(texID, coordinate).rg / vec2(255.0);"
|
||||
//
|
||||
// "float phaseOffset = 6.283185308 * 2.0 * yc.y;"
|
||||
// "float chroma = step(yc.y, 0.75) * cos(phase + phaseOffset);"
|
||||
//
|
||||
// "return vec2(yc.x, chroma);"
|
||||
// "}");
|
||||
|
||||
// default to s-video output
|
||||
crt_->set_video_signal(Outputs::CRT::VideoSignal::SVideo);
|
||||
// crt_->set_video_signal(Outputs::CRT::VideoSignal::SVideo);
|
||||
|
||||
// default to NTSC
|
||||
set_output_mode(OutputMode::NTSC);
|
||||
@@ -155,7 +155,7 @@ template <class BusHandler> class MOS6560 {
|
||||
break;
|
||||
}
|
||||
|
||||
crt_->set_new_display_type(static_cast<unsigned int>(timing_.cycles_per_line*4), display_type);
|
||||
crt_->set_new_display_type(timing_.cycles_per_line*4, display_type);
|
||||
|
||||
switch(output_mode) {
|
||||
case OutputMode::PAL:
|
||||
@@ -465,7 +465,7 @@ template <class BusHandler> class MOS6560 {
|
||||
enum State {
|
||||
Sync, ColourBurst, Border, Pixels
|
||||
} this_state_, output_state_;
|
||||
unsigned int cycles_in_state_;
|
||||
int cycles_in_state_;
|
||||
|
||||
// counters that cover an entire field
|
||||
int horizontal_counter_ = 0, vertical_counter_ = 0;
|
||||
@@ -511,7 +511,7 @@ template <class BusHandler> class MOS6560 {
|
||||
uint16_t colours_[16];
|
||||
|
||||
uint16_t *pixel_pointer;
|
||||
void output_border(unsigned int number_of_cycles) {
|
||||
void output_border(int number_of_cycles) {
|
||||
uint16_t *colour_pointer = reinterpret_cast<uint16_t *>(crt_->allocate_write_area(1));
|
||||
if(colour_pointer) *colour_pointer = registers_.borderColour;
|
||||
crt_->output_level(number_of_cycles);
|
||||
|
||||
+10
-10
@@ -86,12 +86,12 @@ TMS9918::TMS9918(Personality p):
|
||||
Base(p) {
|
||||
// Unimaginatively, this class just passes RGB through to the shader. Investigation is needed
|
||||
// into whether there's a more natural form.
|
||||
crt_->set_rgb_sampling_function(
|
||||
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate)"
|
||||
"{"
|
||||
"return texture(sampler, coordinate).rgb / vec3(255.0);"
|
||||
"}");
|
||||
crt_->set_video_signal(Outputs::CRT::VideoSignal::RGB);
|
||||
// crt_->set_rgb_sampling_function(
|
||||
// "vec3 rgb_sample(usampler2D sampler, vec2 coordinate)"
|
||||
// "{"
|
||||
// "return texture(sampler, coordinate).rgb / vec3(255.0);"
|
||||
// "}");
|
||||
// crt_->set_video_signal(Outputs::CRT::VideoSignal::RGB);
|
||||
crt_->set_visible_area(Outputs::CRT::Rect(0.055f, 0.025f, 0.9f, 0.9f));
|
||||
|
||||
// The TMS remains in-phase with the NTSC colour clock; this is an empirical measurement
|
||||
@@ -410,7 +410,7 @@ void TMS9918::run_for(const HalfCycles cycles) {
|
||||
if(!asked_for_write_area_) {
|
||||
asked_for_write_area_ = true;
|
||||
pixel_origin_ = pixel_target_ = reinterpret_cast<uint32_t *>(
|
||||
crt_->allocate_write_area(static_cast<unsigned int>(line_buffer.next_border_column - line_buffer.first_pixel_output_column))
|
||||
crt_->allocate_write_area(size_t(line_buffer.next_border_column - line_buffer.first_pixel_output_column))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -427,8 +427,8 @@ void TMS9918::run_for(const HalfCycles cycles) {
|
||||
}
|
||||
|
||||
if(end == line_buffer.next_border_column) {
|
||||
const unsigned int length = static_cast<unsigned int>(line_buffer.next_border_column - line_buffer.first_pixel_output_column);
|
||||
crt_->output_data(length * 4, length);
|
||||
const int length = line_buffer.next_border_column - line_buffer.first_pixel_output_column;
|
||||
crt_->output_data(length * 4, size_t(length));
|
||||
pixel_origin_ = pixel_target_ = nullptr;
|
||||
asked_for_write_area_ = false;
|
||||
}
|
||||
@@ -479,7 +479,7 @@ void Base::output_border(int cycles, uint32_t cram_dot) {
|
||||
if(cycles) {
|
||||
uint32_t *const pixel_target = reinterpret_cast<uint32_t *>(crt_->allocate_write_area(1));
|
||||
*pixel_target = border_colour;
|
||||
crt_->output_level(static_cast<unsigned int>(cycles));
|
||||
crt_->output_level(cycles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user