Esempio n. 1
0
  /**
   * Checks if a ROM url has been specified by an applet tag or in the properties file. If so, loads
   * and starts the rom
   */
  private void checkForGame() {
    String loc = Settings.get(Settings.ROM_URL);
    if (loc != null) {
      System.out.println("Loading from url: " + loc);

      // Attempt to load from url
      InputStream is = Util.getStreamFromUrl(loc);
      boolean isZip = loc.endsWith(".zip");

      if (is != null) {
        runGame(is, isZip);
      }
    }
  }
Esempio n. 2
0
File: Core.java Progetto: Osmose/sno
  public static void run(InputStream is, boolean isZip) throws Exception {
    init(is, isZip);
    instCount = 0;
    maxInstructions = Long.parseLong(Settings.get(Settings.CORE_MAX_INSTRUCTIONS));

    // Load save file if found
    if (Settings.isSet(Settings.SAVE_PATH)) {
      InputStream saveStream = Util.getStreamFromUrl(Settings.get(Settings.SAVE_PATH));
      if (saveStream != null) {
        mem.loadSram(saveStream);
      }
    }

    // Execute and time game
    if (Log.instruction.enabled() && Settings.get(Settings.CPU_ALT_DEBUG) == "false") {
      Log.instruction("====CPU Execution====");
      Log.instruction(
          "romAdr pbr:pc   op   CPU Status                      args              Instruction");
      Log.instruction(
          "------ -------  --   ------------------------------- ---------------   -----------");
    }
    timeBegin = new Date().getTime();
    cycle(maxInstructions);
    timeEnd = new Date().getTime();
    running = false;

    // Print run stats
    System.out.println("Total time: " + ((timeEnd - timeBegin) / 1000) + " seconds");
    System.out.println("Instructions performed: " + instCount);
    System.out.println("Cycles performed: " + Timing.getCycles());
    System.out.println(
        "Average speed: "
            + (((Timing.getCycles() + 0f) / ((timeEnd - timeBegin + 0f) / 1000f)) / (1024f * 1024f))
            + " MHz");
    System.out.println(
        "Average speed: "
            + (((Timing.getCycles() + 0f) / ((timeEnd - timeBegin + 0f) / 1000f)))
            + " Hz");
    printMMaps();

    PPU.dumpVRAM();
    mem.dumpWRAM();
    APUMemory.dump();
    renderScreen();
  }