Previous 199869 Revisions Next

r25357 Monday 16th September, 2013 at 20:08:35 UTC by Phil Bennett
05284: exprraid and clones: YM3526 has incorrect frequency [Phil Bennett]

exprraid.c - Cleanups from schematics [Phil Bennett]
- Corrected CPU and YM3526 frequencies
- Improved protection simulation
- Added interrupt acks
- Added service coin input
[src/mame/drivers]exprraid.c
[src/mame/includes]exprraid.h

trunk/src/mame/drivers/exprraid.c
r25356r25357
213213
214214
215215/*****************************************************************************************/
216/* Emulate Protection ( only for original express raider, code is cracked on the bootleg */
216/* Emulate DECO 291 protection (for original express raider, code is cracked on the bootleg)*/
217217/*****************************************************************************************/
218218
219READ8_MEMBER(exprraid_state::exprraid_protection_r)
219READ8_MEMBER(exprraid_state::exprraid_prot_data_r)
220220{
221   switch (offset)
221   return m_prot_value;
222}
223
224READ8_MEMBER(exprraid_state::exprraid_prot_status_r)
225{
226   /*
227      76543210
228      .......x   ?
229      ......x.   Device data available
230      .....x..   CPU data available (cleared by device)
231   */
232
233   return 0x02;
234}
235
236WRITE8_MEMBER(exprraid_state::exprraid_prot_data_w)
237{
238   switch (data)
222239   {
223   case 0:
224      return m_main_ram[0x02a9];
225   case 1:
226      return 0x02;
240      case 0x20:
241         // Written when CPU times out waiting for status
242         break;
243
244      case 0x60:
245         // ?
246         break;
247
248      case 0x80:
249         ++m_prot_value;
250         break;
251
252      case 0x90:
253         m_prot_value = 0;
254         break;
255
256      default:
257         logerror("Unknown protection write: %x at PC:%x\n", data, space.device().safe_pc());
227258   }
259}
228260
229   return 0;
261READ8_MEMBER(exprraid_state::sound_cpu_command_r)
262{
263   m_slave->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
264   return soundlatch_byte_r(space, 0);
230265}
231266
232267WRITE8_MEMBER(exprraid_state::sound_cpu_command_w)
233268{
234269   soundlatch_byte_w(space, 0, data);
235   m_slave->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
270   m_slave->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
236271}
237272
273WRITE8_MEMBER(exprraid_state::exprraid_int_clear_w)
274{
275   m_maincpu->set_input_line(DECO16_IRQ_LINE, CLEAR_LINE);
276}
277
238278READ8_MEMBER(exprraid_state::vblank_r)
239279{
240280   return ioport("IN0")->read();
241281}
242282
283
243284static ADDRESS_MAP_START( master_map, AS_PROGRAM, 8, exprraid_state )
244285   AM_RANGE(0x0000, 0x05ff) AM_RAM AM_SHARE("main_ram")
245286   AM_RANGE(0x0600, 0x07ff) AM_RAM AM_SHARE("spriteram")
246287   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(exprraid_videoram_w) AM_SHARE("videoram")
247288   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(exprraid_colorram_w) AM_SHARE("colorram")
248   AM_RANGE(0x1317, 0x1317) AM_READNOP // ???
249   AM_RANGE(0x1700, 0x1700) AM_READNOP // ???
250289   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("DSW0")   /* DSW 0 */
251290   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")    /* Controls */
252291   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")    /* Coins */
253292   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW1")   /* DSW 1 */
254   AM_RANGE(0x2000, 0x2000) AM_WRITENOP // ???
293   AM_RANGE(0x2000, 0x2000) AM_WRITE(exprraid_int_clear_w)
255294   AM_RANGE(0x2001, 0x2001) AM_WRITE(sound_cpu_command_w)
256295   AM_RANGE(0x2002, 0x2002) AM_WRITE(exprraid_flipscreen_w)
257   AM_RANGE(0x2003, 0x2003) AM_WRITENOP // ???
258   AM_RANGE(0x2800, 0x2801) AM_READ(exprraid_protection_r)
296   AM_RANGE(0x2003, 0x2003) AM_WRITENOP // DMA SWAP - Allow writes to video and sprite RAM
297   AM_RANGE(0x2800, 0x2800) AM_READ(exprraid_prot_data_r)
298   AM_RANGE(0x2801, 0x2801) AM_READ(exprraid_prot_status_r)
259299   AM_RANGE(0x2800, 0x2803) AM_WRITE(exprraid_bgselect_w)
260300   AM_RANGE(0x2804, 0x2804) AM_WRITE(exprraid_scrolly_w)
261301   AM_RANGE(0x2805, 0x2806) AM_WRITE(exprraid_scrollx_w)
262   AM_RANGE(0x2807, 0x2807) AM_WRITENOP    // Scroll related ?
302   AM_RANGE(0x2807, 0x2807) AM_WRITE(exprraid_prot_data_w)
263303   AM_RANGE(0x4000, 0xffff) AM_ROM
264304ADDRESS_MAP_END
265305
r25356r25357
271311   AM_RANGE(0x0000, 0x1fff) AM_RAM
272312   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
273313   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ym2", ym3526_device, read, write)
274   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
314   AM_RANGE(0x6000, 0x6000) AM_READ(sound_cpu_command_r)
275315   AM_RANGE(0x8000, 0xffff) AM_ROM
276316ADDRESS_MAP_END
277317
318
278319INPUT_CHANGED_MEMBER(exprraid_state::coin_inserted_deco16)
279320{
280   m_maincpu->set_input_line(DECO16_IRQ_LINE, oldval ? ASSERT_LINE : CLEAR_LINE);
321   if (oldval && !newval)
322      m_maincpu->set_input_line(DECO16_IRQ_LINE, ASSERT_LINE);
281323}
282324
283325INPUT_CHANGED_MEMBER(exprraid_state::coin_inserted_nmi)
r25356r25357
336378   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_COCKTAIL
337379   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
338380   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
339   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_deco16, 0)
340   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_deco16, 0)
381   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_deco16, 0)
382   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_deco16, 0)
341383
342384   PORT_START("DSW1")  /* 0x1803 */
343385   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW2:1,2")
r25356r25357
356398   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION("SW2:6")     /* see notes */
357399   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
358400   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
359   PORT_DIPNAME( 0x40, 0x40, "Force Coinage = 1C/1C" )     PORT_DIPLOCATION("SW2:7")     /* see notes */
360   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
361   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
401   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_deco16, 0)
362402   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
363403INPUT_PORTS_END
364404
r25356r25357
369409   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, exprraid_state, coin_inserted_nmi, 0)
370410INPUT_PORTS_END
371411
412
372413static const gfx_layout charlayout =
373414{
374415   8,8,    /* 8*8 characters */
r25356r25357
432473GFXDECODE_END
433474
434475
435
436476/* handler called by the 3812 emulator when the internal timers cause an IRQ */
437477WRITE_LINE_MEMBER(exprraid_state::irqhandler)
438478{
439479   m_slave->set_input_line_and_vector(0, state, 0xff);
440480}
441481
442#if 0
443INTERRUPT_GEN_MEMBER(exprraid_state::exprraid_interrupt)
444{
445   if ((~ioport("IN2")->read()) & 0xc0)
446   {
447      if (m_coin == 0)
448      {
449         m_coin = 1;
450         //device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
451         device.execute().set_input_line(DECO16_IRQ_LINE, ASSERT_LINE);
452      }
453   }
454   else
455   {
456      device.execute().set_input_line(DECO16_IRQ_LINE, CLEAR_LINE);
457      m_coin = 0;
458   }
459}
460#endif
461
462
463482void exprraid_state::machine_start()
464483{
484   save_item(NAME(m_prot_value));
465485   save_item(NAME(m_bg_index));
466486}
467487
r25356r25357
473493   m_bg_index[3] = 0;
474494}
475495
496
476497static MACHINE_CONFIG_START( exprraid, exprraid_state )
477498
478499   /* basic machine hardware */
479   MCFG_CPU_ADD("maincpu", DECO16, 4000000)        /* 4 MHz ??? */
500   MCFG_CPU_ADD("maincpu", DECO16, XTAL_12MHz / 8)
480501   MCFG_CPU_PROGRAM_MAP(master_map)
481502   MCFG_CPU_IO_MAP(master_io_map)
482503
483   MCFG_CPU_ADD("slave", M6809, 2000000)        /* 2 MHz ??? */
504   MCFG_CPU_ADD("slave", M6809, XTAL_12MHz / 8)
484505   MCFG_CPU_PROGRAM_MAP(slave_map)
485                        /* IRQs are caused by the YM3526 */
506   /* IRQs are caused by the YM3526 */
486507
508   MCFG_QUANTUM_TIME(attotime::from_hz(12000))
509
487510   /* video hardware */
488511   MCFG_SCREEN_ADD("screen", RASTER)
489512   MCFG_SCREEN_REFRESH_RATE(60)
r25356r25357
500523   /* sound hardware */
501524   MCFG_SPEAKER_STANDARD_MONO("mono")
502525
503   MCFG_SOUND_ADD("ym1", YM2203, 1500000)
526   MCFG_SOUND_ADD("ym1", YM2203, XTAL_12MHz / 8)
504527   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
505528
506   MCFG_SOUND_ADD("ym2", YM3526, 3600000)
529   MCFG_SOUND_ADD("ym2", YM3526, XTAL_12MHz / 4)
507530   MCFG_YM3526_IRQ_HANDLER(WRITELINE(exprraid_state, irqhandler))
508531   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
509532MACHINE_CONFIG_END
510533
511534static MACHINE_CONFIG_DERIVED( exprboot, exprraid )
512535
513   MCFG_CPU_REPLACE("maincpu", M6502, 4000000)        /* 4 MHz ??? */
536   MCFG_CPU_REPLACE("maincpu", M6502, 1500000)        /* 1.5 MHz ??? */
514537   MCFG_CPU_PROGRAM_MAP(master_map)
515538MACHINE_CONFIG_END
516539
trunk/src/mame/includes/exprraid.h
r25356r25357
1010public:
1111   exprraid_state(const machine_config &mconfig, device_type type, const char *tag)
1212      : driver_device(mconfig, type, tag),
13      m_maincpu(*this, "maincpu"),
14      m_slave(*this, "slave"),
1315      m_main_ram(*this, "main_ram"),
1416      m_spriteram(*this, "spriteram"),
1517      m_videoram(*this, "videoram"),
16      m_colorram(*this, "colorram"),
17      m_maincpu(*this, "maincpu"),
18      m_slave(*this, "slave"){ }
18      m_colorram(*this, "colorram") { }
1919
20   /* devices */
21   required_device<cpu_device> m_maincpu;
22   required_device<cpu_device> m_slave;
23
2024   /* memory pointers */
2125   required_shared_ptr<UINT8> m_main_ram;
2226   required_shared_ptr<UINT8> m_spriteram;
2327   required_shared_ptr<UINT8> m_videoram;
2428   required_shared_ptr<UINT8> m_colorram;
2529
30   /* protection */
31   UINT8         m_prot_value;
32
2633   /* video-related */
27   tilemap_t        *m_bg_tilemap;
28   tilemap_t        *m_fg_tilemap;
29   int            m_bg_index[4];
34   tilemap_t      *m_bg_tilemap;
35   tilemap_t      *m_fg_tilemap;
36   int            m_bg_index[4];
3037
31   /* misc */
32   //int          m_coin;    // used in the commented out INTERRUPT_GEN - can this be removed?
38   virtual void machine_start();
39   virtual void machine_reset();
40   virtual void video_start();
3341
34   /* devices */
35   required_device<cpu_device> m_maincpu;
36   required_device<cpu_device> m_slave;
37   DECLARE_READ8_MEMBER(exprraid_protection_r);
42   DECLARE_WRITE8_MEMBER(exprraid_int_clear_w);
43   DECLARE_READ8_MEMBER(exprraid_prot_status_r);
44   DECLARE_READ8_MEMBER(exprraid_prot_data_r);
45   DECLARE_WRITE8_MEMBER(exprraid_prot_data_w);
3846   DECLARE_WRITE8_MEMBER(sound_cpu_command_w);
3947   DECLARE_READ8_MEMBER(vblank_r);
4048   DECLARE_WRITE8_MEMBER(exprraid_videoram_w);
r25356r25357
4553   DECLARE_WRITE8_MEMBER(exprraid_scrolly_w);
4654   DECLARE_INPUT_CHANGED_MEMBER(coin_inserted_deco16);
4755   DECLARE_INPUT_CHANGED_MEMBER(coin_inserted_nmi);
56
57   DECLARE_READ8_MEMBER(sound_cpu_command_r);
58
4859   DECLARE_WRITE_LINE_MEMBER(irqhandler);
4960   DECLARE_DRIVER_INIT(exprraid);
5061   DECLARE_DRIVER_INIT(wexpressb);
r25356r25357
5263   DECLARE_DRIVER_INIT(wexpressb3);
5364   TILE_GET_INFO_MEMBER(get_bg_tile_info);
5465   TILE_GET_INFO_MEMBER(get_fg_tile_info);
55   virtual void machine_start();
56   virtual void machine_reset();
57   virtual void video_start();
66
5867   UINT32 screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5968   INTERRUPT_GEN_MEMBER(exprraid_interrupt);
6069   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );

Previous 199869 Revisions Next


© 1997-2024 The MAME Team