MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / MTC0

Function MTC0

pcsx2/COP0.cpp:541–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539 }
540
541 void MTC0()
542 {
543 //if(bExecBIOS == FALSE && _Rd_ == 25) Console.WriteLn("MTC0 _Rd_ %x = %x", _Rd_, cpuRegs.CP0.r[_Rd_]);
544 switch (_Rd_)
545 {
546 case 9:
547 cpuRegs.lastCOP0Cycle = cpuRegs.cycle;
548 cpuRegs.CP0.r[9] = cpuRegs.GPR.r[_Rt_].UL[0];
549 break;
550
551 case 12:
552 WriteCP0Status(cpuRegs.GPR.r[_Rt_].UL[0]);
553 break;
554
555 case 16:
556 WriteCP0Config(cpuRegs.GPR.r[_Rt_].UL[0]);
557 break;
558
559 case 24:
560 COP0_LOG("MTC0 Breakpoint debug Registers code = %x", cpuRegs.code & 0x3FF);
561 break;
562
563 case 25:
564 /*if(bExecBIOS == FALSE && _Rd_ == 25) Console.WriteLn("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x", params
565 cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);*/
566 if (0 == (_Imm_ & 1)) // MTPS
567 {
568 if (0 != (_Imm_ & 0x3E)) // only effective when the register is 0
569 break;
570 // Updates PCRs and sets the PCCR.
571 COP0_UpdatePCCR();
572 cpuRegs.PERF.n.pccr.val = cpuRegs.GPR.r[_Rt_].UL[0];
573 COP0_DiagnosticPCCR();
574 }
575 else if (0 == (_Imm_ & 2)) // MTPC 0, only LSB of register matters
576 {
577 cpuRegs.PERF.n.pcr0 = cpuRegs.GPR.r[_Rt_].UL[0];
578 cpuRegs.lastPERFCycle[0] = cpuRegs.cycle;
579 }
580 else // MTPC 1
581 {
582 cpuRegs.PERF.n.pcr1 = cpuRegs.GPR.r[_Rt_].UL[0];
583 cpuRegs.lastPERFCycle[1] = cpuRegs.cycle;
584 }
585 break;
586
587 default:
588 cpuRegs.CP0.r[_Rd_] = cpuRegs.GPR.r[_Rt_].UL[0];
589 break;
590 }
591 }
592
593 int CPCOND0()
594 {

Callers

nothing calls this directly

Calls 4

WriteCP0StatusFunction · 0.85
WriteCP0ConfigFunction · 0.85
COP0_UpdatePCCRFunction · 0.85
COP0_DiagnosticPCCRFunction · 0.85

Tested by

no test coverage detected