mirror of
https://github.com/cmosher01/Epple-II.git
synced 2024-06-09 23:29:39 +00:00
24 lines
719 B
C++
24 lines
719 B
C++
#include "memorystrapping.h"
|
|
#include <algorithm>
|
|
|
|
MemoryStrapping::MemoryStrapping(MemoryRow &row):
|
|
row(row) {
|
|
}
|
|
|
|
void MemoryStrapping::strap_to(std::uint16_t addr_base, std::uint16_t addr_size) {
|
|
this->addr_base = addr_base;
|
|
this->addr_size = addr_size;
|
|
}
|
|
|
|
bool MemoryStrapping::contains(std::uint16_t address) const {
|
|
return this->addr_base <= address && address < this->addr_base + std::min(this->row.size(), this->addr_size);
|
|
}
|
|
|
|
std::uint8_t MemoryStrapping::read(const std::uint16_t address) const {
|
|
return this->row.read(address - this->addr_base);
|
|
}
|
|
|
|
void MemoryStrapping::write(const std::uint16_t address, const std::uint8_t data) {
|
|
this->row.write(address - this->addr_base, data);
|
|
}
|