예제 #1
0
        public PortStatusAndControlRegisterChanges setValue(uint value)
        {
            PortStatusAndControlRegisterChanges retVal = new PortStatusAndControlRegisterChanges(); //idicates if interrupt should be rised after this fcn

            retVal.ConnectChange = false;
            retVal.EnableChange  = false;
            //uint oldValue = portValue;
            uint tmpValue = portValue & ~(WriteMask);

            //if(SystemBus != null) this.Log(LogType.Error,"current PC {0:x}", ((IControllableCPU)SystemBus.GetCPUs().First()).PC);
            portValue = (value & WriteMask) | tmpValue;
            if ((value & ConnectStatusChange) != 0)
            {
                portValue &= ~(ConnectStatusChange);
            }
            if ((value & PortEnabledDisabledChange) != 0)
            {
                portValue &= ~(PortEnabledDisabledChange);
            }
            if ((value & PortPower) != 0 && (powered == false))
            {
                retVal = this.powerUp();
            }
            if ((value & PortReset) != 0)
            {
                this.resetRise();
                // this.resetFall();
            }
            if (((value & PortReset) == 0) && reset == true)
            {
                resetFall();
                //retVal.ConnectChange = true;
            }
            if ((value & PortEnabledDisabled) != 0)
            {
                retVal = this.Enable();
            }
            if ((portValue & PortEnabledDisabled) == 0)
            {
                // if(SystemBus != null)
                //   this.Log(LogType.Error,"zerowanie Enable current PC {0:x}", ((IControllableCPU)SystemBus.GetCPUs().First()).PC);
            }
            /* Remove reset bit */
            portValue &= ~(0x1000u);
            return(retVal);
        }
예제 #2
0
        private PortStatusAndControlRegisterChanges checkChanges(uint oldPortVal, uint newPortVal)
        {
            var change = new PortStatusAndControlRegisterChanges();

            change.ConnectChange = false;
            change.EnableChange  = false;
            if ((oldPortVal & CurrentConnectStatus) != (newPortVal & CurrentConnectStatus))
            {
                change.ConnectChange = true;
                portValue           |= ConnectStatusChange;
            }
            if ((oldPortVal & PortEnabledDisabled) != (newPortVal & PortEnabledDisabled))
            {
                change.EnableChange = true;
                portValue          |= PortEnabledDisabledChange;
            }
            return(change);
        }