private int getValueOf(String varName, int len) throws UnknownVariableException {
    Location mem = memoryMap.getLocation(varName);
    if (mem == null) throw new UnknownVariableException("Variable does not exist: " + varName);

    System.out.println("Variable:" + varName + " in section: " + mem.section);
    System.out.println("LMA: " + Integer.toHexString(mem.lma_addr));
    System.out.println("VMA: " + Integer.toHexString(mem.vma_addr));

    System.out.println("Data: " + interpreter.getDataByte(mem.lma_addr & 0xfffff));
    System.out.println("Flash: " + interpreter.getFlashByte(mem.lma_addr & 0xfffff));
    int data = 0;
    if (mem.vma_addr > 0xfffff) {
      for (int i = 0; i < len; i++) {
        data =
            (data << 8) + (interpreter.getDataByte((mem.vma_addr & 0xfffff) + len - i - 1) & 0xff);
        System.out.println(
            "Read byte: " + interpreter.getDataByte((mem.vma_addr & 0xfffff) + i) + " => " + data);
      }
    } else {
      for (int i = 0; i < len; i++) {
        data = (data << 8) + interpreter.getFlashByte(mem.vma_addr + len - i - 1) & 0xff;
      }
    }
    return data;
  }
 public String[] getVariableNames() {
   ArrayList<String> symbols = new ArrayList<String>();
   for (Iterator i = memoryMap.getIterator(); i.hasNext(); ) {
     symbols.add(((Location) i.next()).name);
   }
   return symbols.toArray(new String[0]);
 }
  private void setValue(String varName, int val, int len) throws UnknownVariableException {
    Location mem = memoryMap.getLocation(varName);
    if (mem == null) throw new UnknownVariableException("Variable does not exist: " + varName);

    int data = val;
    if (mem.vma_addr > 0xfffff) {
      // write LSB first.
      for (int i = 0; i < len; i++) {
        interpreter.writeDataByte((mem.vma_addr & 0xfffff) + i, (byte) (data & 0xff));
        System.out.println("Wrote byte: " + (data & 0xff));
        data = data >> 8;
      }
    } else {
      for (int i = 0; i < len; i++) {
        interpreter.writeFlashByte(mem.vma_addr + i, (byte) (data & 0xff));
        data = data >> 8;
      }
    }
  }
 public boolean variableExists(String varName) {
   return memoryMap.getLocation(varName) != null;
 }