2016-10-12 23:20:23 +00:00
|
|
|
//
|
|
|
|
// Video.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 12/10/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-10-12 23:20:23 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2016-10-12 23:20:23 +00:00
|
|
|
|
|
|
|
#include "../../Outputs/CRT/CRT.hpp"
|
2017-07-26 00:20:55 +00:00
|
|
|
#include "../../ClockReceiver/ClockReceiver.hpp"
|
2016-10-12 23:20:23 +00:00
|
|
|
|
2018-11-04 01:54:25 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-10-12 23:20:23 +00:00
|
|
|
namespace Oric {
|
|
|
|
|
2017-07-27 11:40:02 +00:00
|
|
|
class VideoOutput {
|
2016-10-12 23:20:23 +00:00
|
|
|
public:
|
|
|
|
VideoOutput(uint8_t *memory);
|
2018-11-29 02:16:13 +00:00
|
|
|
void set_colour_rom(const std::vector<uint8_t> &colour_rom);
|
|
|
|
|
2017-07-28 02:05:29 +00:00
|
|
|
void run_for(const Cycles cycles);
|
2024-09-11 00:59:05 +00:00
|
|
|
Cycles next_sequence_point() const;
|
2018-11-29 02:16:13 +00:00
|
|
|
|
2024-09-11 00:31:35 +00:00
|
|
|
bool vsync();
|
|
|
|
|
2018-11-29 02:16:13 +00:00
|
|
|
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
|
2018-11-29 01:53:33 +00:00
|
|
|
void set_display_type(Outputs::Display::DisplayType display_type);
|
2020-05-21 03:34:26 +00:00
|
|
|
Outputs::Display::DisplayType get_display_type() const;
|
2020-01-22 03:28:25 +00:00
|
|
|
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
2016-10-12 23:20:23 +00:00
|
|
|
|
2020-01-24 03:14:02 +00:00
|
|
|
void register_crt_frequency_mismatch();
|
|
|
|
|
2016-10-12 23:20:23 +00:00
|
|
|
private:
|
2016-11-22 14:28:45 +00:00
|
|
|
uint8_t *ram_;
|
2018-11-29 02:16:13 +00:00
|
|
|
Outputs::CRT::CRT crt_;
|
2020-01-24 03:14:02 +00:00
|
|
|
Outputs::CRT::CRTFrequencyMismatchWarner<VideoOutput> frequency_mismatch_warner_;
|
|
|
|
bool crt_is_60Hz_ = false;
|
2021-06-07 02:43:53 +00:00
|
|
|
bool has_colour_rom_ = false;
|
2020-01-24 03:14:02 +00:00
|
|
|
|
|
|
|
void update_crt_frequency();
|
2016-10-13 01:29:21 +00:00
|
|
|
|
2020-01-24 03:14:02 +00:00
|
|
|
// Counters and limits.
|
2017-11-11 03:35:05 +00:00
|
|
|
int counter_ = 0, frame_counter_ = 0;
|
2016-11-22 14:28:45 +00:00
|
|
|
int v_sync_start_position_, v_sync_end_position_, counter_period_;
|
2016-10-13 01:29:21 +00:00
|
|
|
|
2020-01-24 03:14:02 +00:00
|
|
|
// Output target and device.
|
2020-02-13 04:31:48 +00:00
|
|
|
uint8_t *rgb_pixel_target_ = nullptr;
|
|
|
|
uint32_t *composite_pixel_target_ = nullptr;
|
2018-11-29 02:40:43 +00:00
|
|
|
uint32_t colour_forms_[8];
|
2019-02-18 21:56:48 +00:00
|
|
|
Outputs::Display::InputDataType data_type_;
|
2016-10-13 01:29:21 +00:00
|
|
|
|
2020-01-24 03:14:02 +00:00
|
|
|
// Registers.
|
2016-11-22 14:28:45 +00:00
|
|
|
uint8_t ink_, paper_;
|
2016-10-13 23:34:29 +00:00
|
|
|
|
2017-11-11 03:35:05 +00:00
|
|
|
int character_set_base_address_ = 0xb400;
|
2016-10-31 00:16:22 +00:00
|
|
|
inline void set_character_set_base_address();
|
2016-10-13 23:34:29 +00:00
|
|
|
|
2017-11-11 03:35:05 +00:00
|
|
|
bool is_graphics_mode_ = false;
|
|
|
|
bool next_frame_is_sixty_hertz_ = false;
|
2016-11-22 14:28:45 +00:00
|
|
|
bool use_alternative_character_set_;
|
|
|
|
bool use_double_height_characters_;
|
|
|
|
bool blink_text_;
|
2016-10-12 23:20:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|