Previous 199869 Revisions Next

r19566 Saturday 15th December, 2012 at 13:11:49 UTC by hap
small cleanup
[src/mame/drivers]cps1.c
[src/mame/includes]cps1.h

trunk/src/mame/drivers/cps1.c
r19565r19566
336336{
337337   /* Strider also has a IRQ4 handler. It is input port related, but the game */
338338   /* works without it. It is the *only* CPS1 game to have that. */
339   /* ...until we found out that ganbare relies on it, see below */
339340   device.execute().set_input_line(2, HOLD_LINE);
340341}
341342
342TIMER_CALLBACK_MEMBER(cps_state::ganbare_interrupt4)
343TIMER_DEVICE_CALLBACK_MEMBER(cps_state::ganbare_interrupt)
343344{
344345   /* not sure on the timing or source of this - the game needs it once per frame, */
345346   /* otherwise you get a "HARD ERROR" after boot */
346   m_maincpu->set_input_line(4, HOLD_LINE);
347   if (param == 0)
348      m_maincpu->set_input_line(4, HOLD_LINE);
347349}
348350
349INTERRUPT_GEN_MEMBER(cps_state::ganbare_interrupt)
350{
351   machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(150000 - 500), timer_expired_delegate(FUNC(cps_state::ganbare_interrupt4),this));
352   device.execute().set_input_line(2, HOLD_LINE);
353}
354351
355352/********************************************************************
356353*
r19565r19566
359356*
360357********************************************************************/
361358
362
363INTERRUPT_GEN_MEMBER(cps_state::cps1_qsound_interrupt)
364{
365   device.execute().set_input_line(2, HOLD_LINE);
366}
367
368
369359READ16_MEMBER(cps_state::qsound_rom_r)
370360{
371361   UINT8 *rom = memregion("user1")->base();
r19565r19566
568558   AM_RANGE(0x800180, 0x800187) AM_WRITE(cps1_soundlatch_w)   /* Sound command */
569559   AM_RANGE(0x800188, 0x80018f) AM_WRITE(cps1_soundlatch2_w)   /* Sound timer fade */
570560   AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE(cps1_gfxram_w) AM_SHARE("gfxram")   /* SF2CE executes code from here */
571   AM_RANGE(0xff0000, 0xffffff) AM_RAM
561   AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("mainram")
572562ADDRESS_MAP_END
573563
574564/*
r19565r19566
621611   AM_RANGE(0xf1c004, 0xf1c005) AM_WRITE(cpsq_coinctrl2_w)      /* Coin control2 (later games) */
622612   AM_RANGE(0xf1c006, 0xf1c007) AM_READ_PORT("EEPROMIN") AM_WRITE_PORT("EEPROMOUT")
623613   AM_RANGE(0xf1e000, 0xf1ffff) AM_READWRITE(qsound_sharedram2_r, qsound_sharedram2_w)  /* Q RAM */
624   AM_RANGE(0xff0000, 0xffffff) AM_RAM
614   AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("mainram")
625615ADDRESS_MAP_END
626616
627617ADDRESS_MAP_START( qsound_sub_map, AS_PROGRAM, 8, cps_state )   // used by cps2.c too
r19565r19566
31643154   /* basic machine hardware */
31653155   MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz )   /* verified on pcb */
31663156   MCFG_CPU_PROGRAM_MAP(main_map)
3167   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
3157   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
31683158
31693159   MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz)  /* verified on pcb */
31703160   MCFG_CPU_PROGRAM_MAP(sub_map)
r19565r19566
32023192static MACHINE_CONFIG_DERIVED( cps1_12MHz, cps1_10MHz )
32033193
32043194   /* basic machine hardware */
3205
32063195   MCFG_CPU_MODIFY("maincpu")
32073196   MCFG_CPU_CLOCK( XTAL_12MHz )   /* verified on pcb */
32083197MACHINE_CONFIG_END
r19565r19566
32103199static MACHINE_CONFIG_DERIVED( pang3, cps1_12MHz )
32113200
32123201   /* basic machine hardware */
3213
32143202   MCFG_EEPROM_ADD("eeprom", pang3_eeprom_interface)
32153203MACHINE_CONFIG_END
32163204
3217static MACHINE_CONFIG_DERIVED( qsound, cps1_12MHz )
3205static MACHINE_CONFIG_DERIVED( ganbare, cps1_10MHz )
32183206
32193207   /* basic machine hardware */
3208   MCFG_CPU_MODIFY("maincpu")
3209   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cps_state, ganbare_interrupt, "screen", 0, 1) // need to investigate more
32203210
3211   MCFG_M48T35_ADD("m48t35")
3212MACHINE_CONFIG_END
3213
3214static MACHINE_CONFIG_DERIVED( qsound, cps1_12MHz )
3215
3216   /* basic machine hardware */
32213217   MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz )   /* verified on pcb */
32223218   MCFG_CPU_PROGRAM_MAP(qsound_main_map)
3223   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_qsound_interrupt)  /* ??? interrupts per frame */
3219   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
32243220
32253221   MCFG_CPU_REPLACE("audiocpu", Z80, XTAL_8MHz)  /* verified on pcb */
32263222   MCFG_CPU_PROGRAM_MAP(qsound_sub_map)
3227   MCFG_CPU_PERIODIC_INT_DRIVER(cps_state, irq0_line_hold, 250)   /* ?? */
3223   MCFG_CPU_PERIODIC_INT_DRIVER(cps_state, irq0_line_hold, 250)   /* ?? */
32283224
32293225   MCFG_MACHINE_START_OVERRIDE(cps_state,qsound)
32303226
r19565r19566
32423238   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
32433239MACHINE_CONFIG_END
32443240
3245static MACHINE_CONFIG_DERIVED( ganbare, cps1_10MHz )
3246
3247   /* basic machine hardware */
3248   MCFG_CPU_MODIFY("maincpu")
3249   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state,  ganbare_interrupt)
3250
3251   MCFG_M48T35_ADD("m48t35")
3252MACHINE_CONFIG_END
3253
32543241/* bootlegs with PIC */
32553242
32563243static MACHINE_CONFIG_START( cpspicb, cps_state )
r19565r19566
32583245   /* basic machine hardware */
32593246   MCFG_CPU_ADD("maincpu", M68000, 12000000)
32603247   MCFG_CPU_PROGRAM_MAP(main_map)
3261   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_qsound_interrupt)
3248   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
32623249
32633250   MCFG_CPU_ADD("audiocpu", PIC16C57, 12000000)
32643251   MCFG_DEVICE_DISABLE() /* no valid dumps .. */
r19565r19566
32893276static MACHINE_CONFIG_DERIVED( wofhfh, cps1_12MHz )
32903277
32913278   /* basic machine hardware */
3292
32933279   MCFG_EEPROM_ADD("eeprom", qsound_eeprom_interface)
32943280MACHINE_CONFIG_END
32953281
r19565r19566
33803366   /* basic machine hardware */
33813367   MCFG_CPU_ADD("maincpu", M68000, 24000000 / 2)
33823368   MCFG_CPU_PROGRAM_MAP(main_map)
3383   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
3369   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt)
33843370
33853371   MCFG_CPU_ADD("audiocpu", Z80, 29821000 / 8)
33863372   MCFG_CPU_PROGRAM_MAP(sf2mdt_z80map)
r19565r19566
1118711173
1118811174READ16_MEMBER(cps_state::ganbare_ram_r)
1118911175{
11190   device_t *device = machine().device("m48t35");
1119111176   UINT16 result = 0xffff;
1119211177   
11193   if ((mem_mask & 0x00ff) != 0)
11194      result = (result & ~0x00ff) | timekeeper_r(device, space, offset);
11195   if ((mem_mask & 0xff00) != 0)
11196      result = (result & ~0xff00) | (m_ganbare_shared_ram[offset] << 8);
11178   if (ACCESSING_BITS_0_7)
11179      result = (result & ~0x00ff) | timekeeper_r(machine().device("m48t35"), space, offset);
11180   if (ACCESSING_BITS_8_15)
11181      result = (result & ~0xff00) | (m_mainram[offset] & 0xff00);
1119711182   
1119811183   return result;
1119911184}
1120011185
1120111186WRITE16_MEMBER(cps_state::ganbare_ram_w)
1120211187{
11203   device_t *device = machine().device("m48t35");
11188   COMBINE_DATA(&m_mainram[offset]);
1120411189
11205   if ((mem_mask & 0x00ff) != 0)
11206      timekeeper_w(device, space, offset, data & 0xff);
11207   if ((mem_mask & 0xff00) != 0)
11208      m_ganbare_shared_ram[offset] = data >> 8;
11190   if (ACCESSING_BITS_0_7)
11191      timekeeper_w(machine().device("m48t35"), space, offset, data & 0xff);
1120911192}
1121011193
1121111194DRIVER_INIT_MEMBER(cps_state, ganbare)
r19565r19566
1121311196   DRIVER_INIT_CALL(cps1);
1121411197   
1121511198   /* ram is shared between the CPS work ram and the timekeeper ram */
11216   m_ganbare_shared_ram = auto_alloc_array(machine(), UINT16, 0x10000 / 2);
11217   save_pointer(NAME(m_ganbare_shared_ram), 0x10000 / 2);
1121811199   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xff0000, 0xffffff, read16_delegate(FUNC(cps_state::ganbare_ram_r),this), write16_delegate(FUNC(cps_state::ganbare_ram_w),this));
1121911200}
1122011201
trunk/src/mame/includes/cps1.h
r19565r19566
6464public:
6565   cps_state(const machine_config &mconfig, device_type type, const char *tag)
6666      : driver_device(mconfig, type, tag),
67      m_mainram(*this, "mainram"),
6768      m_gfxram(*this, "gfxram"),
6869      m_cps_a_regs(*this, "cps_a_regs"),
6970      m_cps_b_regs(*this, "cps_b_regs"),
r19565r19566
7172      m_qsound_sharedram2(*this, "qsound_ram2"),
7273      m_objram1(*this, "objram1"),
7374      m_objram2(*this, "objram2"),
74      m_output(*this, "output") { }
75      m_output(*this, "output")
76   { }
7577
7678   /* memory pointers */
7779   // cps1
80   optional_shared_ptr<UINT16> m_mainram;
7881   required_shared_ptr<UINT16> m_gfxram;
7982   required_shared_ptr<UINT16> m_cps_a_regs;
8083   required_shared_ptr<UINT16> m_cps_b_regs;
r19565r19566
9396   UINT16 *     m_cps2_buffered_obj;
9497   // game-specific
9598   UINT16 *     m_gigaman2_dummyqsound_ram;
96   UINT16 *     m_ganbare_shared_ram;
9799
98100   /* video-related */
99101   tilemap_t      *m_bg_tilemap[3];
r19565r19566
228230   UINT32 screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
229231   void screen_eof_cps1(screen_device &screen, bool state);
230232   INTERRUPT_GEN_MEMBER(cps1_interrupt);
231   INTERRUPT_GEN_MEMBER(cps1_qsound_interrupt);
232   INTERRUPT_GEN_MEMBER(ganbare_interrupt);
233   TIMER_CALLBACK_MEMBER(ganbare_interrupt4);
233   TIMER_DEVICE_CALLBACK_MEMBER(ganbare_interrupt);
234234   TIMER_DEVICE_CALLBACK_MEMBER(cps2_interrupt);
235235   
236236   /* fcrash handlers */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team