private static void dump(char[] ram, int start, int len) throws Exception {
    DataOutputStream dos = new DataOutputStream(new FileOutputStream("mem.dmp"));
    for (int i = 0; i < len; i++) {
      dos.writeChar(ram[start + i]);
    }
    dos.close();
    for (int i = 0; i < len; )
    {
      String str = Integer.toHexString(i);
      while (str.length() < 4)
        str = "0" + str;
//      System.out.print(str + ":");

      for (int j = 0; (j < 8) && (i < len); i++) {
        str = Integer.toHexString(ram[i]);
        while (str.length() < 4)
          str = "0" + str;
        System.out.print(" " + str);

        j++;
      }

      System.out.println();
    }
  }