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

Constrain sprite fetches to Chip RAM.

This commit is contained in:
Thomas Harte 2021-11-17 17:49:42 -05:00
parent be763cf7fe
commit 3496ebd1d7

View File

@ -1089,14 +1089,14 @@ bool Chipset::Sprite::advance_dma(int y) {
// FetchStart: fetch the first control word and proceed to the second.
case DMAState::FetchStart:
set_start_position(ram_[pointer_[0]]);
set_start_position(ram_[pointer_[0] & ram_mask_]);
++pointer_[0];
dma_state_ = DMAState::FetchStopAndControl;
return true;
// FetchStopAndControl: fetch second control word and wait for V start.
case DMAState::FetchStopAndControl:
set_stop_and_control(ram_[pointer_[0]]);
set_stop_and_control(ram_[pointer_[0] & ram_mask_]);
++pointer_[0];
dma_state_ = DMAState::WaitingForStart;
return true;
@ -1116,14 +1116,14 @@ bool Chipset::Sprite::advance_dma(int y) {
active = false;
return false;
}
set_image_data(1, ram_[pointer_[0]]);
set_image_data(1, ram_[pointer_[0] & ram_mask_]);
++pointer_[0];
dma_state_ = DMAState::FetchData0;
return true;
// FetchData0: fetch a word and proceed back to FetchData1.
case DMAState::FetchData0:
set_image_data(0, ram_[pointer_[0]]);
set_image_data(0, ram_[pointer_[0] & ram_mask_]);
++pointer_[0];
dma_state_ = DMAState::FetchData1;
return true;