1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-12-21 12:29:51 +00:00
r65emu/memory.cpp

25 lines
438 B
C++
Raw Normal View History

2018-08-13 13:41:23 +00:00
#include <stdint.h>
2014-10-18 11:33:48 +00:00
#include "memory.h"
void Memory::put (Device &dev, address b) {
2014-10-21 18:41:44 +00:00
Device **d = _pages + b/page_size;
2014-10-18 11:33:48 +00:00
2014-10-21 18:41:44 +00:00
int size = dev.pages();
while (size--)
*d++ = &dev;
2014-10-18 11:33:48 +00:00
2014-10-21 18:41:44 +00:00
dev.base(b);
2014-10-18 11:33:48 +00:00
}
class NullDevice: public Memory::Device {
2014-10-21 18:41:44 +00:00
public:
NullDevice(): Memory::Device(65536) {}
2018-08-13 13:41:23 +00:00
void operator= (uint8_t b) {}
operator uint8_t() { return 0; }
2014-10-18 11:33:48 +00:00
} nd;
2014-10-31 08:44:57 +00:00
void Memory::begin() {
2014-10-21 18:41:44 +00:00
put(nd, 0);
2014-10-31 17:44:37 +00:00
nd._pages = 1; // hack for checkpointing
2014-10-18 11:33:48 +00:00
}