diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index e083eb071..8c94d72d3 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -106,7 +106,7 @@ void Base::reset_sprite_collection() { void Base::posit_sprite(int sprite_number, int sprite_position, int screen_row) { if(!(status_ & StatusSpriteOverflow)) { - status_ = static_cast((status_ & ~31) | sprite_number); + status_ = static_cast((status_ & ~0x1f) | (sprite_number & 0x1f)); } if(sprite_set_.sprites_stopped) return; @@ -891,7 +891,7 @@ void Base::draw_sms(int start, int end) { for(int index = sprite_set_.fetched_sprite_slot - 1; index >= 0; --index) { SpriteSet::ActiveSprite &sprite = sprite_set_.active_sprites[index]; if(sprite.shift_position < 16) { - int pixel_start = std::max(start, sprite.x); + const int pixel_start = std::max(start, sprite.x); // TODO: it feels like the work below should be simplifiable; // the double shift in particular, and hopefully the variable shift. @@ -922,7 +922,8 @@ void Base::draw_sms(int start, int end) { ) colour_buffer[c] = sprite_buffer[c]; } - if(sprite_collision) status_ |= StatusSpriteCollision; + if(sprite_collision) + status_ |= StatusSpriteCollision; } // Map from the 32-colour buffer to real output pixels. diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index e3536f5d0..af2a2b1ee 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -12,6 +12,7 @@ #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" +#include #include #include @@ -593,7 +594,7 @@ class Base { sprite_set_.active_sprites[sprite].x = \ ram_[\ sprite_attribute_table_address_ & size_t(0x3f80 | (sprite_set_.active_sprites[sprite].index << 1))\ - ] - (master_system_.shift_sprites_8px_left ? size_t(8) : size_t(0)); \ + ] - (master_system_.shift_sprites_8px_left ? 8 : 0); \ const uint8_t name = ram_[\ sprite_attribute_table_address_ & size_t(0x3f81 | (sprite_set_.active_sprites[sprite].index << 1))\ ] & (sprites_16x16_ ? ~1 : ~0);\ @@ -682,6 +683,8 @@ class Base { // ... and do the actual fetching, which follows this routine: switch(start) { default: + assert(false); + sprite_fetch_block(0, 0); sprite_fetch_block(6, 2); @@ -712,9 +715,9 @@ class Base { background_fetch_block(103, 16, 40, scrolled_row_info); background_fetch_block(119, 20, 46, scrolled_row_info); background_fetch_block(135, 24, 52, row_info); - background_fetch_block(152, 28, 58, row_info); + background_fetch_block(151, 28, 58, row_info); - external_slots_4(168); + external_slots_4(167); return; }