Previous 199869 Revisions Next

r21199 Wednesday 20th February, 2013 at 01:40:27 UTC by Angelo Salese
Changed some variables around
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21198r21199
280280      m_txt_vram(*this, "txt_vram"),
281281      m_sysh1_txt_blit(*this, "sysh1_txt_blit"),
282282      m_sysh1_workram_h(*this, "sysh1_workrah"),
283      m_h1_unk(*this, "h1_unk"),
283      m_sound_dma(*this, "sound_dma"),
284284      m_soundram(*this, "soundram"),
285285      m_soundram2(*this, "soundram2")
286286      { }
r21198r21199
313313   required_shared_ptr<UINT32> m_txt_vram;
314314   required_shared_ptr<UINT32> m_sysh1_txt_blit;
315315   required_shared_ptr<UINT32> m_sysh1_workram_h;
316   required_shared_ptr<UINT32> m_h1_unk;
316   required_shared_ptr<UINT32> m_sound_dma;
317317   required_shared_ptr<UINT16> m_soundram;
318318   required_shared_ptr<UINT16> m_soundram2;
319319   bitmap_rgb32 m_temp_bitmap_sprites;
r21198r21199
325325   UINT8 an_mux_data;
326326   UINT8 sound_data;
327327
328   DECLARE_READ32_MEMBER(sysh1_unk_r);
329   DECLARE_WRITE32_MEMBER(sysh1_unk_w);
328   DECLARE_READ32_MEMBER(sysh1_sound_dma_r);
329   DECLARE_WRITE32_MEMBER(sysh1_sound_dma_w);
330330   DECLARE_READ32_MEMBER(sysh1_ioga_r);
331331   DECLARE_WRITE32_MEMBER(sysh1_ioga_w);
332332   DECLARE_WRITE32_MEMBER(sysh1_txt_blit_w);
r21198r21199
467467
468468/* end video */
469469
470/* unknown purpose */
471READ32_MEMBER(coolridr_state::sysh1_unk_r)
472{
473   if(offset == 8)
474      return sound_data;
475470
476   if(offset == 2 || offset == 6) // DMA status
477      return 0;
478471
479   printf("%08x\n",offset);
480
481   return m_h1_unk[offset];
482}
483
484WRITE32_MEMBER(coolridr_state::sysh1_unk_w)
485{
486   address_space &main_space = m_maincpu->space(AS_PROGRAM);
487   address_space &sound_space = m_soundcpu->space(AS_PROGRAM);
488
489   //printf("%08x %08x\n",offset*4,m_h1_unk[offset]);
490
491   if(offset == 8)
492   {
493      //probably writing to upper word disables m68k, to lower word enables it
494      machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, (data) ? ASSERT_LINE : CLEAR_LINE);
495      return;
496   }
497
498   if(offset == 2)
499   {
500      if(data & 1 && (!(m_h1_unk[2] & 1))) // 0 -> 1 transition enables DMA
501      {
502         UINT32 src = m_h1_unk[0];
503         UINT32 dst = m_h1_unk[1];
504         UINT32 size = (m_h1_unk[2]>>16)*0x40;
505
506         for(int i = 0;i < size; i+=2)
507         {
508            sound_space.write_word(dst,main_space.read_word(src));
509            src+=2;
510            dst+=2;
511         }
512      }
513   }
514
515   if(offset == 6)
516   {
517      if(data & 1 && (!(m_h1_unk[6] & 1))) // 0 -> 1 transition enables DMA
518      {
519         UINT32 src = m_h1_unk[4];
520         UINT32 dst = m_h1_unk[5];
521         UINT32 size = (m_h1_unk[6]>>16)*0x40;
522
523         //printf("%08x %08x %08x %02x\n",src,dst,size,sound_data);
524
525         for(int i = 0;i < size; i+=2)
526         {
527            sound_space.write_word(dst,main_space.read_word(src));
528            src+=2;
529            dst+=2;
530         }
531      }
532   }
533
534   COMBINE_DATA(&m_h1_unk[offset]);
535
536}
537
538
539472/* According to Guru, this is actually the same I/O chip of Sega Model 2 HW */
540473#if 0
541474READ32_MEMBER(coolridr_state::sysh1_ioga_r)
r21198r21199
1021954   */
1022955}
1023956
957
958READ32_MEMBER(coolridr_state::sysh1_sound_dma_r)
959{
960   if(offset == 8)
961   {
962      //popmessage("%02x",sound_data);
963      /* TODO: this probably stalls the DMA transfers. */
964      return sound_data;
965   }
966
967   if(offset == 2 || offset == 6) // DMA status
968      return 0;
969
970   printf("%08x\n",offset);
971
972   return m_sound_dma[offset];
973}
974
975WRITE32_MEMBER(coolridr_state::sysh1_sound_dma_w)
976{
977   address_space &main_space = m_maincpu->space(AS_PROGRAM);
978   address_space &sound_space = m_soundcpu->space(AS_PROGRAM);
979
980   //printf("%08x %08x\n",offset*4,m_h1_unk[offset]);
981
982   if(offset == 8)
983   {
984      //probably writing to upper word disables m68k, to lower word enables it
985      machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, (data) ? ASSERT_LINE : CLEAR_LINE);
986      return;
987   }
988
989   if(offset == 2)
990   {
991      if(data & 1 && (!(m_sound_dma[2] & 1))) // 0 -> 1 transition enables DMA
992      {
993         UINT32 src = m_sound_dma[0];
994         UINT32 dst = m_sound_dma[1];
995         UINT32 size = (m_sound_dma[2]>>16)*0x40;
996
997         for(int i = 0;i < size; i+=2)
998         {
999            sound_space.write_word(dst,main_space.read_word(src));
1000            src+=2;
1001            dst+=2;
1002         }
1003      }
1004   }
1005
1006   if(offset == 6)
1007   {
1008      if(data & 1 && (!(m_sound_dma[6] & 1))) // 0 -> 1 transition enables DMA
1009      {
1010         UINT32 src = m_sound_dma[4];
1011         UINT32 dst = m_sound_dma[5];
1012         UINT32 size = (m_sound_dma[6]>>16)*0x40;
1013
1014         //printf("%08x %08x %08x %02x\n",src,dst,size,sound_data);
1015
1016         for(int i = 0;i < size; i+=2)
1017         {
1018            sound_space.write_word(dst,main_space.read_word(src));
1019            src+=2;
1020            dst+=2;
1021         }
1022      }
1023   }
1024
1025   COMBINE_DATA(&m_sound_dma[offset]);
1026}
1027
1028
10241029static ADDRESS_MAP_START( coolridr_submap, AS_PROGRAM, 32, coolridr_state )
10251030   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_SHARE("share2")
10261031
r21198r21199
10321037   AM_RANGE(0x03300000, 0x03300fff) AM_DEVREADWRITE16_LEGACY("scsp2", scsp_r, scsp_w, 0xffffffff)
10331038
10341039//   AM_RANGE(0x04000000, 0x0400001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xffffffff)
1035   AM_RANGE(0x04000000, 0x0400003f) AM_READWRITE(sysh1_unk_r,sysh1_unk_w) AM_SHARE("h1_unk")
1040   AM_RANGE(0x04000000, 0x0400003f) AM_READWRITE(sysh1_sound_dma_r,sysh1_sound_dma_w) AM_SHARE("h1_unk")
10361041//   AM_RANGE(0x04200000, 0x0420003f) AM_RAM /* hi-word for DMA? */
10371042
10381043   AM_RANGE(0x05000000, 0x05000fff) AM_RAM
r21198r21199
14581463{
14591464   int scanline = param;
14601465
1461   /* 10: reads from 0x4000000 (sound irq?) */
1466   /* 10: reads from 0x4000000 (sound irq) */
14621467   /* 12: reads from inputs (so presumably V-Blank) */
14631468   /* 14: tries to r/w to 0x62***** area (network irq?) */
14641469

Previous 199869 Revisions Next


© 1997-2024 The MAME Team