Ejemplo n.º 1
0
        public static void PowerOnR4300()
        {
            for (int i = 0; i < Registers.R4300.Reg.Length; ++i)
            {
                Registers.R4300.Reg[i] = 0; // Clear Registers
            }
            COP0.PowerOnCOP0();
            COP1.PowerOnCOP1();

            OpcodeTable.Init();
        }
Ejemplo n.º 2
0
        public static void PowerOnR4300()
        {
            for (int i = 0; i < Registers.R4300.Reg.Length; ++i)
            {
                Registers.R4300.Reg[i] = 0; // Clear Registers.
            }
            uint RomType   = 0;             // 0 = Cart, 1 = DD
            uint ResetType = 0;             // 0 = Cold Reset, 1 = NMI, 2 = Reset to boot disk
            uint osVersion = 0;             // 00 = 1.0, 15 = 2.5, etc.
            uint TVType    = 1;             // 0 = PAL, 1 = NTSC, 2 = MPAL

            Registers.R4300.Reg[1]  = 0x0000000000000001;
            Registers.R4300.Reg[2]  = 0x000000000EBDA536;
            Registers.R4300.Reg[3]  = 0x000000000EBDA536;
            Registers.R4300.Reg[4]  = 0x000000000000A536;
            Registers.R4300.Reg[5]  = 0xFFFFFFFFC0F1D859;
            Registers.R4300.Reg[6]  = 0xFFFFFFFFA4001F0C;
            Registers.R4300.Reg[7]  = 0xFFFFFFFFA4001F08;
            Registers.R4300.Reg[8]  = 0x00000000000000C0;
            Registers.R4300.Reg[10] = 0x0000000000000040;
            Registers.R4300.Reg[11] = 0xFFFFFFFFA4000040;
            Registers.R4300.Reg[12] = 0xFFFFFFFFED10D0B3;
            Registers.R4300.Reg[13] = 0x000000001402A4CC;
            Registers.R4300.Reg[14] = 0x000000002DE108EA;
            Registers.R4300.Reg[15] = 0x000000003103E121;
            Registers.R4300.Reg[19] = RomType;
            Registers.R4300.Reg[20] = TVType;
            Registers.R4300.Reg[21] = ResetType;
            Registers.R4300.Reg[22] = (GetCICSeed() >> 8) & 0xFF;
            Registers.R4300.Reg[23] = osVersion;
            Registers.R4300.Reg[25] = 0xFFFFFFFF9DEBB54F;
            Registers.R4300.Reg[29] = 0xFFFFFFFFA4001FF0;
            Registers.R4300.Reg[31] = 0xFFFFFFFFA4001550;
            Registers.R4300.HI      = 0x000000003FC18657;
            Registers.R4300.LO      = 0x000000003103E121;
            Registers.R4300.PC      = 0xA4000040;

            memory.FastMemoryCopy(0xA4000000, 0xB0000000, 0xFFF); // Load the Boot Code into the correct memory address.

            COP0.PowerOnCOP0();
            COP1.PowerOnCOP1();

            R4300_ON = true;

            OpcodeTable.Init();

            Thread CPUThread =
                new Thread(() =>
            {
                Common.Measure.MeasureTime.Start();
                while (R4300_ON)
                {
                    uint Opcode = memory.ReadUInt32(Registers.R4300.PC);
                    InterpretOpcode(Opcode);

                    while (Common.Settings.STEP_MODE && !Common.Variables.Step)
                    {
                        ;
                    }
                    if (Common.Settings.STEP_MODE)
                    {
                        Registers.R4300.PrintRegisterInfo();
                        Registers.COP0.PrintRegisterInfo();
                        Registers.COP1.PrintRegisterInfo();
                        Thread.Sleep(250);
                        Common.Variables.Step = false;
                    }
                }
                Common.Measure.MeasureTime.Stop();
            });

            CPUThread.Name = "R4300";
            CPUThread.Start();
        }