1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-11 15:49:38 +00:00
CLK/Machines/Sinclair/ZX8081/Video.hpp

65 lines
1.6 KiB
C++
Raw Normal View History

//
// Video.hpp
// Clock Signal
//
// Created by Thomas Harte on 06/06/2017.
// Copyright 2017 Thomas Harte. All rights reserved.
//
#ifndef Machines_ZX8081_Video_hpp
#define Machines_ZX8081_Video_hpp
2021-03-18 02:46:25 +00:00
#include "../../../Outputs/CRT/CRT.hpp"
#include "../../../ClockReceiver/ClockReceiver.hpp"
2021-03-18 02:52:23 +00:00
namespace Sinclair {
namespace ZX8081 {
2017-06-06 22:01:33 +00:00
/*!
Packages a ZX80/81-style video feed into a CRT-compatible waveform.
While sync is active, this feed will output the sync level.
While sync is inactive, this feed will output the white level unless it is supplied
with a byte to output. When a byte is supplied for output, it will be interpreted as
a 1-bit graphic and output over the next 4 cycles, picking between the white level
and the black level.
*/
class Video {
public:
/// Constructs an instance of the video feed.
Video();
2017-06-06 22:01:33 +00:00
2018-04-15 22:00:51 +00:00
/// Advances time by @c half-cycles.
void run_for(const HalfCycles);
2017-06-06 22:01:33 +00:00
/// Forces output to catch up to the current output position.
void flush();
2017-06-06 22:01:33 +00:00
/// Sets the current sync output.
void set_sync(bool sync);
2017-06-06 22:01:33 +00:00
/// Causes @c byte to be serialised into pixels and output over the next four cycles.
void output_byte(uint8_t byte);
/// Sets the scan target.
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
/// Gets the current scan status.
Outputs::Display::ScanStatus get_scaled_scan_status() const;
private:
bool sync_ = false;
uint8_t *line_data_ = nullptr;
uint8_t *line_data_pointer_ = nullptr;
HalfCycles time_since_update_ = 0;
Outputs::CRT::CRT crt_;
2017-06-06 22:01:33 +00:00
void flush(bool next_sync);
};
2021-03-18 02:52:23 +00:00
}
}
#endif /* Video_hpp */