示例#1
0
        /// <summary>
        /// Places the contents of the PC into AR, then places the contents of memory pointed to by AR into the IR.
        /// </summary>
        private void fetch()
        {
            // R'T0:

                // AR <- PC;
                    AR = PC;

                // T0 -> T1
                    timeCC++;

            // R'T1:

                // IR <- M[AR]
                    IR.HexStringValue = Memory[ +AR ];

                // PC <- PC + 1
                    PC++;

                // T1 -> T2
                    timeCC++;
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        private void cfi()
        {
            //Check for interrupts, if (IEN==1)&&(FGI==1), then R = 1
                                if ( IEN == 1 && FGI == 1 )
                                {

                                        R = 1;

                                        // RT0: AR<-0, TR<-PC
                                                AR.Value = 0;
                                                TR = PC;
                                                timeCC++;

                                        // RT1: M[AR]<-TR, PC<-0
                                                Memory[AR.Value] = TR.HexStringValue;
                                                PC.Value = 0;
                                                timeCC++;

                                        // RT2: PC<-PC+1, IEN<-0, R<-0
                                                PC++;
                                                IEN = 0;
                                                R = 0;
                                                timeCC++;

                                }

                                if ( interruptCursor < interruptTime.Length )
                                {

                                        // Simulate Input...
                                        if ( timeCC >= interruptTime[interruptCursor] && FGI == 0 )
                                        {

                                                // Copy the value into the INPR
                                                INPR.HexStringValue = valueForINPR[interruptCursor];

                                                // Set FGI=1
                                                FGI = 1;

                                                // Advance the script cursor (to the next request)
                                                interruptCursor++;

                                        }

                                }
        }