 }
 
 
-static int16_t mem_read(uint16_t addr, bool is16bit, void *ctx UNUSED)
+static int16_t memoryRead(uint16_t address, bool is16bit, void *ctx UNUSED)
 {
   if (is16bit)
-    return (memory[addr] << 8) | memory[addr+1];
-  return memory[addr];
+    return (memory[address] << 8) | memory[address+1];
+  return memory[address];
 }
 
-static void mem_write(uint16_t addr, int16_t value, bool is16bit, void *ctx UNUSED)
+static void memoryWrite(uint16_t address, int16_t value, bool is16bit, void *ctx UNUSED)
 {
   if (is16bit) {
-    memory[addr] = value >> 8;
-    memory[addr+1] = value;
+    memory[address] = value >> 8;
+    memory[address+1] = value;
   } 
   else
-    memory[addr] = value;
+    memory[address] = value;
 }
 
-static int16_t call_user(uint8_t funcid, uint8_t argc, int16_t *argv, void *ctx UNUSED)
+static int16_t callUserFunction(uint8_t function, uint8_t argc, int16_t *argv, void *ctx UNUSED)
 {
   int16_t ret = 0;
   int i;
 
-  if (funcid == 0) {
+  if (function == 0) {
     stop = true;
     Serial.println("Called user function 0 => stop.");
     Serial.flush();
     return ret;
   }
 
-  Serial.print("Called user function " + String(funcid) + " with " + String(argc) + " args:");
+  Serial.print("Called user function " + String(function) + " with " + String(argc) + " args:");
 
   for (i = 0; i < argc; i++) {
     Serial.print(" " + argv[i]);

  Serial.println("");
  Serial.flush();

  return ret ^ funcid;
}




#define UNUSED __attribute__((unused))

#define MEMORY_SIZE 1*1024 //bytes of RAM allocated to the VM
#define PROGRAM_LENGTH 128 //bytes of instruction read by the VM
#define PROGRAM_OFFSET 0 //addressess of program in EEPROM
#define PROGRAM_ENTRY 0 //addressess of first instruction (relative to PROGRAM_OFFSET

#define BAUDRATE 9600 //UART baudrate
#define VERBOSE false //verbose mode

boolean stop = false;
byte memory[MEMORY_SIZE];

//put in seperate namespace to prevent Arduino IDE from preprocessing it; Arduino preprocessor is ST00PID
namespace no {
  struct embedvm_s vm = {
    0xffff, 0, 0, NULL,
    &memoryRead, &memoryWrite, &callUserFunction
  };
}

void setup()
{
  Serial.begin(BAUDRATE);
  for(int address = 0; address < PROGRAM_LENGTH; address++)
    memory[address] = EEPROM.read(address + PROGRAM_OFFSET);
  embedvm_interrupt(&no::vm, PROGRAM_ENTRY);
}

void loop()
