trunk/src/mame/drivers/cps1.c
| r19565 | r19566 | |
| 336 | 336 | { |
| 337 | 337 | /* Strider also has a IRQ4 handler. It is input port related, but the game */ |
| 338 | 338 | /* works without it. It is the *only* CPS1 game to have that. */ |
| 339 | /* ...until we found out that ganbare relies on it, see below */ |
| 339 | 340 | device.execute().set_input_line(2, HOLD_LINE); |
| 340 | 341 | } |
| 341 | 342 | |
| 342 | | TIMER_CALLBACK_MEMBER(cps_state::ganbare_interrupt4) |
| 343 | TIMER_DEVICE_CALLBACK_MEMBER(cps_state::ganbare_interrupt) |
| 343 | 344 | { |
| 344 | 345 | /* not sure on the timing or source of this - the game needs it once per frame, */ |
| 345 | 346 | /* 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); |
| 347 | 349 | } |
| 348 | 350 | |
| 349 | | INTERRUPT_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 | | } |
| 354 | 351 | |
| 355 | 352 | /******************************************************************** |
| 356 | 353 | * |
| r19565 | r19566 | |
| 359 | 356 | * |
| 360 | 357 | ********************************************************************/ |
| 361 | 358 | |
| 362 | | |
| 363 | | INTERRUPT_GEN_MEMBER(cps_state::cps1_qsound_interrupt) |
| 364 | | { |
| 365 | | device.execute().set_input_line(2, HOLD_LINE); |
| 366 | | } |
| 367 | | |
| 368 | | |
| 369 | 359 | READ16_MEMBER(cps_state::qsound_rom_r) |
| 370 | 360 | { |
| 371 | 361 | UINT8 *rom = memregion("user1")->base(); |
| r19565 | r19566 | |
| 568 | 558 | AM_RANGE(0x800180, 0x800187) AM_WRITE(cps1_soundlatch_w) /* Sound command */ |
| 569 | 559 | AM_RANGE(0x800188, 0x80018f) AM_WRITE(cps1_soundlatch2_w) /* Sound timer fade */ |
| 570 | 560 | 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") |
| 572 | 562 | ADDRESS_MAP_END |
| 573 | 563 | |
| 574 | 564 | /* |
| r19565 | r19566 | |
| 621 | 611 | AM_RANGE(0xf1c004, 0xf1c005) AM_WRITE(cpsq_coinctrl2_w) /* Coin control2 (later games) */ |
| 622 | 612 | AM_RANGE(0xf1c006, 0xf1c007) AM_READ_PORT("EEPROMIN") AM_WRITE_PORT("EEPROMOUT") |
| 623 | 613 | 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") |
| 625 | 615 | ADDRESS_MAP_END |
| 626 | 616 | |
| 627 | 617 | ADDRESS_MAP_START( qsound_sub_map, AS_PROGRAM, 8, cps_state ) // used by cps2.c too |
| r19565 | r19566 | |
| 3164 | 3154 | /* basic machine hardware */ |
| 3165 | 3155 | MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz ) /* verified on pcb */ |
| 3166 | 3156 | 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) |
| 3168 | 3158 | |
| 3169 | 3159 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified on pcb */ |
| 3170 | 3160 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r19565 | r19566 | |
| 3202 | 3192 | static MACHINE_CONFIG_DERIVED( cps1_12MHz, cps1_10MHz ) |
| 3203 | 3193 | |
| 3204 | 3194 | /* basic machine hardware */ |
| 3205 | | |
| 3206 | 3195 | MCFG_CPU_MODIFY("maincpu") |
| 3207 | 3196 | MCFG_CPU_CLOCK( XTAL_12MHz ) /* verified on pcb */ |
| 3208 | 3197 | MACHINE_CONFIG_END |
| r19565 | r19566 | |
| 3210 | 3199 | static MACHINE_CONFIG_DERIVED( pang3, cps1_12MHz ) |
| 3211 | 3200 | |
| 3212 | 3201 | /* basic machine hardware */ |
| 3213 | | |
| 3214 | 3202 | MCFG_EEPROM_ADD("eeprom", pang3_eeprom_interface) |
| 3215 | 3203 | MACHINE_CONFIG_END |
| 3216 | 3204 | |
| 3217 | | static MACHINE_CONFIG_DERIVED( qsound, cps1_12MHz ) |
| 3205 | static MACHINE_CONFIG_DERIVED( ganbare, cps1_10MHz ) |
| 3218 | 3206 | |
| 3219 | 3207 | /* 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 |
| 3220 | 3210 | |
| 3211 | MCFG_M48T35_ADD("m48t35") |
| 3212 | MACHINE_CONFIG_END |
| 3213 | |
| 3214 | static MACHINE_CONFIG_DERIVED( qsound, cps1_12MHz ) |
| 3215 | |
| 3216 | /* basic machine hardware */ |
| 3221 | 3217 | MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz ) /* verified on pcb */ |
| 3222 | 3218 | 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) |
| 3224 | 3220 | |
| 3225 | 3221 | MCFG_CPU_REPLACE("audiocpu", Z80, XTAL_8MHz) /* verified on pcb */ |
| 3226 | 3222 | 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) /* ?? */ |
| 3228 | 3224 | |
| 3229 | 3225 | MCFG_MACHINE_START_OVERRIDE(cps_state,qsound) |
| 3230 | 3226 | |
| r19565 | r19566 | |
| 3242 | 3238 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 3243 | 3239 | MACHINE_CONFIG_END |
| 3244 | 3240 | |
| 3245 | | static 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") |
| 3252 | | MACHINE_CONFIG_END |
| 3253 | | |
| 3254 | 3241 | /* bootlegs with PIC */ |
| 3255 | 3242 | |
| 3256 | 3243 | static MACHINE_CONFIG_START( cpspicb, cps_state ) |
| r19565 | r19566 | |
| 3258 | 3245 | /* basic machine hardware */ |
| 3259 | 3246 | MCFG_CPU_ADD("maincpu", M68000, 12000000) |
| 3260 | 3247 | 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) |
| 3262 | 3249 | |
| 3263 | 3250 | MCFG_CPU_ADD("audiocpu", PIC16C57, 12000000) |
| 3264 | 3251 | MCFG_DEVICE_DISABLE() /* no valid dumps .. */ |
| r19565 | r19566 | |
| 3289 | 3276 | static MACHINE_CONFIG_DERIVED( wofhfh, cps1_12MHz ) |
| 3290 | 3277 | |
| 3291 | 3278 | /* basic machine hardware */ |
| 3292 | | |
| 3293 | 3279 | MCFG_EEPROM_ADD("eeprom", qsound_eeprom_interface) |
| 3294 | 3280 | MACHINE_CONFIG_END |
| 3295 | 3281 | |
| r19565 | r19566 | |
| 3380 | 3366 | /* basic machine hardware */ |
| 3381 | 3367 | MCFG_CPU_ADD("maincpu", M68000, 24000000 / 2) |
| 3382 | 3368 | 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) |
| 3384 | 3370 | |
| 3385 | 3371 | MCFG_CPU_ADD("audiocpu", Z80, 29821000 / 8) |
| 3386 | 3372 | MCFG_CPU_PROGRAM_MAP(sf2mdt_z80map) |
| r19565 | r19566 | |
| 11187 | 11173 | |
| 11188 | 11174 | READ16_MEMBER(cps_state::ganbare_ram_r) |
| 11189 | 11175 | { |
| 11190 | | device_t *device = machine().device("m48t35"); |
| 11191 | 11176 | UINT16 result = 0xffff; |
| 11192 | 11177 | |
| 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); |
| 11197 | 11182 | |
| 11198 | 11183 | return result; |
| 11199 | 11184 | } |
| 11200 | 11185 | |
| 11201 | 11186 | WRITE16_MEMBER(cps_state::ganbare_ram_w) |
| 11202 | 11187 | { |
| 11203 | | device_t *device = machine().device("m48t35"); |
| 11188 | COMBINE_DATA(&m_mainram[offset]); |
| 11204 | 11189 | |
| 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); |
| 11209 | 11192 | } |
| 11210 | 11193 | |
| 11211 | 11194 | DRIVER_INIT_MEMBER(cps_state, ganbare) |
| r19565 | r19566 | |
| 11213 | 11196 | DRIVER_INIT_CALL(cps1); |
| 11214 | 11197 | |
| 11215 | 11198 | /* 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); |
| 11218 | 11199 | 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)); |
| 11219 | 11200 | } |
| 11220 | 11201 | |
trunk/src/mame/includes/cps1.h
| r19565 | r19566 | |
| 64 | 64 | public: |
| 65 | 65 | cps_state(const machine_config &mconfig, device_type type, const char *tag) |
| 66 | 66 | : driver_device(mconfig, type, tag), |
| 67 | m_mainram(*this, "mainram"), |
| 67 | 68 | m_gfxram(*this, "gfxram"), |
| 68 | 69 | m_cps_a_regs(*this, "cps_a_regs"), |
| 69 | 70 | m_cps_b_regs(*this, "cps_b_regs"), |
| r19565 | r19566 | |
| 71 | 72 | m_qsound_sharedram2(*this, "qsound_ram2"), |
| 72 | 73 | m_objram1(*this, "objram1"), |
| 73 | 74 | m_objram2(*this, "objram2"), |
| 74 | | m_output(*this, "output") { } |
| 75 | m_output(*this, "output") |
| 76 | { } |
| 75 | 77 | |
| 76 | 78 | /* memory pointers */ |
| 77 | 79 | // cps1 |
| 80 | optional_shared_ptr<UINT16> m_mainram; |
| 78 | 81 | required_shared_ptr<UINT16> m_gfxram; |
| 79 | 82 | required_shared_ptr<UINT16> m_cps_a_regs; |
| 80 | 83 | required_shared_ptr<UINT16> m_cps_b_regs; |
| r19565 | r19566 | |
| 93 | 96 | UINT16 * m_cps2_buffered_obj; |
| 94 | 97 | // game-specific |
| 95 | 98 | UINT16 * m_gigaman2_dummyqsound_ram; |
| 96 | | UINT16 * m_ganbare_shared_ram; |
| 97 | 99 | |
| 98 | 100 | /* video-related */ |
| 99 | 101 | tilemap_t *m_bg_tilemap[3]; |
| r19565 | r19566 | |
| 228 | 230 | UINT32 screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 229 | 231 | void screen_eof_cps1(screen_device &screen, bool state); |
| 230 | 232 | 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); |
| 234 | 234 | TIMER_DEVICE_CALLBACK_MEMBER(cps2_interrupt); |
| 235 | 235 | |
| 236 | 236 | /* fcrash handlers */ |