diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 49d3cd450..a257e1eb2 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -688,9 +688,10 @@ void TMS9918::set_register(int address, uint8_t value) { if(master_system_.cram_is_selected) { master_system_.colour_ram[ram_pointer_ & 0x1f] = palette_pack( - static_cast((value & 0x03) << 6), - static_cast((value & 0x0c) << 4), - static_cast((value & 0x30) << 2)); + static_cast(((value >> 0) & 3) * 255 / 3), + static_cast(((value >> 2) & 3) * 255 / 3), + static_cast(((value >> 4) & 3) * 255 / 3) + ); ++ram_pointer_; // TODO: insert a CRAM dot here. } else { diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 772edb770..4ff6c2513 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -222,7 +222,9 @@ class Base { #define fetch_tile_name(column) {\ size_t address = pattern_address_base + ((column) << 1); \ master_system_.names[column].flags = ram_[address+1]; \ - master_system_.names[column].offset = static_cast((((master_system_.names[column].flags&1) << 8) | ram_[address]) << 5) + sub_row[(master_system_.names[column].flags&4) >> 2]; \ + master_system_.names[column].offset = static_cast( \ + (((master_system_.names[column].flags&1) << 8) | ram_[address]) << 5 \ + ) + sub_row[(master_system_.names[column].flags&4) >> 2]; \ } #define fetch_tile(column) {\ @@ -274,6 +276,13 @@ class Base { const size_t pattern_address_base = (pattern_name_address_ | size_t(0x3ff)) & static_cast(((scrolled_row & ~7) << 3) | 0x3800); const size_t sub_row[2] = {static_cast((scrolled_row & 7) << 2), 28 ^ static_cast((scrolled_row & 7) << 2)}; + /* + To add, relative to the times below: + + hsync active at cycle 14; + hsync inactive at cycle 27; + */ + switch(start) { default: sprite_render_block(0, 0); @@ -319,6 +328,9 @@ class Base { #undef external_slot #undef slot + void draw_sms(int start, int end) { + } + }; }