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:
parent
514022204e
commit
20c1c6fdcd
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user