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