2017-09-06 13:22:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include "Memory.h"
|
|
|
|
|
|
|
|
namespace EightBit {
|
|
|
|
class Ram : public Memory {
|
|
|
|
public:
|
2018-04-14 09:39:06 +01:00
|
|
|
Ram(const size_t size = 0)
|
2017-09-06 13:22:23 +01:00
|
|
|
: Memory(size) {
|
|
|
|
}
|
|
|
|
|
2018-04-14 09:39:06 +01:00
|
|
|
uint8_t peek(const uint16_t address) const {
|
2017-09-06 13:22:23 +01:00
|
|
|
return read(address);
|
|
|
|
}
|
|
|
|
|
2018-04-14 09:39:06 +01:00
|
|
|
void poke(const uint16_t address, const uint8_t value) {
|
2017-09-06 13:22:23 +01:00
|
|
|
write(address, value);
|
|
|
|
}
|
|
|
|
|
2018-04-14 09:39:06 +01:00
|
|
|
uint8_t& reference(const uint16_t address) {
|
2017-11-03 22:05:01 +00:00
|
|
|
return BYTES()[address];
|
2017-09-06 13:22:23 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|