2014-10-18 11:33:48 +00:00
|
|
|
#ifndef _RAM_H
|
|
|
|
#define _RAM_H
|
|
|
|
|
2014-10-21 18:41:44 +00:00
|
|
|
class ram: public Memory::Device {
|
2014-10-18 11:33:48 +00:00
|
|
|
public:
|
2014-10-20 18:19:02 +00:00
|
|
|
virtual void operator= (byte c) { _mem[_acc] = c; }
|
|
|
|
virtual operator byte () { return _mem[_acc]; }
|
2014-10-18 11:33:48 +00:00
|
|
|
|
2014-10-20 18:19:02 +00:00
|
|
|
virtual void checkpoint(Stream &s) { s.write(_mem, sizeof(_mem)); }
|
|
|
|
virtual void restore(Stream &s) { s.readBytes((char *)_mem, sizeof(_mem)); }
|
2014-10-18 11:33:48 +00:00
|
|
|
|
2014-10-20 18:19:02 +00:00
|
|
|
ram (): Memory::Device(sizeof(_mem)) {}
|
2014-10-18 11:33:48 +00:00
|
|
|
|
|
|
|
private:
|
2014-10-20 18:19:02 +00:00
|
|
|
byte _mem[1024];
|
2014-10-18 11:33:48 +00:00
|
|
|
};
|
|
|
|
#endif
|