1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-09 05:25:01 +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. // FetchStart: fetch the first control word and proceed to the second.
case DMAState::FetchStart: case DMAState::FetchStart:
set_start_position(ram_[pointer_[0]]); set_start_position(ram_[pointer_[0] & ram_mask_]);
++pointer_[0]; ++pointer_[0];
dma_state_ = DMAState::FetchStopAndControl; dma_state_ = DMAState::FetchStopAndControl;
return true; return true;
// FetchStopAndControl: fetch second control word and wait for V start. // FetchStopAndControl: fetch second control word and wait for V start.
case DMAState::FetchStopAndControl: case DMAState::FetchStopAndControl:
set_stop_and_control(ram_[pointer_[0]]); set_stop_and_control(ram_[pointer_[0] & ram_mask_]);
++pointer_[0]; ++pointer_[0];
dma_state_ = DMAState::WaitingForStart; dma_state_ = DMAState::WaitingForStart;
return true; return true;
@@ -1116,14 +1116,14 @@ bool Chipset::Sprite::advance_dma(int y) {
active = false; active = false;
return false; return false;
} }
set_image_data(1, ram_[pointer_[0]]); set_image_data(1, ram_[pointer_[0] & ram_mask_]);
++pointer_[0]; ++pointer_[0];
dma_state_ = DMAState::FetchData0; dma_state_ = DMAState::FetchData0;
return true; return true;
// FetchData0: fetch a word and proceed back to FetchData1. // FetchData0: fetch a word and proceed back to FetchData1.
case DMAState::FetchData0: case DMAState::FetchData0:
set_image_data(0, ram_[pointer_[0]]); set_image_data(0, ram_[pointer_[0] & ram_mask_]);
++pointer_[0]; ++pointer_[0];
dma_state_ = DMAState::FetchData1; dma_state_ = DMAState::FetchData1;
return true; return true;