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

Alters 4bpp mapping; adds character mode 4bpp and 8bpp.

This commit is contained in:
Thomas Harte 2021-06-23 19:35:47 -04:00
parent 2c2bb3765f
commit 6c8b23e708

View File

@ -489,12 +489,12 @@ template <int bpp, bool is_lpixel> void Nick::output_pixel(uint16_t *target, int
break;
case 4:
target[0] = palette_[((pixels[0] & 0x80) >> 4) | ((pixels[0] & 0x20) >> 3) | ((pixels[0] & 0x08) >> 2) | ((pixels[0] & 0x02) >> 1)];
target[1] = palette_[((pixels[0] & 0x40) >> 3) | ((pixels[0] & 0x10) >> 2) | ((pixels[0] & 0x04) >> 1) | ((pixels[0] & 0x01) >> 0)];
target[0] = palette_[((pixels[0] & 0xa0) >> 4) | ((pixels[0] & 0x0a) >> 1)];
target[1] = palette_[((pixels[0] & 0x50) >> 3) | ((pixels[0] & 0x05) >> 0)];
if constexpr (!is_lpixel) {
target[2] = palette_[((pixels[1] & 0x80) >> 4) | ((pixels[1] & 0x20) >> 3) | ((pixels[1] & 0x08) >> 2) | ((pixels[1] & 0x02) >> 1)];
target[3] = palette_[((pixels[1] & 0x40) >> 3) | ((pixels[1] & 0x10) >> 2) | ((pixels[1] & 0x04) >> 1) | ((pixels[1] & 0x01) >> 0)];
target[2] = palette_[((pixels[1] & 0xa0) >> 4) | ((pixels[1] & 0x0a) >> 1)];
target[3] = palette_[((pixels[1] & 0x50) >> 3) | ((pixels[1] & 0x05) >> 0)];
target += 2;
}
@ -534,7 +534,6 @@ template <int bpp, int index_bits> void Nick::output_character(uint16_t *target,
switch(bpp) {
default:
assert(false);
// TODO: other BPPs are supported for character modes, I think.
break;
case 1: {
@ -556,9 +555,19 @@ template <int bpp, int index_bits> void Nick::output_character(uint16_t *target,
target[1] = palette_[((pixels & 0x40) >> 5) | ((pixels & 0x04) >> 2)];
target[2] = palette_[((pixels & 0x20) >> 4) | ((pixels & 0x02) >> 1)];
target[3] = palette_[((pixels & 0x10) >> 3) | ((pixels & 0x01) >> 0)];
target += 4;
break;
case 4:
target[0] = palette_[((pixels & 0xa0) >> 4) | ((pixels & 0x0a) >> 1)];
target[1] = palette_[((pixels & 0x50) >> 3) | ((pixels & 0x05) >> 0)];
target += 2;
break;
case 8:
target[0] = mapped_colour(pixels);
++target;
break;
}
}
}