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
|
|
|
|
2023-08-28 21:55:46 +02:00
|
|
|
class Range {
|
2023-08-30 13:02:20 +02:00
|
|
|
public:
|
2023-08-28 21:55:46 +02:00
|
|
|
u16 start;
|
|
|
|
u16 end;
|
|
|
|
|
|
|
|
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
|
|
|
};
|