Previous 15994 Revisions Next

r14572 Wednesday 22nd February, 2012 at 15:35:03 UTC by MooglyGuy
[N64] Miscellaneous machine fixes, gets Conker's Bad Fur Day to boot through its legal screens with interpreter MIPS. [Ryan Holtz]
- Increase the amount of time consumed by PI DMA, makes certain RSP microcodes that test DMA speed land in the correct window.
- Force the main CPU to yield when the RSP reads its atomic semaphore.
- Force the RSP to yield when PI DMA completes.
- Flush the RSP DRC cache when touching IMEM with SP DMA.

(nw) Last N64 update before I move tomorrow!
[src/mame/machine]n64.c

src/mame/machine/n64.c
r14571r14572
7676   rspcpu = machine().device("rsp");
7777   mem_map = maincpu->memory().space(AS_PROGRAM);
7878
79   mi_version = 0x02020102;
79   mi_version = 0x01010101;
8080   mi_interrupt = 0;
8181   mi_intr_mask = 0;
8282   mi_mode = 0;
r14571r14572
144144   dd_seq_ctrl_reg = 0;
145145   dd_int = 0;
146146
147   memset(ri_regs, 0, sizeof(ri_regs));
148
149   //ri_regs[3] = 1;
147150   memset(pif_ram, 0, sizeof(pif_ram));
148151   memset(pif_cmd, 0, sizeof(pif_cmd));
149152   si_dram_addr = 0;
r14571r14572
514517
515518   if(direction == 0)// RDRAM -> I/DMEM
516519   {
520      UINT32 imem_touched = 0;
517521        for(int c = 0; c <= sp_dma_count; c++)
518522        {
519523            UINT32 src = (sp_dram_addr & 0x007fffff) >> 2;
r14571r14572
522526            for(int i = 0; i < length / 4; i++)
523527            {
524528            sp_mem[(dst + i) >> 10][(dst + i) & 0x3ff] = rdram[src + i];
529            imem_touched |= (dst + i) >> 10;
525530            }
526531
527532            sp_mem_addr += length;
r14571r14572
529534
530535            sp_mem_addr += sp_dma_skip;
531536        }
537        if(imem_touched)
538        {
539         rspdrc_flush_drc_cache(machine().device("rsp"));
540      }
532541   }
533542   else               // I/DMEM -> RDRAM
534543   {
r14571r14572
608617
609618      case 0x1c/4:      // SP_SEMAPHORE_REG
610619         //machine().scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(1));
620         device_yield(machine().device("maincpu"));
611621            if( sp_semaphore )
612622            {
613623                ret = 1;
614624            }
615625            else
616626            {
627            //printf("Semaphore is now acquired, returning 0\n");
617628                sp_semaphore = 1;
618629                ret = 0;
619630            }
r14571r14572
720731                {
721732               device_set_input_line(rspcpu, INPUT_LINE_HALT, CLEAR_LINE);
722733               newstatus &= ~RSP_STATUS_HALT;
734               //printf("***SP HALT CLR***\n"); fflush(stdout);
723735                }
724736                if (data & 0x00000002)      // set halt
725737                {
726738                    device_set_input_line(rspcpu, INPUT_LINE_HALT, ASSERT_LINE);
727739                    newstatus |= RSP_STATUS_HALT;
740               //printf("***SP HALT SET***\n"); fflush(stdout);
728741                }
729742                if (data & 0x00000004)
730743                {
731744                    newstatus &= ~RSP_STATUS_BROKE;
745               //printf("***SP BROKE CLR***\n"); fflush(stdout);
732746                }
733747                if (data & 0x00000008)      // clear interrupt
734748                {
749               //printf("***SP INT CLR***\n"); fflush(stdout);
735750                    clear_rcp_interrupt(SP_INTERRUPT);
736751                }
737752                if (data & 0x00000010)      // set interrupt
738753                {
754               //printf("***SP INT SET***\n"); fflush(stdout);
739755                    signal_rcp_interrupt(SP_INTERRUPT);
740756                }
741757                if (data & 0x00000020)
742758                {
743759                    newstatus &= ~RSP_STATUS_SSTEP;
760               //printf("***SP SSTEP CLR***\n"); fflush(stdout);
744761                }
745762                if (data & 0x00000040)
746763                {
747764                    newstatus |= RSP_STATUS_SSTEP;   // set single step
765               //printf("***SP SSTEP SET***\n"); fflush(stdout);
748766                    if(!(oldstatus & (RSP_STATUS_BROKE | RSP_STATUS_HALT)))
749767                    {
750768                        cpu_set_reg(rspcpu, RSP_STEPCNT, 1 );
751                        device_yield(machine().device("maincpu"));
769                        device_yield(machine().device("rsp"));
752770                    }
753771                }
754772                if (data & 0x00000080)
755773                {
756774                    newstatus &= ~RSP_STATUS_INTR_BREAK;   // clear interrupt on break
775               //printf("***SP INTRBRK CLR***\n"); fflush(stdout);
757776                }
758777                if (data & 0x00000100)
759778                {
760779                    newstatus |= RSP_STATUS_INTR_BREAK;      // set interrupt on break
780               //printf("***SP INTRBRK SET***\n"); fflush(stdout);
761781                }
762782                if (data & 0x00000200)
763783                {
764784                    newstatus &= ~RSP_STATUS_SIGNAL0;      // clear signal 0
785               //printf("***SP YIELD CLR***\n"); fflush(stdout);
765786                }
766787                if (data & 0x00000400)
767788                {
768789                    newstatus |= RSP_STATUS_SIGNAL0;      // set signal 0
790               //printf("***SP YIELD SET***\n"); fflush(stdout);
769791                }
770792                if (data & 0x00000800)
771793                {
772794                    newstatus &= ~RSP_STATUS_SIGNAL1;      // clear signal 1
795               //printf("***SP YIELDED CLR***\n"); fflush(stdout);
773796                }
774797                if (data & 0x00001000)
775798                {
776799                    newstatus |= RSP_STATUS_SIGNAL1;      // set signal 1
800               //printf("***SP YIELDED SET***\n"); fflush(stdout);
777801                }
778802                if (data & 0x00002000)
779803                {
780804                    newstatus &= ~RSP_STATUS_SIGNAL2 ;      // clear signal 2
805               //printf("***SP TASKDONE CLR***\n"); fflush(stdout);
781806                }
782807                if (data & 0x00004000)
783808                {
784809                    newstatus |= RSP_STATUS_SIGNAL2;      // set signal 2
810               //printf("***SP TASKDONE SET***\n"); fflush(stdout);
785811                }
786812                if (data & 0x00008000)
787813                {
788814                    newstatus &= ~RSP_STATUS_SIGNAL3;      // clear signal 3
815               //printf("***SP SIG3 CLR***\n"); fflush(stdout);
789816                }
790817                if (data & 0x00010000)
791818                {
792819                    newstatus |= RSP_STATUS_SIGNAL3;      // set signal 3
820               //printf("***SP SIG3 SET***\n"); fflush(stdout);
793821                }
794822                if (data & 0x00020000)
795823                {
796824                    newstatus &= ~RSP_STATUS_SIGNAL4;      // clear signal 4
825               //printf("***SP SIG4 CLR***\n"); fflush(stdout);
797826                }
798827                if (data & 0x00040000)
799828                {
800829                    newstatus |= RSP_STATUS_SIGNAL4;      // set signal 4
830               //printf("***SP SIG4 SET***\n"); fflush(stdout);
801831                }
802832                if (data & 0x00080000)
803833                {
804834                    newstatus &= ~RSP_STATUS_SIGNAL5;      // clear signal 5
835               //printf("***SP SIG5 CLR***\n"); fflush(stdout);
805836                }
806837                if (data & 0x00100000)
807838                {
808839                    newstatus |= RSP_STATUS_SIGNAL5;      // set signal 5
840               //printf("***SP SIG5 SET***\n"); fflush(stdout);
809841                }
810842                if (data & 0x00200000)
811843                {
812844                    newstatus &= ~RSP_STATUS_SIGNAL6;      // clear signal 6
845               //printf("***SP SIG6 CLR***\n"); fflush(stdout);
813846                }
814847                if (data & 0x00400000)
815848                {
816849                    newstatus |= RSP_STATUS_SIGNAL6;      // set signal 6
850               //printf("***SP SIG6 SET***\n"); fflush(stdout);
817851                }
818852                if (data & 0x00800000)
819853                {
820854                    newstatus &= ~RSP_STATUS_SIGNAL7;      // clear signal 7
855               //printf("***SP SIG7 CLR***\n"); fflush(stdout);
821856                }
822857                if (data & 0x01000000)
823858                {
824859                    newstatus |= RSP_STATUS_SIGNAL7;      // set signal 7
860               //printf("***SP SIG7 SET***\n"); fflush(stdout);
825861                }
826862                cpu_set_reg(rspcpu, RSP_SR, newstatus);
827863                break;
r14571r14572
829865
830866         case 0x1c/4:      // SP_SEMAPHORE_REG
831867            //machine().scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(1));
868            //printf("Semaphore is being released\n");
832869            if(data == 0)
833870            {
834871                   sp_semaphore = 0;
r14571r14572
13361373    switch (offset)
13371374    {
13381375        case 0x00/4:        // AI_DRAM_ADDR_REG
1339            ai_dram_addr = data & 0xffffff;
1376            ai_dram_addr = data & 0xfffff8;
13401377            break;
13411378
13421379        case 0x04/4:        // AI_LEN_REG
r14571r14572
13751412static TIMER_CALLBACK(pi_dma_callback)
13761413{
13771414   machine.device<n64_periphs>("rcp")->pi_dma_tick();
1415   device_yield(machine.device("rsp"));
13781416}
13791417
13801418void n64_periphs::pi_dma_tick()
r14571r14572
14201458         pi_cart_addr += dma_length;
14211459         pi_dram_addr += dma_length;
14221460      }
1423
1424      if (pi_first_dma)
1425      {
1426         // TODO: CIC-6105 has different address...
1427         mem_map->write_dword(0x00000318, 0x400000);
1428         mem_map->write_dword(0x000003f0, 0x800000);
1429         pi_first_dma = 0;
1430      }
14311461   }
14321462   else
14331463   {
r14571r14572
15381568         pi_dma_dir = 0;
15391569         pi_status |= 1;
15401570
1541         attotime dma_period = attotime::from_hz(93750000) * (pi_rd_len + 1) * 3;
1571         attotime dma_period = attotime::from_hz(93750000) * (int)((float)(pi_rd_len + 1) * 10.2f);
15421572         //printf("want read dma in %d\n", (pi_rd_len + 1));
15431573         pi_dma_timer->adjust(dma_period);
15441574         //pi_dma_tick();
r14571r14572
15511581         pi_dma_dir = 1;
15521582         pi_status |= 1;
15531583
1554         attotime dma_period = attotime::from_hz(93750000) * (pi_wr_len + 1) * 3;
1584         attotime dma_period = attotime::from_hz(93750000) * (int)((float)(pi_wr_len + 1) * 10.2f);
15551585         //printf("want write dma in %d\n", (pi_wr_len + 1));
15561586         pi_dma_timer->adjust(dma_period);
1587
1588         if (pi_first_dma)
1589         {
1590            // TODO: CIC-6105 has different address...
1591            //mem_map->write_dword(0x00000318, 0x800000);
1592            mem_map->write_dword(0x000003f0, 0x800000);
1593            pi_first_dma = 0;
1594         }
1595
15571596         //pi_dma_tick();
15581597         break;
15591598      }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team