gt: 	  if( state != this.cpuEnableValue ) {
context: /*
   * (c) 2009-2016 Jens Mueller
   *
   * Kleincomputer-Emulator
   *
   * Emulation der Floppy Disk Station D004
   */
  
  package jkcemu.emusys.kc85;
  
  import java.util.Properties;
  import jkcemu.Main;
  import jkcemu.base.ScreenFrm;
  import jkcemu.disk.FloppyDiskDrive;
  import z80emu.Z80CPU;
  import z80emu.Z80Memory;
  
  
  public class D004 extends AbstractKC85Module
  {
    private byte[]      rom;
    private int         romAddr;
    private boolean     connected;
    private boolean     cpuEnableValue;
    private boolean     cpuStopValue;
    private boolean     cpuResetValue;
    private boolean     cpuNMIValue;
    private D004ProcSys procSys;
    private Thread      thread;
  
  
    public D004(
  		ScreenFrm  screenFrm,
  		Properties props,
  		String     propPrefix,
  		byte[]     rom )
    {
      super( 0xFC );
      this.rom            = rom;
      this.romAddr        = 0xC000;
      this.connected      = false;
      this.cpuEnableValue = false;
      this.cpuStopValue   = false;
      this.cpuResetValue  = false;
      this.cpuNMIValue    = false;
      this.procSys        = new D004ProcSys( screenFrm, props, propPrefix );
      this.thread         = null;
    }
  
  
    public void applySettings( Properties props )
    {
      this.procSys.applySettings( props );
    }
  
  
    public boolean canApplySettings( Properties props )
    {
      return this.procSys.canApplySettings( props );
    }
  
  
    public Z80CPU getZ80CPU()
    {
      return this.procSys.getZ80CPU();
    }
  
  
    public Z80Memory getZ80Memory()
    {
      return this.procSys;
    }
  
  
    public synchronized void fireStop()
    {
      if( this.thread != null ) {
        this.procSys.fireStop();
        this.thread = null;
      }
    }
  
  
    public int getSupportedFloppyDiskDriveCount()
    {
      return this.procSys.getSupportedFloppyDiskDriveCount();
    }
  
  
    public boolean isRunning()
    {
      return this.thread != null;
    }
  
  
    public void loadIntoRAM( byte[] loadData, int loadAddr, int startAddr )
    {
      this.procSys.loadIntoRAM( loadData, loadAddr, startAddr );
    }
  
  
    public void setDrive( int idx, FloppyDiskDrive drive )
    {
      this.procSys.setDrive( idx, drive );
    }
  
  
  	/* --- ueberschriebene Methoden --- */
  
    @Override
    public void appendEtcInfoHTMLTo( StringBuilder buf )
    {
      buf.append( "Transfer-RAM " );
      buf.append( this.connected ? "verbunden" : "getrennt" );
    }
  
  
    @Override
    public int getBegAddr()
    {
      return this.romAddr;
    }
  
  
    @Override
    public void clearRAM()
    {
      this.procSys.clearRAM();
    }
  
  
    @Override
    public void die()
    {
      this.procSys.die();
    }
  
  
    @Override
    public String getModuleName()
    {
      return "D004";
    }
  
  
    @Override
    public int getTypeByte()
    {
      return 0xA7;
    }
  
  
    @Override
    public int readMemByte( int addr )
    {
      int rv = -1;
      if( this.enabled && (this.rom != null) ) {
        int idx = addr - this.romAddr;
        if( (idx >= 0) && (idx < this.rom.length) ) {
  	rv = (int) this.rom[ idx ] & 0xFF;
        }
      }
      return rv;
    }
  
  
    @Override
    public int readIOByte( int port, int tStates )
    {
      int rv = -1;
      if( this.connected ) {
        int portL = port & 0xFF;
        if( (portL >= 0xF0) && (portL <= 0xF3) ) {
  	rv = this.procSys.getMemByte(
  			0xFC00 | (portL << 8) | ((port >> 8) & 0xFF),
  			false );
        }
      }
      return rv;
    }
  
  
    @Override
    public void setStatus( int value )
    {
      super.setStatus( value );
      this.connected = ((value & 0x04) != 0);
      this.romAddr   = ((value & 0x20) != 0) ? 0xE000 : 0xC000;
    }
  
  
    @Override
    public boolean writeIOByte( int port, int value, int tStates )
    {
      boolean rv    = false;
      int     portL = (port & 0xFF);
      if( (portL >= 0xF0) && (portL <= 0xF4) ) {
        if( this.connected ) {
  	if( (portL >= 0xF0) && (portL <= 0xF3) ) {
  	  rv = this.procSys.setMemByte(
  			0xFC00 | (portL << 8) | ((port >> 8) & 0xFF),
  			value );
  	}
  	else if( portL == 0xF4 ) {
  	  boolean state = ((value & 0x01) != 0);
  