1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Ensures sprite scanning doesn't improperly set collision flag; that slot 151 is filled.

This commit is contained in:
Thomas Harte 2018-10-12 19:50:48 -04:00
parent 9ab0c54426
commit 9e52ead09a
2 changed files with 10 additions and 6 deletions

View File

@ -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<uint8_t>((status_ & ~31) | sprite_number);
status_ = static_cast<uint8_t>((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.

View File

@ -12,6 +12,7 @@
#include "../../../Outputs/CRT/CRT.hpp"
#include "../../../ClockReceiver/ClockReceiver.hpp"
#include <cassert>
#include <cstdint>
#include <memory>
@ -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;
}