 #define BAUDRATE 9600 //UART baudrate
 #define VERBOSE false //verbose mode
 
-boolean stop = false;
-byte memory[MEMORY_SIZE];
+boolean stop = false; //whether the VM should skip execution of program
+byte memory[MEMORY_SIZE]; //VM memory
 
 //put in seperate namespace to prevent Arduino IDE from preprocessing it; Arduino preprocessor is ST00PID
 namespace no {

    memory[address] = value;
}

static int16_t callUserFunction(uint8_t function, uint8_t argc, int16_t *argv, void *ctx UNUSED)
{
  int16_t ret = 0;
  int i;

  if (function == 0) {
    stop = true;
    Serial.println("Called user function 0 => stop.");

void setup()
{
  Serial.begin(BAUDRATE);
  
  //copy program from EEPROM to RAM; EmbedVM can read program from RAM only
  for(int address = 0; address < PROGRAM_LENGTH; address++)
    memory[address] = EEPROM.read(address + PROGRAM_OFFSET);
  embedvm_interrupt(&no::vm, PROGRAM_ENTRY); //start EmbedVM
}

void loop()
