vgbc/memory/bus.h

32 lines
516 B
C
Raw Normal View History

2023-08-26 19:04:02 +02:00
#pragma once
#include <vector>
#include <optional>
2023-08-29 23:11:31 +02:00
#include <memory/mem_device.h>
2023-08-26 19:04:02 +02:00
class Bus : public Mem_device {
private:
struct MapEntry {
u16 start;
u16 end;
Mem_device *dev;
};
std::optional<MapEntry> find_entry(u16 addr);
public:
Bus();
void map_device(u16 start, u16 end, Mem_device* dev);
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<MapEntry> map;
};