From e5e988b28f56e1d38c83f9028a37d81101aa723b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 15 Jun 2021 22:31:50 -0400 Subject: [PATCH] Adds an incorrect assumed-pixel-mode serialiser. This actually shows something a bit like the Enterprise boot logo. --- Machines/Enterprise/Nick.cpp | 29 +++++++++++++++++++++++++++-- Machines/Enterprise/Nick.hpp | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Machines/Enterprise/Nick.cpp b/Machines/Enterprise/Nick.cpp index 0068d6dd9..8296b2b7a 100644 --- a/Machines/Enterprise/Nick.cpp +++ b/Machines/Enterprise/Nick.cpp @@ -187,8 +187,33 @@ void Nick::run_for(HalfCycles duration) { // TODO: real pixels. if(allocated_pointer_) { for(int c = 0; c < next_event - window; c++) { - pixel_pointer_[0] = uint16_t(0xfff ^ (window + c)); - ++pixel_pointer_; +// pixel_pointer_[0] = uint16_t(0xfff ^ (window + c)); + +// ++pixel_pointer_; + + // Hard-coded here: 1bpp, pixel mode. + const uint8_t pixels[2] = { ram_[line_data_pointer_[0]], ram_[line_data_pointer_[0]+1] }; + line_data_pointer_[0] += 2; + + pixel_pointer_[0] = (pixels[0] & 0x80) ? 0xffff : 0x0000; + pixel_pointer_[1] = (pixels[0] & 0x40) ? 0xffff : 0x0000; + pixel_pointer_[2] = (pixels[0] & 0x20) ? 0xffff : 0x0000; + pixel_pointer_[3] = (pixels[0] & 0x10) ? 0xffff : 0x0000; + pixel_pointer_[4] = (pixels[0] & 0x08) ? 0xffff : 0x0000; + pixel_pointer_[5] = (pixels[0] & 0x04) ? 0xffff : 0x0000; + pixel_pointer_[6] = (pixels[0] & 0x02) ? 0xffff : 0x0000; + pixel_pointer_[7] = (pixels[0] & 0x01) ? 0xffff : 0x0000; + pixel_pointer_[8] = (pixels[1] & 0x80) ? 0xffff : 0x0000; + pixel_pointer_[9] = (pixels[1] & 0x40) ? 0xffff : 0x0000; + pixel_pointer_[10] = (pixels[1] & 0x20) ? 0xffff : 0x0000; + pixel_pointer_[11] = (pixels[1] & 0x10) ? 0xffff : 0x0000; + pixel_pointer_[12] = (pixels[1] & 0x08) ? 0xffff : 0x0000; + pixel_pointer_[13] = (pixels[1] & 0x04) ? 0xffff : 0x0000; + pixel_pointer_[14] = (pixels[1] & 0x02) ? 0xffff : 0x0000; + pixel_pointer_[15] = (pixels[1] & 0x01) ? 0xffff : 0x0000; + pixel_pointer_ += 16; + + // TODO: possibly flush here? } } else { pixel_pointer_ += next_event - window; diff --git a/Machines/Enterprise/Nick.hpp b/Machines/Enterprise/Nick.hpp index 5f99cb0f2..424ba8b1c 100644 --- a/Machines/Enterprise/Nick.hpp +++ b/Machines/Enterprise/Nick.hpp @@ -68,7 +68,7 @@ class Nick { void flush_border(); // The destination for new pixels. - static constexpr int allocation_size = 320; + static constexpr int allocation_size = 800; // TODO: pick an appropriate length once the serialiser is working correctly. uint16_t *pixel_pointer_ = nullptr, *allocated_pointer_ = nullptr; int pixel_duration_ = 0; void flush_pixels();