Previous 199869 Revisions Next

r21691 Thursday 7th March, 2013 at 20:09:03 UTC by Fabio Priuli
temp fixed regression in superfx due to changes done yesterday. the code is not optimal but it's going to be rewritten soon anyway...
[src/mess/drivers]snes.c

trunk/src/mess/drivers/snes.c
r21690r21691
5555   DECLARE_READ8_MEMBER( snes_hi_r );
5656   DECLARE_WRITE8_MEMBER( snes_lo_w );
5757   DECLARE_WRITE8_MEMBER( snes_hi_w );
58   DECLARE_READ8_MEMBER( sfx_r );
59   DECLARE_WRITE8_MEMBER( sfx_w );
5860   DECLARE_READ8_MEMBER( superfx_r_bank1 );
5961   DECLARE_READ8_MEMBER( superfx_r_bank2 );
6062   DECLARE_READ8_MEMBER( superfx_r_bank3 );
r21690r21691
137139}
138140
139141
142READ8_MEMBER( snes_console_state::sfx_r )
143{
144   UINT16 address = offset & 0xffff;
145   if (offset < 0x400000)
146   {
147      if (address < 0x2000)
148         return space.read_byte(0x7e0000 + address);
149      else if (address < 0x6000)
150      {
151         if (address >= 0x3000 && address < 0x3300)
152            return superfx_mmio_read(m_superfx, address);
153         else
154            return snes_r_io(space, address);
155      }
156      else if (address < 0x8000)
157         return superfx_access_ram(m_superfx) ? m_sfx_ram[offset & 0x1fff] : snes_open_bus_r(space, 0);
158      else
159         return snes_ram[offset];
160   }
161   else if (offset < 0x600000)
162   {
163      if (superfx_access_rom(m_superfx))
164         return snes_ram[offset];
165      else
166      {
167         static const UINT8 sfx_data[16] = {
168            0x00, 0x01, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01,
169            0x00, 0x01, 0x08, 0x01, 0x00, 0x01, 0x0c, 0x01,
170         };
171         return sfx_data[offset & 0x0f];
172      }
173   }
174   else
175      return superfx_access_ram(m_superfx) ? m_sfx_ram[offset & 0xfffff] : snes_open_bus_r(space, 0);
176}
177
178WRITE8_MEMBER( snes_console_state::sfx_w )
179{
180   UINT16 address = offset & 0xffff;
181   if (offset < 0x400000)
182   {
183      if (address < 0x2000)
184         space.write_byte(0x7e0000 + address, data);
185      else if (address < 0x6000)
186      {
187         if (address >= 0x3000 && address < 0x3300)
188            superfx_mmio_write(m_superfx, address, data);
189         else
190            snes_w_io(space, address, data);
191      }
192      else if (address < 0x8000)
193         m_sfx_ram[offset & 0x1fff] = data;
194   }
195   else if (offset >= 0x600000)
196      m_sfx_ram[offset & 0xfffff] = data;
197}
198
140199READ8_MEMBER( snes_console_state::snes_lo_r )
141200{
142201   UINT16 address = offset & 0xffff;
r21690r21691
192251      && offset >= 0x500000 && offset < 0x510000)
193252      return spc7110_mmio_read(space, 0x4800);
194253   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
195      return space.read_byte(offset + 0x800000);     // [00-7f] same as [80-ff]
254      return sfx_r(space, offset, 0xff);
196255
197256   // base cart access
198257   return snes_r_bank1(space, offset, 0xff);
r21690r21691
254313   if ((m_has_addon_chip == HAS_SPC7110 || m_has_addon_chip == HAS_SPC7110_RTC)
255314      && offset >= 0x500000)
256315      return spc7110_bank7_read(space, offset - 0x400000);
257   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
258      && offset < 0x400000)
259   {
260      if (address >= 0x3000 && address < 0x3300)
261         return superfx_mmio_read(m_superfx, address);
262      if (address >= 0x6000 && address < 0x8000)
263         return superfx_access_ram(m_superfx) ? m_sfx_ram[offset & 0x1fff] : snes_open_bus_r(space, 0);
264   }
265   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
266      && offset >= 0x400000 && offset < 0x600000)
267   {
268      if (superfx_access_rom(m_superfx))
269         return snes_ram[offset];
270      else
271      {
272         static const UINT8 sfx_data[16] = {
273            0x00, 0x01, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01,
274            0x00, 0x01, 0x08, 0x01, 0x00, 0x01, 0x0c, 0x01,
275         };
276         return sfx_data[offset & 0x0f];
277      }
278   }
279   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
280      && offset >= 0x600000)
281      return superfx_access_ram(m_superfx) ? m_sfx_ram[offset & 0xfffff] : snes_open_bus_r(space, 0);
316   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
317      return sfx_r(space, offset, 0xff);
282318
283319   // base cart access
284320   return snes_r_bank2(space, offset, 0xff);
r21690r21691
352388      {   spc7110_ram_write(address & 0x1fff, data); return; }
353389   }
354390   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
355   {   space.write_byte(offset + 0x800000, data); return; }       // [00-7f] same as [80-ff]
391   {   sfx_w(space, offset, data, 0xff); return; }
356392
357393   // base cart access
358394   snes_w_bank1(space, offset, data, 0xff);
r21690r21691
425461      if (offset >= 0x300000 && offset < 0x310000 && address >= 0x6000 && address < 0x8000)
426462      {   spc7110_ram_write(address & 0x1fff, data); return; }
427463   }
428   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
429      && offset < 0x400000)
430   {
431      if (address >= 0x3000 && address < 0x3300)
432      {   superfx_mmio_write(m_superfx, address, data);   return; }
433      if (address >= 0x6000 && address < 0x8000)
434      {   m_sfx_ram[offset & 0x1fff] = data;  return; }
435   }
436   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL
437      && offset >= 0x600000)
438   {   m_sfx_ram[offset & 0xfffff] = data; return; }
464   if (m_has_addon_chip == HAS_SUPERFX && m_superfx != NULL)
465   {   sfx_w(space, offset, data, 0xff); return; }
439466
440467   // base cart access
441468   snes_w_bank2(space, offset, data, 0xff);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team