2014-11-10 14:16:45 +00:00
|
|
|
#ifndef __RAM_H__
|
|
|
|
#define __RAM_H__
|
2014-10-18 11:33:48 +00:00
|
|
|
|
2014-10-21 18:41:44 +00:00
|
|
|
class ram: public Memory::Device {
|
2014-10-18 11:33:48 +00:00
|
|
|
public:
|
2018-08-13 13:41:23 +00:00
|
|
|
virtual void operator= (uint8_t c) { _mem[_acc] = c; }
|
|
|
|
virtual operator uint8_t () { 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:
|
2018-08-13 13:41:23 +00:00
|
|
|
uint8_t _mem[1024];
|
2014-10-18 11:33:48 +00:00
|
|
|
};
|
|
|
|
#endif
|