Exemplo n.º 1
0
        public IEC(C64Display display)
        {
            the_display = display;

            int i;

            // Create drives 8..11
            for (i = 0; i < drive.Length; i++)
            {
                drive[i] = null;        // Important because UpdateLEDs is called from the drive constructors (via set_error)
            }
            if (!GlobalPrefs.ThePrefs.Emul1541Proc)
            {
                DriveType[] prefDrives = GlobalPrefs.ThePrefs.DriveType;

                for (i = 0; i < prefDrives.Length; i++)
                {
                    if (prefDrives[i] == DriveType.DRVTYPE_DIR)
                    {
                        drive[i] = new FSDrive(this, GlobalPrefs.ThePrefs.DrivePath[i]);
                    }
                    else if (prefDrives[i] == DriveType.DRVTYPE_D64)
                    {
                        drive[i] = new D64Drive(this, GlobalPrefs.ThePrefs.DrivePath[i]);
                    }
                    else
                    {
                        drive[i] = new T64Drive(this, GlobalPrefs.ThePrefs.DrivePath[i]);
                    }
                }
            }

            listener_active = talker_active = false;
            listening       = false;
        }
Exemplo n.º 2
0
        const bool BALow = false;       // used for the EmulateCycle.cs file to ignore this condition
        #endregion

        #region public methods

        public MOS6502_1541(C64 c64, Job1541 job, C64Display disp, byte[] Ram, byte[] Rom)
        {
            the_c64     = c64;
            the_job     = job;
            the_display = disp;
            ram         = Ram;
            rom         = Rom;

            a      = x = y = 0;
            sp     = 0xff;
            n_flag = z_flag = 0;
            v_flag = d_flag = c_flag = false;
            i_flag = true;

            via1_t1c = via1_t1l = via1_t2c = via1_t2l = 0;
            via1_sr  = 0;
            via2_t1c = via2_t1l = via2_t2c = via2_t2l = 0;
            via2_sr  = 0;

            first_irq_cycle = 0;
            Idle            = false;
        }
Exemplo n.º 3
0
        public C64()
        {
            int i, j;

            // The thread is not yet running
            thread_running = false;
            quit_thyself   = false;
            have_a_break   = false;

            // Open display
            TheDisplay = new C64Display(this);
            TheDisplay.Initialize();

            // Allocate RAM/ROM memory
            RAM     = new byte[0x10000];
            Basic   = new byte[0x2000];
            Kernal  = new byte[0x2000];
            Char    = new byte[0x1000];
            Color   = new byte[0x0400];
            RAM1541 = new byte[0x0800];
            ROM1541 = new byte[0x4000];

            // Create the chips
            TheCPU = new MOS6510(this, RAM, Basic, Kernal, Char, Color);

            TheJob1541 = new Job1541(RAM1541);
            TheCPU1541 = new MOS6502_1541(this, TheJob1541, TheDisplay, RAM1541, ROM1541);

            TheVIC  = TheCPU.TheVIC = new MOS6569(this, TheDisplay, TheCPU, RAM, Char, Color);
            TheSID  = TheCPU.TheSID = new MOS6581(this);
            TheCIA1 = TheCPU.TheCIA1 = new MOS6526_1(TheCPU, TheVIC);
            TheCIA2 = TheCPU.TheCIA2 = TheCPU1541.TheCIA2 = new MOS6526_2(TheCPU, TheVIC, TheCPU1541);
            TheIEC  = TheCPU.TheIEC = new IEC(TheDisplay);
            TheREU  = TheCPU.TheREU = new REU(TheCPU);

            unsafe
            {
                fixed(byte *pRAM = RAM, pColor = Color)
                {
                    byte *p = pRAM;

                    // Initialize RAM with powerup pattern
                    for (i = 0; i < 512; i++)
                    {
                        for (j = 0; j < 64; j++)
                        {
                            *p++ = 0;
                        }
                        for (j = 0; j < 64; j++)
                        {
                            *p++ = 0xff;
                        }
                    }

                    Random rand = new Random();

                    p = pColor;
                    // Initialize color RAM with random values
                    for (i = 0; i < 1024; i++)
                    {
                        *p++ = (byte)(rand.Next() & 0x0f);
                    }
                }
            }

            // Open joystick drivers if required
            open_close_joysticks(false, false, GlobalPrefs.ThePrefs.Joystick1On, GlobalPrefs.ThePrefs.Joystick2On);
            joykey = 0xff;

            CycleCounter = 0;

            // No need to check for state change.
            state_change = false;

            frameTimer.Reset();
            frameTimer.Start();
        }