Esempio n. 1
0
        public C64()
        {
            MPU  = new PLA(this);
            CPU  = new CPU_6510("C64", MPU);
            SID  = new SID_OpenAL();
            IEC  = new IECBus();
            VIC  = new VIC_II(this);
            CIA  = new CIA(Keyboard);
            CIA2 = new CIA2();

            //Joystick1 = new NoJoystick();
            //Joystick1 = new JoystickKeypad(Keys.W, Keys.S, Keys.A, Keys.D, Keys.LControlKey);
            Joystick2 = new JoystickKeypad(Keys.NumPad8, Keys.NumPad5, Keys.NumPad4, Keys.NumPad6, Keys.ControlKey);
            // Joystick2 = new JoystickKeypad(Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.ControlKey);

            CIA.SetJoystick(1, Joystick1);
            CIA.SetJoystick(2, Joystick2);

            Datasette = new DatasetteTAP();
            Floppy    = new C1541();

            // Form f = Floppy.GetControlForm();
            // f.Show();

            Reset();
        }
Esempio n. 2
0
        public void Process(C64 _c64)
        {
            xSignal.CopyFrom(Signal);
            Signal.toInactive();

            //  collision?

            //  CIA2: let host signal
            byte PRA = _c64.CIA2.PRA;

            if ((PRA & (1 << 3)) > 0)
            {
                Signal.ATN += 1;
            }

            if ((PRA & (1 << 4)) > 0)
            {
                Signal.CLK += 1;
            }

            if ((PRA & (1 << 5)) > 0)
            {
                Signal.DATA += 1;
            }

            //  floppy output
            C1541 floppy = _c64.Floppy;

            if (floppy.DATA_OUT)
            {
                Signal.DATA += 2;
            }

            if (floppy.CLOCK_OUT)
            {
                Signal.CLK += 2;
            }

            //  collision?
            if ((Signal.ATN == 3) ||
                (Signal.CLK == 3) ||
                (Signal.DATA == 3))
            {
                Console.Out.WriteLine("IEC: collision");
            }

            //
            //  inputs
            //

            //  floppy input
            floppy.ATN_IN   = (Signal.ATN > 0);
            floppy.CLOCK_IN = (Signal.CLK > 0);
            floppy.DATA_IN  = (Signal.DATA > 0);

            //  CIA2 input
            _c64.CIA2.PRA &= 0x3f;
            if (Signal.CLK == 0)
            {
                _c64.CIA2.PRA |= (1 << 6);
            }
            else
            {
                _c64.CIA2.PRA &= 0xbf;
            }

            if (Signal.DATA == 0)
            {
                _c64.CIA2.PRA |= (1 << 7);
            }
            else
            {
                _c64.CIA2.PRA &= 0x7f;
            }

            //
            //  Trace
            //
            if ((Signal.ATN != xSignal.ATN) ||
                (Signal.DATA != xSignal.DATA) ||
                (Signal.CLK != xSignal.CLK))
            {
                string str = "";

                str += string.Format("ATN:{0}  ", Signal.ATN);
                str += string.Format("CLK:{0}  ", Signal.CLK);
                str += string.Format("DATA:{0}  ", Signal.DATA);

                Console.Out.WriteLine(str);
            }
        }