mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Made basic attempt to get something on screen: white where the display is enabled, black for the border.
This commit is contained in:
parent
69b99fe127
commit
f742fd5d4a
@ -124,7 +124,7 @@ void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::setup_output(float aspect_ratio) {
|
void Machine::setup_output(float aspect_ratio) {
|
||||||
crtc_bus_handler_.crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
|
crtc_bus_handler_.crt_.reset(new Outputs::CRT::CRT(1024, 8, Outputs::CRT::DisplayType::PAL50, 1));
|
||||||
crtc_bus_handler_.crt_->set_rgb_sampling_function(
|
crtc_bus_handler_.crt_->set_rgb_sampling_function(
|
||||||
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
|
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
|
||||||
"{"
|
"{"
|
||||||
|
@ -26,10 +26,32 @@ enum ROMType: uint8_t {
|
|||||||
|
|
||||||
struct CRTCBusHandler {
|
struct CRTCBusHandler {
|
||||||
public:
|
public:
|
||||||
|
CRTCBusHandler() : cycles_(0), was_enabled_(false), was_sync_(false) {
|
||||||
|
}
|
||||||
|
|
||||||
inline void perform_bus_cycle(const Motorola::CRTC::BusState &state) {
|
inline void perform_bus_cycle(const Motorola::CRTC::BusState &state) {
|
||||||
|
cycles_++;
|
||||||
|
bool is_sync = state.hsync || state.vsync;
|
||||||
|
if(state.display_enable != was_enabled_ || is_sync != was_sync_) {
|
||||||
|
if(was_sync_) {
|
||||||
|
crt_->output_sync((unsigned int)(cycles_ * 2));
|
||||||
|
} else {
|
||||||
|
uint8_t *colour_pointer = (uint8_t *)crt_->allocate_write_area(1);
|
||||||
|
if(colour_pointer) *colour_pointer = was_enabled_ ? 0xff : 0x00;
|
||||||
|
crt_->output_level((unsigned int)(cycles_ * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
cycles_ = 0;
|
||||||
|
was_sync_ = is_sync;
|
||||||
|
was_enabled_ = state.display_enable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int cycles_;
|
||||||
|
bool was_enabled_, was_sync_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Machine:
|
class Machine:
|
||||||
|
Loading…
Reference in New Issue
Block a user