2017-06-06 21:53:23 +00:00
|
|
|
//
|
|
|
|
// Video.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 06/06/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-06-06 21:53:23 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#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"
|
2017-06-06 21:53:23 +00:00
|
|
|
|
2021-03-18 02:52:23 +00:00
|
|
|
namespace Sinclair {
|
2017-06-06 21:53:23 +00:00
|
|
|
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.
|
|
|
|
*/
|
2017-07-27 11:40:02 +00:00
|
|
|
class Video {
|
2017-06-06 21:53:23 +00:00
|
|
|
public:
|
2018-11-15 02:52:57 +00:00
|
|
|
/// 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.
|
2017-07-28 02:05:29 +00:00
|
|
|
void run_for(const HalfCycles);
|
2020-05-30 04:37:06 +00:00
|
|
|
|
2017-06-06 22:01:33 +00:00
|
|
|
/// Forces output to catch up to the current output position.
|
2017-06-06 21:53:23 +00:00
|
|
|
void flush();
|
|
|
|
|
2017-06-06 22:01:33 +00:00
|
|
|
/// Sets the current sync output.
|
2017-06-06 21:53:23 +00:00
|
|
|
void set_sync(bool sync);
|
2020-01-21 02:45:10 +00:00
|
|
|
|
2017-06-06 22:01:33 +00:00
|
|
|
/// Causes @c byte to be serialised into pixels and output over the next four cycles.
|
2017-06-06 21:53:23 +00:00
|
|
|
void output_byte(uint8_t byte);
|
|
|
|
|
2018-11-15 02:52:57 +00:00
|
|
|
/// Sets the scan target.
|
|
|
|
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
|
|
|
|
|
2020-01-21 02:45:10 +00:00
|
|
|
/// Gets the current scan status.
|
2020-01-22 03:28:25 +00:00
|
|
|
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
2020-01-21 02:45:10 +00:00
|
|
|
|
2017-06-06 21:53:23 +00:00
|
|
|
private:
|
2017-11-10 03:14:22 +00:00
|
|
|
bool sync_ = false;
|
|
|
|
uint8_t *line_data_ = nullptr;
|
|
|
|
uint8_t *line_data_pointer_ = nullptr;
|
2018-06-02 22:25:00 +00:00
|
|
|
HalfCycles time_since_update_ = 0;
|
2018-11-15 02:52:57 +00:00
|
|
|
Outputs::CRT::CRT crt_;
|
2017-06-06 22:01:33 +00:00
|
|
|
|
|
|
|
void flush(bool next_sync);
|
2017-06-06 21:53:23 +00:00
|
|
|
};
|
|
|
|
|
2021-03-18 02:52:23 +00:00
|
|
|
}
|
2017-06-06 21:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Video_hpp */
|