mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Converted the Oric's video output into a ClockReceiver
.
This commit is contained in:
parent
c2a7dffa7d
commit
6369138bd1
@ -142,7 +142,7 @@ void Machine::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::update_video() {
|
void Machine::update_video() {
|
||||||
video_output_->run_for_cycles(cycles_since_video_update_);
|
video_output_->run_for(Cycles(cycles_since_video_update_));
|
||||||
cycles_since_video_update_ = 0;
|
cycles_since_video_update_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +74,14 @@ std::shared_ptr<Outputs::CRT::CRT> VideoOutput::get_crt() {
|
|||||||
return crt_;
|
return crt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoOutput::run_for_cycles(int number_of_cycles) {
|
void VideoOutput::run_for(const Cycles &cycles) {
|
||||||
// Vertical: 0–39: pixels; otherwise blank; 48–53 sync, 54–56 colour burst
|
// Vertical: 0–39: pixels; otherwise blank; 48–53 sync, 54–56 colour burst
|
||||||
// Horizontal: 0–223: pixels; otherwise blank; 256–259 sync
|
// Horizontal: 0–223: pixels; otherwise blank; 256–259 sync
|
||||||
|
|
||||||
#define clamp(action) \
|
#define clamp(action) \
|
||||||
if(cycles_run_for <= number_of_cycles) { action; } else cycles_run_for = number_of_cycles;
|
if(cycles_run_for <= number_of_cycles) { action; } else cycles_run_for = number_of_cycles;
|
||||||
|
|
||||||
|
int number_of_cycles = int(cycles);
|
||||||
while(number_of_cycles) {
|
while(number_of_cycles) {
|
||||||
int h_counter = counter_ & 63;
|
int h_counter = counter_ & 63;
|
||||||
int cycles_run_for = 0;
|
int cycles_run_for = 0;
|
||||||
|
@ -10,14 +10,15 @@
|
|||||||
#define Machines_Oric_Video_hpp
|
#define Machines_Oric_Video_hpp
|
||||||
|
|
||||||
#include "../../Outputs/CRT/CRT.hpp"
|
#include "../../Outputs/CRT/CRT.hpp"
|
||||||
|
#include "../../Components/ClockReceiver.hpp"
|
||||||
|
|
||||||
namespace Oric {
|
namespace Oric {
|
||||||
|
|
||||||
class VideoOutput {
|
class VideoOutput: public ClockReceiver<VideoOutput> {
|
||||||
public:
|
public:
|
||||||
VideoOutput(uint8_t *memory);
|
VideoOutput(uint8_t *memory);
|
||||||
std::shared_ptr<Outputs::CRT::CRT> get_crt();
|
std::shared_ptr<Outputs::CRT::CRT> get_crt();
|
||||||
void run_for_cycles(int number_of_cycles);
|
void run_for(const Cycles &cycles);
|
||||||
void set_colour_rom(const std::vector<uint8_t> &rom);
|
void set_colour_rom(const std::vector<uint8_t> &rom);
|
||||||
void set_output_device(Outputs::CRT::OutputDevice output_device);
|
void set_output_device(Outputs::CRT::OutputDevice output_device);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user