Esempio n. 1
0
  public static int loadURIResource(URI uri, CPU cpu, int addr) {
    int i;

    System.out.println("loadURL: " + uri.toString());

    try {
      DataInputStream s = new DataInputStream(new BufferedInputStream(uri.toURL().openStream()));

      i = 0;
      try {
        while (true) {
          cpu.write8_a32(addr + i, s.readByte());
          i++;
        }
      } catch (EOFException e) {
        // end
      }
    } catch (IOException e) {
      e.printStackTrace(System.err);
      throw new IllegalArgumentException(e);
    }

    System.out.printf("loadURL: '%s' done, %dbytes.\n", uri.toString(), i);

    return i;
  }
Esempio n. 2
0
 public void STS() // method to execute an instruction when the current process finishes
     {
   while (!queue.isEmpty() && (STATE_COMPLETED)) {
     CPU.execute(queue.remove());
   }
 }