From a506b65bdd589997195e3f93222c37a539a29a28 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 14 Feb 2023 14:35:29 -0500 Subject: allow byte indexing --- memdict.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'memdict.hpp') 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(dict + addr); } virtual int write(Addr addr, Cell value) final { + *reinterpret_cast(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; } -- cgit v1.2.3