Bug fix: check if vm exists
[avr-sim.git] / SRam.h
blob4b218d3ecc2deac939f4830320eb72dc4dd87051
1 #ifndef AVR_SRAM_H
2 #define AVR_SRAM_H
4 #include "Memory.h"
6 namespace avr {
8 class SRam : public Memory {
9 public:
10 SRam(unsigned int size);
12 public:
13 /**
14 * Reads a single bytes of raw data from memory at
15 * offset \e offset.
17 * \exception AccessViolation { When the data requested is
18 * not available, this exception is thrown }
20 void writeByte(unsigned int offset, byte val);
22 /**
23 * Reads a word of raw data from memory starting at
24 * offset \e offset.
26 * \exception AccessViolation { When the data requested is
27 * not available, this exception is thrown }
29 void writeWord(unsigned int offset, word val);
32 inline SRam::SRam(unsigned int size) : Memory(size) {
33 fill(0);
36 inline void SRam::writeByte(unsigned int offset, byte val) {
37 write(offset, &val, 1);
40 inline void SRam::writeWord(unsigned int offset, word val) {
41 write(offset, (unsigned char *)&val, 2);
46 #endif /*AVR_SRAM_H*/