Previous 199869 Revisions Next

r33283 Saturday 8th November, 2014 at 18:33:05 UTC by hap
added sega_315_5296_device
[src/mame/drivers]segas18.c
[src/mame/includes]segas18.h
[src/mame/video]segas18.c

trunk/src/mame/drivers/segas18.c
r241794r241795
150150   m_vdp->set_vdp_pal(FALSE);
151151   m_vdp->set_framerate(60);
152152   m_vdp->set_total_scanlines(262);
153   m_vdp->stop_timers();   // 315-5124 timers
153   m_vdp->stop_timers(); // 315-5124 timers
154154
155155   // save state
156156   save_item(NAME(m_mcu_data));
157157   save_item(NAME(m_lghost_value));
158158   save_item(NAME(m_lghost_select));
159   save_item(NAME(m_misc_io_data));
160159   save_item(NAME(m_wwally_last_x));
161160   save_item(NAME(m_wwally_last_y));
162161}
r241794r241795
199198 *
200199 *************************************/
201200
202READ16_MEMBER( segas18_state::io_chip_r )
201WRITE8_MEMBER( segas18_state::misc_outputs_w )
203202{
204   static const char *const portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" };
205   offset &= 0x1f/2;
206
207   switch (offset)
208   {
209      // I/O ports
210      case 0x00/2:
211      case 0x02/2:
212      case 0x04/2:
213      case 0x06/2:
214      case 0x08/2:
215      case 0x0a/2:
216      case 0x0c/2:
217      case 0x0e/2:
218         // if the port is configured as an output, return the last thing written
219         if (m_misc_io_data[0x1e/2] & (1 << offset))
220            return m_misc_io_data[offset];
221
222         // otherwise, return an input port
223         return ioport(portnames[offset])->read();
224
225      // 'SEGA' protection
226      case 0x10/2:
227         return 'S';
228      case 0x12/2:
229         return 'E';
230      case 0x14/2:
231         return 'G';
232      case 0x16/2:
233         return 'A';
234
235      // CNT register & mirror
236      case 0x18/2:
237      case 0x1c/2:
238         return m_misc_io_data[0x1c/2];
239
240      // port direction register & mirror
241      case 0x1a/2:
242      case 0x1e/2:
243         return m_misc_io_data[0x1e/2];
244   }
245   return 0xffff;
203   // miscellaneous output
204   set_grayscale(~data & 0x40);
205   m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20);
206   m_sprites->set_flip(data & 0x20);
207   // These are correct according to cgfm's docs, but mwalker and ddcrew both
208   // enable the lockout and never turn it off
209   // coin_lockout_w(machine(), 1, data & 0x08);
210   // coin_lockout_w(machine(), 0, data & 0x04);
211   coin_counter_w(machine(), 1, data & 0x02);
212   coin_counter_w(machine(), 0, data & 0x01);
246213}
247214
248215
249WRITE16_MEMBER( segas18_state::io_chip_w )
250{
251   // generic implementation
252   offset &= 0x1f/2;
253   UINT8 old = m_misc_io_data[offset];
254   m_misc_io_data[offset] = data;
255
256   switch (offset)
257   {
258      // I/O ports
259      case 0x00/2:
260      case 0x02/2:
261      case 0x04/2:
262      case 0x08/2:
263      case 0x0a/2:
264      case 0x0c/2:
265         if (m_has_guns)
266         {
267            // outputs for lghost only
268            output_set_value("P1_Gun_Recoil",(~data & 0x01));
269            output_set_value("P2_Gun_Recoil",(~data & 0x02)>>1);
270            output_set_value("P3_Gun_Recoil",(~data & 0x04)>>2);
271         }
272         break;
273
274      // miscellaneous output
275      case 0x06/2:
276         set_grayscale(~data & 0x40);
277         m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20);
278         m_sprites->set_flip(data & 0x20);
279// These are correct according to cgfm's docs, but mwalker and ddcrew both
280// enable the lockout and never turn it off
281//            coin_lockout_w(machine(), 1, data & 0x08);
282//            coin_lockout_w(machine(), 0, data & 0x04);
283         coin_counter_w(machine(), 1, data & 0x02);
284         coin_counter_w(machine(), 0, data & 0x01);
285         break;
286
287      // tile banking
288      case 0x0e/2:
289         if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW)
290            for (int i = 0; i < 4; i++)
291            {
292               m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i);
293               m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i);
294            }
295         break;
296
297      // CNT register
298      case 0x1c/2:
299         m_segaic16vid->segaic16_set_display_enable(data & 2);
300         if ((old ^ data) & 4)
301            set_vdp_enable(data & 4);
302         break;
303   }
304}
305
306
307216READ16_MEMBER( segas18_state::misc_io_r )
308217{
309   static const char *const portnames[] = { "SERVICE", "COINAGE" };
310
311218   offset &= 0x1fff;
312
313219   switch (offset & (0x3000/2))
314220   {
315221      // I/O chip
316222      case 0x0000/2:
317223      case 0x1000/2:
318         return io_chip_r(space, offset, mem_mask);
224         return m_io->read(space, offset) | (open_bus_r(space, 0, mem_mask) & 0xff00);
319225
320226      // video control latch
321227      case 0x2000/2:
228      {
229         static const char *const portnames[] = { "SERVICE", "COINAGE" };
322230         return ioport(portnames[offset & 1])->read();
231      }
323232   }
233
324234   if (!m_custom_io_r.isnull())
325235      return m_custom_io_r(space, offset, mem_mask);
326236   logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
327237   return open_bus_r(space, 0, mem_mask);
328238}
329239
330
331240WRITE16_MEMBER( segas18_state::misc_io_w )
332241{
333242   offset &= 0x1fff;
r241794r241795
338247      case 0x1000/2:
339248         if (ACCESSING_BITS_0_7)
340249         {
341            io_chip_w(space, offset, data, mem_mask);
250            m_io->write(space, offset, data);
342251            return;
343252         }
344253         break;
r241794r241795
352261         }
353262         break;
354263   }
264
355265   if (!m_custom_io_w.isnull())
356266   {
357267      m_custom_io_w(space, offset, data, mem_mask);
r241794r241795
368278 *
369279 *************************************/
370280
281WRITE8_MEMBER( segas18_state::rom_5874_bank_w )
282{
283   if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW)
284   {
285      for (int i = 0; i < 4; i++)
286      {
287         m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i);
288         m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i);
289      }
290   }
291}
292
293
371294WRITE16_MEMBER( segas18_state::rom_5987_bank_w )
372295{
373296   if (!ACCESSING_BITS_0_7)
374297      return;
298
375299   offset &= 0xf;
376300   data &= 0xff;
377301
r241794r241795
406330   // tile banking
407331   if (offset < 8)
408332   {
409   //   int maxbanks = m_gfxdecode->gfx(0)->elements() / 1024;
410333      data &= 0x9f;
411334
412335      if (data & 0x80) data += 0x20;
r241794r241795
435358   switch (offset)
436359   {
437360      case 0x3020/2:
438         return ioport("P3")->read();
361         return ioport("EXP3")->read();
439362
440363      case 0x3022/2:
441         return ioport("P4")->read();
364         return ioport("EXP4")->read();
442365
443366      case 0x3024/2:
444         return ioport("P34START")->read();
367         return ioport("EXSERVICE")->read();
445368   }
446369   return open_bus_r(space, 0, mem_mask);
447370}
r241794r241795
470393   return open_bus_r(space, 0, mem_mask);
471394}
472395
473
474396WRITE16_MEMBER( segas18_state::lghost_custom_io_w )
475397{
476398   switch (offset)
r241794r241795
498420}
499421
500422
423WRITE8_MEMBER( segas18_state::lghost_gun_recoil_w )
424{
425   output_set_value("P1_Gun_Recoil", (~data & 0x01));
426   output_set_value("P2_Gun_Recoil", (~data & 0x02)>>1);
427   output_set_value("P3_Gun_Recoil", (~data & 0x04)>>2);
428}
501429
430
431
502432/*************************************
503433 *
504434 *  Where's Wally Custom I/O
r241794r241795
575505   m_mcu->set_input_line(MCS51_INT1_LINE, HOLD_LINE);
576506}
577507
578/*************************************
579 *
580 *  VDP memory handlers
581 *
582 *************************************/
583508
584READ16_MEMBER( segas18_state::genesis_vdp_r )
585{
586   return m_vdp->vdp_r(space, offset, mem_mask);
587}
588509
589WRITE16_MEMBER( segas18_state::genesis_vdp_w )
590{
591   m_vdp->vdp_w(space, offset, data, mem_mask);
592}
593
594
595
596510/*************************************
597511 *
598512 *  Main CPU memory handlers
r241794r241795
681595   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
682596   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
683597
684   PORT_START("PORTC")
598   PORT_START("P3")
685599   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
686600
687   PORT_START("PORTD")
688   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
689
690601   PORT_START("SERVICE")
691602   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
692603   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
r241794r241795
709620   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" )
710621   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" )
711622   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" )
712
713   PORT_START("PORTH")
714   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
715623INPUT_PORTS_END
716624
717625
r241794r241795
725633static INPUT_PORTS_START( astorm )
726634   PORT_INCLUDE( system18_generic )
727635
728   PORT_MODIFY("PORTC")
636   PORT_MODIFY("P3")
729637   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
730638   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
731639   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r241794r241795
877785   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
878786   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
879787
880   PORT_START("P3")
788   PORT_START("EXP3")
881789   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
882790   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
883791   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r241794r241795
887795   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
888796   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
889797
890   PORT_START("P4")
798   PORT_START("EXP4")
891799   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
892800   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
893801   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
r241794r241795
897805   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
898806   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
899807
900   PORT_START("P34START")
808   PORT_START("EXSERVICE")
901809   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START3 )
902810   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 )
903811   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) // individual mode
r241794r241795
936844static INPUT_PORTS_START( ddcrew3p )
937845   PORT_INCLUDE( ddcrew2p )
938846
939   PORT_MODIFY("PORTC")
847   PORT_MODIFY("P3")
940848   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
941849   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
942850   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r241794r241795
955863static INPUT_PORTS_START( desertbr )
956864   PORT_INCLUDE( system18_generic )
957865
958   PORT_MODIFY("PORTC")
866   PORT_MODIFY("P3")
959867   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
960868   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
961869   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r241794r241795
11011009static INPUT_PORTS_START( mwalk )
11021010   PORT_INCLUDE( system18_generic )
11031011
1104   PORT_MODIFY("PORTC")
1012   PORT_MODIFY("P3")
11051013   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
11061014   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
11071015   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r241794r241795
12811189
12821190WRITE_LINE_MEMBER(segas18_state::ym3438_irq_handler)
12831191{
1284   if (state)
1285      m_soundcpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE );
1286   else
1287      m_soundcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE );
1192   m_soundcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE);
12881193}
12891194
12901195
r241794r241795
13031208
13041209   MCFG_SEGA_315_5195_MAPPER_ADD("mapper", "maincpu", segas18_state, memory_mapper, mapper_sound_r, mapper_sound_w)
13051210
1211   MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000)
1212   MCFG_315_5296_IN_PORTA_CB(IOPORT("P1"))
1213   MCFG_315_5296_IN_PORTB_CB(IOPORT("P2"))
1214   MCFG_315_5296_IN_PORTC_CB(IOPORT("P3"))
1215   MCFG_315_5296_OUT_PORTD_CB(WRITE8(segas18_state, misc_outputs_w))
1216   MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE"))
1217   MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE"))
1218   MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW"))
1219   MCFG_315_5296_OUT_PORTH_CB(WRITE8(segas18_state, rom_5874_bank_w))
1220   MCFG_315_5296_OUT_CNT1_CB(DEVWRITELINE("segaic16vid", segaic16_video_device, segaic16_set_display_enable))
1221   MCFG_315_5296_OUT_CNT2_CB(WRITELINE(segas18_state, set_vdp_enable))
13061222
13071223   MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, 0)
13081224   MCFG_SEGA315_5313_IS_PAL(false)
r241794r241795
13151231
13161232   MCFG_TIMER_DEVICE_ADD_SCANLINE("scantimer", "gen_vdp", sega315_5313_device, megadriv_scanline_timer_callback_alt_timing, "screen", 0, 1)
13171233
1318
13191234   // video hardware
13201235   MCFG_SCREEN_ADD("screen", RASTER)
1321   MCFG_SCREEN_REFRESH_RATE(57.23)    // verified on pcb
1236   MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb
13221237   MCFG_SCREEN_SIZE(342,262)
13231238   MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
13241239   MCFG_SCREEN_UPDATE_DRIVER(segas18_state, screen_update)
r241794r241795
13471262
13481263
13491264static MACHINE_CONFIG_DERIVED( system18_fd1094, system18 )
1265
1266   // basic machine hardware
13501267   MCFG_CPU_REPLACE("maincpu", FD1094, 10000000)
13511268   MCFG_CPU_PROGRAM_MAP(system18_map)
13521269   MCFG_CPU_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold)
13531270MACHINE_CONFIG_END
13541271
1272static MACHINE_CONFIG_DERIVED( lghost, system18_fd1094 )
1273
1274   // basic machine hardware
1275   MCFG_DEVICE_MODIFY("io")
1276   MCFG_315_5296_OUT_PORTC_CB(WRITE8(segas18_state, lghost_gun_recoil_w))
1277MACHINE_CONFIG_END
1278
1279
13551280static MACHINE_CONFIG_DERIVED( system18_fd1094_i8751, system18_fd1094 )
1281
1282   // basic machine hardware
13561283   MCFG_CPU_MODIFY("maincpu")
13571284   MCFG_CPU_VBLANK_INT_REMOVE()
13581285
r241794r241795
24032330
24042331DRIVER_INIT_MEMBER(segas18_state,lghost)
24052332{
2406   m_has_guns = true;
24072333   init_generic_5987();
24082334   m_custom_io_r = read16_delegate(FUNC(segas18_state::lghost_custom_io_r), this);
24092335   m_custom_io_w = write16_delegate(FUNC(segas18_state::lghost_custom_io_w), this);
r241794r241795
24402366GAME( 1991, ddcrewj,   ddcrew,   system18_fd1094,      ddcrew,   segas18_state, ddcrew,       ROT0,   "Sega",          "D. D. Crew (Japan, 4 Players, FD1094 317-0185)", 0 )
24412367GAME( 1991, ddcrewj2,  ddcrew,   system18_fd1094,      ddcrew2p, segas18_state, ddcrew,       ROT0,   "Sega",          "D. D. Crew (Japan, 2 Players, FD1094 317-0182)", 0 )
24422368GAME( 1991, hamaway,   0,        system18,             hamaway,  segas18_state, hamaway,      ROT90,  "Sega / Santos", "Hammer Away (Japan, prototype)", 0 )
2443GAME( 1990, lghost,    0,        system18_fd1094,      lghost,   segas18_state, lghost,       ROT0,   "Sega",          "Laser Ghost (World, FD1094 317-0166)", 0 )
2444GAME( 1990, lghostu,   lghost,   system18_fd1094,      lghost,   segas18_state, lghost,       ROT0,   "Sega",          "Laser Ghost (US, FD1094 317-0165)", 0 )
2369GAME( 1990, lghost,    0,        lghost,               lghost,   segas18_state, lghost,       ROT0,   "Sega",          "Laser Ghost (World, FD1094 317-0166)", 0 )
2370GAME( 1990, lghostu,   lghost,   lghost,               lghost,   segas18_state, lghost,       ROT0,   "Sega",          "Laser Ghost (US, FD1094 317-0165)", 0 )
24452371GAME( 1990, mwalk,     0,        system18_fd1094_i8751,mwalk,    segas18_state, generic_5874, ROT0,   "Sega",          "Michael Jackson's Moonwalker (World, FD1094/8751 317-0159)", 0 )
24462372GAME( 1990, mwalku,    mwalk,    system18_fd1094_i8751,mwalka,   segas18_state, generic_5874, ROT0,   "Sega",          "Michael Jackson's Moonwalker (US, FD1094/8751 317-0158)", 0 )
24472373GAME( 1990, mwalkj,    mwalk,    system18_fd1094_i8751,mwalk,    segas18_state, generic_5874, ROT0,   "Sega",          "Michael Jackson's Moonwalker (Japan, FD1094/8751 317-0157)", 0 )
r241794r241795
24492375GAME( 1989, shdancer,  0,        system18,             shdancer, segas18_state, generic_shad, ROT0,   "Sega",          "Shadow Dancer (World)", 0 )
24502376GAME( 1989, shdancerj, shdancer, system18,             shdancer, segas18_state, generic_shad, ROT0,   "Sega",          "Shadow Dancer (Japan)", 0 )
24512377GAME( 1989, shdancer1, shdancer, system18,             shdancer, segas18_state, generic_shad, ROT0,   "Sega",          "Shadow Dancer (US)", 0 )
2452GAME( 1992, wwallyj,   0,        system18_fd1094,      wwally,   segas18_state, wwally,       ROT0,   "Sega",          "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0) // the roms do contain an english logo so maybe there is a world / us set too
2378GAME( 1992, wwallyj,   0,        system18_fd1094,      wwally,   segas18_state, wwally,       ROT0,   "Sega",          "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0 ) // the roms do contain an english logo so maybe there is a world / us set too
24532379GAME( 1992, wwallyja,  wwallyj,  system18_fd1094,      wwally,   segas18_state, wwally,       ROT0,   "Sega",          "Wally wo Sagase! (rev A, Japan, FD1094 317-0197A)", 0 )
trunk/src/mame/includes/segas18.h
r241794r241795
1111#include "cpu/z80/z80.h"
1212#include "machine/nvram.h"
1313#include "machine/segaic16.h"
14#include "machine/315_5296.h"
1415#include "video/315_5313.h"
1516#include "video/segaic16.h"
1617#include "video/sega16sp.h"
r241794r241795
2930         m_soundcpu(*this, "soundcpu"),
3031         m_mcu(*this, "mcu"),
3132         m_vdp(*this, "gen_vdp"),
33         m_io(*this, "io"),
3234         m_nvram(*this, "nvram"),
3335         m_sprites(*this, "sprites"),
3436         m_segaic16vid(*this, "segaic16vid"),
37         m_gfxdecode(*this, "gfxdecode"),
3538         m_workram(*this, "workram"),
3639         m_romboard(ROM_BOARD_INVALID),
37         m_has_guns(false),
3840         m_grayscale_enable(false),
3941         m_vdp_enable(false),
4042         m_vdp_mixing(0),
4143         m_mcu_data(0),
4244         m_lghost_value(0),
43         m_lghost_select(0),
44         m_gfxdecode(*this, "gfxdecode")
45         m_lghost_select(0)
4546   {
46      memset(m_misc_io_data, 0, sizeof(m_misc_io_data));
4747      memset(m_wwally_last_x, 0, sizeof(m_wwally_last_x));
4848      memset(m_wwally_last_y, 0, sizeof(m_wwally_last_y));
4949   }
r241794r241795
6363   void mapper_sound_w(UINT8 data);
6464
6565   // read/write handlers
66   DECLARE_WRITE8_MEMBER( rom_5874_bank_w );
6667   DECLARE_WRITE16_MEMBER( rom_5987_bank_w );
6768   DECLARE_WRITE16_MEMBER( rom_837_7525_bank_w );
68   DECLARE_READ16_MEMBER( io_chip_r );
69   DECLARE_WRITE16_MEMBER( io_chip_w );
69   DECLARE_WRITE8_MEMBER( misc_outputs_w );
7070   DECLARE_READ16_MEMBER( misc_io_r );
7171   DECLARE_WRITE16_MEMBER( misc_io_w );
7272   DECLARE_WRITE8_MEMBER( soundbank_w );
7373   DECLARE_WRITE8_MEMBER( mcu_data_w );
7474
75   DECLARE_READ16_MEMBER( genesis_vdp_r );
76   DECLARE_WRITE16_MEMBER( genesis_vdp_w );
75   DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler);
7776
78   DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18);
79   DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18);
80   DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18);
81
82
8377   // custom I/O
8478   DECLARE_READ16_MEMBER( ddcrew_custom_io_r );
8579   DECLARE_READ16_MEMBER( lghost_custom_io_r );
80   DECLARE_WRITE8_MEMBER( lghost_gun_recoil_w );
8681   DECLARE_WRITE16_MEMBER( lghost_custom_io_w );
8782   DECLARE_READ16_MEMBER( wwally_custom_io_r );
8883   DECLARE_WRITE16_MEMBER( wwally_custom_io_w );
r241794r241795
9085   // video rendering
9186   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9287
93   DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space,offset,data,mem_mask); };
94   DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space,offset,data,mem_mask); };
95   
96   DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler);
88   DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18);
89   DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18);
90   DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18);
9791
92   DECLARE_READ16_MEMBER( genesis_vdp_r ) { return m_vdp->vdp_r(space, offset, mem_mask); }
93   DECLARE_WRITE16_MEMBER( genesis_vdp_w ) { m_vdp->vdp_w(space, offset, data, mem_mask); }
94   DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space, offset, data, mem_mask); }
95   DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space, offset, data, mem_mask); }
96
97   DECLARE_WRITE_LINE_MEMBER(set_grayscale);
98   DECLARE_WRITE_LINE_MEMBER(set_vdp_enable);
99   
98100protected:
99101   // timer IDs
100102   enum
r241794r241795
110112      ROM_BOARD_171_5874,     // 171-5874
111113      ROM_BOARD_171_5987,     // 171-5987
112114      ROM_BOARD_837_7525      // Hammer Away proto
113
114115   };
115116
116117   // device overrides
r241794r241795
120121
121122   // internal helpers
122123   void init_generic(segas18_rom_board rom_board);
123   void set_grayscale(bool enable);
124   void set_vdp_enable(bool enable);
125124   void set_vdp_mixing(UINT8 mixing);
126125   void draw_vdp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
127126
r241794r241795
131130   required_device<z80_device> m_soundcpu;
132131   optional_device<i8751_device> m_mcu;
133132   required_device<sega315_5313_device> m_vdp;
133   required_device<sega_315_5296_device> m_io;
134134   required_device<nvram_device> m_nvram;
135135   required_device<sega_sys16b_sprite_device> m_sprites;
136136   required_device<segaic16_video_device> m_segaic16vid;
137   required_device<gfxdecode_device> m_gfxdecode;
137138
138139   // memory pointers
139140   required_shared_ptr<UINT16> m_workram;
r241794r241795
142143   segas18_rom_board   m_romboard;
143144   read16_delegate     m_custom_io_r;
144145   write16_delegate    m_custom_io_w;
145   bool                m_has_guns;
146146
147147   // internal state
148   bool                m_grayscale_enable;
149   bool                m_vdp_enable;
148   int                 m_grayscale_enable;
149   int                 m_vdp_enable;
150150   UINT8               m_vdp_mixing;
151151   bitmap_ind16        m_temp_bitmap;
152152   UINT8               m_mcu_data;
153   UINT8               m_misc_io_data[0x10];
154153
155154   // game-specific state
156155   UINT8               m_wwally_last_x[3];
157156   UINT8               m_wwally_last_y[3];
158157   UINT8               m_lghost_value;
159158   UINT8               m_lghost_select;
160
161   required_device<gfxdecode_device> m_gfxdecode;
162159};
trunk/src/mame/video/segas18.c
r241794r241795
2929void segas18_state::video_start()
3030{
3131   m_temp_bitmap.allocate(m_screen->width(), m_screen->height());
32   m_grayscale_enable = false;
33   m_vdp_enable = false;
32   m_grayscale_enable = 0;
33   m_vdp_enable = 0;
3434   m_vdp_mixing = 0;
3535
3636   // initialize the tile/text layers
r241794r241795
5050 *
5151 *************************************/
5252
53void segas18_state::set_grayscale(bool enable)
53WRITE_LINE_MEMBER(segas18_state::set_grayscale)
5454{
55   if (enable != m_grayscale_enable)
55   if (state != m_grayscale_enable)
5656   {
5757      m_screen->update_partial(m_screen->vpos());
58      m_grayscale_enable = enable;
58      m_grayscale_enable = state;
5959//      osd_printf_debug("Grayscale = %02X\n", enable);
6060   }
6161}
6262
6363
64void segas18_state::set_vdp_enable(bool enable)
64WRITE_LINE_MEMBER(segas18_state::set_vdp_enable)
6565{
66   if (enable != m_vdp_enable)
66   if (state != m_vdp_enable)
6767   {
6868      m_screen->update_partial(m_screen->vpos());
69      m_vdp_enable = enable;
69      m_vdp_enable = state;
7070#if DEBUG_VDP
7171      osd_printf_debug("VDP enable = %02X\n", enable);
7272#endif
r241794r241795
222222   // mix in sprites
223223   bitmap_ind16 &sprites = m_sprites->bitmap();
224224   for (const sparse_dirty_rect *rect = m_sprites->first_dirty_rect(cliprect); rect != NULL; rect = rect->next())
225   {
225226      for (int y = rect->min_y; y <= rect->max_y; y++)
226227      {
227228         UINT16 *dest = &bitmap.pix(y);
r241794r241795
248249            }
249250         }
250251      }
252   }
251253
252254#if DEBUG_VDP
253255   if (m_vdp_enable && machine().input().code_pressed(KEYCODE_V))


Previous 199869 Revisions Next


© 1997-2024 The MAME Team