1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Adds sprite DMA windows.

This commit is contained in:
Thomas Harte 2021-10-22 13:07:20 -07:00
parent c5e8b547af
commit b489ba3d0d
2 changed files with 16 additions and 2 deletions

View File

@ -231,6 +231,7 @@ template <int cycle, bool stop_if_cpu> bool Chipset::perform_cycle() {
constexpr auto BitplaneFlag = DMAMask<DMAFlag::Bitplane, DMAFlag::AllBelow>::value;
constexpr auto CopperFlag = DMAMask<DMAFlag::Copper, DMAFlag::AllBelow>::value;
constexpr auto DiskFlag = DMAMask<DMAFlag::Disk, DMAFlag::AllBelow>::value;
constexpr auto SpritesFlag = DMAMask<DMAFlag::Sprites, DMAFlag::AllBelow>::value;
// Update state as to whether bitplane fetching should happen now.
//
@ -257,13 +258,22 @@ template <int cycle, bool stop_if_cpu> bool Chipset::perform_cycle() {
// 2. Refresh, disk, audio, or sprites. Depending on region.
//
// Blitter and CPU priority is dealt with below.
if constexpr (cycle >= 7 && cycle < 13) {
if constexpr (cycle >= 0x07 && cycle < 0x0d) {
if((dma_control_ & DiskFlag) == DiskFlag) {
if(disk_.advance()) {
return false;
}
}
}
if constexpr(cycle >= 0x15 && cycle < 0x35) {
if((dma_control_ & SpritesFlag) == SpritesFlag) {
constexpr auto sprite_id = (cycle - 0x15) >> 2;
if(sprites_[sprite_id].advance(sprite_id)) {
return false;
}
}
}
} else {
// Bitplanes being dealt with, specific odd-cycle responsibility
// is just possibly to pass to the Copper.
@ -926,6 +936,10 @@ void Chipset::Sprite::set_image_data(int slot, uint16_t value) {
active_ |= slot == 0;
}
bool Chipset::Sprite::advance([[maybe_unused]] int sprite_id) {
return false;
}
// MARK: - Disk.
void Chipset::DiskDMA::enqueue(uint16_t value, bool matches_sync) {

View File

@ -132,7 +132,7 @@ class Chipset: private ClockingHint::Observer {
void set_stop_and_control(uint16_t value);
void set_image_data(int slot, uint16_t value);
bool advance(int slot);
bool advance(int sprite_id);
private:
uint16_t v_start_ = 0, h_start_ = 0, v_stop_ = 0;