1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Add sanity check on sprite fetches versus draws.

This commit is contained in:
Thomas Harte 2023-04-03 22:46:49 -04:00
parent 514022204e
commit 20c1c6fdcd
4 changed files with 16 additions and 0 deletions

View File

@ -136,6 +136,10 @@ void Base<personality>::posit_sprite(int sprite_number, int sprite_position, uin
advance(fetch_sprite_buffer_);
fetch_sprite_buffer_->reset_sprite_collection();
fetch_sprite_buffer_->sprite_terminator = mode_timing_.sprite_terminator(fetch_line_buffer_->screen_mode);
#ifndef NDEBUG
fetch_sprite_buffer_->is_filling = true;
#endif
}
if(!(status_ & StatusSpriteOverflow)) {

View File

@ -78,6 +78,8 @@ void Base<personality>::draw_sprites(uint8_t y, int start, int end, const std::a
return;
}
assert(!buffer.is_filling);
constexpr uint32_t sprite_colour_selection_masks[2] = {0x00000000, 0xffffffff};
constexpr int colour_masks[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
const int sprite_width = sprites_16x16_ ? 16 : 8;

View File

@ -281,6 +281,12 @@ class SpriteFetcher {
const AddressT graphic_location = base->sprite_generator_table_address_ & bits<11>(AddressT((name << 3) | sprite.row));
sprite.image[0] = base->ram_[graphic_location];
sprite.image[1] = base->ram_[graphic_location+16];
#ifndef NDEBUG
if(slot == ((mode == SpriteMode::Mode2) ? 7 : 3)) {
base->fetch_sprite_buffer_->is_filling = false;
}
#endif
}
Base<personality> *const base;

View File

@ -112,6 +112,10 @@ struct SpriteBuffer {
// being evaluated for display. This flag determines whether the sentinel has yet been reached.
uint8_t sprite_terminator = 0;
#ifndef NDEBUG
bool is_filling = false;
#endif
void reset_sprite_collection();
};