Ejemplo n.º 1
0
 public bool IncludeState(TState state)
 {
     if (mState.Equals(state))
     {
         return(true);
     }
     foreach (StateRepresentation sr in mSubStates)
     {
         if (sr.IncludeState(state))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 void EnforceNotIdentityTransition(TState destination)
 {
     if (destination.Equals(_representation.UnderlyingState))
     {
         throw new ArgumentException(StateConfigurationResources.SelfTransitionsEitherIgnoredOrReentrant);
     }
 }
 void EnforceNotIdentityTransition(TState destination)
 {
     if (destination.Equals(m_representation.UnderlyingState))
     {
         throw new ArgumentException("Permit() (and PermitIf()) require that the destination state is not equal to the source state. To accept a trigger without changing state, use either Ignore() or PermitReentry().");
     }
 }
Ejemplo n.º 4
0
 private void EnforceNotIdentityTransition(TState destination)
 {
     if (destination.Equals(mRepresentation.UnderlyingState))
     {
         Debug.LogError("{0} = {1}", destination, mRepresentation.UnderlyingState);
     }
 }
Ejemplo n.º 5
0
            public override bool Equals(object obj)
            {
                if (!(obj is VisitHistoryRecord))
                {
                    return(false);
                }

                var record = (VisitHistoryRecord)obj;

                return(Position == record.Position &&
                       State.Equals(record.State) &&
                       StackSymbol.Equals(record.StackSymbol));
            }
Ejemplo n.º 6
0
            public override bool Equals(object obj)
            {
                if (!(obj is VisitOnPopHistoryRecord))
                {
                    return(false);
                }

                var record = (VisitOnPopHistoryRecord)obj;

                return(Position == record.Position &&
                       State.Equals(record.State) &&
                       ReferenceEquals(Stack, record.Stack));
            }
Ejemplo n.º 7
0
 public bool Includes(TState state)
 {
     return(_state.Equals(state) || _substates.Any(s => s.Includes(state)));
 }
Ejemplo n.º 8
0
        public string RunCycle()
        {
            string debugInfo = String.Empty;

            if (TState.Equals(EnumTstate.T1))
            {
                if (IR.Equals(0x29))
                {
                    Accu      = _alu;   // !!!!!!!!!!
                    debugInfo = $"IR: {IR:X2} - T1 Execute - Accu: {Accu:X2} - Flags: N={StatusReg.N}, Z={StatusReg.Z}";
                }



                // T1 Fetch

                // Instruction = _instructionSet.GetInstruction(_dataBus.Data);
                IR = _dataBus.Data;
                PC++;
                LoadAddress(PC);
                debugInfo = $"T1 Fetch ";
            }
            ;


            if (TState.Equals(EnumTstate.T2) || TState.Equals(EnumTstate.T0T2))
            {
                // T2 Execute

                if (IR.Equals(0x18)) // Klar! (1 byte)
                {
                    StatusReg.C = false;
                    debugInfo   = $"IR: {IR:X2} - T2 Execute - Flags: C={StatusReg.C}";
                }

                if (IR.Equals(0xA9))      // Klar!
                {
                    Accu = _dataBus.Data; // TODO: INTE KORREKT att göra så här direkt.
                    SetStatus_NZ(Accu);
                    PC++;
                    LoadAddress(PC);
                    // debugInfo = $"IR: {IR:X2} - T2 Execute - Accu: {Accu:X2} - Flags: N={StatusReg.N}, Z={StatusReg.Z}";
                }


                if (IR.Equals(0x29))
                {
                    _pd = _dataBus.Data;

                    _alu = (byte)(Accu & _pd);
                    SetStatus_NZ(_alu);

                    // SetStatus_NZ(Accu);
                    PC++;
                    LoadAddress(PC);
                    //   debugInfo = $"IR: {IR:X2} - T2 Execute - Accu: {Accu:X2} - Flags: N={StatusReg.N}, Z={StatusReg.Z}";
                }



                if (IR.Equals(0x0A))    // Klar! (1 byte)
                {
                    StatusReg.C = (Accu >= 0x80) ? true : false;
                    Accu        = (byte)(Accu << 0x01);
                    debugInfo   = $"IR: {IR:X2} - T2 Execute - Accu: {Accu:X2} - Flags: C={StatusReg.C}";
                }


                if (IR.Equals(0x6D) || IR.Equals(0x8D))
                {
                    _pd = _dataBus.Data;
                    PC++;
                    LoadAddress(PC);
                    debugInfo = $"IR: {IR:X2} - T2 Execute - Low byte: {_pd:X2}";
                }


                // Zero page - samma för alla?
                if (IR.Equals(0xA5))
                {
                    _pd = _dataBus.Data;
                    PC++;

                    _adh = 0x00;
                    _adl = _pd;

                    debugInfo = $"IR: {IR:X2} - T2 Execute - Low byte: {_pd:X2}";
                }
            }

            if (TState.Equals(EnumTstate.T3))
            {
                // T3 Execute

                // Absolute addressing - samma för alla?
                if (IR.Equals(0x6D) || IR.Equals(0x8D))
                {
                    _alu = _pd;
                    _pd  = _dataBus.Data;
                    PC++;

                    _adh = _pd;
                    _adl = _alu;

                    debugInfo = $"IR: {IR:X2} - T3 Execute - High byte: {_adh:X2}";
                }
            }

            // TODO: Borde man flytta _pd = _dataBus.Data, bort till preRunCycle istället? OCh hur gör man i så fall åt andra hållet?

            if (TState.Equals(EnumTstate.T0))
            {
                // Execute T0

                if (IR.Equals(0x6D))
                {
                    Accu += _dataBus.Data;     //  Direkt från minnet till accumulatorn eller via PD? TODO: Gör en bättre add som påverkar flaggorna.
                    LoadAddress(PC);
                    debugInfo = $"IR: {IR:X2} - T0 Execute - ADH: {_adh:X2} ADL: {_adl:X2} - Accu: {Accu:X2}";
                }

                if (IR.Equals(0x8D))
                {
                    RW            = false;
                    _dataBus.Data = Accu;
                    LoadAddress(PC);
                    debugInfo = $"Write to memory - IR: {IR:X2} - T0 Execute - ADH: {_adh:X2} ADL: {_adl:X2} - Accu: {Accu:X2}";
                }

                if (IR.Equals(0xA5))
                {
                    Accu = _dataBus.Data;
                    LoadAddress(PC);
                    debugInfo = $"IR: {IR:X2} - T0 Execute - Accu: {Accu:X2} - Flags: N, Z";
                }
            }

            TState = GetNextTstate(TState, IR);

            return(debugInfo);
        }
Ejemplo n.º 9
0
 public bool Match(TState currentState, TCommand command)
 {
     return(_currentState.Equals(currentState) && _command.Equals(command));
 }