private void dumpMemory(int address, int size) {
    String tmp = "";
    String tmp2 = "";
    String t;
    System.out.println("Dumping memory: " + address);
    for (int i = 0; i < size; i++) {
      t = Integer.toString(memory[i + address] & 0xff, 16);
      if (t.length() < 2)
	t = "0" + t;
      tmp = tmp + t + " ";
      if (i % 4 == 3) tmp += " ";

      if (memory[i + address] > 32 && memory[i + address] < 99)
	tmp2 += (char) memory[i + address];
      else
	tmp2 += ".";

      if (i % 16 == 15) {
	String adr = Integer.toString(address + i - 15, 16);
	while (adr.length() < 4)
	  adr = "0" + adr;
	System.out.println(adr + "  " + tmp + " " + tmp2);
	tmp = "";
	tmp2 = "";
      }
    }
  }