diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2023-02-14 14:35:29 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2023-02-14 14:35:29 -0500 |
commit | a506b65bdd589997195e3f93222c37a539a29a28 (patch) | |
tree | 558f259f9e3eb2b8d1a03ced527b649bf0c5ed86 /memdict.hpp | |
parent | 18bcd5dd0e283100d25ca44e60f1705f3c028456 (diff) |
allow byte indexing
Diffstat (limited to 'memdict.hpp')
-rw-r--r-- | memdict.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/memdict.hpp b/memdict.hpp index 8606da2..6209f3b 100644 --- a/memdict.hpp +++ b/memdict.hpp @@ -25,14 +25,23 @@ constexpr unsigned long int MemDictSize = 4096; class MemDict : public Dictionary { - Cell dict[MemDictSize]; + uint8_t dict[MemDictSize]; public: virtual Cell read(Addr addr) const final { - return dict[addr]; + return *reinterpret_cast<const Cell *>(dict + addr); } virtual int write(Addr addr, Cell value) final { + *reinterpret_cast<Cell *>(dict + addr) = value; + return 0; + } + + virtual uint8_t readbyte(Addr addr) const final { + return dict[addr]; + } + + virtual int writebyte(Addr addr, uint8_t value) final { dict[addr] = value; return 0; } |