1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Limit to specific purpose.

This commit is contained in:
Thomas Harte 2021-10-22 16:16:19 -07:00
parent 040ac93042
commit 003162f710
2 changed files with 27 additions and 15 deletions

View File

@ -182,17 +182,25 @@ template <int cycle> void Chipset::output() {
// TODO: this doesn't support dual playfields; use an alternative
// palette table for that.
pixels_[0] = palette_[bitplane_pixels_ >> 120];
bitplane_pixels_ <<= is_high_res_ * 8;
if(is_high_res_) {
pixels_[0] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
pixels_[1] = palette_[bitplane_pixels_ >> 120];
bitplane_pixels_ <<= 8;
pixels_[1] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
pixels_[2] = palette_[bitplane_pixels_ >> 120];
bitplane_pixels_ <<= is_high_res_ * 8;
pixels_[2] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
pixels_[3] = palette_[bitplane_pixels_ >> 120];
bitplane_pixels_ <<= 8;
pixels_[3] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
} else {
pixels_[0] = pixels_[1] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
pixels_[2] = pixels_[3] = palette_[bitplane_pixels_.get()];
bitplane_pixels_.shift();
}
pixels_ += 4;
}
@ -464,6 +472,12 @@ constexpr uint64_t expand_byte(uint8_t source) {
return result;
}
// A very small selection of test cases.
static_assert(expand_byte(0xff) == 0x01'01'01'01'01'01'01'01);
static_assert(expand_byte(0x55) == 0x00'01'00'01'00'01'00'01);
static_assert(expand_byte(0xaa) == 0x01'00'01'00'01'00'01'00);
static_assert(expand_byte(0x00) == 0x00'00'00'00'00'00'00'00);
}
void Chipset::SixteenPixels::set(const BitplaneData &previous, const BitplaneData &next, int odd_delay, int even_delay) {

View File

@ -220,15 +220,13 @@ class Chipset: private ClockingHint::Observer {
int odd_delay,
int even_delay);
SixteenPixels &operator <<= (int c) {
(*this)[1] = ((*this)[1] << c) | ((*this)[0] >> (64 - c));
(*this)[0] <<= c;
return *this;
void shift() {
(*this)[1] = ((*this)[1] << 8) | ((*this)[0] >> 56);
(*this)[0] <<= 8;
}
int operator >> (int c) {
assert(c >= 96);
return int((*this)[1] >> (c - 64));
uint8_t get() {
return uint8_t((*this)[1] >> 56);
}
} bitplane_pixels_;