2018-04-14 23:46:15 +00:00
|
|
|
//
|
|
|
|
// Video.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 14/04/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-04-14 23:46:15 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "Video.hpp"
|
|
|
|
|
2018-04-15 23:35:08 +00:00
|
|
|
using namespace AppleII::Video;
|
2018-04-14 23:46:15 +00:00
|
|
|
|
2018-04-18 02:04:02 +00:00
|
|
|
VideoBase::VideoBase() :
|
2018-06-03 02:03:45 +00:00
|
|
|
crt_(new Outputs::CRT::CRT(910, 1, Outputs::CRT::DisplayType::NTSC60, 1)) {
|
2018-04-18 02:04:02 +00:00
|
|
|
|
2018-06-03 02:03:45 +00:00
|
|
|
// Set a composite sampling function that assumes one byte per pixel input, and
|
|
|
|
// accepts any non-zero value as being fully on, zero being fully off.
|
2018-04-18 02:04:02 +00:00
|
|
|
crt_->set_composite_sampling_function(
|
|
|
|
"float composite_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate, float phase, float amplitude)"
|
|
|
|
"{"
|
2018-08-01 22:52:42 +00:00
|
|
|
"return clamp(texture(sampler, coordinate).r, 0.0, 0.7);"
|
2018-04-18 02:04:02 +00:00
|
|
|
"}");
|
|
|
|
|
|
|
|
// Show only the centre 75% of the TV frame.
|
|
|
|
crt_->set_video_signal(Outputs::CRT::VideoSignal::Composite);
|
2018-07-06 02:07:18 +00:00
|
|
|
crt_->set_visible_area(Outputs::CRT::Rect(0.115f, 0.122f, 0.77f, 0.77f));
|
2018-05-30 02:30:45 +00:00
|
|
|
crt_->set_immediate_default_phase(0.0f);
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Outputs::CRT::CRT *VideoBase::get_crt() {
|
|
|
|
return crt_.get();
|
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
/*
|
|
|
|
Rote setters and getters.
|
|
|
|
*/
|
|
|
|
void VideoBase::set_alternative_character_set(bool alternative_character_set) {
|
|
|
|
alternative_character_set_ = alternative_character_set;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
bool VideoBase::get_alternative_character_set() {
|
|
|
|
return alternative_character_set_;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
void VideoBase::set_80_columns(bool columns_80) {
|
|
|
|
columns_80_ = columns_80;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
bool VideoBase::get_80_columns() {
|
|
|
|
return columns_80_;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
void VideoBase::set_80_store(bool store_80) {
|
|
|
|
store_80_ = store_80;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 02:15:42 +00:00
|
|
|
bool VideoBase::get_80_store() {
|
|
|
|
return store_80_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_page2(bool page2) {
|
2018-07-29 14:41:12 +00:00
|
|
|
page2_ = page2;
|
2018-07-25 02:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoBase::get_page2() {
|
|
|
|
return page2_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_text(bool text) {
|
|
|
|
text_ = text;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoBase::get_text() {
|
|
|
|
return text_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_mixed(bool mixed) {
|
|
|
|
mixed_ = mixed;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoBase::get_mixed() {
|
|
|
|
return mixed_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_high_resolution(bool high_resolution) {
|
|
|
|
high_resolution_ = high_resolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoBase::get_high_resolution() {
|
|
|
|
return high_resolution_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_double_high_resolution(bool double_high_resolution) {
|
|
|
|
double_high_resolution_ = double_high_resolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoBase::get_double_high_resolution() {
|
|
|
|
return double_high_resolution_;
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VideoBase::set_character_rom(const std::vector<uint8_t> &character_rom) {
|
|
|
|
character_rom_ = character_rom;
|
2018-08-04 20:52:29 +00:00
|
|
|
|
|
|
|
// Flip all character contents based on the second line of the $ graphic.
|
|
|
|
if(character_rom_[0x121] == 0x3c || character_rom_[0x122] == 0x3c) {
|
|
|
|
for(auto &graphic : character_rom_) {
|
|
|
|
graphic =
|
|
|
|
((graphic & 0x01) ? 0x40 : 0x00) |
|
|
|
|
((graphic & 0x02) ? 0x20 : 0x00) |
|
|
|
|
((graphic & 0x04) ? 0x10 : 0x00) |
|
|
|
|
((graphic & 0x08) ? 0x08 : 0x00) |
|
|
|
|
((graphic & 0x10) ? 0x04 : 0x00) |
|
|
|
|
((graphic & 0x20) ? 0x02 : 0x00) |
|
|
|
|
((graphic & 0x40) ? 0x01 : 0x00);
|
|
|
|
}
|
|
|
|
}
|
2018-04-18 02:04:02 +00:00
|
|
|
}
|