Previous 199869 Revisions Next

r20981 Tuesday 12th February, 2013 at 14:25:10 UTC by Miodrag Milanović
morednized pipedrm (nw)
[src/mame/drivers]pipedrm.c
[src/mame/includes]fromance.h

trunk/src/mame/includes/fromance.h
r20980r20981
7676   DECLARE_WRITE8_MEMBER(fromance_crtc_data_w);
7777   DECLARE_WRITE8_MEMBER(fromance_crtc_register_w);
7878   DECLARE_WRITE8_MEMBER(fromance_adpcm_reset_w);
79   DECLARE_DRIVER_INIT(pipedrm);
80   DECLARE_DRIVER_INIT(hatris);
8179   TILE_GET_INFO_MEMBER(get_fromance_bg_tile_info);
8280   TILE_GET_INFO_MEMBER(get_fromance_fg_tile_info);
8381   TILE_GET_INFO_MEMBER(get_nekkyoku_bg_tile_info);
r20980r20981
8684   DECLARE_MACHINE_RESET(fromance);
8785   DECLARE_VIDEO_START(nekkyoku);
8886   DECLARE_VIDEO_START(fromance);
89   DECLARE_MACHINE_START(pipedrm);
90   DECLARE_MACHINE_RESET(pipedrm);
9187   DECLARE_VIDEO_START(pipedrm);
9288   DECLARE_VIDEO_START(hatris);
9389   UINT32 screen_update_fromance(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/drivers/pipedrm.c
r20980r20981
167167#include "includes/fromance.h"
168168
169169
170class pipedrm_state : public fromance_state
171{
172public:
173   pipedrm_state(const machine_config &mconfig, device_type type, const char *tag)
174      : fromance_state(mconfig, type, tag)
175   { }
176
177   DECLARE_MACHINE_START(pipedrm);
178   DECLARE_MACHINE_RESET(pipedrm);
179   DECLARE_DRIVER_INIT(pipedrm);
180   DECLARE_DRIVER_INIT(hatris);
181   DECLARE_WRITE8_MEMBER( pipedrm_bankswitch_w );
182   DECLARE_WRITE8_MEMBER( sound_bankswitch_w );
183   TIMER_CALLBACK_MEMBER( delayed_command_w );
184   DECLARE_WRITE8_MEMBER( sound_command_w );
185   DECLARE_WRITE8_MEMBER( sound_command_nonmi_w );
186   DECLARE_WRITE8_MEMBER( pending_command_clear_w );
187   DECLARE_READ8_MEMBER( pending_command_r );
188   DECLARE_READ8_MEMBER( sound_command_r );
189};
190
191
170192/*************************************
171193 *
172194 *  Bankswitching
173195 *
174196 *************************************/
175197
176static WRITE8_HANDLER( pipedrm_bankswitch_w )
198WRITE8_MEMBER(pipedrm_state::pipedrm_bankswitch_w )
177199{
178   fromance_state *state = space.machine().driver_data<fromance_state>();
179200   /*
180201       Bit layout:
181202
r20980r20981
188209   */
189210
190211   /* set the memory bank on the Z80 using the low 3 bits */
191   state->membank("bank1")->set_entry(data & 0x7);
212   membank("bank1")->set_entry(data & 0x7);
192213
193214   /* map to the fromance gfx register */
194   state->fromance_gfxreg_w(space, offset, ((data >> 6) & 0x01) |  /* flipscreen */
215   fromance_gfxreg_w(space, offset, ((data >> 6) & 0x01) |  /* flipscreen */
195216                        ((~data >> 2) & 0x02)); /* videoram select */
196217}
197218
198219
199static WRITE8_HANDLER( sound_bankswitch_w )
220WRITE8_MEMBER(pipedrm_state::sound_bankswitch_w )
200221{
201222   space.machine().root_device().membank("bank2")->set_entry(data & 0x01);
202223}
r20980r20981
209230 *
210231 *************************************/
211232
212static TIMER_CALLBACK( delayed_command_w    )
233TIMER_CALLBACK_MEMBER(pipedrm_state::delayed_command_w)
213234{
214   fromance_state *state = machine.driver_data<fromance_state>();
215   state->m_sound_command = param & 0xff;
216   state->m_pending_command = 1;
235   m_sound_command = param & 0xff;
236   m_pending_command = 1;
217237
218238   /* Hatris polls commands *and* listens to the NMI; this causes it to miss */
219239   /* sound commands. It's possible the NMI isn't really hooked up on the YM2608 */
220240   /* sound board. */
221241   if (param & 0x100)
222      state->m_subcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
242      m_subcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
223243}
224244
225245
226static WRITE8_HANDLER( sound_command_w )
246WRITE8_MEMBER(pipedrm_state::sound_command_w )
227247{
228   space.machine().scheduler().synchronize(FUNC(delayed_command_w), data | 0x100);
248   machine().scheduler().synchronize(timer_expired_delegate(FUNC(pipedrm_state::delayed_command_w),this), data | 0x100);
229249}
230250
231251
232static WRITE8_HANDLER( sound_command_nonmi_w )
252WRITE8_MEMBER(pipedrm_state::sound_command_nonmi_w )
233253{
234   space.machine().scheduler().synchronize(FUNC(delayed_command_w), data);
254   machine().scheduler().synchronize(timer_expired_delegate(FUNC(pipedrm_state::delayed_command_w),this), data);
235255}
236256
237257
238static WRITE8_HANDLER( pending_command_clear_w )
258WRITE8_MEMBER(pipedrm_state::pending_command_clear_w )
239259{
240   fromance_state *state = space.machine().driver_data<fromance_state>();
241   state->m_pending_command = 0;
242   state->m_subcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
260   m_pending_command = 0;
261   m_subcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
243262}
244263
245264
246static READ8_HANDLER( pending_command_r )
265READ8_MEMBER(pipedrm_state::pending_command_r )
247266{
248   fromance_state *state = space.machine().driver_data<fromance_state>();
249   return state->m_pending_command;
267   return m_pending_command;
250268}
251269
252270
253static READ8_HANDLER( sound_command_r )
271READ8_MEMBER(pipedrm_state::sound_command_r )
254272{
255   fromance_state *state = space.machine().driver_data<fromance_state>();
256   return state->m_sound_command;
273   return m_sound_command;
257274}
258275
259276
r20980r20981
264281 *
265282 *************************************/
266283
267static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, fromance_state )
284static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, pipedrm_state )
268285   AM_RANGE(0x0000, 0x7fff) AM_ROM
269286   AM_RANGE(0x8000, 0x9fff) AM_RAM
270287   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1")
r20980r20981
273290ADDRESS_MAP_END
274291
275292
276static ADDRESS_MAP_START( main_portmap, AS_IO, 8, fromance_state )
293static ADDRESS_MAP_START( main_portmap, AS_IO, 8, pipedrm_state )
277294   ADDRESS_MAP_GLOBAL_MASK(0xff)
278295   AM_RANGE(0x10, 0x10) AM_WRITE(fromance_crtc_data_w)
279296   AM_RANGE(0x11, 0x11) AM_WRITE(fromance_crtc_register_w)
280   AM_RANGE(0x20, 0x20) AM_READ_PORT("P1") AM_WRITE_LEGACY(sound_command_w)
281   AM_RANGE(0x21, 0x21) AM_READ_PORT("P2") AM_WRITE_LEGACY(pipedrm_bankswitch_w)
297   AM_RANGE(0x20, 0x20) AM_READ_PORT("P1") AM_WRITE(sound_command_w)
298   AM_RANGE(0x21, 0x21) AM_READ_PORT("P2") AM_WRITE(pipedrm_bankswitch_w)
282299   AM_RANGE(0x22, 0x25) AM_WRITE(fromance_scroll_w)
283300   AM_RANGE(0x22, 0x22) AM_READ_PORT("DSW1")
284301   AM_RANGE(0x23, 0x23) AM_READ_PORT("DSW2")
285302   AM_RANGE(0x24, 0x24) AM_READ_PORT("SYSTEM")
286   AM_RANGE(0x25, 0x25) AM_READ_LEGACY(pending_command_r)
303   AM_RANGE(0x25, 0x25) AM_READ(pending_command_r)
287304ADDRESS_MAP_END
288305
289306
r20980r20981
294311 *
295312 *************************************/
296313
297static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, fromance_state )
314static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, pipedrm_state )
298315   AM_RANGE(0x0000, 0x77ff) AM_ROM
299316   AM_RANGE(0x7800, 0x7fff) AM_RAM
300317   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank2")
301318ADDRESS_MAP_END
302319
303320
304static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, fromance_state )
321static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, pipedrm_state )
305322   ADDRESS_MAP_GLOBAL_MASK(0xff)
306   AM_RANGE(0x04, 0x04) AM_WRITE_LEGACY(sound_bankswitch_w)
307   AM_RANGE(0x16, 0x16) AM_READ_LEGACY(sound_command_r)
308   AM_RANGE(0x17, 0x17) AM_WRITE_LEGACY(pending_command_clear_w)
323   AM_RANGE(0x04, 0x04) AM_WRITE(sound_bankswitch_w)
324   AM_RANGE(0x16, 0x16) AM_READ(sound_command_r)
325   AM_RANGE(0x17, 0x17) AM_WRITE(pending_command_clear_w)
309326   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
310327ADDRESS_MAP_END
311328
312329
313static ADDRESS_MAP_START( hatris_sound_portmap, AS_IO, 8, fromance_state )
330static ADDRESS_MAP_START( hatris_sound_portmap, AS_IO, 8, pipedrm_state )
314331   ADDRESS_MAP_GLOBAL_MASK(0xff)
315332   AM_RANGE(0x00, 0x03) AM_MIRROR(0x08) AM_DEVREADWRITE_LEGACY("ymsnd", ym2608_r, ym2608_w)
316   AM_RANGE(0x04, 0x04) AM_READ_LEGACY(sound_command_r)
317   AM_RANGE(0x05, 0x05) AM_READWRITE_LEGACY(pending_command_r, pending_command_clear_w)
333   AM_RANGE(0x04, 0x04) AM_READ(sound_command_r)
334   AM_RANGE(0x05, 0x05) AM_READWRITE(pending_command_r, pending_command_clear_w)
318335ADDRESS_MAP_END
319336
320337
r20980r20981
557574 *
558575 *************************************/
559576
560static void irqhandler( device_t *device, int irq )
577static void irqhandler(device_t *device, int irq )
561578{
562   fromance_state *state = device->machine().driver_data<fromance_state>();
579   pipedrm_state *state = device->machine().driver_data<pipedrm_state>();
563580   state->m_subcpu->set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE);
564581}
565582
r20980r20981
588605 *
589606 *************************************/
590607
591MACHINE_START_MEMBER(fromance_state,pipedrm)
608MACHINE_START_MEMBER(pipedrm_state,pipedrm)
592609{
593610   m_subcpu = machine().device<cpu_device>("sub");
594611
r20980r20981
607624   /* video-related elements are saved in VIDEO_START */
608625}
609626
610MACHINE_RESET_MEMBER(fromance_state,pipedrm)
627MACHINE_RESET_MEMBER(pipedrm_state,pipedrm)
611628{
612629   int i;
613630
r20980r20981
631648      m_crtc_data[i] = 0;
632649}
633650
634static MACHINE_CONFIG_START( pipedrm, fromance_state )
651static MACHINE_CONFIG_START( pipedrm, pipedrm_state )
635652
636653   /* basic machine hardware */
637654   MCFG_CPU_ADD("maincpu", Z80,12000000/2)
638655   MCFG_CPU_PROGRAM_MAP(main_map)
639656   MCFG_CPU_IO_MAP(main_portmap)
640   MCFG_CPU_VBLANK_INT_DRIVER("screen", fromance_state, irq0_line_hold)
657   MCFG_CPU_VBLANK_INT_DRIVER("screen", pipedrm_state, irq0_line_hold)
641658
642659   MCFG_CPU_ADD("sub", Z80,14318000/4)
643660   MCFG_CPU_PROGRAM_MAP(sound_map)
644661   MCFG_CPU_IO_MAP(sound_portmap)
645662
646   MCFG_MACHINE_START_OVERRIDE(fromance_state,pipedrm)
647   MCFG_MACHINE_RESET_OVERRIDE(fromance_state,pipedrm)
663   MCFG_MACHINE_START_OVERRIDE(pipedrm_state,pipedrm)
664   MCFG_MACHINE_RESET_OVERRIDE(pipedrm_state,pipedrm)
648665
649666   /* video hardware */
650667   MCFG_SCREEN_ADD("screen", RASTER)
r20980r20981
652669   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
653670   MCFG_SCREEN_SIZE(44*8, 30*8)
654671   MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
655   MCFG_SCREEN_UPDATE_DRIVER(fromance_state, screen_update_pipedrm)
672   MCFG_SCREEN_UPDATE_DRIVER(pipedrm_state, screen_update_pipedrm)
656673
657674   MCFG_GFXDECODE(pipedrm)
658675   MCFG_PALETTE_LENGTH(2048)
r20980r20981
662679   MCFG_VSYSTEM_SPR2_SET_OFFSETS(-13, -6)
663680   MCFG_VSYSTEM_SPR2_SET_PRITYPE(3)
664681
665   MCFG_VIDEO_START_OVERRIDE(fromance_state,pipedrm)
682   MCFG_VIDEO_START_OVERRIDE(pipedrm_state,pipedrm)
666683
667684   /* sound hardware */
668685   MCFG_SPEAKER_STANDARD_MONO("mono")
r20980r20981
675692MACHINE_CONFIG_END
676693
677694
678static MACHINE_CONFIG_START( hatris, fromance_state )
695static MACHINE_CONFIG_START( hatris, pipedrm_state )
679696
680697   /* basic machine hardware */
681698   MCFG_CPU_ADD("maincpu", Z80,12000000/2)
682699   MCFG_CPU_PROGRAM_MAP(main_map)
683700   MCFG_CPU_IO_MAP(main_portmap)
684   MCFG_CPU_VBLANK_INT_DRIVER("screen", fromance_state, irq0_line_hold)
701   MCFG_CPU_VBLANK_INT_DRIVER("screen", pipedrm_state, irq0_line_hold)
685702
686703   MCFG_CPU_ADD("sub", Z80,14318000/4)
687704   MCFG_CPU_PROGRAM_MAP(sound_map)
688705   MCFG_CPU_IO_MAP(hatris_sound_portmap)
689706
690   MCFG_MACHINE_START_OVERRIDE(fromance_state,pipedrm)
691   MCFG_MACHINE_RESET_OVERRIDE(fromance_state,pipedrm)
707   MCFG_MACHINE_START_OVERRIDE(pipedrm_state,pipedrm)
708   MCFG_MACHINE_RESET_OVERRIDE(pipedrm_state,pipedrm)
692709
693710   /* video hardware */
694711   MCFG_SCREEN_ADD("screen", RASTER)
r20980r20981
696713   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
697714   MCFG_SCREEN_SIZE(44*8, 30*8)
698715   MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
699   MCFG_SCREEN_UPDATE_DRIVER(fromance_state, screen_update_fromance)
716   MCFG_SCREEN_UPDATE_DRIVER(pipedrm_state, screen_update_fromance)
700717
701718   MCFG_GFXDECODE(hatris)
702719   MCFG_PALETTE_LENGTH(2048)
703720
704   MCFG_VIDEO_START_OVERRIDE(fromance_state,hatris)
721   MCFG_VIDEO_START_OVERRIDE(pipedrm_state,hatris)
705722
706723   /* sound hardware */
707724   MCFG_SPEAKER_STANDARD_MONO("mono")
r20980r20981
876893 *
877894 *************************************/
878895
879DRIVER_INIT_MEMBER(fromance_state,pipedrm)
896DRIVER_INIT_MEMBER(pipedrm_state,pipedrm)
880897{
881898   /* sprite RAM lives at the end of palette RAM */
882899   m_spriteram.set_target(&m_generic_paletteram_8[0xc00], 0x400);
r20980r20981
884901}
885902
886903
887DRIVER_INIT_MEMBER(fromance_state,hatris)
904DRIVER_INIT_MEMBER(pipedrm_state,hatris)
888905{
889   machine().device("maincpu")->memory().space(AS_IO).install_legacy_write_handler(0x20, 0x20, FUNC(sound_command_nonmi_w));
890   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x21, 0x21, write8_delegate(FUNC(fromance_state::fromance_gfxreg_w),this));
906   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x20, 0x20, write8_delegate(FUNC(pipedrm_state::sound_command_nonmi_w),this));
907   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x21, 0x21, write8_delegate(FUNC(pipedrm_state::fromance_gfxreg_w),this));
891908}
892909
893910
r20980r20981
898915 *
899916 *************************************/
900917
901GAME( 1990, pipedrm,  0,       pipedrm, pipedrm, fromance_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (World)", GAME_SUPPORTS_SAVE )
902GAME( 1990, pipedrmu, pipedrm, pipedrm, pipedrm, fromance_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (US)", GAME_SUPPORTS_SAVE )
903GAME( 1990, pipedrmj, pipedrm, pipedrm, pipedrm, fromance_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (Japan)", GAME_SUPPORTS_SAVE )
904GAME( 1990, hatris,   0,       hatris,  hatris, fromance_state,  hatris,  ROT0, "Video System Co.", "Hatris (US)", GAME_SUPPORTS_SAVE )
905GAME( 1990, hatrisj,  hatris,  hatris,  hatris, fromance_state,  hatris,  ROT0, "Video System Co.", "Hatris (Japan)", GAME_SUPPORTS_SAVE )
918GAME( 1990, pipedrm,  0,       pipedrm, pipedrm, pipedrm_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (World)", GAME_SUPPORTS_SAVE )
919GAME( 1990, pipedrmu, pipedrm, pipedrm, pipedrm, pipedrm_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (US)", GAME_SUPPORTS_SAVE )
920GAME( 1990, pipedrmj, pipedrm, pipedrm, pipedrm, pipedrm_state, pipedrm, ROT0, "Video System Co.", "Pipe Dream (Japan)", GAME_SUPPORTS_SAVE )
921GAME( 1990, hatris,   0,       hatris,  hatris, pipedrm_state,  hatris,  ROT0, "Video System Co.", "Hatris (US)", GAME_SUPPORTS_SAVE )
922GAME( 1990, hatrisj,  hatris,  hatris,  hatris, pipedrm_state,  hatris,  ROT0, "Video System Co.", "Hatris (Japan)", GAME_SUPPORTS_SAVE )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team