1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 07:29:45 +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:
Thomas Harte 2017-07-31 22:13:20 -04:00
parent 69b99fe127
commit f742fd5d4a
2 changed files with 23 additions and 1 deletions

View File

@ -124,7 +124,7 @@ void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
}
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(
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
"{"

View File

@ -26,10 +26,32 @@ enum ROMType: uint8_t {
struct CRTCBusHandler {
public:
CRTCBusHandler() : cycles_(0), was_enabled_(false), was_sync_(false) {
}
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_;
private:
int cycles_;
bool was_enabled_, was_sync_;
};
class Machine: