Previous 199869 Revisions Next

r22716 Thursday 9th May, 2013 at 08:15:16 UTC by Fabio Priuli
(MESS) nes.c: slightly more refined open bus emulation (still not 100% accurate, but it suffices
to make happy the two games which had issues with previous implementation). nw
[src/mess/machine]nes_bootleg.c nes_jy.c nes_kaiser.c nes_konami.c nes_mmc1.c nes_mmc3.c nes_mmc3_clones.c nes_multigame.c nes_namcot.c nes_pirate.c nes_slot.c nes_slot.h nes_sunsoft.c nes_sunsoft_dcs.c nes_taito.c

trunk/src/mess/machine/nes_slot.c
r22715r22716
130130                  m_has_trainer(FALSE),
131131                  m_x1_005_alt_mirroring(FALSE),
132132                  m_bus_conflict(TRUE),
133                  m_open_bus(0),
133134                  m_prg_chunks(0),
134135                  m_prg_mask(0xffff),
135136                  m_chr_source(CHRRAM),
r22715r22716
656657
657658READ8_MEMBER(device_nes_cart_interface::read_l)
658659{
659   return ((offset + 0x4100) & 0xff00) >> 8;   // open bus
660   return m_open_bus;
660661}
661662
662663READ8_MEMBER(device_nes_cart_interface::read_m)
r22715r22716
666667   if (m_prgram)
667668      return m_prgram[offset & (m_prgram_size - 1)];
668669
669   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
670   return m_open_bus;
670671}
671672
672673WRITE8_MEMBER(device_nes_cart_interface::write_l)
r22715r22716
993994READ8_MEMBER(nes_cart_slot_device::read_l)
994995{
995996   if (m_cart)
996      return m_cart->read_l(space, offset);
997   {
998      UINT8 val = m_cart->read_l(space, offset);
999      // update open bus
1000      m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
1001      return val;
1002   }
9971003   else
9981004      return 0xff;
9991005}
r22715r22716
10011007READ8_MEMBER(nes_cart_slot_device::read_m)
10021008{
10031009   if (m_cart)
1004      return m_cart->read_m(space, offset);
1010   {
1011      UINT8 val = m_cart->read_m(space, offset);
1012      // update open bus
1013      m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
1014      return val;
1015   }
10051016   else
10061017      return 0xff;
10071018}
r22715r22716
10091020READ8_MEMBER(nes_cart_slot_device::read_h)
10101021{
10111022   if (m_cart)
1012      return m_cart->read_h(space, offset);
1023   {
1024      UINT8 val = m_cart->read_h(space, offset);
1025      // update open bus
1026      m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
1027      return val;
1028   }
10131029   else
10141030      return 0xff;
10151031}
r22715r22716
10171033READ8_MEMBER(nes_cart_slot_device::read_ex)
10181034{
10191035   if (m_cart)
1020      return m_cart->read_ex(space, offset);
1036   {
1037      UINT8 val = m_cart->read_ex(space, offset);
1038      // update open bus
1039      m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
1040      return val;
1041   }
10211042   else
10221043      return 0xff;
10231044}
r22715r22716
10301051WRITE8_MEMBER(nes_cart_slot_device::write_l)
10311052{
10321053   if (m_cart)
1054   {
10331055      m_cart->write_l(space, offset, data);
1056      // update open bus
1057      m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
1058   }
10341059}
10351060
10361061WRITE8_MEMBER(nes_cart_slot_device::write_m)
10371062{
10381063   if (m_cart)
1064   {
10391065      m_cart->write_m(space, offset, data);
1066      // update open bus
1067      m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
1068   }
10401069}
10411070
10421071WRITE8_MEMBER(nes_cart_slot_device::write_h)
10431072{
10441073   if (m_cart)
1074   {
10451075      m_cart->write_h(space, offset, data);
1076      // update open bus
1077      m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
1078   }
10461079}
10471080
10481081WRITE8_MEMBER(nes_cart_slot_device::write_ex)
10491082{
10501083   if (m_cart)
1084   {
10511085      m_cart->write_ex(space, offset, data);
1086      // update open bus
1087      m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
1088   }
10521089}
10531090
10541091
trunk/src/mess/machine/nes_slot.h
r22715r22716
192192   void set_vrc_lines(int PRG_A, int PRG_B, int CHR) { m_vrc_ls_prg_a = PRG_A; m_vrc_ls_prg_b = PRG_B; m_vrc_ls_chr = CHR; }
193193   void set_x1_005_alt(bool val) { m_x1_005_alt_mirroring = val; }
194194   void set_bus_conflict(bool val) { m_bus_conflict = val; }
195   void set_open_bus(UINT8 val) { m_open_bus = val; }
195196
196197   UINT8* get_prg_base() { return m_prg; }
197198   UINT8* get_prgram_base() { return m_prgram; }
r22715r22716
252253   bool m_pcb_ctrl_mirror, m_four_screen_vram, m_has_trainer;
253254   bool m_x1_005_alt_mirroring;    // temp hack for two kind of mirroring in Taito X1-005 boards (to be replaced with pin checking)
254255   bool m_bus_conflict;
256   UINT8 m_open_bus;
255257
256258   // PRG
257259   inline int prg_8k_bank_num(int bank);
trunk/src/mess/machine/nes_namcot.c
r22715r22716
520520   if (m_battery && offset < m_battery_size && m_wram_enable)
521521      return m_battery[offset & (m_battery_size - 1)];
522522
523   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
523   return m_open_bus;   // open bus
524524}
525525
526526WRITE8_MEMBER(nes_namcot175_device::write_m)
r22715r22716
602602   if (m_battery && offset < m_battery_size)
603603      return m_battery[offset & (m_battery_size - 1)];
604604
605   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
605   return m_open_bus;   // open bus
606606}
607607
608608WRITE8_MEMBER(nes_namcot163_device::write_m)
trunk/src/mess/machine/nes_pirate.c
r22715r22716
13841384   if (offset == 0x7001 || offset == 0x7777)
13851385      return m_latch | ((offset >> 8) & 0x7f);
13861386
1387   return (offset & 0xff00) >> 8;  // open bus
1387   return m_open_bus;  // open bus
13881388}
13891389#endif
trunk/src/mess/machine/nes_mmc3_clones.c
r22715r22716
444444{
445445   m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
446446
447   mmc3_common_initialize(0x7f, 0xff, 0);
448447   m_reg[0] = 0;
449448   m_reg[1] = 0;
450449   m_reg[2] = 0;
450   mmc3_common_initialize(0x7f, 0xff, 0);
451451}
452452
453453void nes_fk23c_device::device_start()
r22715r22716
17971797   {
17981798      // DSW read!
17991799   }
1800   return (offset & 0xff00) >> 8;  // open bus
1800   return m_open_bus;  // open bus
18011801}
18021802
18031803
trunk/src/mess/machine/nes_taito.c
r22715r22716
366366   if (offset >= 0x1f00 && m_latch == 0xa3)
367367      return m_x1_005_ram[offset & 0x7f];
368368
369   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
369   return m_open_bus;   // open bus
370370}
371371
372372/*-------------------------------------------------
r22715r22716
469469   if (offset < 0x1400 && m_reg[2] == 0x84)
470470      return m_x1_017_ram[0x1000 + (offset & 0x3ff)];
471471
472   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
472   return m_open_bus;   // open bus
473473}
trunk/src/mess/machine/nes_kaiser.c
r22715r22716
476476      return temp;
477477   }
478478
479   return ((offset + 0x4000) & 0xff00) >> 8;   // open bus
479   return m_open_bus;   // open bus
480480}
481481
482482/*-------------------------------------------------
trunk/src/mess/machine/nes_mmc1.c
r22715r22716
293293         return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
294294   }
295295
296   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
296   return m_open_bus;   // open bus
297297}
298298
299299// SOROM has two RAM banks, the first is not battery backed up, the second is.
r22715r22716
324324         return m_prgram[offset & (m_prgram_size - 1)];
325325   }
326326
327   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
327   return m_open_bus;   // open bus
328328}
329329
330330// MMC1A boards have no wram enable/disable bit
r22715r22716
349349   if (m_prgram)
350350      return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
351351
352   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
352   return m_open_bus;   // open bus
353353}
354354
355355WRITE8_MEMBER(nes_sorom_a_device::write_m)
trunk/src/mess/machine/nes_mmc3.c
r22715r22716
340340         return m_prgram[offset & (m_prgram_size - 1)];
341341   }
342342
343   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
343   return m_open_bus;   // open bus
344344}
345345
346346
r22715r22716
376376   LOG_MMC(("hkrom read_m, offset: %04x\n", offset));
377377
378378   if (offset < 0x1000)
379      return 0xff;    // here it should be open bus
379      return m_open_bus;    // open bus
380380
381381   if (!(m_mmc6_reg & 0xa0))
382      return 0xff;    // here it should be open bus
382      return m_open_bus;    // open bus
383383
384384   if (BIT(offset, 9) && BIT(m_mmc6_reg, 7))   // access to upper half of 1k when upper read is enabled
385385      return m_mmc6_ram[offset & 0x3ff];
trunk/src/mess/machine/nes_konami.c
r22715r22716
295295   else if (m_prgram)
296296      return m_prgram[offset & (m_prgram_size - 1)];
297297   else    // sort of protection? it returns open bus in $7000-$7fff and (open bus & 0xfe) | m_latch in $6000-$6fff
298      return (offset < 0x1000) ? ((((offset + 0x8000) & 0xfe00) >> 8) | (m_latch & 1)) : (((offset + 0x8000) & 0xff00) >> 8);
298      return (offset < 0x1000) ? ((m_open_bus & 0xfe) | (m_latch & 1)) : m_open_bus;
299299}
300300
301301WRITE8_MEMBER(nes_konami_vrc2_device::write_m)
r22715r22716
602602            }
603603         }
604604         else    // saw
605         {
606605            m_vrc6snd->write(space, (add_lines>>8) | 0x200, data);
607         }
608606         break;
609607      case 0x5000:
610608      case 0x6000:
trunk/src/mess/machine/nes_sunsoft_dcs.c
r22715r22716
231231      if (m_timer_on)
232232         return m_subslot->m_cart->read(space, offset, mem_mask);
233233      else
234         return ((offset + 0x8000) & 0xff00) >> 8;   // after the timer is off, this returns open bus...
234         return m_open_bus;   // after the timer is off, this returns open bus...
235235   }
236236   else
237237      return hi_access_rom(offset);
r22715r22716
262262   if (m_prgram && m_wram_enable)
263263      return m_prgram[offset & (m_prgram_size - 1)];
264264
265   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
265   return m_open_bus;   // open bus
266266}
267267
268268//-------------------------------------------------
trunk/src/mess/machine/nes_sunsoft.c
r22715r22716
443443   if (m_prgram && m_wram_enable)
444444      return m_prgram[offset & (m_prgram_size - 1)];
445445
446   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
446   return m_open_bus;   // open bus
447447}
448448
449449/*-------------------------------------------------
r22715r22716
564564         return m_prgram[((bank * 0x2000) + offset) & (m_prgram_size - 1)];
565565   }
566566
567   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
567   return m_open_bus;   // open bus
568568}
569569
570570
trunk/src/mess/machine/nes_multigame.c
r22715r22716
14761476   //  m_dipsetting = ioport("CARTDIPS")->read();
14771477
14781478   if (m_latch == 1)
1479      return (offset & 0xff00) >> 8;    // open bus
1479      return m_open_bus;    // open bus
14801480   else
14811481      return hi_access_rom(offset);
14821482}
r22715r22716
24582458   LOG_MMC(("bmc_gold150 read_h, offset: %04x\n", offset));
24592459
24602460   if (m_latch)    // open bus
2461      return (offset & 0xff00) >> 8;
2461      return m_open_bus;
24622462   else
24632463      return hi_access_rom(offset);
24642464}
r22715r22716
25112511   LOG_MMC(("bmc_ch001 read_h, offset: %04x\n", offset));
25122512
25132513   if (m_latch && offset < 0x4000) // open bus
2514      return (offset & 0xff00) >> 8;
2514      return m_open_bus;
25152515   else
25162516      return hi_access_rom(offset);
25172517}
trunk/src/mess/machine/nes_jy.c
r22715r22716
283283      if ((offset & 3) == 3)
284284         return m_latch;
285285   }
286   return ((offset + 0x4000) & 0xff00) >> 8;   // open bus
286   return m_open_bus;   // open bus
287287}
288288
289289WRITE8_MEMBER(nes_jy_typea_device::write_l)
r22715r22716
310310   if (m_reg[0] & 0x80)
311311      return m_prg[(m_bank_6000 & m_prg_mask) * 0x2000 + (offset & 0x1fff)];
312312
313   return ((offset + 0x6000) & 0xff00) >> 8;   // open bus
313   return m_open_bus;   // open bus
314314}
315315
316316
trunk/src/mess/machine/nes_bootleg.c
r22715r22716
969969   if (offset >= 0x1000)
970970      return m_prg[0x10000 + (offset & 0x0fff)];
971971
972   return ((offset + 0x4000) & 0xff00) >> 8;   // open bus
972   return m_open_bus;   // open bus
973973}
974974
975975READ8_MEMBER(nes_smb2j_device::read_m)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team