1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Obeys stated memory size.

This commit is contained in:
Thomas Harte 2019-11-03 21:18:17 -05:00
parent 48b0d8c329
commit e9965c2738

View File

@ -179,7 +179,7 @@ int DMAController::bus_grant(uint16_t *ram, size_t size) {
if(!buffer_[active_buffer_ ^ 1].is_full) return 0;
for(int c = 0; c < 8; ++c) {
ram[address_ >> 1] = uint16_t(
ram[size_t(address_ >> 1) & (size - 1)] = uint16_t(
(buffer_[active_buffer_ ^ 1].contents[(c << 1) + 0] << 8) |
(buffer_[active_buffer_ ^ 1].contents[(c << 1) + 1] << 0)
);
@ -191,7 +191,7 @@ int DMAController::bus_grant(uint16_t *ram, size_t size) {
if(!buffer_[active_buffer_ ].is_full) return 8;
for(int c = 0; c < 8; ++c) {
ram[address_ >> 1] = uint16_t(
ram[size_t(address_ >> 1) & (size - 1)] = uint16_t(
(buffer_[active_buffer_].contents[(c << 1) + 0] << 8) |
(buffer_[active_buffer_].contents[(c << 1) + 1] << 0)
);