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) {}
|
|
|
|
void operator= (byte b) {}
|
|
|
|
operator byte() { return 0; }
|
2014-10-18 11:33:48 +00:00
|
|
|
} nd;
|
|
|
|
|
|
|
|
Memory::Memory() {
|
2014-10-21 18:41:44 +00:00
|
|
|
put(nd, 0);
|
2014-10-18 11:33:48 +00:00
|
|
|
}
|