28 lines
435 B
C++
28 lines
435 B
C++
#pragma once
|
|
|
|
#include <misc/types.h>
|
|
|
|
class Range {
|
|
public:
|
|
u16 start;
|
|
u16 end;
|
|
|
|
constexpr Range(u16 start, u16 end)
|
|
: start(start), end(end)
|
|
{};
|
|
|
|
inline
|
|
bool contains(u16 addr)
|
|
{
|
|
return addr >= start && addr <= end;
|
|
}
|
|
};
|
|
|
|
class Mem_device {
|
|
public:
|
|
virtual void write8(u16 addr, u8 data) = 0;
|
|
virtual u8 read8(u16 addr) = 0;
|
|
|
|
virtual void write16(u16 addr, u16 data);
|
|
virtual u16 read16(u16 addr);
|
|
};
|