diff --git a/Machines/AppleII/Video.cpp b/Machines/AppleII/Video.cpp index ec1a83d88..64daee143 100644 --- a/Machines/AppleII/Video.cpp +++ b/Machines/AppleII/Video.cpp @@ -57,8 +57,8 @@ void VideoBase::setup_tables() { ((c & 0x40) ? 0x6000 : 0x0000); uint8_t *const table_entry = reinterpret_cast(&scaled_byte[c]); - table_entry[1] = static_cast(value & 0xff); table_entry[0] = static_cast(value >> 8); + table_entry[1] = static_cast(value & 0xff); } for(int c = 128; c < 256; ++c) { uint8_t *const source_table_entry = reinterpret_cast(&scaled_byte[c & 0x7f]); @@ -69,14 +69,23 @@ void VideoBase::setup_tables() { } for(int c = 0; c < 16; ++c) { - uint8_t *table_entry = reinterpret_cast(&low_resolution_patterns[0][c]); - table_entry[1] = static_cast(c | (c << 4)); - table_entry[0] = static_cast((c >> 3) | (c << 1) | (c << 5)); + // Produce the whole 28-bit pattern that would cover two bytes. + int pattern = 0; + for(int l = 0; l < 7; ++l) { + pattern <<= 4; + pattern |= c; + } - table_entry = reinterpret_cast(&low_resolution_patterns[1][c]); - table_entry[1] = static_cast((c >> 2) | (c << 2) | (c << 6)); - table_entry[0] = static_cast((c >> 1) | (c << 3)); + // Pack that 28-bit pattern into the appropriate look-up tables. + uint8_t *const left_entry = reinterpret_cast(&low_resolution_patterns[0][c]); + uint8_t *const right_entry = reinterpret_cast(&low_resolution_patterns[1][c]); + left_entry[0] = static_cast(pattern >> 21); + left_entry[1] = static_cast(pattern >> 14); + right_entry[0] = static_cast(pattern >> 7); + right_entry[1] = static_cast(pattern); } + + printf(""); } void VideoBase::set_graphics_mode() { diff --git a/Machines/AppleII/Video.hpp b/Machines/AppleII/Video.hpp index 8d9c836f5..32d19ef8c 100644 --- a/Machines/AppleII/Video.hpp +++ b/Machines/AppleII/Video.hpp @@ -128,7 +128,7 @@ template class Video: public VideoBase { case GraphicsMode::LowRes: for(int c = column_; c < pixel_end; ++c) { const uint8_t character = bus_handler_.perform_read(static_cast(text_address + c)); - pixel_pointer_[c] = low_resolution_patterns[column_&1][(character >> row_shift)&0xf]; + pixel_pointer_[c] = low_resolution_patterns[c&1][(character >> row_shift)&0xf]; } break;