Previous 199869 Revisions Next

r21486 Thursday 28th February, 2013 at 19:50:48 UTC by Angelo Salese
Added oki bank
[src/mame/drivers]gunpey.c

trunk/src/mame/drivers/gunpey.c
r21485r21486
55ASM code study:
660x84718 main code
770x8472c call 0x81f34 reading of dip-switches
8   0x5e62:
890x84731 call 0x81f5c move dip-switches settings to work RAM
9100x84736 call 0x80ae4 writes to i/os 0x7fc0-0x7fff:
1011   0x7fc0: 0x00
r21485r21486
9697   [+0x10] 0x00
9798   [+0x12] 0x0c
9899   does the same with 0x5c89-0x5c9b
990x84745: call 0x82026 (TODO)
1000x84745: call 0x82026
101   checks if 0x5e62 is 0 (bit 6 of 0x5c80, i/o 0x7f41)
102   ...
1030x8474a: call 0xa7f53 sound init
100104
101
102105=============================================================================================
103106
104107Gunpey
r21485r21486
186189public:
187190   gunpey_state(const machine_config &mconfig, device_type type, const char *tag)
188191      : driver_device(mconfig, type, tag),
189      m_maincpu(*this, "maincpu")
192      m_maincpu(*this, "maincpu"),
193      m_oki(*this, "oki")
190194      { }
191195
192196   required_device<cpu_device> m_maincpu;
197   required_device<okim6295_device> m_oki;
193198
194199   UINT16 *m_blit_buffer;
195200   UINT16 m_blit_ram[0x10];
r21485r21486
198203   DECLARE_READ8_MEMBER(gunpey_status_r);
199204   DECLARE_READ8_MEMBER(gunpey_inputs_r);
200205   DECLARE_WRITE8_MEMBER(gunpey_blitter_w);
206   DECLARE_WRITE8_MEMBER(gunpey_output_w);
201207   DECLARE_DRIVER_INIT(gunpey);
202208   virtual void video_start();
203209   virtual void palette_init();
r21485r21486
296302   UINT8 *blit_rom = memregion("blit_data")->base();
297303   int x,y;
298304
299   //printf("gunpey_blitter_w offset %01x data %02x\n", offset,data);
305   //printf("gunpey_blitter_w offset %01x data %02x\n", offset,data);
300306
301307   blit_ram[offset] = data;
302308
r21485r21486
345351
346352}
347353
354WRITE8_MEMBER(gunpey_state::gunpey_output_w)
355{
356   if((data & 0xf0) != 0x90)
357      printf("0x7f48 write with %02x\n",data);
358
359   downcast<okim6295_device *>(m_oki)->set_bank_base((data & 0x0f) * 0x40000);
360}
361
348362/***************************************************************************************/
349363
350364static ADDRESS_MAP_START( mem_map, AS_PROGRAM, 16, gunpey_state )
r21485r21486
357371static ADDRESS_MAP_START( io_map, AS_IO, 16, gunpey_state )
358372   AM_RANGE(0x7f40, 0x7f45) AM_READ8(gunpey_inputs_r,0xffff)
359373
360   //AM_RANGE(0x7f48, 0x7f49) AM_RAM
374   AM_RANGE(0x7f48, 0x7f49) AM_WRITE8(gunpey_output_w,0x00ff)
361375   AM_RANGE(0x7f80, 0x7f81) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0xffff)
362376
363377   AM_RANGE(0x7f88, 0x7f89) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
r21485r21486
458472   PORT_START("SYSTEM")    // IN4 - 7f44
459473   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
460474   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
461   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )   // TEST!!
475   PORT_SERVICE( 0x04, IP_ACTIVE_HIGH )   // TEST!!
462476   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
463477   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 )
464478   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 )
r21485r21486
541555   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
542556
543557   MCFG_OKIM6295_ADD("oki", XTAL_16_9344MHz / 8, OKIM6295_PIN7_LOW)
544   MCFG_SOUND_ROUTE(0, "lspeaker", 0.25)
545   MCFG_SOUND_ROUTE(1, "rspeaker", 0.25)
558   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25)
559   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25)
546560
547561   MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz)
548562   MCFG_SOUND_CONFIG(ymz280b_intf)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team