mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-14 13:33:42 +00:00
Starts nudging the Oric back to functionality under the new regime.
i.e. one where it can't invent internal pixel formats.
This commit is contained in:
parent
64465f97b6
commit
5f90941e4e
@ -212,6 +212,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
public:
|
public:
|
||||||
ConcreteMachine(const Analyser::Static::Oric::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
ConcreteMachine(const Analyser::Static::Oric::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||||
m6502_(*this),
|
m6502_(*this),
|
||||||
|
video_output_(ram_),
|
||||||
ay8910_(audio_queue_),
|
ay8910_(audio_queue_),
|
||||||
speaker_(ay8910_),
|
speaker_(ay8910_),
|
||||||
via_port_handler_(audio_queue_, ay8910_, speaker_, tape_player_, keyboard_),
|
via_port_handler_(audio_queue_, ay8910_, speaker_, tape_player_, keyboard_),
|
||||||
@ -246,7 +247,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour_rom_ = std::move(*roms[0]);
|
video_output_.set_colour_rom(*roms[0]);
|
||||||
rom_ = std::move(*roms[1]);
|
rom_ = std::move(*roms[1]);
|
||||||
|
|
||||||
switch(disk_interface) {
|
switch(disk_interface) {
|
||||||
@ -267,7 +268,6 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
colour_rom_.resize(128);
|
|
||||||
rom_.resize(16384);
|
rom_.resize(16384);
|
||||||
paged_rom_ = rom_.data();
|
paged_rom_ = rom_.data();
|
||||||
|
|
||||||
@ -461,11 +461,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
|
|
||||||
// to satisfy CRTMachine::Machine
|
// to satisfy CRTMachine::Machine
|
||||||
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
|
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
|
||||||
speaker_.set_input_rate(1000000.0f);
|
video_output_.set_scan_target(scan_target);
|
||||||
|
|
||||||
video_output_.reset(new VideoOutput(ram_));
|
|
||||||
if(!colour_rom_.empty()) video_output_->set_colour_rom(colour_rom_);
|
|
||||||
set_display_type(Outputs::Display::DisplayType::RGB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Speaker::Speaker *get_speaker() override final {
|
Outputs::Speaker::Speaker *get_speaker() override final {
|
||||||
@ -534,7 +530,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_display_type(Outputs::Display::DisplayType display_type) override {
|
void set_display_type(Outputs::Display::DisplayType display_type) override {
|
||||||
// video_output_->set_video_signal(video_signal);
|
video_output_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Configurable::SelectionSet get_accurate_selections() override {
|
Configurable::SelectionSet get_accurate_selections() override {
|
||||||
@ -574,11 +570,11 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, ConcreteMachine, false> m6502_;
|
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, ConcreteMachine, false> m6502_;
|
||||||
|
|
||||||
// RAM and ROM
|
// RAM and ROM
|
||||||
std::vector<uint8_t> rom_, microdisc_rom_, colour_rom_;
|
std::vector<uint8_t> rom_, microdisc_rom_;
|
||||||
uint8_t ram_[65536];
|
uint8_t ram_[65536];
|
||||||
Cycles cycles_since_video_update_;
|
Cycles cycles_since_video_update_;
|
||||||
inline void update_video() {
|
inline void update_video() {
|
||||||
video_output_->run_for(cycles_since_video_update_.flush());
|
video_output_.run_for(cycles_since_video_update_.flush());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ROM bookkeeping
|
// ROM bookkeeping
|
||||||
@ -586,7 +582,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
int keyboard_read_count_ = 0;
|
int keyboard_read_count_ = 0;
|
||||||
|
|
||||||
// Outputs
|
// Outputs
|
||||||
std::unique_ptr<VideoOutput> video_output_;
|
VideoOutput video_output_;
|
||||||
|
|
||||||
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
||||||
GI::AY38910::AY38910 ay8910_;
|
GI::AY38910::AY38910 ay8910_;
|
||||||
|
@ -21,11 +21,7 @@ namespace {
|
|||||||
const unsigned int PAL60Period = 262*64;
|
const unsigned int PAL60Period = 262*64;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoOutput::VideoOutput(uint8_t *memory) :
|
|
||||||
ram_(memory),
|
|
||||||
// crt_(new Outputs::CRT::CRT(64*6, 6, Outputs::Display::Type::PAL50, 2)),
|
|
||||||
v_sync_start_position_(PAL50VSyncStartPosition), v_sync_end_position_(PAL50VSyncEndPosition),
|
|
||||||
counter_period_(PAL50Period) {
|
|
||||||
// crt_->set_rgb_sampling_function(
|
// crt_->set_rgb_sampling_function(
|
||||||
// "vec3 rgb_sample(usampler2D sampler, vec2 coordinate)"
|
// "vec3 rgb_sample(usampler2D sampler, vec2 coordinate)"
|
||||||
// "{"
|
// "{"
|
||||||
@ -41,15 +37,25 @@ VideoOutput::VideoOutput(uint8_t *memory) :
|
|||||||
// "return (float(texValue) - 4.0) / 20.0;"
|
// "return (float(texValue) - 4.0) / 20.0;"
|
||||||
// "}"
|
// "}"
|
||||||
// );
|
// );
|
||||||
crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
|
|
||||||
|
VideoOutput::VideoOutput(uint8_t *memory) :
|
||||||
|
ram_(memory),
|
||||||
|
crt_(64*6, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red1Green1Blue1),
|
||||||
|
v_sync_start_position_(PAL50VSyncStartPosition), v_sync_end_position_(PAL50VSyncEndPosition),
|
||||||
|
counter_period_(PAL50Period) {
|
||||||
|
// crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
|
||||||
|
|
||||||
set_display_type(Outputs::Display::DisplayType::CompositeColour);
|
set_display_type(Outputs::Display::DisplayType::CompositeColour);
|
||||||
crt_->set_visible_area(crt_->get_rect_for_area(54, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
crt_.set_visible_area(crt_.get_rect_for_area(54, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
||||||
// video_signal_ = video_signal;
|
display_type_ = display_type;
|
||||||
// crt_->set_video_signal(video_signal);
|
crt_.set_display_type(display_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoOutput::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
||||||
|
crt_.set_scan_target(scan_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
|
void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
|
||||||
@ -69,10 +75,6 @@ void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::CRT::CRT *VideoOutput::get_crt() {
|
|
||||||
return crt_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VideoOutput::run_for(const Cycles cycles) {
|
void VideoOutput::run_for(const Cycles cycles) {
|
||||||
// Vertical: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst
|
// Vertical: 0-39: pixels; otherwise blank; 48-53 sync, 54-56 colour burst
|
||||||
// Horizontal: 0-223: pixels; otherwise blank; 256-259 sync
|
// Horizontal: 0-223: pixels; otherwise blank; 256-259 sync
|
||||||
@ -88,7 +90,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
if(counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_) {
|
if(counter_ >= v_sync_start_position_ && counter_ < v_sync_end_position_) {
|
||||||
// this is a sync line
|
// this is a sync line
|
||||||
cycles_run_for = v_sync_end_position_ - counter_;
|
cycles_run_for = v_sync_end_position_ - counter_;
|
||||||
clamp(crt_->output_sync((v_sync_end_position_ - v_sync_start_position_) * 6));
|
clamp(crt_.output_sync((v_sync_end_position_ - v_sync_start_position_) * 6));
|
||||||
} else if(counter_ < 224*64 && h_counter < 40) {
|
} else if(counter_ < 224*64 && h_counter < 40) {
|
||||||
// this is a pixel line
|
// this is a pixel line
|
||||||
if(!h_counter) {
|
if(!h_counter) {
|
||||||
@ -96,7 +98,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
paper_ = 0x0;
|
paper_ = 0x0;
|
||||||
use_alternative_character_set_ = use_double_height_characters_ = blink_text_ = false;
|
use_alternative_character_set_ = use_double_height_characters_ = blink_text_ = false;
|
||||||
set_character_set_base_address();
|
set_character_set_base_address();
|
||||||
pixel_target_ = reinterpret_cast<uint16_t *>(crt_->begin_data(240));
|
pixel_target_ = reinterpret_cast<uint16_t *>(crt_.begin_data(240));
|
||||||
|
|
||||||
if(!counter_) {
|
if(!counter_) {
|
||||||
frame_counter_++;
|
frame_counter_++;
|
||||||
@ -193,7 +195,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(h_counter == 40) {
|
if(h_counter == 40) {
|
||||||
crt_->output_data(40 * 6);
|
crt_.output_data(40 * 6);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is a blank line (or the equivalent part of a pixel line)
|
// this is a blank line (or the equivalent part of a pixel line)
|
||||||
@ -201,17 +203,17 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
cycles_run_for = 48 - h_counter;
|
cycles_run_for = 48 - h_counter;
|
||||||
clamp(
|
clamp(
|
||||||
int period = (counter_ < 224*64) ? 8 : 48;
|
int period = (counter_ < 224*64) ? 8 : 48;
|
||||||
crt_->output_blank(period * 6);
|
crt_.output_blank(period * 6);
|
||||||
);
|
);
|
||||||
} else if(h_counter < 54) {
|
} else if(h_counter < 54) {
|
||||||
cycles_run_for = 54 - h_counter;
|
cycles_run_for = 54 - h_counter;
|
||||||
clamp(crt_->output_sync(6 * 6));
|
clamp(crt_.output_sync(6 * 6));
|
||||||
} else if(h_counter < 56) {
|
} else if(h_counter < 56) {
|
||||||
cycles_run_for = 56 - h_counter;
|
cycles_run_for = 56 - h_counter;
|
||||||
clamp(crt_->output_default_colour_burst(2 * 6));
|
clamp(crt_.output_default_colour_burst(2 * 6));
|
||||||
} else {
|
} else {
|
||||||
cycles_run_for = 64 - h_counter;
|
cycles_run_for = 64 - h_counter;
|
||||||
clamp(crt_->output_blank(8 * 6));
|
clamp(crt_.output_blank(8 * 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,14 +21,16 @@ namespace Oric {
|
|||||||
class VideoOutput {
|
class VideoOutput {
|
||||||
public:
|
public:
|
||||||
VideoOutput(uint8_t *memory);
|
VideoOutput(uint8_t *memory);
|
||||||
Outputs::CRT::CRT *get_crt();
|
void set_colour_rom(const std::vector<uint8_t> &colour_rom);
|
||||||
|
|
||||||
void run_for(const Cycles cycles);
|
void run_for(const Cycles cycles);
|
||||||
void set_colour_rom(const std::vector<uint8_t> &rom);
|
|
||||||
|
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
|
||||||
void set_display_type(Outputs::Display::DisplayType display_type);
|
void set_display_type(Outputs::Display::DisplayType display_type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t *ram_;
|
uint8_t *ram_;
|
||||||
std::unique_ptr<Outputs::CRT::CRT> crt_;
|
Outputs::CRT::CRT crt_;
|
||||||
|
|
||||||
// Counters and limits
|
// Counters and limits
|
||||||
int counter_ = 0, frame_counter_ = 0;
|
int counter_ = 0, frame_counter_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user