1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Eliminate hard-coded assumption of 16kb.

Clearly I'll have to do something else to support 128k+, probably move the ram pointer?
This commit is contained in:
Thomas Harte 2023-01-10 12:38:19 -05:00
parent 9085ba4081
commit 4d96122884
2 changed files with 6 additions and 2 deletions

View File

@ -360,10 +360,10 @@ template <Personality personality> struct Base {
break;
}
}
ram_[ram_pointer_ & 16383] = read_ahead_buffer_;
ram_[ram_pointer_ & memory_mask(personality)] = read_ahead_buffer_;
break;
case MemoryAccess::Read:
read_ahead_buffer_ = ram_[ram_pointer_ & 16383];
read_ahead_buffer_ = ram_[ram_pointer_ & memory_mask(personality)];
break;
}
++ram_pointer_;

View File

@ -42,6 +42,10 @@ constexpr size_t memory_size(Personality p) {
}
}
constexpr uint16_t memory_mask(Personality p) {
return (memory_size(p) >= 65536) ? 0xffff : uint16_t(memory_size(p) - 1);
}
}
}