vgbc/memory/mem_device.h

30 lines
444 B
C
Raw Normal View History

2023-08-26 19:04:02 +02:00
#pragma once
2023-08-29 23:16:09 +02:00
#include <misc/types.h>
2023-08-26 19:04:02 +02:00
class Range {
private:
u16 start;
u16 end;
public:
constexpr Range(u16 start, u16 end)
: start(start), end(end)
{};
inline
bool contains(u16 addr)
{
return addr >= start && addr <= end;
}
};
2023-08-26 19:04:02 +02:00
class Mem_device {
public:
virtual void write8(u16 addr, u8 data) = 0;
virtual u8 read8(u16 addr) = 0;
2023-08-27 22:19:02 +02:00
virtual void write16(u16 addr, u16 data);
virtual u16 read16(u16 addr);
2023-08-26 19:04:02 +02:00
};