From a0cd944080348e7c4349b115a767d0a1de5cb771 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Sun, 14 May 2017 14:07:24 +0200 Subject: [PATCH] Divise le classi, boilerplate --- cpp/vmas.cpp | 22 ++++++++++++++++++++++ cpp/vmas.h | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 cpp/vmas.cpp create mode 100644 cpp/vmas.h 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