예제 #1
0
        public Clock.ClockEntry CreateOps()
        {
            Clock.ClockEntry op = new Clock.ClockEntry(this);
            op.Next = op;

            return(op);
        }
예제 #2
0
        public Clock.ClockEntry CreateOps()
        {
            Clock.ClockEntry op = new Clock.ClockEntry(this);
            op.Next = op;

            return op;
        }
예제 #3
0
        public virtual void Execute(Clock.Clock clock, byte cycle)
        {
            Clock.ClockEntry first = null;
            Clock.ClockEntry next  = null;

            if (_cpu.NMI.Check())
            {
                first = next = new Clock.ClockEntryRep(new InterruptOp(_cpu, 0xfffa), 7);
            }
            else if (_cpu.IRQ.IsRaised && !_cpu.State.P.IrqMask)
            {
                first = next = new Clock.ClockEntryRep(new InterruptOp(_cpu, 0xfffe), 7);
            }
            else
            {
                _cpu.Opcode = _cpu.Memory.Read(_cpu.State.PC.Value);
                _cpu.State.PC.Next();

                DecodingTable.Entry decoded = DecodingTable.Opcodes[_cpu.Opcode];
                DecodeAddressOp     addrOp  = new DecodeAddressOp(_cpu, decoded._addressing);
                ExecuteOpcodeOp     execOp  = new ExecuteOpcodeOp(_cpu, decoded._instruction, decoded._timing._prolongOnPageCross);

                byte addrTime = decoded._timing._addressingTime;
                byte execTime = decoded._timing._execTime;

                first           = addrTime < 2 ? new Clock.ClockEntry(addrOp, true) : new Clock.ClockEntryRep(addrOp, addrTime);
                first.ComboNext = execTime == 0 || addrTime == 0;

                next = first.Next = execTime < 2 ? new Clock.ClockEntry(execOp) : new Clock.ClockEntryRep(execOp, execTime);

                sbyte writeCycles = decoded._timing._writeTime;
                if (writeCycles >= 0)
                {
                    if (writeCycles < 2)
                    {
                        next.ComboNext = writeCycles == 0;
                        next           = next.Next = new Clock.ClockEntry(new WriteResultOp(_cpu));
                    }
                    else
                    {
                        next = next.Next = new Clock.ClockEntryRep(new Clock.StallOp(), (byte)(writeCycles - 1));
                        next = next.Next = new Clock.ClockEntry(new WriteResultOp(_cpu));
                    }
                }
            }

            next.Next = new Clock.ClockEntry(new DecodeOpcodeOp(_cpu));
            clock.QueueOps(first, _cpu.Phase);
        }
예제 #4
0
        public Clock.ClockEntry CreateOps()
        {
            _activeOps = new Clock.ClockOp[]
            {
                new VicGraphReadOp(_vic, GraphReadOp15_53, CheckedActiveGraphLeftOp),
                new VicGraphReadOp(_vic, GraphReadOp15_53, UncheckedActiveGraphOp),
                new VicGraphReadOp(_vic, GraphReadOp54, CheckedActiveGraphRight1Op),
                new VicGraphReadOp(_vic, IdleReadOp55, CheckedActiveGraphRight2Op)
            };

            _borderOps = new Clock.ClockOp[]
            {
                new VicGraphReadOp(_vic, GraphReadOp15_53, BorderGraphOp),
                new VicGraphReadOp(_vic, GraphReadOp15_53, BorderGraphOp),
                new VicGraphReadOp(_vic, GraphReadOp54, BorderGraphOp),
                new VicGraphReadOp(_vic, IdleReadOp55, BorderGraphOp)
            };

            _replacableOps = new Clock.ClockEntry[]
            {
                new Clock.ClockEntryRep(_activeOps[0], 2),
                new Clock.ClockEntryRep(_activeOps[1], 37),
                new Clock.ClockEntry(_activeOps[2]),
                new Clock.ClockEntry(_activeOps[3]),
            };

            Clock.ClockEntry first = new Clock.ClockEntry(new VicReadOp(_vic, SpriteReadOp0));
            Clock.ClockEntry next = first.Next = new Clock.ClockEntryRep(new VicReadOp(_vic, SpriteReadOp1_9), 9);
            next = next.Next = new Clock.ClockEntryRep(new VicNop(_vic), 2);
            next = next.Next = new Clock.ClockEntry(new VicGraphOp(_vic, BorderWrapGraphOp));
            next = next.Next = new Clock.ClockEntry(new VicGraphReadOp(_vic, RefreshReadOp13, BorderGraphOp));
            next = next.Next = new Clock.ClockEntry(new VicGraphReadOp(_vic, RefreshReadOp14, BorderGraphOp));
            next = next.Next = _replacableOps[0];
            next = next.Next = _replacableOps[1];
            next = next.Next = _replacableOps[2];
            next = next.Next = _replacableOps[3];
            next = next.Next = new Clock.ClockEntry(new VicGraphReadOp(_vic, IdleReadOp56, BorderGraphOp));
            next = next.Next = new Clock.ClockEntry(new VicGraphReadOp(_vic, SpriteReadOp57, BorderGraphOp));
            next = next.Next = new Clock.ClockEntryRep(new VicReadOp(_vic, SpriteReadOp58_61), 4);
            next = next.Next = new Clock.ClockEntry(new VicReadOp62(_vic, SpriteReadOp62));
            next.Next = first;

            return first;
        }