diff --git a/cpp/vmas.cpp b/cpp/vmas.cpp new file mode 100644 index 0000000..f6a7ff2 --- /dev/null +++ b/cpp/vmas.cpp @@ -0,0 +1,22 @@ +#include +#include +#include "vmas.h" +#include "debug.h" + +void VMAddrSpace::insCode(uint8_t * buf, uint8_t size) { + DBG_INFO(("Copying buffer into code section.\n")); + memcpy(&this->code, buf, size); + return; +} + +void VMAddrSpace::insStack(uint8_t * buf, uint8_t size) { + DBG_INFO(("Copying buffer into code section.\n")); + memcpy(&this->stack, buf, size); + return; +} + +void VMAddrSpace::insData(uint8_t * buf, uint8_t size) { + DBG_INFO(("Copying buffer into data section.\n")); + memcpy(&this->data, buf, size); + return; +} \ No newline at end of file diff --git a/cpp/vmas.h b/cpp/vmas.h new file mode 100644 index 0000000..730123d --- /dev/null +++ b/cpp/vmas.h @@ -0,0 +1,14 @@ +#ifndef VMAS_H +#define VMAS_H + +class VMAddrSpace { + uint8_t stack[0x100], code[0x300], data[0x500]; + +public: + void assemble(void); + void insStack(uint8_t *buf, uint8_t size); + void insCode(uint8_t *buf, uint8_t size); + void insData(uint8_t *buf, uint8_t size); +}; + +#endif \ No newline at end of file