#include "vm.h" #include "debug.h" #include "vmas.h" #include VM::VM() { DBG_INFO(("Creating VM without code.\n")); init_regs(); } VM::VM(uint8_t *code, uint32_t codesize) { DBG_INFO(("Creating VM with code.\n")); init_regs(); as.insCode(code, codesize); } void VM::init_regs(void) { uint8_t i; for (i = R0; i <= SP; i++) { this->regs[i] = 0; } return; } void VM::status(void) { uint8_t i; DBG_INFO(("VM Status:\n")); DBG_INFO(("~~~~~~~~~~\n")); for (i = R0; i <= SP; i++) { switch (i) { case R0: DBG_INFO(("R0:\t0x%x\n", this->regs[i])); break; case R1: DBG_INFO(("R1:\t0x%x\n", this->regs[i])); break; case R2: DBG_INFO(("R2:\t0x%x\n", this->regs[i])); break; case R3: DBG_INFO(("R3:\t0x%x\n", this->regs[i])); break; case S0: DBG_INFO(("S0:\t0x%x\n", this->regs[i])); break; case S1: DBG_INFO(("S1:\t0x%x\n", this->regs[i])); break; case S2: DBG_INFO(("S2:\t0x%x\n", this->regs[i])); break; case S3: DBG_INFO(("S3:\t0x%x\n", this->regs[i])); break; case IP: DBG_INFO(("IP:\t0x%x\n", this->regs[i])); break; case BP: DBG_INFO(("BP:\t0x%x\n", this->regs[i])); break; case SP: DBG_INFO(("SP:\t0x%x\n", this->regs[i])); break; } } DBG_INFO(("~~~~~~~~~~\n")); return; } void VM::run(uint8_t *code) { return; }