From bfb9d8ccb67de3e8cc178f4515d3c3154dadf11d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 7 Oct 2018 14:32:20 -0400 Subject: [PATCH] At least attempts to use proper addressing for sprite info fetches. --- Components/9918/Implementation/9918Base.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 60cd95541..873e9b05b 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -581,7 +581,10 @@ class Base { template void fetch_sms(int start, int end) { #define sprite_fetch(sprite) {\ - sprite_set_.active_sprites[sprite].shift_position = -ram_[sprite_attribute_table_address_ + 128 + (sprite_set_.active_sprites[sprite].index << 1)] + (master_system_.shift_sprites_8px_left ? 8 : 0); \ + sprite_set_.active_sprites[sprite].shift_position = \ + -ram_[\ + (sprite_attribute_table_address_ | 0x7f) & (0x3f80 | (sprite_set_.active_sprites[sprite].index << 1))\ + ] + (master_system_.shift_sprites_8px_left ? 8 : 0); \ sprite_set_.active_sprites[sprite].image[0] = \ sprite_set_.active_sprites[sprite].image[1] = \ sprite_set_.active_sprites[sprite].image[2] = \ @@ -612,8 +615,8 @@ class Base { #define sprite_y_read(location, sprite) \ slot(location): \ - posit_sprite(sprite, ram_[sprite_attribute_table_address_ + sprite], row_); \ - posit_sprite(sprite, ram_[sprite_attribute_table_address_ + sprite + 1], row_); \ + posit_sprite(sprite, ram_[(sprite_attribute_table_address_ | 0x7f) & (sprite | 0x3f00)], row_); \ + posit_sprite(sprite, ram_[(sprite_attribute_table_address_ | 0x7f) & ((sprite + 1) | 0x3f00)], row_); \ #define fetch_tile_name(column) {\ const size_t scrolled_column = (column - horizontal_offset) & 0x1f;\