#pragma once #include #include #include class Bus : public Mem_device { private: struct MapEntry { Range range; u16 offset; Mem_device *dev; }; std::optional find_entry(u16 addr); public: Bus(); void map_device(u16 start, u16 end, Mem_device* dev, u16 offset = 0x0); virtual void write8(u16 addr, u8 data); virtual u8 read8(u16 addr); virtual void write16(u16 addr, u16 data); virtual u16 read16(u16 addr); private: std::vector map; };