public void dispose(boolean toDispose) {
   if (toDispose) {
     super.dispose();
     frame.toFront();
   }
   if (client != null) client.dialogDismissed(this);
 }
Beispiel #2
0
  @Override
  public void run() {
    this.emuRunning = true;
    while (this.emuRunning) {
      try {

        /*
         * Pruefen, ob ein Programm geladen oder der Emulator
         * tatsaechlich zurueckgesetzt werden soll
         */
        LoadData loadData = null;
        synchronized (this.monitor) {
          loadData = this.loadData;
          if (loadData != null) {
            this.loadData = null;
          } else {
            if (this.resetLevel == ResetLevel.POWER_ON) {
              Arrays.fill(this.ram, (byte) 0);
            }
          }
        }
        if (loadData != null) {
          loadData.loadIntoMemory(this);
          this.z80cpu.setRegPC(loadData.getStartAddr());
          if (this.emuSys != null) {
            int spInitValue = this.emuSys.getAppStartStackInitValue();
            if (spInitValue > 0) {
              this.z80cpu.setRegSP(spInitValue);
            }
          }
        } else {
          if ((this.resetLevel == ResetLevel.COLD_RESET)
              || (this.resetLevel == ResetLevel.POWER_ON)) {
            this.z80cpu.resetCPU(true);
          } else {
            this.z80cpu.resetCPU(false);
          }
          if (this.emuSys != null) {
            this.emuSys.reset(this.resetLevel, Main.getProperties());
            this.z80cpu.setRegPC(this.emuSys.getResetStartAddress(this.resetLevel));
          }
        }

        // RAM-Floppies und Druckmanager zuruecksetzen
        this.printMngr.reset();
        this.ramFloppy1.reset();
        this.ramFloppy2.reset();
        if ((this.emuSys != null)
            && (this.resetLevel == ResetLevel.POWER_ON)
            && Main.getBooleanProperty("jkcemu.ramfloppy.clear_on_power_on", false)) {
          if (this.emuSys.supportsRAMFloppy1() && (this.ramFloppy1.getUsedSize() > 0)) {
            this.ramFloppy1.clear();
          }
          if (this.emuSys.supportsRAMFloppy2() && (this.ramFloppy2.getUsedSize() > 0)) {
            this.ramFloppy2.clear();
          }
        }

        // Fenster informieren
        final Frame[] frms = Frame.getFrames();
        if (frms != null) {
          EventQueue.invokeLater(
              new Runnable() {
                @Override
                public void run() {
                  for (Frame f : frms) {
                    if (f instanceof BasicFrm) {
                      ((BasicFrm) f).resetFired();
                    }
                  }
                }
              });
        }

        // in die Z80-Emulation verzweigen
        this.resetLevel = ResetLevel.NO_RESET;
        this.z80cpu.run();
      } catch (Z80ExternalException ex) {
      } catch (Exception ex) {
        this.emuRunning = false;
        EventQueue.invokeLater(new ErrorMsg(this.screenFrm, ex));
      }
    }
  }