trunk/src/mame/drivers/dec0.c
| r24008 | r24009 | |
| 281 | 281 | |
| 282 | 282 | static ADDRESS_MAP_START( dec0_map, AS_PROGRAM, 16, dec0_state ) |
| 283 | 283 | AM_RANGE(0x000000, 0x05ffff) AM_ROM |
| 284 | | AM_RANGE(0x240000, 0x240007) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_0_w) /* text layer */ |
| 285 | | AM_RANGE(0x240010, 0x240017) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_1_w) |
| 286 | | AM_RANGE(0x242000, 0x24207f) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 287 | | AM_RANGE(0x242400, 0x2427ff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 284 | AM_RANGE(0x240000, 0x240007) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_0_w) /* text layer */ |
| 285 | AM_RANGE(0x240010, 0x240017) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_1_w) |
| 286 | AM_RANGE(0x242000, 0x24207f) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 287 | AM_RANGE(0x242400, 0x2427ff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 288 | 288 | AM_RANGE(0x242800, 0x243fff) AM_RAM /* Robocop only */ |
| 289 | | AM_RANGE(0x244000, 0x245fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 289 | AM_RANGE(0x244000, 0x245fff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w) |
| 290 | 290 | |
| 291 | | AM_RANGE(0x246000, 0x246007) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_0_w) /* first tile layer */ |
| 292 | | AM_RANGE(0x246010, 0x246017) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_1_w) |
| 293 | | AM_RANGE(0x248000, 0x24807f) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 294 | | AM_RANGE(0x248400, 0x2487ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 295 | | AM_RANGE(0x24a000, 0x24a7ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 291 | AM_RANGE(0x246000, 0x246007) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_0_w) /* first tile layer */ |
| 292 | AM_RANGE(0x246010, 0x246017) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_1_w) |
| 293 | AM_RANGE(0x248000, 0x24807f) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 294 | AM_RANGE(0x248400, 0x2487ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 295 | AM_RANGE(0x24a000, 0x24a7ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_data_r, pf_data_w) |
| 296 | 296 | |
| 297 | | AM_RANGE(0x24c000, 0x24c007) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_0_w) /* second tile layer */ |
| 298 | | AM_RANGE(0x24c010, 0x24c017) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_1_w) |
| 299 | | AM_RANGE(0x24c800, 0x24c87f) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 300 | | AM_RANGE(0x24cc00, 0x24cfff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 301 | | AM_RANGE(0x24d000, 0x24d7ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 297 | AM_RANGE(0x24c000, 0x24c007) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_0_w) /* second tile layer */ |
| 298 | AM_RANGE(0x24c010, 0x24c017) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_1_w) |
| 299 | AM_RANGE(0x24c800, 0x24c87f) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 300 | AM_RANGE(0x24cc00, 0x24cfff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 301 | AM_RANGE(0x24d000, 0x24d7ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_r, pf_data_w) |
| 302 | 302 | |
| 303 | 303 | AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r) |
| 304 | 304 | AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r) |
| r24008 | r24009 | |
| 319 | 319 | static ADDRESS_MAP_START( hippodrm_sub_map, AS_PROGRAM, 8, dec0_state ) |
| 320 | 320 | AM_RANGE(0x000000, 0x00ffff) AM_ROM |
| 321 | 321 | AM_RANGE(0x180000, 0x1800ff) AM_READWRITE(hippodrm_shared_r, hippodrm_shared_w) |
| 322 | | AM_RANGE(0x1a0000, 0x1a0007) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control0_8bit_packed_w) |
| 323 | | AM_RANGE(0x1a0010, 0x1a001f) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control1_8bit_swap_w) |
| 324 | | AM_RANGE(0x1a1000, 0x1a17ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w) |
| 322 | AM_RANGE(0x1a0000, 0x1a0007) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control0_8bit_packed_w) |
| 323 | AM_RANGE(0x1a0010, 0x1a001f) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control1_8bit_swap_w) |
| 324 | AM_RANGE(0x1a1000, 0x1a17ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_8bit_swap_r, pf_data_8bit_swap_w) |
| 325 | 325 | AM_RANGE(0x1d0000, 0x1d00ff) AM_READWRITE(hippodrm_prot_r, hippodrm_prot_w) |
| 326 | 326 | AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8") /* Main ram */ |
| 327 | 327 | AM_RANGE(0x1ff400, 0x1ff403) AM_DEVWRITE("sub", h6280_device, irq_status_w) |
| r24008 | r24009 | |
| 423 | 423 | { |
| 424 | 424 | address_space& space = m_maincpu->space(AS_PROGRAM); |
| 425 | 425 | |
| 426 | | deco_bac06_device *tilegen1 = (deco_bac06_device*)m_tilegen1; |
| 427 | | deco_bac06_device *tilegen2 = (deco_bac06_device*)m_tilegen2; |
| 428 | | |
| 429 | 426 | space.install_write_handler( 0x240000, 0x24ffff, write16_delegate(FUNC(dec0_state::unmapped_w),this)); |
| 430 | 427 | |
| 431 | 428 | space.install_write_handler( 0x24a000, 0x24a001, write16_delegate(FUNC(dec0_state::slyspy_state_w),this)); |
| r24008 | r24009 | |
| 434 | 431 | switch (type) |
| 435 | 432 | { |
| 436 | 433 | case 0: |
| 437 | | space.install_legacy_write_handler( *tilegen2, 0x240000, 0x240007, FUNC(deco_bac06_pf_control_0_w)); |
| 438 | | space.install_legacy_write_handler( *tilegen2, 0x240010, 0x240017, FUNC(deco_bac06_pf_control_1_w)); |
| 434 | space.install_write_handler(0x240000, 0x240007, write16_delegate(FUNC(deco_bac06_device::pf_control_0_w), (deco_bac06_device*)m_tilegen2)); |
| 435 | space.install_write_handler(0x240010, 0x240017, write16_delegate(FUNC(deco_bac06_device::pf_control_1_w), (deco_bac06_device*)m_tilegen2)); |
| 439 | 436 | |
| 440 | | space.install_legacy_write_handler( *tilegen2, 0x242000, 0x24207f, FUNC(deco_bac06_pf_colscroll_w)); |
| 441 | | space.install_legacy_write_handler( *tilegen2, 0x242400, 0x2427ff, FUNC(deco_bac06_pf_rowscroll_w)); |
| 437 | space.install_write_handler(0x242000, 0x24207f, write16_delegate(FUNC(deco_bac06_device::pf_colscroll_w), (deco_bac06_device*)m_tilegen2)); |
| 438 | space.install_write_handler(0x242400, 0x2427ff, write16_delegate(FUNC(deco_bac06_device::pf_rowscroll_w), (deco_bac06_device*)m_tilegen2)); |
| 442 | 439 | |
| 443 | | space.install_legacy_write_handler( *tilegen2, 0x246000, 0x247fff, FUNC(deco_bac06_pf_data_w)); |
| 440 | space.install_write_handler(0x246000, 0x247fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen2)); |
| 444 | 441 | |
| 445 | | space.install_legacy_write_handler( *tilegen1, 0x248000, 0x280007, FUNC(deco_bac06_pf_control_0_w)); |
| 446 | | space.install_legacy_write_handler( *tilegen1, 0x248010, 0x280017, FUNC(deco_bac06_pf_control_1_w)); |
| 442 | space.install_write_handler(0x248000, 0x280007, write16_delegate(FUNC(deco_bac06_device::pf_control_0_w), (deco_bac06_device*)m_tilegen1)); |
| 443 | space.install_write_handler(0x248010, 0x280017, write16_delegate(FUNC(deco_bac06_device::pf_control_1_w), (deco_bac06_device*)m_tilegen1)); |
| 447 | 444 | |
| 448 | | space.install_legacy_write_handler( *tilegen1, 0x24c000, 0x24c07f, FUNC(deco_bac06_pf_colscroll_w)); |
| 449 | | space.install_legacy_write_handler( *tilegen1, 0x24c400, 0x24c7ff, FUNC(deco_bac06_pf_rowscroll_w)); |
| 445 | space.install_write_handler(0x24c000, 0x24c07f, write16_delegate(FUNC(deco_bac06_device::pf_colscroll_w), (deco_bac06_device*)m_tilegen1)); |
| 446 | space.install_write_handler(0x24c400, 0x24c7ff, write16_delegate(FUNC(deco_bac06_device::pf_rowscroll_w), (deco_bac06_device*)m_tilegen1)); |
| 450 | 447 | |
| 451 | | space.install_legacy_write_handler( *tilegen1, 0x24e000, 0x24ffff, FUNC(deco_bac06_pf_data_w)); |
| 448 | space.install_write_handler(0x24e000, 0x24ffff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen1)); |
| 452 | 449 | |
| 453 | 450 | break; |
| 454 | 451 | |
| r24008 | r24009 | |
| 456 | 453 | // 0x240000 - 0x241fff not mapped |
| 457 | 454 | // 0x242000 - 0x243fff not mapped |
| 458 | 455 | // 0x246000 - 0x247fff not mapped |
| 459 | | space.install_legacy_write_handler( *tilegen1, 0x248000, 0x249fff, FUNC(deco_bac06_pf_data_w)); |
| 460 | | space.install_legacy_write_handler( *tilegen2, 0x24c000, 0x24dfff, FUNC(deco_bac06_pf_data_w)); |
| 456 | space.install_write_handler(0x248000, 0x249fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen1)); |
| 457 | space.install_write_handler(0x24c000, 0x24dfff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen2)); |
| 461 | 458 | // 0x24e000 - 0x24ffff not mapped |
| 462 | 459 | break; |
| 463 | 460 | |
| 464 | 461 | case 2: |
| 465 | | space.install_legacy_write_handler( *tilegen2, 0x240000, 0x241fff, FUNC(deco_bac06_pf_data_w)); |
| 466 | | space.install_legacy_write_handler( *tilegen1, 0x242000, 0x243fff, FUNC(deco_bac06_pf_data_w)); |
| 462 | space.install_write_handler(0x240000, 0x241fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen2)); |
| 463 | space.install_write_handler(0x242000, 0x243fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen1)); |
| 467 | 464 | // 0x242000 - 0x243fff not mapped |
| 468 | 465 | // 0x246000 - 0x247fff not mapped |
| 469 | 466 | // 0x248000 - 0x249fff not mapped |
| 470 | 467 | // 0x24c000 - 0x24dfff not mapped |
| 471 | | space.install_legacy_write_handler( *tilegen1, 0x24e000, 0x24ffff, FUNC(deco_bac06_pf_data_w)); |
| 468 | space.install_write_handler(0x24e000, 0x24ffff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen1)); |
| 472 | 469 | break; |
| 473 | 470 | |
| 474 | 471 | case 3: |
| 475 | | space.install_legacy_write_handler( *tilegen1, 0x240000, 0x241fff, FUNC(deco_bac06_pf_data_w)); |
| 472 | space.install_write_handler(0x240000, 0x241fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen1)); |
| 476 | 473 | // 0x242000 - 0x243fff not mapped |
| 477 | 474 | // 0x246000 - 0x247fff not mapped |
| 478 | | space.install_legacy_write_handler( *tilegen2, 0x248000, 0x249fff, FUNC(deco_bac06_pf_data_w)); |
| 475 | space.install_write_handler(0x248000, 0x249fff, write16_delegate(FUNC(deco_bac06_device::pf_data_w), (deco_bac06_device*)m_tilegen2)); |
| 479 | 476 | // 0x24c000 - 0x24dfff not mapped |
| 480 | 477 | // 0x24e000 - 0x24ffff not mapped |
| 481 | 478 | break; |
| r24008 | r24009 | |
| 495 | 492 | /* The location of p1 & pf2 can change in the 240000 - 24ffff region according to protection */ |
| 496 | 493 | |
| 497 | 494 | /* Pf3 is unaffected by protection */ |
| 498 | | AM_RANGE(0x300000, 0x300007) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_0_w) |
| 499 | | AM_RANGE(0x300010, 0x300017) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_1_w) |
| 500 | | AM_RANGE(0x300800, 0x30087f) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 501 | | AM_RANGE(0x300c00, 0x300fff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 502 | | AM_RANGE(0x301000, 0x3017ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 495 | AM_RANGE(0x300000, 0x300007) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_0_w) |
| 496 | AM_RANGE(0x300010, 0x300017) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_1_w) |
| 497 | AM_RANGE(0x300800, 0x30087f) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 498 | AM_RANGE(0x300c00, 0x300fff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 499 | AM_RANGE(0x301000, 0x3017ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_r, pf_data_w) |
| 503 | 500 | |
| 504 | 501 | AM_RANGE(0x304000, 0x307fff) AM_RAM AM_SHARE("ram") /* Sly spy main ram */ |
| 505 | 502 | AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_SHARE("spriteram") /* Sprites */ |
| r24008 | r24009 | |
| 520 | 517 | AM_RANGE(0x180008, 0x18000f) AM_WRITENOP /* ?? watchdog ?? */ |
| 521 | 518 | AM_RANGE(0x1a0000, 0x1a0001) AM_WRITE(midres_sound_w) |
| 522 | 519 | |
| 523 | | AM_RANGE(0x200000, 0x200007) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_0_w) |
| 524 | | AM_RANGE(0x200010, 0x200017) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_1_w) |
| 525 | | AM_RANGE(0x220000, 0x2207ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 526 | | AM_RANGE(0x220800, 0x220fff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) /* mirror address used in end sequence */ |
| 527 | | AM_RANGE(0x240000, 0x24007f) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 528 | | AM_RANGE(0x240400, 0x2407ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 520 | AM_RANGE(0x200000, 0x200007) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_0_w) |
| 521 | AM_RANGE(0x200010, 0x200017) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_1_w) |
| 522 | AM_RANGE(0x220000, 0x2207ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_data_r, pf_data_w) |
| 523 | AM_RANGE(0x220800, 0x220fff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_data_r, pf_data_w) /* mirror address used in end sequence */ |
| 524 | AM_RANGE(0x240000, 0x24007f) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 525 | AM_RANGE(0x240400, 0x2407ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 529 | 526 | |
| 530 | | AM_RANGE(0x280000, 0x280007) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_0_w) |
| 531 | | AM_RANGE(0x280010, 0x280017) AM_DEVWRITE_LEGACY("tilegen3", deco_bac06_pf_control_1_w) |
| 532 | | AM_RANGE(0x2a0000, 0x2a07ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 533 | | AM_RANGE(0x2c0000, 0x2c007f) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 534 | | AM_RANGE(0x2c0400, 0x2c07ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 527 | AM_RANGE(0x280000, 0x280007) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_0_w) |
| 528 | AM_RANGE(0x280010, 0x280017) AM_DEVWRITE("tilegen3", deco_bac06_device, pf_control_1_w) |
| 529 | AM_RANGE(0x2a0000, 0x2a07ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_r, pf_data_w) |
| 530 | AM_RANGE(0x2c0000, 0x2c007f) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 531 | AM_RANGE(0x2c0400, 0x2c07ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 535 | 532 | |
| 536 | | AM_RANGE(0x300000, 0x300007) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_0_w) |
| 537 | | AM_RANGE(0x300010, 0x300017) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_1_w) |
| 538 | | AM_RANGE(0x320000, 0x321fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 539 | | AM_RANGE(0x340000, 0x34007f) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 540 | | AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 533 | AM_RANGE(0x300000, 0x300007) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_0_w) |
| 534 | AM_RANGE(0x300010, 0x300017) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_1_w) |
| 535 | AM_RANGE(0x320000, 0x321fff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w) |
| 536 | AM_RANGE(0x340000, 0x34007f) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 537 | AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 541 | 538 | |
| 542 | 539 | AM_RANGE(0x320000, 0x321fff) AM_RAM |
| 543 | 540 | ADDRESS_MAP_END |
| r24008 | r24009 | |
| 603 | 600 | AM_RANGE(0x242000, 0x24207f) AM_RAM |
| 604 | 601 | AM_RANGE(0x242400, 0x2427ff) AM_RAM |
| 605 | 602 | AM_RANGE(0x242800, 0x243fff) AM_RAM |
| 606 | | AM_RANGE(0x244000, 0x245fff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 603 | AM_RANGE(0x244000, 0x245fff) AM_RAM AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w) |
| 607 | 604 | |
| 608 | 605 | AM_RANGE(0x246000, 0x246007) AM_RAM /* first tile layer */ |
| 609 | 606 | AM_RANGE(0x246010, 0x246017) AM_RAM |
| 610 | 607 | AM_RANGE(0x248000, 0x24807f) AM_RAM |
| 611 | 608 | AM_RANGE(0x248400, 0x2487ff) AM_RAM |
| 612 | | AM_RANGE(0x24a000, 0x24a7ff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 609 | AM_RANGE(0x24a000, 0x24a7ff) AM_RAM AM_DEVREADWRITE("tilegen2",deco_bac06_device, pf_data_r, pf_data_w) |
| 613 | 610 | |
| 614 | 611 | AM_RANGE(0x24c000, 0x24c007) AM_RAM /* second tile layer */ |
| 615 | 612 | AM_RANGE(0x24c010, 0x24c017) AM_RAM |
| 616 | 613 | AM_RANGE(0x24c800, 0x24c87f) AM_RAM |
| 617 | 614 | AM_RANGE(0x24cc00, 0x24cfff) AM_RAM |
| 618 | | AM_RANGE(0x24d000, 0x24d7ff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 615 | AM_RANGE(0x24d000, 0x24d7ff) AM_RAM AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_r, pf_data_w) |
| 619 | 616 | |
| 620 | 617 | AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r) |
| 621 | 618 | AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r) |
| r24008 | r24009 | |
| 633 | 630 | |
| 634 | 631 | static ADDRESS_MAP_START( secretab_map, AS_PROGRAM, 16, dec0_automat_state ) |
| 635 | 632 | AM_RANGE(0x000000, 0x05ffff) AM_ROM |
| 636 | | // AM_RANGE(0x240000, 0x240007) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_0_w) |
| 637 | | // AM_RANGE(0x240010, 0x240017) AM_DEVWRITE_LEGACY("tilegen2", deco_bac06_pf_control_1_w) |
| 638 | | AM_RANGE(0x246000, 0x247fff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 639 | | // AM_RANGE(0x240000, 0x24007f) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 640 | | // AM_RANGE(0x240400, 0x2407ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 633 | // AM_RANGE(0x240000, 0x240007) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_0_w) |
| 634 | // AM_RANGE(0x240010, 0x240017) AM_DEVWRITE("tilegen2", deco_bac06_device, pf_control_1_w) |
| 635 | AM_RANGE(0x246000, 0x247fff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_data_r, pf_data_w) |
| 636 | // AM_RANGE(0x240000, 0x24007f) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 637 | // AM_RANGE(0x240400, 0x2407ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 641 | 638 | |
| 642 | | // AM_RANGE(0x200000, 0x300007) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_0_w) |
| 643 | | // AM_RANGE(0x300010, 0x300017) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_1_w) |
| 644 | | AM_RANGE(0x24e000, 0x24ffff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 645 | | // AM_RANGE(0x340000, 0x34007f) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w) |
| 646 | | // AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w) |
| 639 | // AM_RANGE(0x200000, 0x300007) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_0_w) |
| 640 | // AM_RANGE(0x300010, 0x300017) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_1_w) |
| 641 | AM_RANGE(0x24e000, 0x24ffff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w) |
| 642 | // AM_RANGE(0x340000, 0x34007f) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_colscroll_r, pf_colscroll_w) |
| 643 | // AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w) |
| 647 | 644 | |
| 648 | 645 | AM_RANGE(0x314008, 0x31400f) AM_READ(slyspy_controls_r) |
| 649 | 646 | // AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w) |
| r24008 | r24009 | |
| 652 | 649 | AM_RANGE(0x300010, 0x300017) AM_RAM |
| 653 | 650 | AM_RANGE(0x300800, 0x30087f) AM_RAM |
| 654 | 651 | AM_RANGE(0x300c00, 0x300fff) AM_RAM |
| 655 | | AM_RANGE(0x301000, 0x3017ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) |
| 652 | AM_RANGE(0x301000, 0x3017ff) AM_DEVREADWRITE("tilegen3", deco_bac06_device, pf_data_r, pf_data_w) |
| 656 | 653 | AM_RANGE(0x301800, 0x307fff) AM_RAM AM_SHARE("ram") /* Sly spy main ram */ |
| 657 | 654 | AM_RANGE(0x310000, 0x3107ff) AM_READWRITE(automat_palette_r, automat_palette_w) AM_SHARE("paletteram") |
| 658 | 655 | AM_RANGE(0xb08000, 0xb08fff) AM_RAM AM_SHARE("spriteram") /* Sprites */ |
| r24008 | r24009 | |
| 1314 | 1311 | MCFG_PALETTE_LENGTH(1024) |
| 1315 | 1312 | |
| 1316 | 1313 | MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0) |
| 1317 | | deco_bac06_device::set_gfx_region_wide(*device, 0,0,0); |
| 1314 | deco_bac06_device::set_gfx_region_wide(*device,0,0,0); |
| 1318 | 1315 | MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0) |
| 1319 | | deco_bac06_device::set_gfx_region_wide(*device, 0,1,0); |
| 1316 | deco_bac06_device::set_gfx_region_wide(*device,0,1,0); |
| 1320 | 1317 | MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0) |
| 1321 | | deco_bac06_device::set_gfx_region_wide(*device, 0,2,0); |
| 1318 | deco_bac06_device::set_gfx_region_wide(*device,0,2,0); |
| 1322 | 1319 | |
| 1323 | 1320 | MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0) |
| 1324 | 1321 | deco_mxc06_device::set_gfx_region(*device, 3); |
| r24008 | r24009 | |
| 1415 | 1412 | MCFG_VIDEO_START_OVERRIDE(dec0_state,dec0_nodma) |
| 1416 | 1413 | |
| 1417 | 1414 | MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0) |
| 1418 | | deco_bac06_device::set_gfx_region_wide(*device, 0,0,0); |
| 1415 | deco_bac06_device::set_gfx_region_wide(*device,0,0,0); |
| 1419 | 1416 | MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0) |
| 1420 | | deco_bac06_device::set_gfx_region_wide(*device, 0,1,0); |
| 1417 | deco_bac06_device::set_gfx_region_wide(*device,0,1,0); |
| 1421 | 1418 | MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0) |
| 1422 | | deco_bac06_device::set_gfx_region_wide(*device, 0,2,0); |
| 1419 | deco_bac06_device::set_gfx_region_wide(*device,0,2,0); |
| 1423 | 1420 | |
| 1424 | 1421 | MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0) |
| 1425 | 1422 | deco_mxc06_device::set_gfx_region(*device, 3); |
| r24008 | r24009 | |
| 1468 | 1465 | MCFG_VIDEO_START_OVERRIDE(dec0_state,dec0_nodma) |
| 1469 | 1466 | |
| 1470 | 1467 | MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0) |
| 1471 | | deco_bac06_device::set_gfx_region_wide(*device, 0,0,0); |
| 1468 | deco_bac06_device::set_gfx_region_wide(*device,0,0,0); |
| 1472 | 1469 | MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0) |
| 1473 | | deco_bac06_device::set_gfx_region_wide(*device, 0,1,0); |
| 1470 | deco_bac06_device::set_gfx_region_wide(*device,0,1,0); |
| 1474 | 1471 | MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0) |
| 1475 | | deco_bac06_device::set_gfx_region_wide(*device, 0,2,0); |
| 1472 | deco_bac06_device::set_gfx_region_wide(*device,0,2,0); |
| 1476 | 1473 | |
| 1477 | 1474 | MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0) |
| 1478 | 1475 | deco_mxc06_device::set_gfx_region(*device, 3); |
trunk/src/mame/video/dec0.c
| r24008 | r24009 | |
| 47 | 47 | { |
| 48 | 48 | flip_screen_set(m_tilegen1->get_flip_state()); |
| 49 | 49 | |
| 50 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 50 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 51 | 51 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, 0x08, 0x0f); |
| 52 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 52 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 53 | 53 | |
| 54 | 54 | /* HB always keeps pf2 on top of pf3, no need explicitly support priority register */ |
| 55 | 55 | |
| 56 | 56 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, 0x00, 0x0f); |
| 57 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 57 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 58 | 58 | return 0; |
| 59 | 59 | } |
| 60 | 60 | |
| r24008 | r24009 | |
| 67 | 67 | /* WARNING: inverted wrt Midnight Resistance */ |
| 68 | 68 | if ((m_pri & 0x01) == 0) |
| 69 | 69 | { |
| 70 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 71 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 70 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 71 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 72 | 72 | |
| 73 | 73 | if (m_pri & 2) |
| 74 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 74 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 75 | 75 | |
| 76 | 76 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 77 | 77 | |
| 78 | 78 | if (m_pri & 4) |
| 79 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 79 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 80 | 80 | } |
| 81 | 81 | else |
| 82 | 82 | { |
| 83 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 84 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 83 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 84 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 85 | 85 | |
| 86 | 86 | if (m_pri & 2) |
| 87 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 87 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 88 | 88 | |
| 89 | 89 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 90 | 90 | |
| 91 | 91 | if (m_pri & 4) |
| 92 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 92 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 95 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 96 | 96 | return 0; |
| 97 | 97 | } |
| 98 | 98 | |
| r24008 | r24009 | |
| 115 | 115 | /* Robocop uses it only for the title screen, so this might be just */ |
| 116 | 116 | /* completely wrong. The top 8 bits of the register might mean */ |
| 117 | 117 | /* something (they are 0x80 in midres, 0x00 here) */ |
| 118 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 118 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 119 | 119 | |
| 120 | 120 | if (m_pri & 0x02) |
| 121 | 121 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 122 | 122 | |
| 123 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 123 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 124 | 124 | } |
| 125 | 125 | else |
| 126 | 126 | { |
| 127 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 127 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 128 | 128 | |
| 129 | 129 | if (m_pri & 0x02) |
| 130 | 130 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 131 | 131 | |
| 132 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 132 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (m_pri & 0x02) |
| r24008 | r24009 | |
| 137 | 137 | else |
| 138 | 138 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 139 | 139 | |
| 140 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 140 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 141 | 141 | return 0; |
| 142 | 142 | } |
| 143 | 143 | |
| r24008 | r24009 | |
| 150 | 150 | |
| 151 | 151 | // the bootleg doesn't write these registers, I think they're hardcoded?, so fake them for compatibility with our implementation.. |
| 152 | 152 | address_space &space = machine().driver_data()->generic_space(); |
| 153 | | deco_bac06_pf_control_0_w(m_tilegen1,space,0,0x0003, 0x00ff); // 8x8 |
| 154 | | deco_bac06_pf_control_0_w(m_tilegen1,space,1,0x0003, 0x00ff); |
| 155 | | deco_bac06_pf_control_0_w(m_tilegen1,space,2,0x0000, 0x00ff); |
| 156 | | deco_bac06_pf_control_0_w(m_tilegen1,space,3,0x0001, 0x00ff); // dimensions |
| 153 | m_tilegen1->pf_control_0_w(space,0,0x0003, 0x00ff); // 8x8 |
| 154 | m_tilegen1->pf_control_0_w(space,1,0x0003, 0x00ff); |
| 155 | m_tilegen1->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 156 | m_tilegen1->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 157 | 157 | |
| 158 | | deco_bac06_pf_control_0_w(m_tilegen2,space,0,0x0082, 0x00ff); // 16x16 |
| 159 | | deco_bac06_pf_control_0_w(m_tilegen2,space,1,0x0000, 0x00ff); |
| 160 | | deco_bac06_pf_control_0_w(m_tilegen2,space,2,0x0000, 0x00ff); |
| 161 | | deco_bac06_pf_control_0_w(m_tilegen2,space,3,0x0001, 0x00ff); // dimensions |
| 158 | m_tilegen2->pf_control_0_w(space,0,0x0082, 0x00ff); // 16x16 |
| 159 | m_tilegen2->pf_control_0_w(space,1,0x0000, 0x00ff); |
| 160 | m_tilegen2->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 161 | m_tilegen2->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 162 | 162 | |
| 163 | | deco_bac06_pf_control_0_w(m_tilegen3,space,0,0x0082, 0x00ff); // 16x16 |
| 164 | | deco_bac06_pf_control_0_w(m_tilegen3,space,1,0x0003, 0x00ff); |
| 165 | | deco_bac06_pf_control_0_w(m_tilegen3,space,2,0x0000, 0x00ff); |
| 166 | | deco_bac06_pf_control_0_w(m_tilegen3,space,3,0x0001, 0x00ff); // dimensions |
| 163 | m_tilegen3->pf_control_0_w(space,0,0x0082, 0x00ff); // 16x16 |
| 164 | m_tilegen3->pf_control_0_w(space,1,0x0003, 0x00ff); |
| 165 | m_tilegen3->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 166 | m_tilegen3->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 167 | 167 | |
| 168 | 168 | // scroll registers got written elsewhere, copy them across |
| 169 | | deco_bac06_pf_control_1_w(m_tilegen1,space,0,0x0000, 0xffff); // no scroll? |
| 170 | | deco_bac06_pf_control_1_w(m_tilegen1,space,1,0x0000, 0xffff); // no scroll? |
| 169 | m_tilegen1->pf_control_1_w(space,0,0x0000, 0xffff); // no scroll? |
| 170 | m_tilegen1->pf_control_1_w(space,1,0x0000, 0xffff); // no scroll? |
| 171 | 171 | |
| 172 | | deco_bac06_pf_control_1_w(m_tilegen2,space,0,m_automat_scroll_regs[3] - 0x010a, 0xffff); |
| 173 | | deco_bac06_pf_control_1_w(m_tilegen2,space,1,m_automat_scroll_regs[2], 0xffff); |
| 172 | m_tilegen2->pf_control_1_w(space,0,m_automat_scroll_regs[3] - 0x010a, 0xffff); |
| 173 | m_tilegen2->pf_control_1_w(space,1,m_automat_scroll_regs[2], 0xffff); |
| 174 | 174 | |
| 175 | | deco_bac06_pf_control_1_w(m_tilegen3,space,0,m_automat_scroll_regs[1] - 0x0108, 0xffff); |
| 176 | | deco_bac06_pf_control_1_w(m_tilegen3,space,1,m_automat_scroll_regs[0], 0xffff); |
| 175 | m_tilegen3->pf_control_1_w(space,0,m_automat_scroll_regs[1] - 0x0108, 0xffff); |
| 176 | m_tilegen3->pf_control_1_w(space,1,m_automat_scroll_regs[0], 0xffff); |
| 177 | 177 | |
| 178 | 178 | |
| 179 | 179 | flip_screen_set(m_tilegen1->get_flip_state()); |
| r24008 | r24009 | |
| 185 | 185 | |
| 186 | 186 | if (m_pri & 0x01) |
| 187 | 187 | { |
| 188 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 188 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 189 | 189 | |
| 190 | 190 | if (m_pri & 0x02) |
| 191 | 191 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 192 | 192 | |
| 193 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 193 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 194 | 194 | } |
| 195 | 195 | else |
| 196 | 196 | { |
| 197 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 197 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 198 | 198 | |
| 199 | 199 | if (m_pri & 0x02) |
| 200 | 200 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 201 | 201 | |
| 202 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 202 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if (m_pri & 0x02) |
| r24008 | r24009 | |
| 207 | 207 | else |
| 208 | 208 | m_spritegen->draw_sprites_bootleg(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 209 | 209 | |
| 210 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 210 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 211 | 211 | return 0; |
| 212 | 212 | } |
| 213 | 213 | |
| r24008 | r24009 | |
| 217 | 217 | |
| 218 | 218 | // the bootleg doesn't write these registers, I think they're hardcoded?, so fake them for compatibility with our implementation.. |
| 219 | 219 | address_space &space = machine().driver_data()->generic_space(); |
| 220 | | deco_bac06_pf_control_0_w(m_tilegen1,space,0,0x0003, 0x00ff); // 8x8 |
| 221 | | deco_bac06_pf_control_0_w(m_tilegen1,space,1,0x0003, 0x00ff); |
| 222 | | deco_bac06_pf_control_0_w(m_tilegen1,space,2,0x0000, 0x00ff); |
| 223 | | deco_bac06_pf_control_0_w(m_tilegen1,space,3,0x0001, 0x00ff); // dimensions |
| 220 | m_tilegen1->pf_control_0_w(space,0,0x0003, 0x00ff); // 8x8 |
| 221 | m_tilegen1->pf_control_0_w(space,1,0x0003, 0x00ff); |
| 222 | m_tilegen1->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 223 | m_tilegen1->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 224 | 224 | |
| 225 | | deco_bac06_pf_control_0_w(m_tilegen2,space,0,0x0082, 0x00ff); // 16x16 |
| 226 | | deco_bac06_pf_control_0_w(m_tilegen2,space,1,0x0000, 0x00ff); |
| 227 | | deco_bac06_pf_control_0_w(m_tilegen2,space,2,0x0000, 0x00ff); |
| 228 | | deco_bac06_pf_control_0_w(m_tilegen2,space,3,0x0001, 0x00ff); // dimensions |
| 225 | m_tilegen2->pf_control_0_w(space,0,0x0082, 0x00ff); // 16x16 |
| 226 | m_tilegen2->pf_control_0_w(space,1,0x0000, 0x00ff); |
| 227 | m_tilegen2->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 228 | m_tilegen2->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 229 | 229 | |
| 230 | | deco_bac06_pf_control_0_w(m_tilegen3,space,0,0x0082, 0x00ff); // 16x16 |
| 231 | | deco_bac06_pf_control_0_w(m_tilegen3,space,1,0x0003, 0x00ff); |
| 232 | | deco_bac06_pf_control_0_w(m_tilegen3,space,2,0x0000, 0x00ff); |
| 233 | | deco_bac06_pf_control_0_w(m_tilegen3,space,3,0x0001, 0x00ff); // dimensions |
| 230 | m_tilegen3->pf_control_0_w(space,0,0x0082, 0x00ff); // 16x16 |
| 231 | m_tilegen3->pf_control_0_w(space,1,0x0003, 0x00ff); |
| 232 | m_tilegen3->pf_control_0_w(space,2,0x0000, 0x00ff); |
| 233 | m_tilegen3->pf_control_0_w(space,3,0x0001, 0x00ff); // dimensions |
| 234 | 234 | |
| 235 | 235 | // scroll registers got written elsewhere, copy them across |
| 236 | | deco_bac06_pf_control_1_w(m_tilegen1,space,0,0x0000, 0xffff); // no scroll? |
| 237 | | deco_bac06_pf_control_1_w(m_tilegen1,space,1,0x0000, 0xffff); // no scroll? |
| 236 | m_tilegen1->pf_control_1_w(space,0,0x0000, 0xffff); // no scroll? |
| 237 | m_tilegen1->pf_control_1_w(space,1,0x0000, 0xffff); // no scroll? |
| 238 | 238 | |
| 239 | | deco_bac06_pf_control_1_w(m_tilegen2,space,0,m_automat_scroll_regs[3] - 0x010a, 0xffff); |
| 240 | | deco_bac06_pf_control_1_w(m_tilegen2,space,1,m_automat_scroll_regs[2], 0xffff); |
| 239 | m_tilegen2->pf_control_1_w(space,0,m_automat_scroll_regs[3] - 0x010a, 0xffff); |
| 240 | m_tilegen2->pf_control_1_w(space,1,m_automat_scroll_regs[2], 0xffff); |
| 241 | 241 | |
| 242 | | deco_bac06_pf_control_1_w(m_tilegen3,space,0,m_automat_scroll_regs[1] - 0x0108, 0xffff); |
| 243 | | deco_bac06_pf_control_1_w(m_tilegen3,space,1,m_automat_scroll_regs[0], 0xffff); |
| 242 | m_tilegen3->pf_control_1_w(space,0,m_automat_scroll_regs[1] - 0x0108, 0xffff); |
| 243 | m_tilegen3->pf_control_1_w(space,1,m_automat_scroll_regs[0], 0xffff); |
| 244 | 244 | |
| 245 | 245 | flip_screen_set(m_tilegen1->get_flip_state()); |
| 246 | 246 | |
| 247 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 248 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 247 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 248 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 249 | 249 | |
| 250 | 250 | m_spritegen->draw_sprites_bootleg(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 251 | 251 | |
| 252 | 252 | /* Redraw top 8 pens of top 8 palettes over sprites */ |
| 253 | 253 | if (m_pri&0x80) |
| 254 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles |
| 254 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles |
| 255 | 255 | |
| 256 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 256 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 257 | 257 | return 0; |
| 258 | 258 | } |
| 259 | 259 | |
| r24008 | r24009 | |
| 267 | 267 | /* This game doesn't have the extra playfield chip on the game board, but |
| 268 | 268 | the palette does show through. */ |
| 269 | 269 | bitmap.fill(machine().pens[768], cliprect); |
| 270 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 270 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 271 | 271 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 272 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 272 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 273 | 273 | return 0; |
| 274 | 274 | } |
| 275 | 275 | |
| r24008 | r24009 | |
| 281 | 281 | |
| 282 | 282 | if (m_pri & 0x01) |
| 283 | 283 | { |
| 284 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 285 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 284 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 285 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 286 | 286 | } |
| 287 | 287 | else |
| 288 | 288 | { |
| 289 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 290 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 289 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 290 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 294 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 294 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 295 | 295 | return 0; |
| 296 | 296 | } |
| 297 | 297 | |
| r24008 | r24009 | |
| 301 | 301 | { |
| 302 | 302 | flip_screen_set(m_tilegen1->get_flip_state()); |
| 303 | 303 | |
| 304 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 305 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 304 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 305 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 306 | 306 | |
| 307 | 307 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 308 | 308 | |
| 309 | 309 | /* Redraw top 8 pens of top 8 palettes over sprites */ |
| 310 | 310 | if (m_pri&0x80) |
| 311 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles |
| 311 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles |
| 312 | 312 | |
| 313 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 313 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 314 | 314 | return 0; |
| 315 | 315 | } |
| 316 | 316 | |
| r24008 | r24009 | |
| 328 | 328 | |
| 329 | 329 | if (m_pri & 0x01) |
| 330 | 330 | { |
| 331 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 331 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 332 | 332 | |
| 333 | 333 | if (m_pri & 0x02) |
| 334 | 334 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 335 | 335 | |
| 336 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 336 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 337 | 337 | } |
| 338 | 338 | else |
| 339 | 339 | { |
| 340 | | m_tilegen3->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 340 | m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); |
| 341 | 341 | |
| 342 | 342 | if (m_pri & 0x02) |
| 343 | 343 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f); |
| 344 | 344 | |
| 345 | | m_tilegen2->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 345 | m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if (m_pri & 0x02) |
| r24008 | r24009 | |
| 350 | 350 | else |
| 351 | 351 | m_spritegen->draw_sprites(machine(), bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f); |
| 352 | 352 | |
| 353 | | m_tilegen1->deco_bac06_pf_draw(machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 353 | m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); |
| 354 | 354 | return 0; |
| 355 | 355 | } |
| 356 | 356 | |
trunk/src/mame/video/decbac06.c
| r24008 | r24009 | |
| 63 | 63 | #include "emu.h" |
| 64 | 64 | #include "decbac06.h" |
| 65 | 65 | |
| 66 | | void deco_bac06_device::set_gfx_region_wide(device_t &device, int region8x8, int region16x16, int wide) |
| 67 | | { |
| 68 | | deco_bac06_device &dev = downcast<deco_bac06_device &>(device); |
| 69 | | dev.m_gfxregion8x8 = region8x8; |
| 70 | | dev.m_gfxregion16x16 = region16x16; |
| 71 | | dev.m_wide = wide; |
| 72 | | } |
| 73 | | |
| 74 | 66 | const device_type DECO_BAC06 = &device_creator<deco_bac06_device>; |
| 75 | 67 | |
| 76 | 68 | deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 77 | 69 | : device_t(mconfig, DECO_BAC06, "decbac06_device", tag, owner, clock, "deco_bac06", __FILE__), |
| 70 | m_pf_data(NULL), |
| 71 | m_pf_rowscroll(NULL), |
| 72 | m_pf_colscroll(NULL), |
| 73 | m_tile_region(0), |
| 74 | m_gfxcolmask(0), |
| 75 | m_rambank(0), |
| 78 | 76 | m_gfxregion8x8(0), |
| 79 | 77 | m_gfxregion16x16(0), |
| 80 | | m_wide(0) |
| 78 | m_wide(0), |
| 79 | m_bppmult(0), |
| 80 | m_bppmask(0) |
| 81 | //m_pf_control_0[8] |
| 82 | //m_pf_control_1[8] |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | void deco_bac06_device::device_start() |
| 81 | 87 | { |
| 88 | m_pf_data = auto_alloc_array_clear(machine(), UINT16, 0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?! |
| 89 | m_pf_rowscroll = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); |
| 90 | m_pf_colscroll = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); |
| 91 | |
| 92 | create_tilemaps(m_gfxregion8x8, m_gfxregion16x16); |
| 93 | m_gfxcolmask = 0x0f; |
| 94 | |
| 95 | m_bppmult = 0x10; |
| 96 | m_bppmask = 0x0f; |
| 97 | m_rambank = 0; |
| 98 | |
| 99 | save_pointer(NAME(m_pf_data), 0x4000/2); |
| 100 | save_pointer(NAME(m_pf_rowscroll), 0x2000/2); |
| 101 | save_pointer(NAME(m_pf_colscroll), 0x2000/2); |
| 102 | save_pointer(NAME(m_pf_control_0), 8); |
| 103 | save_pointer(NAME(m_pf_control_1), 8); |
| 104 | |
| 105 | save_item(NAME(m_rambank)); |
| 82 | 106 | } |
| 83 | 107 | |
| 108 | void deco_bac06_device::device_reset() |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | void deco_bac06_device::set_gfx_region_wide(device_t &device, int region8x8, int region16x16, int wide) |
| 113 | { |
| 114 | deco_bac06_device &dev = downcast<deco_bac06_device &>(device); |
| 115 | dev.m_gfxregion8x8 = region8x8; |
| 116 | dev.m_gfxregion16x16 = region16x16; |
| 117 | dev.m_wide = wide; |
| 118 | } |
| 119 | |
| 84 | 120 | TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_scan) |
| 85 | 121 | { |
| 86 | 122 | return (col & 0xf) + ((row & 0xf) << 4) + ((col & 0x1f0) << 4); |
| r24008 | r24009 | |
| 114 | 150 | TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf8x8_tile_info) |
| 115 | 151 | { |
| 116 | 152 | if (m_rambank&1) tile_index+=0x1000; |
| 117 | | int tile=pf_data[tile_index]; |
| 153 | int tile=m_pf_data[tile_index]; |
| 118 | 154 | int colourpri=(tile>>12); |
| 119 | | SET_TILE_INFO_MEMBER(tile_region,tile&0xfff,0,0); |
| 155 | SET_TILE_INFO_MEMBER(m_tile_region,tile&0xfff,0,0); |
| 120 | 156 | tileinfo.category = colourpri; |
| 121 | 157 | } |
| 122 | 158 | |
| 123 | 159 | TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf16x16_tile_info) |
| 124 | 160 | { |
| 125 | 161 | if (m_rambank&1) tile_index+=0x1000; |
| 126 | | int tile=pf_data[tile_index]; |
| 162 | int tile=m_pf_data[tile_index]; |
| 127 | 163 | int colourpri=(tile>>12); |
| 128 | | SET_TILE_INFO_MEMBER(tile_region,tile&0xfff,0,0); |
| 164 | SET_TILE_INFO_MEMBER(m_tile_region,tile&0xfff,0,0); |
| 129 | 165 | tileinfo.category = colourpri; |
| 130 | 166 | } |
| 131 | 167 | |
| 132 | 168 | void deco_bac06_device::create_tilemaps(int region8x8, int region16x16) |
| 133 | 169 | { |
| 134 | | tile_region = region8x8; |
| 170 | m_tile_region = region8x8; |
| 135 | 171 | |
| 136 | | pf8x8_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_8x8_scan),this), 8, 8,128, 32); |
| 137 | | pf8x8_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_8x8_scan),this), 8, 8, 64, 64); |
| 138 | | pf8x8_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_8x8_scan),this), 8, 8, 32,128); |
| 172 | m_pf8x8_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_8x8_scan),this), 8, 8,128, 32); |
| 173 | m_pf8x8_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_8x8_scan),this), 8, 8, 64, 64); |
| 174 | m_pf8x8_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_8x8_scan),this), 8, 8, 32,128); |
| 139 | 175 | |
| 140 | | tile_region = region16x16; |
| 176 | m_tile_region = region16x16; |
| 141 | 177 | |
| 142 | 178 | if (m_wide==2) |
| 143 | 179 | { |
| 144 | | pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 256, 16); |
| 145 | | pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 128, 32); |
| 146 | | pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 64, 64); |
| 180 | m_pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 256, 16); |
| 181 | m_pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 128, 32); |
| 182 | m_pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 64, 64); |
| 147 | 183 | } |
| 148 | 184 | else if (m_wide==1) |
| 149 | 185 | { |
| 150 | | pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 128, 16); |
| 151 | | pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 64, 32); |
| 152 | | pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 32, 64); |
| 186 | m_pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 128, 16); |
| 187 | m_pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 64, 32); |
| 188 | m_pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 32, 64); |
| 153 | 189 | } |
| 154 | 190 | else |
| 155 | 191 | { |
| 156 | | pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16,16, 64, 16); |
| 157 | | pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16,16, 32, 32); |
| 158 | | pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16,16, 16, 64); |
| 192 | m_pf16x16_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16,16, 64, 16); |
| 193 | m_pf16x16_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16,16, 32, 32); |
| 194 | m_pf16x16_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16,16, 16, 64); |
| 159 | 195 | } |
| 160 | 196 | } |
| 161 | 197 | |
| 162 | | void deco_bac06_device::device_start() |
| 163 | | { |
| 164 | | pf_data = auto_alloc_array_clear(this->machine(), UINT16, 0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?! |
| 165 | | pf_rowscroll = auto_alloc_array_clear(this->machine(), UINT16, 0x2000 / 2); |
| 166 | | pf_colscroll = auto_alloc_array_clear(this->machine(), UINT16, 0x2000 / 2); |
| 167 | | |
| 168 | | create_tilemaps(m_gfxregion8x8, m_gfxregion16x16); |
| 169 | | m_gfxcolmask = 0x0f; |
| 170 | | |
| 171 | | m_bppmult = 0x10; |
| 172 | | m_bppmask = 0x0f; |
| 173 | | m_rambank = 0; |
| 174 | | |
| 175 | | save_pointer(NAME(pf_data), 0x4000/2); |
| 176 | | save_pointer(NAME(pf_rowscroll), 0x2000/2); |
| 177 | | save_pointer(NAME(pf_colscroll), 0x2000/2); |
| 178 | | save_pointer(NAME(pf_control_0), 8); |
| 179 | | save_pointer(NAME(pf_control_1), 8); |
| 180 | | |
| 181 | | save_item(NAME(m_rambank)); |
| 182 | | } |
| 183 | | |
| 184 | | void deco_bac06_device::device_reset() |
| 185 | | { |
| 186 | | } |
| 187 | | |
| 188 | | |
| 189 | | void deco_bac06_device::custom_tilemap_draw(running_machine &machine, |
| 190 | | bitmap_ind16 &bitmap, |
| 198 | void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, |
| 191 | 199 | const rectangle &cliprect, |
| 192 | 200 | tilemap_t *tilemap_ptr, |
| 193 | 201 | const UINT16 *rowscroll_ptr, |
| r24008 | r24009 | |
| 246 | 254 | doesn't affect any games. |
| 247 | 255 | */ |
| 248 | 256 | |
| 249 | | if (machine.driver_data()->flip_screen()) |
| 257 | if (machine().driver_data()->flip_screen()) |
| 250 | 258 | src_y = (src_bitmap.height() - 256) - scrolly; |
| 251 | 259 | else |
| 252 | 260 | src_y = scrolly; |
| r24008 | r24009 | |
| 257 | 265 | else |
| 258 | 266 | src_x=scrollx; |
| 259 | 267 | |
| 260 | | if (machine.driver_data()->flip_screen()) |
| 268 | if (machine().driver_data()->flip_screen()) |
| 261 | 269 | src_x=(src_bitmap.width() - 256) - src_x; |
| 262 | 270 | |
| 263 | 271 | for (x=0; x<=cliprect.max_x; x++) { |
| r24008 | r24009 | |
| 279 | 287 | } |
| 280 | 288 | } |
| 281 | 289 | |
| 282 | | void deco_bac06_device::deco_bac06_pf_draw(running_machine &machine,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,UINT16 penmask, UINT16 pencondition,UINT16 colprimask, UINT16 colpricondition) |
| 290 | void deco_bac06_device::deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,UINT16 penmask, UINT16 pencondition,UINT16 colprimask, UINT16 colpricondition) |
| 283 | 291 | { |
| 284 | 292 | tilemap_t* tm = 0; |
| 285 | 293 | |
| 286 | | switch (pf_control_0[3]&0x3) { |
| 294 | switch (m_pf_control_0[3]&0x3) { |
| 287 | 295 | case 0: /* 4x1 */ |
| 288 | | if (pf_control_0[0]&0x1) |
| 289 | | tm = pf8x8_tilemap[0]; |
| 296 | if (m_pf_control_0[0]&0x1) |
| 297 | tm = m_pf8x8_tilemap[0]; |
| 290 | 298 | else |
| 291 | | tm = pf16x16_tilemap[0]; |
| 299 | tm = m_pf16x16_tilemap[0]; |
| 292 | 300 | break; |
| 293 | 301 | |
| 294 | 302 | case 1: /* 2x2 */ |
| 295 | 303 | default: |
| 296 | | if (pf_control_0[0]&0x1) |
| 297 | | tm = pf8x8_tilemap[1]; |
| 304 | if (m_pf_control_0[0]&0x1) |
| 305 | tm = m_pf8x8_tilemap[1]; |
| 298 | 306 | else |
| 299 | | tm = pf16x16_tilemap[1]; |
| 307 | tm = m_pf16x16_tilemap[1]; |
| 300 | 308 | break; |
| 301 | 309 | |
| 302 | 310 | case 2: /* 1x4 */ |
| 303 | | if (pf_control_0[0]&0x1) |
| 304 | | tm = pf8x8_tilemap[2]; |
| 311 | if (m_pf_control_0[0]&0x1) |
| 312 | tm = m_pf8x8_tilemap[2]; |
| 305 | 313 | else |
| 306 | | tm = pf16x16_tilemap[2]; |
| 314 | tm = m_pf16x16_tilemap[2]; |
| 307 | 315 | break; |
| 308 | 316 | }; |
| 309 | 317 | |
| 310 | 318 | if (tm) |
| 311 | | custom_tilemap_draw(machine,bitmap,cliprect,tm,pf_rowscroll,pf_colscroll,pf_control_0,pf_control_1,flags, penmask, pencondition, colprimask, colpricondition); |
| 319 | custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll,m_pf_colscroll,m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition); |
| 312 | 320 | |
| 313 | 321 | } |
| 314 | 322 | |
| 315 | 323 | // used for pocket gal bootleg, which doesn't set registers properly and simply expects a fixed size tilemap. |
| 316 | | void deco_bac06_device::deco_bac06_pf_draw_bootleg(running_machine &machine,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type) |
| 324 | void deco_bac06_device::deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type) |
| 317 | 325 | { |
| 318 | 326 | tilemap_t* tm = 0; |
| 319 | | if (!mode) tm = pf8x8_tilemap[type]; |
| 320 | | else tm = pf16x16_tilemap[type]; |
| 327 | if (!mode) tm = m_pf8x8_tilemap[type]; |
| 328 | else tm = m_pf16x16_tilemap[type]; |
| 321 | 329 | |
| 322 | | custom_tilemap_draw(machine,bitmap,cliprect,tm,pf_rowscroll,pf_colscroll,0,0,flags, 0, 0, 0, 0); |
| 330 | custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll,m_pf_colscroll,0,0,flags, 0, 0, 0, 0); |
| 323 | 331 | } |
| 324 | 332 | |
| 325 | 333 | |
| 326 | 334 | |
| 327 | | WRITE16_DEVICE_HANDLER( deco_bac06_pf_control_0_w ) |
| 335 | WRITE16_MEMBER( deco_bac06_device::pf_control_0_w ) |
| 328 | 336 | { |
| 329 | 337 | offset &= 3; |
| 330 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 338 | |
| 339 | COMBINE_DATA(&m_pf_control_0[offset]); |
| 331 | 340 | |
| 332 | | COMBINE_DATA(&dev->pf_control_0[offset]); |
| 333 | | |
| 334 | 341 | if (offset==2) |
| 335 | 342 | { |
| 336 | | int newbank = dev->pf_control_0[offset]&1; |
| 337 | | if ((newbank&1) != (dev->m_rambank&1)) |
| 343 | int newbank = m_pf_control_0[offset]&1; |
| 344 | if ((newbank&1) != (m_rambank&1)) |
| 338 | 345 | { |
| 339 | 346 | // I don't know WHY Stadium Hero uses this as a bank but the RAM test expects it.. |
| 340 | 347 | // I'm curious as to if anything else sets it tho |
| 341 | | if (strcmp(dev->machine().system().name,"stadhero")) |
| 348 | if (strcmp(machine().system().name,"stadhero")) |
| 342 | 349 | printf("tilemap ram bank change to %d\n", newbank&1); |
| 343 | 350 | |
| 344 | | dev->m_rambank = newbank&1; |
| 345 | | dev->pf8x8_tilemap[0]->mark_all_dirty(); |
| 346 | | dev->pf8x8_tilemap[1]->mark_all_dirty(); |
| 347 | | dev->pf8x8_tilemap[2]->mark_all_dirty(); |
| 348 | | dev->pf16x16_tilemap[0]->mark_all_dirty(); |
| 349 | | dev->pf16x16_tilemap[1]->mark_all_dirty(); |
| 350 | | dev->pf16x16_tilemap[2]->mark_all_dirty(); |
| 351 | m_rambank = newbank&1; |
| 352 | m_pf8x8_tilemap[0]->mark_all_dirty(); |
| 353 | m_pf8x8_tilemap[1]->mark_all_dirty(); |
| 354 | m_pf8x8_tilemap[2]->mark_all_dirty(); |
| 355 | m_pf16x16_tilemap[0]->mark_all_dirty(); |
| 356 | m_pf16x16_tilemap[1]->mark_all_dirty(); |
| 357 | m_pf16x16_tilemap[2]->mark_all_dirty(); |
| 351 | 358 | } |
| 352 | 359 | } |
| 353 | 360 | } |
| 354 | 361 | |
| 355 | | READ16_DEVICE_HANDLER( deco_bac06_pf_control_1_r ) |
| 362 | READ16_MEMBER( deco_bac06_device::pf_control_1_r ) |
| 356 | 363 | { |
| 357 | 364 | offset &= 7; |
| 358 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 359 | | return dev->pf_control_1[offset]; |
| 365 | return m_pf_control_1[offset]; |
| 360 | 366 | } |
| 361 | 367 | |
| 362 | | WRITE16_DEVICE_HANDLER( deco_bac06_pf_control_1_w ) |
| 368 | WRITE16_MEMBER( deco_bac06_device::pf_control_1_w ) |
| 363 | 369 | { |
| 364 | 370 | offset &= 7; |
| 365 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 366 | | COMBINE_DATA(&dev->pf_control_1[offset]); |
| 371 | COMBINE_DATA(&m_pf_control_1[offset]); |
| 367 | 372 | } |
| 368 | 373 | |
| 369 | | WRITE16_DEVICE_HANDLER( deco_bac06_pf_data_w ) |
| 374 | WRITE16_MEMBER( deco_bac06_device::pf_data_w ) |
| 370 | 375 | { |
| 371 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 372 | | if (dev->m_rambank&1) offset+=0x1000; |
| 376 | if (m_rambank&1) offset+=0x1000; |
| 373 | 377 | |
| 374 | | COMBINE_DATA(&dev->pf_data[offset]); |
| 375 | | dev->pf8x8_tilemap[0]->mark_tile_dirty(offset); |
| 376 | | dev->pf8x8_tilemap[1]->mark_tile_dirty(offset); |
| 377 | | dev->pf8x8_tilemap[2]->mark_tile_dirty(offset); |
| 378 | | dev->pf16x16_tilemap[0]->mark_tile_dirty(offset); |
| 379 | | dev->pf16x16_tilemap[1]->mark_tile_dirty(offset); |
| 380 | | dev->pf16x16_tilemap[2]->mark_tile_dirty(offset); |
| 378 | COMBINE_DATA(&m_pf_data[offset]); |
| 379 | m_pf8x8_tilemap[0]->mark_tile_dirty(offset); |
| 380 | m_pf8x8_tilemap[1]->mark_tile_dirty(offset); |
| 381 | m_pf8x8_tilemap[2]->mark_tile_dirty(offset); |
| 382 | m_pf16x16_tilemap[0]->mark_tile_dirty(offset); |
| 383 | m_pf16x16_tilemap[1]->mark_tile_dirty(offset); |
| 384 | m_pf16x16_tilemap[2]->mark_tile_dirty(offset); |
| 381 | 385 | } |
| 382 | 386 | |
| 383 | | READ16_DEVICE_HANDLER( deco_bac06_pf_data_r ) |
| 387 | READ16_MEMBER( deco_bac06_device::pf_data_r ) |
| 384 | 388 | { |
| 385 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 386 | | if (dev->m_rambank&1) offset+=0x1000; |
| 389 | if (m_rambank&1) offset+=0x1000; |
| 387 | 390 | |
| 388 | | return dev->pf_data[offset]; |
| 391 | return m_pf_data[offset]; |
| 389 | 392 | } |
| 390 | 393 | |
| 391 | | |
| 392 | | |
| 393 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_w ) |
| 394 | WRITE8_MEMBER( deco_bac06_device::pf_data_8bit_w ) |
| 394 | 395 | { |
| 395 | 396 | if (offset&1) |
| 396 | | deco_bac06_pf_data_w(device,space,offset/2,data,0x00ff); |
| 397 | pf_data_w(space,offset/2,data,0x00ff); |
| 397 | 398 | else |
| 398 | | deco_bac06_pf_data_w(device,space,offset/2,data<<8,0xff00); |
| 399 | pf_data_w(space,offset/2,data<<8,0xff00); |
| 399 | 400 | } |
| 400 | 401 | |
| 401 | | READ8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_r ) |
| 402 | READ8_MEMBER( deco_bac06_device::pf_data_8bit_r ) |
| 402 | 403 | { |
| 403 | 404 | if (offset&1) /* MSB */ |
| 404 | | return deco_bac06_pf_data_r(device,space,offset/2,0x00ff); |
| 405 | return pf_data_r(space,offset/2,0x00ff); |
| 405 | 406 | else |
| 406 | | return deco_bac06_pf_data_r(device,space,offset/2,0xff00)>>8; |
| 407 | return pf_data_r(space,offset/2,0xff00)>>8; |
| 407 | 408 | } |
| 408 | 409 | |
| 409 | | WRITE16_DEVICE_HANDLER( deco_bac06_pf_rowscroll_w ) |
| 410 | WRITE16_MEMBER( deco_bac06_device::pf_rowscroll_w ) |
| 410 | 411 | { |
| 411 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 412 | | COMBINE_DATA(&dev->pf_rowscroll[offset]); |
| 412 | COMBINE_DATA(&m_pf_rowscroll[offset]); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | | WRITE16_DEVICE_HANDLER( deco_bac06_pf_colscroll_w ) |
| 415 | WRITE16_MEMBER( deco_bac06_device::pf_colscroll_w ) |
| 416 | 416 | { |
| 417 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 418 | | COMBINE_DATA(&dev->pf_colscroll[offset]); |
| 417 | COMBINE_DATA(&m_pf_colscroll[offset]); |
| 419 | 418 | } |
| 420 | 419 | |
| 421 | | READ16_DEVICE_HANDLER( deco_bac06_pf_rowscroll_r ) |
| 420 | READ16_MEMBER( deco_bac06_device::pf_rowscroll_r ) |
| 422 | 421 | { |
| 423 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 424 | | return dev->pf_rowscroll[offset]; |
| 422 | return m_pf_rowscroll[offset]; |
| 425 | 423 | } |
| 426 | 424 | |
| 427 | | READ16_DEVICE_HANDLER( deco_bac06_pf_colscroll_r ) |
| 425 | READ16_MEMBER( deco_bac06_device::pf_colscroll_r ) |
| 428 | 426 | { |
| 429 | | deco_bac06_device *dev = (deco_bac06_device*)device; |
| 430 | | return dev->pf_colscroll[offset]; |
| 427 | return m_pf_colscroll[offset]; |
| 431 | 428 | } |
| 432 | 429 | |
| 433 | 430 | /* used by dec8.c */ |
| 434 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_control0_8bit_w ) |
| 431 | WRITE8_MEMBER( deco_bac06_device::pf_control0_8bit_w ) |
| 435 | 432 | { |
| 436 | 433 | if (offset&1) |
| 437 | | deco_bac06_pf_control_0_w(device,space,offset/2,data,0x00ff); // oscar (mirrors?) |
| 434 | pf_control_0_w(space,offset/2,data,0x00ff); // oscar (mirrors?) |
| 438 | 435 | else |
| 439 | | deco_bac06_pf_control_0_w(device,space,offset/2,data,0x00ff); |
| 436 | pf_control_0_w(space,offset/2,data,0x00ff); |
| 440 | 437 | } |
| 441 | 438 | |
| 442 | 439 | /* used by dec8.c */ |
| 443 | | READ8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_r ) |
| 440 | READ8_MEMBER( deco_bac06_device::pf_control1_8bit_r ) |
| 444 | 441 | { |
| 445 | 442 | if (offset&1) |
| 446 | | return deco_bac06_pf_control_1_r(device,space,offset/2,0x00ff); |
| 443 | return pf_control_1_r(space,offset/2,0x00ff); |
| 447 | 444 | else |
| 448 | | return deco_bac06_pf_control_1_r(device,space,offset/2,0xff00)>>8; |
| 445 | return pf_control_1_r(space,offset/2,0xff00)>>8; |
| 449 | 446 | } |
| 450 | 447 | |
| 451 | 448 | /* used by dec8.c */ |
| 452 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_w ) |
| 449 | WRITE8_MEMBER( deco_bac06_device::pf_control1_8bit_w ) |
| 453 | 450 | { |
| 454 | 451 | if (offset<4) // these registers are 16-bit? |
| 455 | 452 | { |
| 456 | 453 | if (offset&1) |
| 457 | | deco_bac06_pf_control_1_w(device,space,offset/2,data,0x00ff); |
| 454 | pf_control_1_w(space,offset/2,data,0x00ff); |
| 458 | 455 | else |
| 459 | | deco_bac06_pf_control_1_w(device,space,offset/2,data<<8,0xff00); |
| 456 | pf_control_1_w(space,offset/2,data<<8,0xff00); |
| 460 | 457 | } |
| 461 | 458 | else // these registers are 8-bit and mirror? (triothep vs actfancr) |
| 462 | 459 | { |
| 463 | 460 | if (offset&1) |
| 464 | | deco_bac06_pf_control_1_w(device,space,offset/2,data,0x00ff); |
| 461 | pf_control_1_w(space,offset/2,data,0x00ff); |
| 465 | 462 | else |
| 466 | | deco_bac06_pf_control_1_w(device,space,offset/2,data,0x00ff); |
| 463 | pf_control_1_w(space,offset/2,data,0x00ff); |
| 467 | 464 | } |
| 468 | 465 | } |
| 469 | 466 | |
| 470 | | READ8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_r ) |
| 467 | READ8_MEMBER( deco_bac06_device::pf_rowscroll_8bit_r ) |
| 471 | 468 | { |
| 472 | 469 | if (offset&1) |
| 473 | | return deco_bac06_pf_rowscroll_r(device,space,offset/2,0x00ff); |
| 470 | return pf_rowscroll_r(space,offset/2,0x00ff); |
| 474 | 471 | else |
| 475 | | return deco_bac06_pf_rowscroll_r(device,space,offset/2,0xff00)>>8; |
| 472 | return pf_rowscroll_r(space,offset/2,0xff00)>>8; |
| 476 | 473 | } |
| 477 | 474 | |
| 478 | 475 | |
| 479 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_w ) |
| 476 | WRITE8_MEMBER( deco_bac06_device::pf_rowscroll_8bit_w ) |
| 480 | 477 | { |
| 481 | 478 | if (offset&1) |
| 482 | | deco_bac06_pf_rowscroll_w(device,space,offset/2,data,0x00ff); |
| 479 | pf_rowscroll_w(space,offset/2,data,0x00ff); |
| 483 | 480 | else |
| 484 | | deco_bac06_pf_rowscroll_w(device,space,offset/2,data<<8,0xff00); |
| 481 | pf_rowscroll_w(space,offset/2,data<<8,0xff00); |
| 485 | 482 | } |
| 486 | 483 | |
| 487 | | READ8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_r ) |
| 484 | READ8_MEMBER( deco_bac06_device::pf_rowscroll_8bit_swap_r ) |
| 488 | 485 | { |
| 489 | 486 | if (offset&1) |
| 490 | | return deco_bac06_pf_rowscroll_r(device,space,offset/2,0xff00)>>8; |
| 487 | return pf_rowscroll_r(space,offset/2,0xff00)>>8; |
| 491 | 488 | else |
| 492 | | return deco_bac06_pf_rowscroll_r(device,space,offset/2,0x00ff); |
| 489 | return pf_rowscroll_r(space,offset/2,0x00ff); |
| 493 | 490 | } |
| 494 | 491 | |
| 495 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_w ) |
| 492 | WRITE8_MEMBER( deco_bac06_device::pf_rowscroll_8bit_swap_w ) |
| 496 | 493 | { |
| 497 | 494 | if (offset&1) |
| 498 | | deco_bac06_pf_rowscroll_w(device,space,offset/2,data<<8,0xff00); |
| 495 | pf_rowscroll_w(space,offset/2,data<<8,0xff00); |
| 499 | 496 | else |
| 500 | | deco_bac06_pf_rowscroll_w(device,space,offset/2,data,0x00ff); |
| 497 | pf_rowscroll_w(space,offset/2,data,0x00ff); |
| 501 | 498 | } |
| 502 | 499 | |
| 503 | 500 | |
| 504 | 501 | |
| 505 | 502 | /* used by hippodrm */ |
| 506 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_control0_8bit_packed_w ) |
| 503 | WRITE8_MEMBER( deco_bac06_device::pf_control0_8bit_packed_w ) |
| 507 | 504 | { |
| 508 | 505 | if (offset&1) |
| 509 | | deco_bac06_pf_control_0_w(device,space,offset/2,data<<8,0xff00); |
| 506 | pf_control_0_w(space,offset/2,data<<8,0xff00); |
| 510 | 507 | else |
| 511 | | deco_bac06_pf_control_0_w(device,space,offset/2,data,0x00ff); |
| 508 | pf_control_0_w(space,offset/2,data,0x00ff); |
| 512 | 509 | } |
| 513 | 510 | |
| 514 | 511 | /* used by hippodrm */ |
| 515 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_swap_w ) |
| 512 | WRITE8_MEMBER( deco_bac06_device::pf_control1_8bit_swap_w ) |
| 516 | 513 | { |
| 517 | | deco_bac06_pf_control1_8bit_w(device,space, offset^1, data); |
| 514 | pf_control1_8bit_w(space, offset^1, data); |
| 518 | 515 | } |
| 519 | 516 | |
| 520 | 517 | /* used by hippodrm */ |
| 521 | | READ8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_r ) |
| 518 | READ8_MEMBER( deco_bac06_device::pf_data_8bit_swap_r ) |
| 522 | 519 | { |
| 523 | | return deco_bac06_pf_data_8bit_r(device,space, offset^1); |
| 520 | return pf_data_8bit_r(space, offset^1); |
| 524 | 521 | } |
| 525 | 522 | |
| 526 | 523 | /* used by hippodrm */ |
| 527 | | WRITE8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_w ) |
| 524 | WRITE8_MEMBER( deco_bac06_device::pf_data_8bit_swap_w ) |
| 528 | 525 | { |
| 529 | | deco_bac06_pf_data_8bit_w(device,space, offset^1, data); |
| 526 | pf_data_8bit_w(space, offset^1, data); |
| 530 | 527 | } |
trunk/src/mame/video/taitoic.c
| r24008 | r24009 | |
| 549 | 549 | const device_type PC080SN = &device_creator<pc080sn_device>; |
| 550 | 550 | |
| 551 | 551 | pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 552 | | : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock, "pc080sn", __FILE__) |
| 552 | : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock, "pc080sn", __FILE__), |
| 553 | m_ram(NULL) |
| 554 | //m_bg_ram[0](NULL), |
| 555 | //m_bg_ram[1](NULL), |
| 556 | //m_bgscroll_ram[0](NULL), |
| 557 | //m_bgscroll_ram[1](NULL) |
| 553 | 558 | { |
| 554 | 559 | } |
| 555 | 560 | |
| r24008 | r24009 | |
| 1005 | 1010 | const device_type PC090OJ = &device_creator<pc090oj_device>; |
| 1006 | 1011 | |
| 1007 | 1012 | pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1008 | | : device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock, "pc090oj", __FILE__) |
| 1013 | : device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock, "pc090oj", __FILE__), |
| 1014 | m_ctrl(0), |
| 1015 | m_sprite_ctrl(0), |
| 1016 | m_ram(NULL), |
| 1017 | m_ram_buffered(0) |
| 1009 | 1018 | { |
| 1010 | 1019 | } |
| 1011 | 1020 | |
| r24008 | r24009 | |
| 1176 | 1185 | const device_type TC0080VCO = &device_creator<tc0080vco_device>; |
| 1177 | 1186 | |
| 1178 | 1187 | tc0080vco_device::tc0080vco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1179 | | : device_t(mconfig, TC0080VCO, "Taito TC0080VCO", tag, owner, clock, "tc0080vco", __FILE__) |
| 1188 | : device_t(mconfig, TC0080VCO, "Taito TC0080VCO", tag, owner, clock, "tc0080vco", __FILE__), |
| 1189 | m_ram(NULL), |
| 1190 | m_bg0_ram_0(NULL), |
| 1191 | m_bg0_ram_1(NULL), |
| 1192 | m_bg1_ram_0(NULL), |
| 1193 | m_bg1_ram_1(NULL), |
| 1194 | m_tx_ram_0(NULL), |
| 1195 | m_tx_ram_1(NULL), |
| 1196 | m_char_ram(NULL), |
| 1197 | m_bgscroll_ram(NULL), |
| 1198 | m_chain_ram_0(NULL), |
| 1199 | m_chain_ram_1(NULL), |
| 1200 | m_spriteram(NULL), |
| 1201 | m_scroll_ram(NULL), |
| 1202 | m_bg0_scrollx(0), |
| 1203 | m_bg0_scrolly(0), |
| 1204 | m_bg1_scrollx(0), |
| 1205 | m_bg1_scrolly(0), |
| 1206 | m_flipscreen(0) |
| 1180 | 1207 | { |
| 1181 | 1208 | } |
| 1182 | 1209 | |
| r24008 | r24009 | |
| 1261 | 1288 | m_scroll_ram = m_ram + 0x20800 / 2; |
| 1262 | 1289 | |
| 1263 | 1290 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 1264 | | machine().gfx[m_txnum] = auto_alloc(machine(), gfx_element(machine(), charlayout, (UINT8 *)m_char_ram, 64, 0)); |
| 1291 | machine().gfx[m_txnum] = auto_alloc_clear(machine(), gfx_element(machine(), charlayout, (UINT8 *)m_char_ram, 64, 0)); |
| 1265 | 1292 | |
| 1266 | 1293 | save_pointer(NAME(m_ram), TC0080VCO_RAM_SIZE / 2); |
| 1267 | 1294 | machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_device::postload), this)); |
| r24008 | r24009 | |
| 1810 | 1837 | const device_type TC0100SCN = &device_creator<tc0100scn_device>; |
| 1811 | 1838 | |
| 1812 | 1839 | tc0100scn_device::tc0100scn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1813 | | : device_t(mconfig, TC0100SCN, "Taito TC0100SCN", tag, owner, clock, "tc0100scn", __FILE__) |
| 1840 | : device_t(mconfig, TC0100SCN, "Taito TC0100SCN", tag, owner, clock, "tc0100scn", __FILE__), |
| 1841 | m_ram(NULL), |
| 1842 | m_bg_ram(NULL), |
| 1843 | m_fg_ram(NULL), |
| 1844 | m_tx_ram(NULL), |
| 1845 | m_char_ram(NULL), |
| 1846 | m_bgscroll_ram(NULL), |
| 1847 | m_fgscroll_ram(NULL), |
| 1848 | m_colscroll_ram(NULL), |
| 1849 | m_bgscrollx(0), |
| 1850 | m_bgscrolly(0), |
| 1851 | m_fgscrollx(0), |
| 1852 | m_fgscrolly(0), |
| 1853 | m_bg_col_mult(0), |
| 1854 | m_bg_tilemask(0), |
| 1855 | m_tx_col_mult(0), |
| 1856 | m_gfxbank(0), |
| 1857 | m_colbank(0), |
| 1858 | m_bg0_colbank(0), |
| 1859 | m_bg1_colbank(0), |
| 1860 | m_tx_colbank(0), |
| 1861 | m_dblwidth(0), |
| 1862 | m_screen(NULL) |
| 1814 | 1863 | { |
| 1815 | | // device stuff |
| 1816 | | for (int i=0;i<8;i++) |
| 1817 | | m_ctrl[i] = 0; |
| 1818 | | |
| 1819 | | m_ram = 0; |
| 1820 | | m_bg_ram = 0; |
| 1821 | | m_fg_ram = 0; |
| 1822 | | m_tx_ram = 0; |
| 1823 | | m_char_ram = 0; |
| 1824 | | m_bgscroll_ram = 0; |
| 1825 | | m_fgscroll_ram = 0; |
| 1826 | | m_colscroll_ram = 0; |
| 1827 | | |
| 1828 | | m_bgscrollx = 0; |
| 1829 | | m_bgscrolly = 0; |
| 1830 | | m_fgscrollx = 0; |
| 1831 | | m_fgscrolly = 0; |
| 1832 | | |
| 1833 | | m_bg_col_mult = 0; |
| 1834 | | m_bg_tilemask = 0; |
| 1835 | | m_tx_col_mult = 0; |
| 1836 | | m_gfxbank = 0; |
| 1837 | | m_colbank = 0; |
| 1838 | | m_bg0_colbank = 0; |
| 1839 | | m_bg1_colbank = 0; |
| 1840 | | m_tx_colbank = 0; |
| 1841 | | m_dblwidth = 0; |
| 1842 | | |
| 1843 | | //m_tilemap[3][2]; |
| 1844 | | //m_cliprect; |
| 1845 | | |
| 1846 | | m_screen = 0; |
| 1847 | | |
| 1848 | | // interface stuff |
| 1849 | | m_screen_tag = 0; |
| 1850 | | |
| 1851 | | m_gfxnum = 0; |
| 1852 | | m_txnum = 0; |
| 1853 | | |
| 1854 | | m_x_offset = 0; |
| 1855 | | m_y_offset = 0; |
| 1856 | | m_flip_xoffs = 0; |
| 1857 | | m_flip_yoffs = 0; |
| 1858 | | m_flip_text_xoffs = 0; |
| 1859 | | m_flip_text_yoffs = 0; |
| 1860 | | |
| 1861 | | m_multiscrn_xoffs = 0; |
| 1862 | | m_multiscrn_hack = 0; |
| 1863 | | |
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | //------------------------------------------------- |
| r24008 | r24009 | |
| 1983 | 1983 | /* we call this here, so that they can be modified at VIDEO_START*/ |
| 1984 | 1984 | |
| 1985 | 1985 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 1986 | | machine().gfx[m_txnum] = auto_alloc(machine(), gfx_element(machine(), tc0100scn_charlayout, (UINT8 *)m_char_ram, 64, 0)); |
| 1986 | machine().gfx[m_txnum] = auto_alloc_clear(machine(), gfx_element(machine(), tc0100scn_charlayout, (UINT8 *)m_char_ram, 64, 0)); |
| 1987 | 1987 | |
| 1988 | 1988 | save_pointer(NAME(m_ram), TC0100SCN_RAM_SIZE / 2); |
| 1989 | 1989 | save_item(NAME(m_ctrl)); |
| r24008 | r24009 | |
| 2433 | 2433 | const device_type TC0280GRD = &device_creator<tc0280grd_device>; |
| 2434 | 2434 | |
| 2435 | 2435 | tc0280grd_device::tc0280grd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 2436 | | : device_t(mconfig, TC0280GRD, "Taito TC0280GRD & TC0430GRW", tag, owner, clock, "tc0280grd", __FILE__) |
| 2436 | : device_t(mconfig, TC0280GRD, "Taito TC0280GRD & TC0430GRW", tag, owner, clock, "tc0280grd", __FILE__), |
| 2437 | m_ram(NULL), |
| 2438 | //m_ctrl[8](0), |
| 2439 | m_base_color(0) |
| 2437 | 2440 | { |
| 2438 | 2441 | } |
| 2439 | 2442 | |
| r24008 | r24009 | |
| 2465 | 2468 | m_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0280grd_device::tc0280grd_get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); |
| 2466 | 2469 | m_tilemap->set_transparent_pen(0); |
| 2467 | 2470 | |
| 2468 | | m_ram = auto_alloc_array(machine(), UINT16, TC0280GRD_RAM_SIZE / 2); |
| 2471 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0280GRD_RAM_SIZE / 2); |
| 2469 | 2472 | |
| 2470 | 2473 | save_pointer(NAME(m_ram), TC0280GRD_RAM_SIZE / 2); |
| 2471 | 2474 | save_item(NAME(m_ctrl)); |
| r24008 | r24009 | |
| 2599 | 2602 | |
| 2600 | 2603 | tc0360pri_device::tc0360pri_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 2601 | 2604 | : device_t(mconfig, TC0360PRI, "Taito TC0360PRI", tag, owner, clock, "tc0360pri", __FILE__) |
| 2605 | // m_regs[16](0), |
| 2602 | 2606 | { |
| 2603 | 2607 | } |
| 2604 | 2608 | |
| r24008 | r24009 | |
| 2666 | 2670 | /* */ |
| 2667 | 2671 | /***************************************************************************/ |
| 2668 | 2672 | |
| 2669 | | struct tc0480scp_state |
| 2670 | | { |
| 2671 | | UINT16 ctrl[0x18]; |
| 2673 | #define TC0480SCP_RAM_SIZE 0x10000 |
| 2674 | #define TC0480SCP_TOTAL_CHARS 256 |
| 2672 | 2675 | |
| 2673 | | UINT16 * ram; |
| 2674 | | UINT16 * bg_ram[4]; |
| 2675 | | UINT16 * tx_ram; |
| 2676 | | UINT16 * char_ram; |
| 2677 | | UINT16 * bgscroll_ram[4]; |
| 2678 | | UINT16 * rowzoom_ram[4]; |
| 2679 | | UINT16 * bgcolumn_ram[4]; |
| 2680 | | int bgscrollx[4]; |
| 2681 | | int bgscrolly[4]; |
| 2682 | | int pri_reg; |
| 2683 | 2676 | |
| 2684 | | /* We keep two tilemaps for each of the 5 actual tilemaps: one at standard width, one double */ |
| 2685 | | tilemap_t *tilemap[5][2]; |
| 2686 | | int bg_gfx, tx_gfx; |
| 2687 | | INT32 tile_colbase, dblwidth; |
| 2688 | | int x_offs, y_offs; |
| 2689 | | int text_xoffs, text_yoffs; |
| 2690 | | int flip_xoffs, flip_yoffs; |
| 2691 | | }; |
| 2692 | 2677 | |
| 2693 | | #define TC0480SCP_RAM_SIZE 0x10000 |
| 2694 | | #define TC0480SCP_TOTAL_CHARS 256 |
| 2678 | const device_type TC0480SCP = &device_creator<tc0480scp_device>; |
| 2695 | 2679 | |
| 2696 | | /***************************************************************************** |
| 2697 | | INLINE FUNCTIONS |
| 2698 | | *****************************************************************************/ |
| 2680 | tc0480scp_device::tc0480scp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 2681 | : device_t(mconfig, TC0480SCP, "Taito TC0480SCP", tag, owner, clock, "tc0480scp", __FILE__), |
| 2682 | // m_ctrl[0x18](0), |
| 2683 | m_ram(NULL), |
| 2684 | //m_bg_ram[4](NULL), |
| 2685 | m_tx_ram(NULL), |
| 2686 | m_char_ram(NULL), |
| 2687 | //m_bgscroll_ram[4](NULL), |
| 2688 | //m_rowzoom_ram[4](NULL), |
| 2689 | //m_bgcolumn_ram[4](NULL), |
| 2690 | //m_bgscrollx[4](NULL), |
| 2691 | //m_bgscrolly[4](NULL), |
| 2692 | m_pri_reg(0), |
| 2693 | m_dblwidth(0), |
| 2694 | m_x_offs(0) |
| 2695 | { |
| 2696 | } |
| 2699 | 2697 | |
| 2700 | | INLINE tc0480scp_state *tc0480scp_get_safe_token( device_t *device ) |
| 2698 | //------------------------------------------------- |
| 2699 | // device_config_complete - perform any |
| 2700 | // operations now that the configuration is |
| 2701 | // complete |
| 2702 | //------------------------------------------------- |
| 2703 | |
| 2704 | void tc0480scp_device::device_config_complete() |
| 2701 | 2705 | { |
| 2702 | | assert(device != NULL); |
| 2703 | | assert(device->type() == TC0480SCP); |
| 2706 | // inherit a copy of the static data |
| 2707 | const tc0480scp_interface *intf = reinterpret_cast<const tc0480scp_interface *>(static_config()); |
| 2708 | if (intf != NULL) |
| 2709 | *static_cast<tc0480scp_interface *>(this) = *intf; |
| 2710 | |
| 2711 | // or initialize to defaults if none provided |
| 2712 | else |
| 2713 | { |
| 2714 | } |
| 2715 | } |
| 2704 | 2716 | |
| 2705 | | return (tc0480scp_state *)downcast<tc0480scp_device *>(device)->token(); |
| 2717 | //------------------------------------------------- |
| 2718 | // device_start - device-specific startup |
| 2719 | //------------------------------------------------- |
| 2720 | |
| 2721 | void tc0480scp_device::device_start() |
| 2722 | { |
| 2723 | int i, xd, yd; |
| 2724 | |
| 2725 | m_x_offs = m_x_offset + m_pixels; |
| 2726 | |
| 2727 | |
| 2728 | static const gfx_layout tc0480scp_charlayout = |
| 2729 | { |
| 2730 | 8,8, /* 8*8 characters */ |
| 2731 | 256, /* 256 characters */ |
| 2732 | 4, /* 4 bits per pixel */ |
| 2733 | { 0, 1, 2, 3 }, |
| 2734 | { XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4, XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4 }, |
| 2735 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 2736 | 32*8 /* every sprite takes 32 consecutive bytes */ |
| 2737 | }; |
| 2738 | |
| 2739 | |
| 2740 | /* Single width versions */ |
| 2741 | m_tilemap[0][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 2742 | m_tilemap[1][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 2743 | m_tilemap[2][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 2744 | m_tilemap[3][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg3_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 2745 | m_tilemap[4][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); |
| 2746 | |
| 2747 | /* Double width versions */ |
| 2748 | m_tilemap[0][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 2749 | m_tilemap[1][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 2750 | m_tilemap[2][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 2751 | m_tilemap[3][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_bg3_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 2752 | m_tilemap[4][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); |
| 2753 | |
| 2754 | for (i = 0; i < 2; i++) |
| 2755 | { |
| 2756 | m_tilemap[0][i]->set_transparent_pen(0); |
| 2757 | m_tilemap[1][i]->set_transparent_pen(0); |
| 2758 | m_tilemap[2][i]->set_transparent_pen(0); |
| 2759 | m_tilemap[3][i]->set_transparent_pen(0); |
| 2760 | m_tilemap[4][i]->set_transparent_pen(0); |
| 2761 | } |
| 2762 | |
| 2763 | xd = -m_x_offs; |
| 2764 | yd = m_y_offset; |
| 2765 | |
| 2766 | /* Metalb and Deadconx have minor screenflip issues: blue planet |
| 2767 | is off on x axis by 1 and in Deadconx the dark blue screen |
| 2768 | between stages also seems off by 1 pixel. */ |
| 2769 | |
| 2770 | /* It's not possible to get the text scrolldx calculations |
| 2771 | harmonised with the other layers: xd-2, 315-xd is the |
| 2772 | next valid pair:- the numbers diverge from xd, 319-xd */ |
| 2773 | |
| 2774 | /* Single width offsets */ |
| 2775 | m_tilemap[0][0]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2776 | m_tilemap[0][0]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2777 | m_tilemap[1][0]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2778 | m_tilemap[1][0]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2779 | m_tilemap[2][0]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2780 | m_tilemap[2][0]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2781 | m_tilemap[3][0]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2782 | m_tilemap[3][0]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2783 | m_tilemap[4][0]->set_scrolldx(xd - 3, 316 - xd); /* text layer */ |
| 2784 | m_tilemap[4][0]->set_scrolldy(yd, 256 - yd); /* text layer */ |
| 2785 | |
| 2786 | /* Double width offsets */ |
| 2787 | m_tilemap[0][1]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2788 | m_tilemap[0][1]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2789 | m_tilemap[1][1]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2790 | m_tilemap[1][1]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2791 | m_tilemap[2][1]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2792 | m_tilemap[2][1]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2793 | m_tilemap[3][1]->set_scrolldx(xd, 320 - xd + m_flip_xoffs); |
| 2794 | m_tilemap[3][1]->set_scrolldy(yd, 256 - yd + m_flip_yoffs); |
| 2795 | m_tilemap[4][1]->set_scrolldx(xd - 3, 317 - xd); /* text layer */ |
| 2796 | m_tilemap[4][1]->set_scrolldy(yd, 256 - yd); /* text layer */ |
| 2797 | |
| 2798 | for (i = 0; i < 2; i++) |
| 2799 | { |
| 2800 | /* Both sets of bg tilemaps scrollable per pixel row */ |
| 2801 | m_tilemap[0][i]->set_scroll_rows(512); |
| 2802 | m_tilemap[1][i]->set_scroll_rows(512); |
| 2803 | m_tilemap[2][i]->set_scroll_rows(512); |
| 2804 | m_tilemap[3][i]->set_scroll_rows(512); |
| 2805 | } |
| 2806 | |
| 2807 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0480SCP_RAM_SIZE / 2); |
| 2808 | |
| 2809 | set_layer_ptrs(); |
| 2810 | |
| 2811 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 2812 | machine().gfx[m_txnum] = auto_alloc_clear(machine(), gfx_element(machine(), tc0480scp_charlayout, (UINT8 *)m_char_ram, 64, 0)); |
| 2813 | |
| 2814 | save_pointer(NAME(m_ram), TC0480SCP_RAM_SIZE / 2); |
| 2815 | save_item(NAME(m_ctrl)); |
| 2816 | save_item(NAME(m_dblwidth)); |
| 2817 | machine().save().register_postload(save_prepost_delegate(FUNC(tc0480scp_device::postload), this)); |
| 2706 | 2818 | } |
| 2707 | 2819 | |
| 2708 | | INLINE const tc0480scp_interface *tc0480scp_get_interface( device_t *device ) |
| 2820 | //------------------------------------------------- |
| 2821 | // device_reset - device-specific reset |
| 2822 | //------------------------------------------------- |
| 2823 | |
| 2824 | void tc0480scp_device::device_reset() |
| 2709 | 2825 | { |
| 2710 | | assert(device != NULL); |
| 2711 | | assert((device->type() == TC0480SCP)); |
| 2712 | | return (const tc0480scp_interface *) device->static_config(); |
| 2826 | int i; |
| 2827 | |
| 2828 | m_dblwidth = 0; |
| 2829 | |
| 2830 | for (i = 0; i < 0x18; i++) |
| 2831 | m_ctrl[i] = 0; |
| 2832 | |
| 2713 | 2833 | } |
| 2714 | 2834 | |
| 2715 | 2835 | /***************************************************************************** |
| r24008 | r24009 | |
| 2717 | 2837 | *****************************************************************************/ |
| 2718 | 2838 | |
| 2719 | 2839 | |
| 2720 | | INLINE void common_get_tc0480bg_tile_info( running_machine &machine, device_t *device, tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum ) |
| 2840 | void tc0480scp_device::common_get_tc0480bg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum ) |
| 2721 | 2841 | { |
| 2722 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2723 | 2842 | int code = ram[2 * tile_index + 1] & 0x7fff; |
| 2724 | 2843 | int attr = ram[2 * tile_index]; |
| 2725 | | SET_TILE_INFO( |
| 2844 | SET_TILE_INFO_MEMBER( |
| 2726 | 2845 | gfxnum, |
| 2727 | 2846 | code, |
| 2728 | | (attr & 0xff) + tc0480scp->tile_colbase, |
| 2847 | (attr & 0xff) + m_col_base, |
| 2729 | 2848 | TILE_FLIPYX((attr & 0xc000) >> 14)); |
| 2730 | 2849 | } |
| 2731 | 2850 | |
| 2732 | | INLINE void common_get_tc0480tx_tile_info( running_machine &machine, device_t *device, tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum ) |
| 2851 | void tc0480scp_device::common_get_tc0480tx_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum ) |
| 2733 | 2852 | { |
| 2734 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2735 | 2853 | int attr = ram[tile_index]; |
| 2736 | | SET_TILE_INFO( |
| 2854 | SET_TILE_INFO_MEMBER( |
| 2737 | 2855 | gfxnum, |
| 2738 | 2856 | attr & 0xff, |
| 2739 | | ((attr & 0x3f00) >> 8) + tc0480scp->tile_colbase, |
| 2857 | ((attr & 0x3f00) >> 8) + m_col_base, |
| 2740 | 2858 | TILE_FLIPYX((attr & 0xc000) >> 14)); |
| 2741 | 2859 | } |
| 2742 | 2860 | |
| 2743 | | TILE_GET_INFO_MEMBER(tc0480scp_device::tc0480scp_get_bg0_tile_info) |
| 2861 | TILE_GET_INFO_MEMBER(tc0480scp_device::get_bg0_tile_info) |
| 2744 | 2862 | { |
| 2745 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 2746 | | common_get_tc0480bg_tile_info(machine(), this, tileinfo, tile_index, tc0480scp->bg_ram[0], tc0480scp->bg_gfx ); |
| 2863 | common_get_tc0480bg_tile_info(tileinfo, tile_index, m_bg_ram[0], m_gfxnum ); |
| 2747 | 2864 | } |
| 2748 | 2865 | |
| 2749 | | TILE_GET_INFO_MEMBER(tc0480scp_device::tc0480scp_get_bg1_tile_info) |
| 2866 | TILE_GET_INFO_MEMBER(tc0480scp_device::get_bg1_tile_info) |
| 2750 | 2867 | { |
| 2751 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 2752 | | common_get_tc0480bg_tile_info(machine(), this, tileinfo, tile_index, tc0480scp->bg_ram[1], tc0480scp->bg_gfx); |
| 2868 | common_get_tc0480bg_tile_info(tileinfo, tile_index, m_bg_ram[1], m_gfxnum); |
| 2753 | 2869 | } |
| 2754 | 2870 | |
| 2755 | | TILE_GET_INFO_MEMBER(tc0480scp_device::tc0480scp_get_bg2_tile_info) |
| 2871 | TILE_GET_INFO_MEMBER(tc0480scp_device::get_bg2_tile_info) |
| 2756 | 2872 | { |
| 2757 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 2758 | | common_get_tc0480bg_tile_info(machine(), this, tileinfo, tile_index, tc0480scp->bg_ram[2], tc0480scp->bg_gfx); |
| 2873 | common_get_tc0480bg_tile_info(tileinfo, tile_index, m_bg_ram[2], m_gfxnum); |
| 2759 | 2874 | } |
| 2760 | 2875 | |
| 2761 | | TILE_GET_INFO_MEMBER(tc0480scp_device::tc0480scp_get_bg3_tile_info) |
| 2876 | TILE_GET_INFO_MEMBER(tc0480scp_device::get_bg3_tile_info) |
| 2762 | 2877 | { |
| 2763 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 2764 | | common_get_tc0480bg_tile_info(machine(), this, tileinfo, tile_index, tc0480scp->bg_ram[3], tc0480scp->bg_gfx); |
| 2878 | common_get_tc0480bg_tile_info(tileinfo, tile_index, m_bg_ram[3], m_gfxnum); |
| 2765 | 2879 | } |
| 2766 | 2880 | |
| 2767 | | TILE_GET_INFO_MEMBER(tc0480scp_device::tc0480scp_get_tx_tile_info) |
| 2881 | TILE_GET_INFO_MEMBER(tc0480scp_device::get_tx_tile_info) |
| 2768 | 2882 | { |
| 2769 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 2770 | | common_get_tc0480tx_tile_info(machine(), this, tileinfo, tile_index, tc0480scp->tx_ram, tc0480scp->tx_gfx); |
| 2883 | common_get_tc0480tx_tile_info(tileinfo, tile_index, m_tx_ram, m_txnum); |
| 2771 | 2884 | } |
| 2772 | 2885 | |
| 2773 | | static const gfx_layout tc0480scp_charlayout = |
| 2886 | void tc0480scp_device::dirty_tilemaps() |
| 2774 | 2887 | { |
| 2775 | | 8,8, /* 8*8 characters */ |
| 2776 | | 256, /* 256 characters */ |
| 2777 | | 4, /* 4 bits per pixel */ |
| 2778 | | { 0, 1, 2, 3 }, |
| 2779 | | { XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4, XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4 }, |
| 2780 | | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 2781 | | 32*8 /* every sprite takes 32 consecutive bytes */ |
| 2782 | | }; |
| 2783 | | |
| 2784 | | |
| 2785 | | static void tc0480scp_dirty_tilemaps( tc0480scp_state *tc0480scp ) |
| 2786 | | { |
| 2787 | | tc0480scp->tilemap[0][tc0480scp->dblwidth]->mark_all_dirty(); |
| 2788 | | tc0480scp->tilemap[1][tc0480scp->dblwidth]->mark_all_dirty(); |
| 2789 | | tc0480scp->tilemap[2][tc0480scp->dblwidth]->mark_all_dirty(); |
| 2790 | | tc0480scp->tilemap[3][tc0480scp->dblwidth]->mark_all_dirty(); |
| 2791 | | tc0480scp->tilemap[4][tc0480scp->dblwidth]->mark_all_dirty(); |
| 2888 | m_tilemap[0][m_dblwidth]->mark_all_dirty(); |
| 2889 | m_tilemap[1][m_dblwidth]->mark_all_dirty(); |
| 2890 | m_tilemap[2][m_dblwidth]->mark_all_dirty(); |
| 2891 | m_tilemap[3][m_dblwidth]->mark_all_dirty(); |
| 2892 | m_tilemap[4][m_dblwidth]->mark_all_dirty(); |
| 2792 | 2893 | } |
| 2793 | 2894 | |
| 2794 | 2895 | |
| 2795 | | static void tc0480scp_set_layer_ptrs( tc0480scp_state *tc0480scp ) |
| 2896 | void tc0480scp_device::set_layer_ptrs() |
| 2796 | 2897 | { |
| 2797 | | if (!tc0480scp->dblwidth) |
| 2898 | if (!m_dblwidth) |
| 2798 | 2899 | { |
| 2799 | | tc0480scp->bg_ram[0] = tc0480scp->ram + 0x0000; //0000 |
| 2800 | | tc0480scp->bg_ram[1] = tc0480scp->ram + 0x0800; //1000 |
| 2801 | | tc0480scp->bg_ram[2] = tc0480scp->ram + 0x1000; //2000 |
| 2802 | | tc0480scp->bg_ram[3] = tc0480scp->ram + 0x1800; //3000 |
| 2803 | | tc0480scp->bgscroll_ram[0] = tc0480scp->ram + 0x2000; //4000 |
| 2804 | | tc0480scp->bgscroll_ram[1] = tc0480scp->ram + 0x2200; //4400 |
| 2805 | | tc0480scp->bgscroll_ram[2] = tc0480scp->ram + 0x2400; //4800 |
| 2806 | | tc0480scp->bgscroll_ram[3] = tc0480scp->ram + 0x2600; //4c00 |
| 2807 | | tc0480scp->rowzoom_ram[2] = tc0480scp->ram + 0x3000; //6000 |
| 2808 | | tc0480scp->rowzoom_ram[3] = tc0480scp->ram + 0x3200; //6400 |
| 2809 | | tc0480scp->bgcolumn_ram[2] = tc0480scp->ram + 0x3400; //6800 |
| 2810 | | tc0480scp->bgcolumn_ram[3] = tc0480scp->ram + 0x3600; //6c00 |
| 2811 | | tc0480scp->tx_ram = tc0480scp->ram + 0x6000; //c000 |
| 2812 | | tc0480scp->char_ram = tc0480scp->ram + 0x7000; //e000 |
| 2900 | m_bg_ram[0] = m_ram + 0x0000; //0000 |
| 2901 | m_bg_ram[1] = m_ram + 0x0800; //1000 |
| 2902 | m_bg_ram[2] = m_ram + 0x1000; //2000 |
| 2903 | m_bg_ram[3] = m_ram + 0x1800; //3000 |
| 2904 | m_bgscroll_ram[0] = m_ram + 0x2000; //4000 |
| 2905 | m_bgscroll_ram[1] = m_ram + 0x2200; //4400 |
| 2906 | m_bgscroll_ram[2] = m_ram + 0x2400; //4800 |
| 2907 | m_bgscroll_ram[3] = m_ram + 0x2600; //4c00 |
| 2908 | m_rowzoom_ram[2] = m_ram + 0x3000; //6000 |
| 2909 | m_rowzoom_ram[3] = m_ram + 0x3200; //6400 |
| 2910 | m_bgcolumn_ram[2] = m_ram + 0x3400; //6800 |
| 2911 | m_bgcolumn_ram[3] = m_ram + 0x3600; //6c00 |
| 2912 | m_tx_ram = m_ram + 0x6000; //c000 |
| 2913 | m_char_ram = m_ram + 0x7000; //e000 |
| 2813 | 2914 | } |
| 2814 | 2915 | else |
| 2815 | 2916 | { |
| 2816 | | tc0480scp->bg_ram[0] = tc0480scp->ram + 0x0000; //0000 |
| 2817 | | tc0480scp->bg_ram[1] = tc0480scp->ram + 0x1000; //2000 |
| 2818 | | tc0480scp->bg_ram[2] = tc0480scp->ram + 0x2000; //4000 |
| 2819 | | tc0480scp->bg_ram[3] = tc0480scp->ram + 0x3000; //6000 |
| 2820 | | tc0480scp->bgscroll_ram[0] = tc0480scp->ram + 0x4000; //8000 |
| 2821 | | tc0480scp->bgscroll_ram[1] = tc0480scp->ram + 0x4200; //8400 |
| 2822 | | tc0480scp->bgscroll_ram[2] = tc0480scp->ram + 0x4400; //8800 |
| 2823 | | tc0480scp->bgscroll_ram[3] = tc0480scp->ram + 0x4600; //8c00 |
| 2824 | | tc0480scp->rowzoom_ram[2] = tc0480scp->ram + 0x5000; //a000 |
| 2825 | | tc0480scp->rowzoom_ram[3] = tc0480scp->ram + 0x5200; //a400 |
| 2826 | | tc0480scp->bgcolumn_ram[2] = tc0480scp->ram + 0x5400; //a800 |
| 2827 | | tc0480scp->bgcolumn_ram[3] = tc0480scp->ram + 0x5600; //ac00 |
| 2828 | | tc0480scp->tx_ram = tc0480scp->ram + 0x6000; //c000 |
| 2829 | | tc0480scp->char_ram = tc0480scp->ram + 0x7000; //e000 |
| 2917 | m_bg_ram[0] = m_ram + 0x0000; //0000 |
| 2918 | m_bg_ram[1] = m_ram + 0x1000; //2000 |
| 2919 | m_bg_ram[2] = m_ram + 0x2000; //4000 |
| 2920 | m_bg_ram[3] = m_ram + 0x3000; //6000 |
| 2921 | m_bgscroll_ram[0] = m_ram + 0x4000; //8000 |
| 2922 | m_bgscroll_ram[1] = m_ram + 0x4200; //8400 |
| 2923 | m_bgscroll_ram[2] = m_ram + 0x4400; //8800 |
| 2924 | m_bgscroll_ram[3] = m_ram + 0x4600; //8c00 |
| 2925 | m_rowzoom_ram[2] = m_ram + 0x5000; //a000 |
| 2926 | m_rowzoom_ram[3] = m_ram + 0x5200; //a400 |
| 2927 | m_bgcolumn_ram[2] = m_ram + 0x5400; //a800 |
| 2928 | m_bgcolumn_ram[3] = m_ram + 0x5600; //ac00 |
| 2929 | m_tx_ram = m_ram + 0x6000; //c000 |
| 2930 | m_char_ram = m_ram + 0x7000; //e000 |
| 2830 | 2931 | } |
| 2831 | 2932 | } |
| 2832 | 2933 | |
| 2833 | | READ16_DEVICE_HANDLER( tc0480scp_word_r ) |
| 2934 | READ16_MEMBER( tc0480scp_device::word_r ) |
| 2834 | 2935 | { |
| 2835 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2836 | | return tc0480scp->ram[offset]; |
| 2936 | return m_ram[offset]; |
| 2837 | 2937 | } |
| 2838 | 2938 | |
| 2839 | | WRITE16_DEVICE_HANDLER( tc0480scp_word_w ) |
| 2939 | WRITE16_MEMBER( tc0480scp_device::word_w ) |
| 2840 | 2940 | { |
| 2841 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2941 | COMBINE_DATA(&m_ram[offset]); |
| 2842 | 2942 | |
| 2843 | | COMBINE_DATA(&tc0480scp->ram[offset]); |
| 2844 | | |
| 2845 | | if (!tc0480scp->dblwidth) |
| 2943 | if (!m_dblwidth) |
| 2846 | 2944 | { |
| 2847 | 2945 | if (offset < 0x2000) |
| 2848 | 2946 | { |
| 2849 | | tc0480scp->tilemap[(offset / 0x800)][tc0480scp->dblwidth]->mark_tile_dirty(((offset % 0x800) / 2)); |
| 2947 | m_tilemap[(offset / 0x800)][m_dblwidth]->mark_tile_dirty(((offset % 0x800) / 2)); |
| 2850 | 2948 | } |
| 2851 | 2949 | else if (offset < 0x6000) |
| 2852 | 2950 | { /* do nothing */ |
| 2853 | 2951 | } |
| 2854 | 2952 | else if (offset < 0x7000) |
| 2855 | 2953 | { |
| 2856 | | tc0480scp->tilemap[4][tc0480scp->dblwidth]->mark_tile_dirty((offset - 0x6000)); |
| 2954 | m_tilemap[4][m_dblwidth]->mark_tile_dirty((offset - 0x6000)); |
| 2857 | 2955 | } |
| 2858 | 2956 | else if (offset <= 0x7fff) |
| 2859 | 2957 | { |
| 2860 | | space.machine().gfx[tc0480scp->tx_gfx]->mark_dirty((offset - 0x7000) / 16); |
| 2958 | space.machine().gfx[m_txnum]->mark_dirty((offset - 0x7000) / 16); |
| 2861 | 2959 | } |
| 2862 | 2960 | } |
| 2863 | 2961 | else |
| 2864 | 2962 | { |
| 2865 | 2963 | if (offset < 0x4000) |
| 2866 | 2964 | { |
| 2867 | | tc0480scp->tilemap[(offset / 0x1000)][tc0480scp->dblwidth]->mark_tile_dirty(((offset % 0x1000) / 2)); |
| 2965 | m_tilemap[(offset / 0x1000)][m_dblwidth]->mark_tile_dirty(((offset % 0x1000) / 2)); |
| 2868 | 2966 | } |
| 2869 | 2967 | else if (offset < 0x6000) |
| 2870 | 2968 | { /* do nothing */ |
| 2871 | 2969 | } |
| 2872 | 2970 | else if (offset < 0x7000) |
| 2873 | 2971 | { |
| 2874 | | tc0480scp->tilemap[4][tc0480scp->dblwidth]->mark_tile_dirty((offset - 0x6000)); |
| 2972 | m_tilemap[4][m_dblwidth]->mark_tile_dirty((offset - 0x6000)); |
| 2875 | 2973 | } |
| 2876 | 2974 | else if (offset <= 0x7fff) |
| 2877 | 2975 | { |
| 2878 | | space.machine().gfx[tc0480scp->tx_gfx]->mark_dirty((offset - 0x7000) / 16); |
| 2976 | space.machine().gfx[m_txnum]->mark_dirty((offset - 0x7000) / 16); |
| 2879 | 2977 | } |
| 2880 | 2978 | } |
| 2881 | 2979 | } |
| 2882 | 2980 | |
| 2883 | | READ16_DEVICE_HANDLER( tc0480scp_ctrl_word_r ) |
| 2981 | READ16_MEMBER( tc0480scp_device::ctrl_word_r ) |
| 2884 | 2982 | { |
| 2885 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2886 | | return tc0480scp->ctrl[offset]; |
| 2983 | return m_ctrl[offset]; |
| 2887 | 2984 | } |
| 2888 | 2985 | |
| 2889 | | WRITE16_DEVICE_HANDLER( tc0480scp_ctrl_word_w ) |
| 2986 | WRITE16_MEMBER( tc0480scp_device::ctrl_word_w ) |
| 2890 | 2987 | { |
| 2891 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 2892 | | int flip = tc0480scp->pri_reg & 0x40; |
| 2988 | int flip = m_pri_reg & 0x40; |
| 2893 | 2989 | |
| 2894 | | COMBINE_DATA(&tc0480scp->ctrl[offset]); |
| 2895 | | data = tc0480scp->ctrl[offset]; |
| 2990 | COMBINE_DATA(&m_ctrl[offset]); |
| 2991 | data = m_ctrl[offset]; |
| 2896 | 2992 | |
| 2897 | 2993 | switch (offset) |
| 2898 | 2994 | { |
| 2899 | 2995 | /* The x offsets of the four bg layers are staggered by intervals of 4 pixels */ |
| 2900 | 2996 | case 0x00: /* bg0 x */ |
| 2901 | 2997 | if (!flip) data = -data; |
| 2902 | | tc0480scp->bgscrollx[0] = data; |
| 2998 | m_bgscrollx[0] = data; |
| 2903 | 2999 | break; |
| 2904 | 3000 | |
| 2905 | 3001 | case 0x01: /* bg1 x */ |
| 2906 | 3002 | data += 4; |
| 2907 | 3003 | if (!flip) data = -data; |
| 2908 | | tc0480scp->bgscrollx[1] = data; |
| 3004 | m_bgscrollx[1] = data; |
| 2909 | 3005 | break; |
| 2910 | 3006 | |
| 2911 | 3007 | case 0x02: /* bg2 x */ |
| 2912 | 3008 | data += 8; |
| 2913 | 3009 | if (!flip) data = -data; |
| 2914 | | tc0480scp->bgscrollx[2] = data; |
| 3010 | m_bgscrollx[2] = data; |
| 2915 | 3011 | break; |
| 2916 | 3012 | |
| 2917 | 3013 | case 0x03: /* bg3 x */ |
| 2918 | 3014 | data += 12; |
| 2919 | 3015 | if (!flip) data = -data; |
| 2920 | | tc0480scp->bgscrollx[3] = data; |
| 3016 | m_bgscrollx[3] = data; |
| 2921 | 3017 | break; |
| 2922 | 3018 | |
| 2923 | 3019 | case 0x04: /* bg0 y */ |
| 2924 | 3020 | if (flip) data = -data; |
| 2925 | | tc0480scp->bgscrolly[0] = data; |
| 3021 | m_bgscrolly[0] = data; |
| 2926 | 3022 | break; |
| 2927 | 3023 | |
| 2928 | 3024 | case 0x05: /* bg1 y */ |
| 2929 | 3025 | if (flip) data = -data; |
| 2930 | | tc0480scp->bgscrolly[1] = data; |
| 3026 | m_bgscrolly[1] = data; |
| 2931 | 3027 | break; |
| 2932 | 3028 | |
| 2933 | 3029 | case 0x06: /* bg2 y */ |
| 2934 | 3030 | if (flip) data = -data; |
| 2935 | | tc0480scp->bgscrolly[2] = data; |
| 3031 | m_bgscrolly[2] = data; |
| 2936 | 3032 | break; |
| 2937 | 3033 | |
| 2938 | 3034 | case 0x07: /* bg3 y */ |
| 2939 | 3035 | if (flip) data = -data; |
| 2940 | | tc0480scp->bgscrolly[3] = data; |
| 3036 | m_bgscrolly[3] = data; |
| 2941 | 3037 | break; |
| 2942 | 3038 | |
| 2943 | 3039 | case 0x08: /* bg0 zoom */ |
| r24008 | r24009 | |
| 2949 | 3045 | case 0x0c: /* fg (text) x */ |
| 2950 | 3046 | |
| 2951 | 3047 | /* Text layer can be offset from bg0 (e.g. Metalb) */ |
| 2952 | | if (!flip) data -= tc0480scp->text_xoffs; |
| 2953 | | if (flip) data += tc0480scp->text_xoffs; |
| 3048 | if (!flip) data -= m_text_xoffs; |
| 3049 | if (flip) data += m_text_xoffs; |
| 2954 | 3050 | |
| 2955 | | tc0480scp->tilemap[4][0]->set_scrollx(0, -data); |
| 2956 | | tc0480scp->tilemap[4][1]->set_scrollx(0, -data); |
| 3051 | m_tilemap[4][0]->set_scrollx(0, -data); |
| 3052 | m_tilemap[4][1]->set_scrollx(0, -data); |
| 2957 | 3053 | break; |
| 2958 | 3054 | |
| 2959 | 3055 | case 0x0d: /* fg (text) y */ |
| 2960 | 3056 | |
| 2961 | 3057 | /* Text layer can be offset from bg0 (e.g. Slapshot) */ |
| 2962 | | if (!flip) data -= tc0480scp->text_yoffs; |
| 2963 | | if (flip) data += tc0480scp->text_yoffs; |
| 3058 | if (!flip) data -= m_text_yoffs; |
| 3059 | if (flip) data += m_text_yoffs; |
| 2964 | 3060 | |
| 2965 | | tc0480scp->tilemap[4][0]->set_scrolly(0, -data); |
| 2966 | | tc0480scp->tilemap[4][1]->set_scrolly(0, -data); |
| 3061 | m_tilemap[4][0]->set_scrolly(0, -data); |
| 3062 | m_tilemap[4][1]->set_scrolly(0, -data); |
| 2967 | 3063 | break; |
| 2968 | 3064 | |
| 2969 | 3065 | /* offset 0x0e unused */ |
| 2970 | 3066 | |
| 2971 | 3067 | case 0x0f: /* control register */ |
| 2972 | 3068 | { |
| 2973 | | int old_width = (tc0480scp->pri_reg & 0x80) >> 7; |
| 3069 | int old_width = (m_pri_reg & 0x80) >> 7; |
| 2974 | 3070 | flip = (data & 0x40) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0; |
| 2975 | | tc0480scp->pri_reg = data; |
| 3071 | m_pri_reg = data; |
| 2976 | 3072 | |
| 2977 | | tc0480scp->tilemap[0][0]->set_flip(flip); |
| 2978 | | tc0480scp->tilemap[1][0]->set_flip(flip); |
| 2979 | | tc0480scp->tilemap[2][0]->set_flip(flip); |
| 2980 | | tc0480scp->tilemap[3][0]->set_flip(flip); |
| 2981 | | tc0480scp->tilemap[4][0]->set_flip(flip); |
| 3073 | m_tilemap[0][0]->set_flip(flip); |
| 3074 | m_tilemap[1][0]->set_flip(flip); |
| 3075 | m_tilemap[2][0]->set_flip(flip); |
| 3076 | m_tilemap[3][0]->set_flip(flip); |
| 3077 | m_tilemap[4][0]->set_flip(flip); |
| 2982 | 3078 | |
| 2983 | | tc0480scp->tilemap[0][1]->set_flip(flip); |
| 2984 | | tc0480scp->tilemap[1][1]->set_flip(flip); |
| 2985 | | tc0480scp->tilemap[2][1]->set_flip(flip); |
| 2986 | | tc0480scp->tilemap[3][1]->set_flip(flip); |
| 2987 | | tc0480scp->tilemap[4][1]->set_flip(flip); |
| 3079 | m_tilemap[0][1]->set_flip(flip); |
| 3080 | m_tilemap[1][1]->set_flip(flip); |
| 3081 | m_tilemap[2][1]->set_flip(flip); |
| 3082 | m_tilemap[3][1]->set_flip(flip); |
| 3083 | m_tilemap[4][1]->set_flip(flip); |
| 2988 | 3084 | |
| 2989 | | tc0480scp->dblwidth = (tc0480scp->pri_reg & 0x80) >> 7; |
| 3085 | m_dblwidth = (m_pri_reg & 0x80) >> 7; |
| 2990 | 3086 | |
| 2991 | | if (tc0480scp->dblwidth != old_width) /* tilemap width is changing */ |
| 3087 | if (m_dblwidth != old_width) /* tilemap width is changing */ |
| 2992 | 3088 | { |
| 2993 | 3089 | /* Reinitialise layer pointers */ |
| 2994 | | tc0480scp_set_layer_ptrs(tc0480scp); |
| 3090 | set_layer_ptrs(); |
| 2995 | 3091 | |
| 2996 | 3092 | /* and ensure full redraw of tilemaps */ |
| 2997 | | tc0480scp_dirty_tilemaps(tc0480scp); |
| 3093 | dirty_tilemaps(); |
| 2998 | 3094 | } |
| 2999 | 3095 | |
| 3000 | 3096 | break; |
| r24008 | r24009 | |
| 3005 | 3101 | } |
| 3006 | 3102 | |
| 3007 | 3103 | |
| 3008 | | READ32_DEVICE_HANDLER( tc0480scp_ctrl_long_r ) |
| 3104 | READ32_MEMBER( tc0480scp_device::ctrl_long_r ) |
| 3009 | 3105 | { |
| 3010 | | return (tc0480scp_ctrl_word_r(device, space, offset * 2, 0xffff) << 16) | tc0480scp_ctrl_word_r(device, space, offset * 2 + 1, 0xffff); |
| 3106 | return (ctrl_word_r(space, offset * 2, 0xffff) << 16) | ctrl_word_r(space, offset * 2 + 1, 0xffff); |
| 3011 | 3107 | } |
| 3012 | 3108 | |
| 3013 | 3109 | /* TODO: byte access ? */ |
| 3014 | 3110 | |
| 3015 | | WRITE32_DEVICE_HANDLER( tc0480scp_ctrl_long_w ) |
| 3111 | WRITE32_MEMBER( tc0480scp_device::ctrl_long_w ) |
| 3016 | 3112 | { |
| 3017 | 3113 | if (ACCESSING_BITS_16_31) |
| 3018 | | tc0480scp_ctrl_word_w(device, space, offset * 2, data >> 16, mem_mask >> 16); |
| 3114 | ctrl_word_w(space, offset * 2, data >> 16, mem_mask >> 16); |
| 3019 | 3115 | if (ACCESSING_BITS_0_15) |
| 3020 | | tc0480scp_ctrl_word_w(device, space, (offset * 2) + 1, data & 0xffff, mem_mask & 0xffff); |
| 3116 | ctrl_word_w(space, (offset * 2) + 1, data & 0xffff, mem_mask & 0xffff); |
| 3021 | 3117 | } |
| 3022 | 3118 | |
| 3023 | | READ32_DEVICE_HANDLER( tc0480scp_long_r ) |
| 3119 | READ32_MEMBER( tc0480scp_device::long_r ) |
| 3024 | 3120 | { |
| 3025 | | return (tc0480scp_word_r(device, space, offset * 2, 0xffff) << 16) | tc0480scp_word_r(device, space, offset * 2 + 1, 0xffff); |
| 3121 | return (word_r(space, offset * 2, 0xffff) << 16) | word_r(space, offset * 2 + 1, 0xffff); |
| 3026 | 3122 | } |
| 3027 | 3123 | |
| 3028 | | WRITE32_DEVICE_HANDLER( tc0480scp_long_w ) |
| 3124 | WRITE32_MEMBER( tc0480scp_device::long_w ) |
| 3029 | 3125 | { |
| 3030 | 3126 | if (ACCESSING_BITS_16_31) |
| 3031 | 3127 | { |
| 3032 | | int oldword = tc0480scp_word_r(device, space, offset * 2, 0xffff); |
| 3128 | int oldword = word_r(space, offset * 2, 0xffff); |
| 3033 | 3129 | int newword = data >> 16; |
| 3034 | 3130 | if (!ACCESSING_BITS_16_23) |
| 3035 | 3131 | newword |= (oldword & 0x00ff); |
| 3036 | 3132 | if (!ACCESSING_BITS_24_31) |
| 3037 | 3133 | newword |= (oldword & 0xff00); |
| 3038 | | tc0480scp_word_w(device, space, offset * 2, newword, 0xffff); |
| 3134 | word_w(space, offset * 2, newword, 0xffff); |
| 3039 | 3135 | } |
| 3040 | 3136 | if (ACCESSING_BITS_0_15) |
| 3041 | 3137 | { |
| 3042 | | int oldword = tc0480scp_word_r(device, space, (offset * 2) + 1, 0xffff); |
| 3138 | int oldword = word_r(space, (offset * 2) + 1, 0xffff); |
| 3043 | 3139 | int newword = data & 0xffff; |
| 3044 | 3140 | if (!ACCESSING_BITS_0_7) |
| 3045 | 3141 | newword |= (oldword & 0x00ff); |
| 3046 | 3142 | if (!ACCESSING_BITS_8_15) |
| 3047 | 3143 | newword |= (oldword & 0xff00); |
| 3048 | | tc0480scp_word_w(device, space, (offset * 2) + 1, newword, 0xffff); |
| 3144 | word_w(space, (offset * 2) + 1, newword, 0xffff); |
| 3049 | 3145 | } |
| 3050 | 3146 | } |
| 3051 | 3147 | |
| 3052 | 3148 | |
| 3053 | | void tc0480scp_tilemap_update( device_t *device ) |
| 3149 | void tc0480scp_device::tilemap_update() |
| 3054 | 3150 | { |
| 3055 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3056 | 3151 | int layer, zoom, i, j; |
| 3057 | | int flip = tc0480scp->pri_reg & 0x40; |
| 3152 | int flip = m_pri_reg & 0x40; |
| 3058 | 3153 | |
| 3059 | 3154 | for (layer = 0; layer < 4; layer++) |
| 3060 | 3155 | { |
| 3061 | | tc0480scp->tilemap[layer][tc0480scp->dblwidth]->set_scrolly(0, tc0480scp->bgscrolly[layer]); |
| 3062 | | zoom = 0x10000 + 0x7f - tc0480scp->ctrl[0x08 + layer]; |
| 3156 | m_tilemap[layer][m_dblwidth]->set_scrolly(0, m_bgscrolly[layer]); |
| 3157 | zoom = 0x10000 + 0x7f - m_ctrl[0x08 + layer]; |
| 3063 | 3158 | |
| 3064 | 3159 | if (zoom != 0x10000) /* can't use scroll rows when zooming */ |
| 3065 | 3160 | { |
| 3066 | | tc0480scp->tilemap[layer][tc0480scp->dblwidth]->set_scrollx(0, tc0480scp->bgscrollx[layer]); |
| 3161 | m_tilemap[layer][m_dblwidth]->set_scrollx(0, m_bgscrollx[layer]); |
| 3067 | 3162 | } |
| 3068 | 3163 | else |
| 3069 | 3164 | { |
| 3070 | 3165 | for (j = 0; j < 512; j++) |
| 3071 | 3166 | { |
| 3072 | | i = tc0480scp->bgscroll_ram[layer][j]; |
| 3167 | i = m_bgscroll_ram[layer][j]; |
| 3073 | 3168 | |
| 3074 | 3169 | if (!flip) |
| 3075 | | tc0480scp->tilemap[layer][tc0480scp->dblwidth]->set_scrollx(j & 0x1ff, tc0480scp->bgscrollx[layer] - i); |
| 3170 | m_tilemap[layer][m_dblwidth]->set_scrollx(j & 0x1ff, m_bgscrollx[layer] - i); |
| 3076 | 3171 | else |
| 3077 | | tc0480scp->tilemap[layer][tc0480scp->dblwidth]->set_scrollx(j & 0x1ff, tc0480scp->bgscrollx[layer] + i); |
| 3172 | m_tilemap[layer][m_dblwidth]->set_scrollx(j & 0x1ff, m_bgscrollx[layer] + i); |
| 3078 | 3173 | } |
| 3079 | 3174 | } |
| 3080 | 3175 | } |
| r24008 | r24009 | |
| 3117 | 3212 | |
| 3118 | 3213 | **********************************************************************/ |
| 3119 | 3214 | |
| 3120 | | static void tc0480scp_bg01_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3215 | void tc0480scp_device::bg01_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3121 | 3216 | { |
| 3122 | 3217 | /* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max |
| 3123 | 3218 | Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max |
| 3124 | 3219 | (0x1a in Footchmp hiscore = shrunk) */ |
| 3125 | 3220 | |
| 3126 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3127 | | int zoomx = 0x10000 - (tc0480scp->ctrl[0x08 + layer] & 0xff00); |
| 3128 | | int zoomy = 0x10000 - (((tc0480scp->ctrl[0x08 + layer] & 0xff) - 0x7f) * 512); |
| 3221 | int zoomx = 0x10000 - (m_ctrl[0x08 + layer] & 0xff00); |
| 3222 | int zoomy = 0x10000 - (((m_ctrl[0x08 + layer] & 0xff) - 0x7f) * 512); |
| 3129 | 3223 | |
| 3130 | 3224 | if ((zoomx == 0x10000) && (zoomy == 0x10000)) /* no zoom, simple */ |
| 3131 | 3225 | { |
| 3132 | 3226 | /* Prevent bad things */ |
| 3133 | | tc0480scp->tilemap[layer][tc0480scp->dblwidth]->draw(bitmap, cliprect, flags, priority); |
| 3227 | m_tilemap[layer][m_dblwidth]->draw(bitmap, cliprect, flags, priority); |
| 3134 | 3228 | } |
| 3135 | 3229 | else /* zoom */ |
| 3136 | 3230 | { |
| r24008 | r24009 | |
| 3138 | 3232 | UINT8 *tsrc; |
| 3139 | 3233 | UINT16 scanline[512]; |
| 3140 | 3234 | UINT32 sx; |
| 3141 | | bitmap_ind16 &srcbitmap = tc0480scp->tilemap[layer][tc0480scp->dblwidth]->pixmap(); |
| 3142 | | bitmap_ind8 &flagsbitmap = tc0480scp->tilemap[layer][tc0480scp->dblwidth]->flagsmap(); |
| 3143 | | int flip = tc0480scp->pri_reg & 0x40; |
| 3235 | bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); |
| 3236 | bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); |
| 3237 | int flip = m_pri_reg & 0x40; |
| 3144 | 3238 | int i, y, y_index, src_y_index, row_index; |
| 3145 | 3239 | int x_index, x_step; |
| 3146 | 3240 | int machine_flip = 0; /* for ROT 180 ? */ |
| r24008 | r24009 | |
| 3150 | 3244 | UINT16 max_y = cliprect.max_y; |
| 3151 | 3245 | |
| 3152 | 3246 | int width_mask = 0x1ff; |
| 3153 | | if (tc0480scp->dblwidth) |
| 3247 | if (m_dblwidth) |
| 3154 | 3248 | width_mask = 0x3ff; |
| 3155 | 3249 | |
| 3156 | 3250 | if (!flip) |
| 3157 | 3251 | { |
| 3158 | | sx = ((tc0480scp->bgscrollx[layer] + 15 + layer * 4) << 16) + ((255 - (tc0480scp->ctrl[0x10 + layer] & 0xff)) << 8); |
| 3159 | | sx += (tc0480scp->x_offs - 15 - layer * 4) * zoomx; |
| 3252 | sx = ((m_bgscrollx[layer] + 15 + layer * 4) << 16) + ((255 - (m_ctrl[0x10 + layer] & 0xff)) << 8); |
| 3253 | sx += (m_x_offs - 15 - layer * 4) * zoomx; |
| 3160 | 3254 | |
| 3161 | | y_index = (tc0480scp->bgscrolly[layer] << 16) + ((tc0480scp->ctrl[0x14 + layer] & 0xff) << 8); |
| 3162 | | y_index -= (tc0480scp->y_offs - min_y) * zoomy; |
| 3255 | y_index = (m_bgscrolly[layer] << 16) + ((m_ctrl[0x14 + layer] & 0xff) << 8); |
| 3256 | y_index -= (m_y_offset - min_y) * zoomy; |
| 3163 | 3257 | } |
| 3164 | 3258 | else /* TC0480SCP tiles flipscreen */ |
| 3165 | 3259 | { |
| 3166 | | sx = ((-tc0480scp->bgscrollx[layer] + 15 + layer * 4 + tc0480scp->flip_xoffs ) << 16) + ((255-(tc0480scp->ctrl[0x10 + layer] & 0xff)) << 8); |
| 3167 | | sx += (tc0480scp->x_offs - 15 - layer * 4) * zoomx; |
| 3260 | sx = ((-m_bgscrollx[layer] + 15 + layer * 4 + m_flip_xoffs ) << 16) + ((255-(m_ctrl[0x10 + layer] & 0xff)) << 8); |
| 3261 | sx += (m_x_offs - 15 - layer * 4) * zoomx; |
| 3168 | 3262 | |
| 3169 | | y_index = ((-tc0480scp->bgscrolly[layer] + tc0480scp->flip_yoffs) << 16) + ((tc0480scp->ctrl[0x14 + layer] & 0xff) << 8); |
| 3170 | | y_index -= (tc0480scp->y_offs - min_y) * zoomy; |
| 3263 | y_index = ((-m_bgscrolly[layer] + m_flip_yoffs) << 16) + ((m_ctrl[0x14 + layer] & 0xff) << 8); |
| 3264 | y_index -= (m_y_offset - min_y) * zoomy; |
| 3171 | 3265 | } |
| 3172 | 3266 | |
| 3173 | 3267 | if (!machine_flip) |
| r24008 | r24009 | |
| 3184 | 3278 | if (flip) |
| 3185 | 3279 | row_index = 0x1ff - row_index; |
| 3186 | 3280 | |
| 3187 | | x_index = sx - ((tc0480scp->bgscroll_ram[layer][row_index] << 16)) - ((tc0480scp->bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); |
| 3281 | x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); |
| 3188 | 3282 | |
| 3189 | 3283 | src16 = &srcbitmap.pix16(src_y_index); |
| 3190 | 3284 | tsrc = &flagsbitmap.pix8(src_y_index); |
| r24008 | r24009 | |
| 3212 | 3306 | } |
| 3213 | 3307 | } |
| 3214 | 3308 | |
| 3215 | | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, device->machine().priority_bitmap, priority); |
| 3309 | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine().priority_bitmap, priority); |
| 3216 | 3310 | |
| 3217 | 3311 | y_index += zoomy; |
| 3218 | 3312 | if (!machine_flip) |
| r24008 | r24009 | |
| 3266 | 3360 | |
| 3267 | 3361 | ****************************************************************/ |
| 3268 | 3362 | |
| 3269 | | static void tc0480scp_bg23_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3363 | void tc0480scp_device::bg23_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3270 | 3364 | { |
| 3271 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3272 | | bitmap_ind16 &srcbitmap = tc0480scp->tilemap[layer][tc0480scp->dblwidth]->pixmap(); |
| 3273 | | bitmap_ind8 &flagsbitmap = tc0480scp->tilemap[layer][tc0480scp->dblwidth]->flagsmap(); |
| 3365 | bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); |
| 3366 | bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); |
| 3274 | 3367 | |
| 3275 | 3368 | UINT16 *dst16, *src16; |
| 3276 | 3369 | UINT8 *tsrc; |
| r24008 | r24009 | |
| 3278 | 3371 | int sx, x_index, x_step; |
| 3279 | 3372 | UINT32 zoomx, zoomy; |
| 3280 | 3373 | UINT16 scanline[512]; |
| 3281 | | int flipscreen = tc0480scp->pri_reg & 0x40; |
| 3374 | int flipscreen = m_pri_reg & 0x40; |
| 3282 | 3375 | int machine_flip = 0; /* for ROT 180 ? */ |
| 3283 | 3376 | |
| 3284 | 3377 | UINT16 screen_width = 512; //cliprect.width(); |
| r24008 | r24009 | |
| 3286 | 3379 | UINT16 max_y = cliprect.max_y; |
| 3287 | 3380 | |
| 3288 | 3381 | int width_mask = 0x1ff; |
| 3289 | | if (tc0480scp->dblwidth) |
| 3382 | if (m_dblwidth) |
| 3290 | 3383 | width_mask = 0x3ff; |
| 3291 | 3384 | |
| 3292 | 3385 | /* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max |
| 3293 | 3386 | Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max |
| 3294 | 3387 | (0x1a in Footchmp hiscore = shrunk) */ |
| 3295 | 3388 | |
| 3296 | | zoomx = 0x10000 - (tc0480scp->ctrl[0x08 + layer] & 0xff00); |
| 3297 | | zoomy = 0x10000 - (((tc0480scp->ctrl[0x08 + layer] & 0xff) - 0x7f) * 512); |
| 3389 | zoomx = 0x10000 - (m_ctrl[0x08 + layer] & 0xff00); |
| 3390 | zoomy = 0x10000 - (((m_ctrl[0x08 + layer] & 0xff) - 0x7f) * 512); |
| 3298 | 3391 | |
| 3299 | 3392 | if (!flipscreen) |
| 3300 | 3393 | { |
| 3301 | | sx = ((tc0480scp->bgscrollx[layer] + 15 + layer * 4) << 16) + ((255-(tc0480scp->ctrl[0x10 + layer] & 0xff)) << 8); |
| 3302 | | sx += (tc0480scp->x_offs - 15 - layer * 4) * zoomx; |
| 3394 | sx = ((m_bgscrollx[layer] + 15 + layer * 4) << 16) + ((255-(m_ctrl[0x10 + layer] & 0xff)) << 8); |
| 3395 | sx += (m_x_offs - 15 - layer * 4) * zoomx; |
| 3303 | 3396 | |
| 3304 | | y_index = (tc0480scp->bgscrolly[layer] << 16) + ((tc0480scp->ctrl[0x14 + layer] & 0xff) << 8); |
| 3305 | | y_index -= (tc0480scp->y_offs - min_y) * zoomy; |
| 3397 | y_index = (m_bgscrolly[layer] << 16) + ((m_ctrl[0x14 + layer] & 0xff) << 8); |
| 3398 | y_index -= (m_y_offset - min_y) * zoomy; |
| 3306 | 3399 | } |
| 3307 | 3400 | else /* TC0480SCP tiles flipscreen */ |
| 3308 | 3401 | { |
| 3309 | | sx = ((-tc0480scp->bgscrollx[layer] + 15 + layer * 4 + tc0480scp->flip_xoffs ) << 16) + ((255 - (tc0480scp->ctrl[0x10 + layer] & 0xff)) << 8); |
| 3310 | | sx += (tc0480scp->x_offs - 15 - layer * 4) * zoomx; |
| 3402 | sx = ((-m_bgscrollx[layer] + 15 + layer * 4 + m_flip_xoffs ) << 16) + ((255 - (m_ctrl[0x10 + layer] & 0xff)) << 8); |
| 3403 | sx += (m_x_offs - 15 - layer * 4) * zoomx; |
| 3311 | 3404 | |
| 3312 | | y_index = ((-tc0480scp->bgscrolly[layer] + tc0480scp->flip_yoffs) << 16) + ((tc0480scp->ctrl[0x14 + layer] & 0xff) << 8); |
| 3313 | | y_index -= (tc0480scp->y_offs - min_y) * zoomy; |
| 3405 | y_index = ((-m_bgscrolly[layer] + m_flip_yoffs) << 16) + ((m_ctrl[0x14 + layer] & 0xff) << 8); |
| 3406 | y_index -= (m_y_offset - min_y) * zoomy; |
| 3314 | 3407 | } |
| 3315 | 3408 | |
| 3316 | 3409 | |
| r24008 | r24009 | |
| 3322 | 3415 | do |
| 3323 | 3416 | { |
| 3324 | 3417 | if (!flipscreen) |
| 3325 | | src_y_index = ((y_index>>16) + tc0480scp->bgcolumn_ram[layer][(y - tc0480scp->y_offs) & 0x1ff]) & 0x1ff; |
| 3418 | src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff; |
| 3326 | 3419 | else /* colscroll area is back to front in flipscreen */ |
| 3327 | | src_y_index = ((y_index>>16) + tc0480scp->bgcolumn_ram[layer][0x1ff - ((y - tc0480scp->y_offs) & 0x1ff)]) & 0x1ff; |
| 3420 | src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][0x1ff - ((y - m_y_offset) & 0x1ff)]) & 0x1ff; |
| 3328 | 3421 | |
| 3329 | 3422 | /* row areas are the same in flipscreen, so we must read in reverse */ |
| 3330 | 3423 | row_index = src_y_index; |
| 3331 | 3424 | if (flipscreen) |
| 3332 | 3425 | row_index = 0x1ff - row_index; |
| 3333 | 3426 | |
| 3334 | | if (tc0480scp->pri_reg & (layer - 1)) /* bit0 enables for BG2, bit1 for BG3 */ |
| 3335 | | row_zoom = tc0480scp->rowzoom_ram[layer][row_index]; |
| 3427 | if (m_pri_reg & (layer - 1)) /* bit0 enables for BG2, bit1 for BG3 */ |
| 3428 | row_zoom = m_rowzoom_ram[layer][row_index]; |
| 3336 | 3429 | else |
| 3337 | 3430 | row_zoom = 0; |
| 3338 | 3431 | |
| 3339 | | x_index = sx - ((tc0480scp->bgscroll_ram[layer][row_index] << 16)) - ((tc0480scp->bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); |
| 3432 | x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); |
| 3340 | 3433 | |
| 3341 | 3434 | /* flawed calc ?? */ |
| 3342 | | x_index -= (tc0480scp->x_offs - 0x1f + layer * 4) * ((row_zoom & 0xff) << 8); |
| 3435 | x_index -= (m_x_offs - 0x1f + layer * 4) * ((row_zoom & 0xff) << 8); |
| 3343 | 3436 | |
| 3344 | 3437 | /* We used to kludge 270 multiply factor, before adjusting x_index instead */ |
| 3345 | 3438 | |
| r24008 | r24009 | |
| 3376 | 3469 | } |
| 3377 | 3470 | } |
| 3378 | 3471 | |
| 3379 | | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, device->machine().priority_bitmap, priority); |
| 3472 | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine().priority_bitmap, priority); |
| 3380 | 3473 | |
| 3381 | 3474 | y_index += zoomy; |
| 3382 | 3475 | if (!machine_flip) |
| r24008 | r24009 | |
| 3388 | 3481 | } |
| 3389 | 3482 | |
| 3390 | 3483 | |
| 3391 | | void tc0480scp_tilemap_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3484 | void tc0480scp_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) |
| 3392 | 3485 | { |
| 3393 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3394 | | |
| 3395 | 3486 | /* no layer disable bits */ |
| 3396 | 3487 | switch (layer) |
| 3397 | 3488 | { |
| 3398 | 3489 | case 0: |
| 3399 | | tc0480scp_bg01_draw(device, bitmap, cliprect, 0, flags, priority); |
| 3490 | bg01_draw(bitmap, cliprect, 0, flags, priority); |
| 3400 | 3491 | break; |
| 3401 | 3492 | case 1: |
| 3402 | | tc0480scp_bg01_draw(device, bitmap, cliprect, 1, flags, priority); |
| 3493 | bg01_draw(bitmap, cliprect, 1, flags, priority); |
| 3403 | 3494 | break; |
| 3404 | 3495 | case 2: |
| 3405 | | tc0480scp_bg23_draw(device, bitmap, cliprect, 2, flags, priority); |
| 3496 | bg23_draw(bitmap, cliprect, 2, flags, priority); |
| 3406 | 3497 | break; |
| 3407 | 3498 | case 3: |
| 3408 | | tc0480scp_bg23_draw(device, bitmap, cliprect, 3, flags, priority); |
| 3499 | bg23_draw(bitmap, cliprect, 3, flags, priority); |
| 3409 | 3500 | break; |
| 3410 | 3501 | case 4: |
| 3411 | | tc0480scp->tilemap[4][tc0480scp->dblwidth]->draw(bitmap, cliprect, flags, priority); |
| 3502 | m_tilemap[4][m_dblwidth]->draw(bitmap, cliprect, flags, priority); |
| 3412 | 3503 | break; |
| 3413 | 3504 | } |
| 3414 | 3505 | } |
| r24008 | r24009 | |
| 3427 | 3518 | 0x0321 |
| 3428 | 3519 | }; |
| 3429 | 3520 | |
| 3430 | | int tc0480scp_get_bg_priority( device_t *device ) |
| 3521 | int tc0480scp_device::get_bg_priority() |
| 3431 | 3522 | { |
| 3432 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3433 | | return tc0480scp_bg_pri_lookup[(tc0480scp->pri_reg & 0x1c) >> 2]; |
| 3523 | return tc0480scp_bg_pri_lookup[(m_pri_reg & 0x1c) >> 2]; |
| 3434 | 3524 | } |
| 3435 | 3525 | |
| 3436 | 3526 | // undrfire.c also needs to directly access the priority reg |
| 3437 | | READ8_DEVICE_HANDLER( tc0480scp_pri_reg_r ) |
| 3527 | READ8_MEMBER( tc0480scp_device::pri_reg_r ) |
| 3438 | 3528 | { |
| 3439 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); |
| 3440 | | return tc0480scp->pri_reg; |
| 3529 | return m_pri_reg; |
| 3441 | 3530 | } |
| 3442 | 3531 | |
| 3443 | | void tc0480scp_device::tc0480scp_postload() |
| 3532 | void tc0480scp_device::postload() |
| 3444 | 3533 | { |
| 3445 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 3446 | | |
| 3447 | 3534 | int reg; |
| 3448 | | int flip = tc0480scp->ctrl[0xf] & 0x40; |
| 3535 | int flip = m_ctrl[0xf] & 0x40; |
| 3449 | 3536 | |
| 3450 | | tc0480scp_set_layer_ptrs(tc0480scp); |
| 3537 | set_layer_ptrs(); |
| 3451 | 3538 | |
| 3452 | | tc0480scp->tilemap[0][0]->set_flip(flip); |
| 3453 | | tc0480scp->tilemap[1][0]->set_flip(flip); |
| 3454 | | tc0480scp->tilemap[2][0]->set_flip(flip); |
| 3455 | | tc0480scp->tilemap[3][0]->set_flip(flip); |
| 3456 | | tc0480scp->tilemap[4][0]->set_flip(flip); |
| 3539 | m_tilemap[0][0]->set_flip(flip); |
| 3540 | m_tilemap[1][0]->set_flip(flip); |
| 3541 | m_tilemap[2][0]->set_flip(flip); |
| 3542 | m_tilemap[3][0]->set_flip(flip); |
| 3543 | m_tilemap[4][0]->set_flip(flip); |
| 3457 | 3544 | |
| 3458 | | tc0480scp->tilemap[0][1]->set_flip(flip); |
| 3459 | | tc0480scp->tilemap[1][1]->set_flip(flip); |
| 3460 | | tc0480scp->tilemap[2][1]->set_flip(flip); |
| 3461 | | tc0480scp->tilemap[3][1]->set_flip(flip); |
| 3462 | | tc0480scp->tilemap[4][1]->set_flip(flip); |
| 3545 | m_tilemap[0][1]->set_flip(flip); |
| 3546 | m_tilemap[1][1]->set_flip(flip); |
| 3547 | m_tilemap[2][1]->set_flip(flip); |
| 3548 | m_tilemap[3][1]->set_flip(flip); |
| 3549 | m_tilemap[4][1]->set_flip(flip); |
| 3463 | 3550 | |
| 3464 | | reg = tc0480scp->ctrl[0]; |
| 3551 | reg = m_ctrl[0]; |
| 3465 | 3552 | if (!flip) reg = -reg; |
| 3466 | | tc0480scp->bgscrollx[0] = reg; |
| 3553 | m_bgscrollx[0] = reg; |
| 3467 | 3554 | |
| 3468 | | reg = tc0480scp->ctrl[1] + 4; |
| 3555 | reg = m_ctrl[1] + 4; |
| 3469 | 3556 | if (!flip) reg = -reg; |
| 3470 | | tc0480scp->bgscrollx[1] = reg; |
| 3557 | m_bgscrollx[1] = reg; |
| 3471 | 3558 | |
| 3472 | | reg = tc0480scp->ctrl[2] + 8; |
| 3559 | reg = m_ctrl[2] + 8; |
| 3473 | 3560 | if (!flip) reg = -reg; |
| 3474 | | tc0480scp->bgscrollx[2] = reg; |
| 3561 | m_bgscrollx[2] = reg; |
| 3475 | 3562 | |
| 3476 | | reg = tc0480scp->ctrl[3] + 12; |
| 3563 | reg = m_ctrl[3] + 12; |
| 3477 | 3564 | if (!flip) reg = -reg; |
| 3478 | | tc0480scp->bgscrollx[3] = reg; |
| 3565 | m_bgscrollx[3] = reg; |
| 3479 | 3566 | |
| 3480 | | reg = tc0480scp->ctrl[4]; |
| 3567 | reg = m_ctrl[4]; |
| 3481 | 3568 | if (!flip) reg = -reg; |
| 3482 | | tc0480scp->bgscrolly[0] = reg; |
| 3569 | m_bgscrolly[0] = reg; |
| 3483 | 3570 | |
| 3484 | | reg = tc0480scp->ctrl[5]; |
| 3571 | reg = m_ctrl[5]; |
| 3485 | 3572 | if (!flip) reg = -reg; |
| 3486 | | tc0480scp->bgscrolly[1] = reg; |
| 3573 | m_bgscrolly[1] = reg; |
| 3487 | 3574 | |
| 3488 | | reg = tc0480scp->ctrl[6]; |
| 3575 | reg = m_ctrl[6]; |
| 3489 | 3576 | if (!flip) reg = -reg; |
| 3490 | | tc0480scp->bgscrolly[2] = reg; |
| 3577 | m_bgscrolly[2] = reg; |
| 3491 | 3578 | |
| 3492 | | reg = tc0480scp->ctrl[7]; |
| 3579 | reg = m_ctrl[7]; |
| 3493 | 3580 | if (!flip) reg = -reg; |
| 3494 | | tc0480scp->bgscrolly[3] = reg; |
| 3581 | m_bgscrolly[3] = reg; |
| 3495 | 3582 | |
| 3496 | | reg = tc0480scp->ctrl[0x0c]; |
| 3497 | | if (!flip) reg -= tc0480scp->text_xoffs; |
| 3498 | | if (flip) reg += tc0480scp->text_xoffs; |
| 3499 | | tc0480scp->tilemap[4][0]->set_scrollx(0, -reg); |
| 3500 | | tc0480scp->tilemap[4][1]->set_scrollx(0, -reg); |
| 3583 | reg = m_ctrl[0x0c]; |
| 3584 | if (!flip) reg -= m_text_xoffs; |
| 3585 | if (flip) reg += m_text_xoffs; |
| 3586 | m_tilemap[4][0]->set_scrollx(0, -reg); |
| 3587 | m_tilemap[4][1]->set_scrollx(0, -reg); |
| 3501 | 3588 | |
| 3502 | | reg = tc0480scp->ctrl[0x0d]; |
| 3503 | | if (!flip) reg -= tc0480scp->text_yoffs; |
| 3504 | | if (flip) reg += tc0480scp->text_yoffs; |
| 3505 | | tc0480scp->tilemap[4][0]->set_scrolly(0, -reg); |
| 3506 | | tc0480scp->tilemap[4][1]->set_scrolly(0, -reg); |
| 3589 | reg = m_ctrl[0x0d]; |
| 3590 | if (!flip) reg -= m_text_yoffs; |
| 3591 | if (flip) reg += m_text_yoffs; |
| 3592 | m_tilemap[4][0]->set_scrolly(0, -reg); |
| 3593 | m_tilemap[4][1]->set_scrolly(0, -reg); |
| 3507 | 3594 | } |
| 3508 | 3595 | |
| 3596 | /***************************************************************************/ |
| 3597 | /* */ |
| 3598 | /* TC0150ROD */ |
| 3599 | /* */ |
| 3600 | /***************************************************************************/ |
| 3509 | 3601 | |
| 3602 | #define TC0150ROD_RAM_SIZE 0x2000 |
| 3510 | 3603 | |
| 3511 | | const device_type TC0480SCP = &device_creator<tc0480scp_device>; |
| 3512 | 3604 | |
| 3513 | | tc0480scp_device::tc0480scp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 3514 | | : device_t(mconfig, TC0480SCP, "Taito TC0480SCP", tag, owner, clock, "tc0480scp", __FILE__) |
| 3605 | |
| 3606 | const device_type TC0150ROD = &device_creator<tc0150rod_device>; |
| 3607 | |
| 3608 | tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 3609 | : device_t(mconfig, TC0150ROD, "Taito TC0150ROD", tag, owner, clock, "tc0150rod", __FILE__), |
| 3610 | m_ram(NULL) |
| 3515 | 3611 | { |
| 3516 | | m_token = global_alloc_clear(tc0480scp_state); |
| 3517 | 3612 | } |
| 3518 | 3613 | |
| 3519 | 3614 | //------------------------------------------------- |
| r24008 | r24009 | |
| 3522 | 3617 | // complete |
| 3523 | 3618 | //------------------------------------------------- |
| 3524 | 3619 | |
| 3525 | | void tc0480scp_device::device_config_complete() |
| 3620 | void tc0150rod_device::device_config_complete() |
| 3526 | 3621 | { |
| 3527 | | } |
| 3528 | | |
| 3529 | | //------------------------------------------------- |
| 3530 | | // device_start - device-specific startup |
| 3531 | | //------------------------------------------------- |
| 3532 | | |
| 3533 | | void tc0480scp_device::device_start() |
| 3534 | | { |
| 3535 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 3536 | | const tc0480scp_interface *intf = tc0480scp_get_interface(this); |
| 3537 | | int i, xd, yd; |
| 3538 | | |
| 3539 | | /* use the given gfx set for bg/tx tiles */ |
| 3540 | | tc0480scp->bg_gfx = intf->gfxnum; |
| 3541 | | tc0480scp->tx_gfx = intf->txnum; |
| 3542 | | |
| 3543 | | tc0480scp->tile_colbase = intf->col_base; |
| 3544 | | tc0480scp->text_xoffs = intf->text_xoffs; |
| 3545 | | tc0480scp->text_yoffs = intf->text_yoffs; |
| 3546 | | tc0480scp->flip_xoffs = intf->flip_xoffs; /* for most games (-1,0) */ |
| 3547 | | tc0480scp->flip_yoffs = intf->flip_yoffs; |
| 3548 | | tc0480scp->x_offs = intf->x_offset + intf->pixels; |
| 3549 | | tc0480scp->y_offs = intf->y_offset; |
| 3550 | | |
| 3551 | | /* Single width versions */ |
| 3552 | | tc0480scp->tilemap[0][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 3553 | | tc0480scp->tilemap[1][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 3554 | | tc0480scp->tilemap[2][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 3555 | | tc0480scp->tilemap[3][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg3_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); |
| 3556 | | tc0480scp->tilemap[4][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); |
| 3557 | | |
| 3558 | | /* Double width versions */ |
| 3559 | | tc0480scp->tilemap[0][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 3560 | | tc0480scp->tilemap[1][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 3561 | | tc0480scp->tilemap[2][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 3562 | | tc0480scp->tilemap[3][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_bg3_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32); |
| 3563 | | tc0480scp->tilemap[4][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0480scp_device::tc0480scp_get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); |
| 3564 | | |
| 3565 | | for (i = 0; i < 2; i++) |
| 3622 | // inherit a copy of the static data |
| 3623 | const tc0150rod_interface *intf = reinterpret_cast<const tc0150rod_interface *>(static_config()); |
| 3624 | if (intf != NULL) |
| 3625 | *static_cast<tc0150rod_interface *>(this) = *intf; |
| 3626 | |
| 3627 | // or initialize to defaults if none provided |
| 3628 | else |
| 3566 | 3629 | { |
| 3567 | | tc0480scp->tilemap[0][i]->set_transparent_pen(0); |
| 3568 | | tc0480scp->tilemap[1][i]->set_transparent_pen(0); |
| 3569 | | tc0480scp->tilemap[2][i]->set_transparent_pen(0); |
| 3570 | | tc0480scp->tilemap[3][i]->set_transparent_pen(0); |
| 3571 | | tc0480scp->tilemap[4][i]->set_transparent_pen(0); |
| 3572 | 3630 | } |
| 3573 | | |
| 3574 | | xd = -tc0480scp->x_offs; |
| 3575 | | yd = tc0480scp->y_offs; |
| 3576 | | |
| 3577 | | /* Metalb and Deadconx have minor screenflip issues: blue planet |
| 3578 | | is off on x axis by 1 and in Deadconx the dark blue screen |
| 3579 | | between stages also seems off by 1 pixel. */ |
| 3580 | | |
| 3581 | | /* It's not possible to get the text scrolldx calculations |
| 3582 | | harmonised with the other layers: xd-2, 315-xd is the |
| 3583 | | next valid pair:- the numbers diverge from xd, 319-xd */ |
| 3584 | | |
| 3585 | | /* Single width offsets */ |
| 3586 | | tc0480scp->tilemap[0][0]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3587 | | tc0480scp->tilemap[0][0]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3588 | | tc0480scp->tilemap[1][0]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3589 | | tc0480scp->tilemap[1][0]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3590 | | tc0480scp->tilemap[2][0]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3591 | | tc0480scp->tilemap[2][0]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3592 | | tc0480scp->tilemap[3][0]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3593 | | tc0480scp->tilemap[3][0]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3594 | | tc0480scp->tilemap[4][0]->set_scrolldx(xd - 3, 316 - xd); /* text layer */ |
| 3595 | | tc0480scp->tilemap[4][0]->set_scrolldy(yd, 256 - yd); /* text layer */ |
| 3596 | | |
| 3597 | | /* Double width offsets */ |
| 3598 | | tc0480scp->tilemap[0][1]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3599 | | tc0480scp->tilemap[0][1]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3600 | | tc0480scp->tilemap[1][1]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3601 | | tc0480scp->tilemap[1][1]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3602 | | tc0480scp->tilemap[2][1]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3603 | | tc0480scp->tilemap[2][1]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3604 | | tc0480scp->tilemap[3][1]->set_scrolldx(xd, 320 - xd + tc0480scp->flip_xoffs); |
| 3605 | | tc0480scp->tilemap[3][1]->set_scrolldy(yd, 256 - yd + tc0480scp->flip_yoffs); |
| 3606 | | tc0480scp->tilemap[4][1]->set_scrolldx(xd - 3, 317 - xd); /* text layer */ |
| 3607 | | tc0480scp->tilemap[4][1]->set_scrolldy(yd, 256 - yd); /* text layer */ |
| 3608 | | |
| 3609 | | for (i = 0; i < 2; i++) |
| 3610 | | { |
| 3611 | | /* Both sets of bg tilemaps scrollable per pixel row */ |
| 3612 | | tc0480scp->tilemap[0][i]->set_scroll_rows(512); |
| 3613 | | tc0480scp->tilemap[1][i]->set_scroll_rows(512); |
| 3614 | | tc0480scp->tilemap[2][i]->set_scroll_rows(512); |
| 3615 | | tc0480scp->tilemap[3][i]->set_scroll_rows(512); |
| 3616 | | } |
| 3617 | | |
| 3618 | | tc0480scp->ram = auto_alloc_array_clear(machine(), UINT16, TC0480SCP_RAM_SIZE / 2); |
| 3619 | | |
| 3620 | | tc0480scp_set_layer_ptrs(tc0480scp); |
| 3621 | | |
| 3622 | | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 3623 | | machine().gfx[tc0480scp->tx_gfx] = auto_alloc(machine(), gfx_element(machine(), tc0480scp_charlayout, (UINT8 *)tc0480scp->char_ram, 64, 0)); |
| 3624 | | |
| 3625 | | save_pointer(NAME(tc0480scp->ram), TC0480SCP_RAM_SIZE / 2); |
| 3626 | | save_item(NAME(tc0480scp->ctrl)); |
| 3627 | | save_item(NAME(tc0480scp->dblwidth)); |
| 3628 | | machine().save().register_postload(save_prepost_delegate(FUNC(tc0480scp_device::tc0480scp_postload), this)); |
| 3629 | 3631 | } |
| 3630 | 3632 | |
| 3631 | 3633 | //------------------------------------------------- |
| 3632 | | // device_reset - device-specific reset |
| 3634 | // device_start - device-specific startup |
| 3633 | 3635 | //------------------------------------------------- |
| 3634 | 3636 | |
| 3635 | | void tc0480scp_device::device_reset() |
| 3637 | void tc0150rod_device::device_start() |
| 3636 | 3638 | { |
| 3637 | | tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(this); |
| 3638 | | int i; |
| 3639 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0150ROD_RAM_SIZE / 2); |
| 3639 | 3640 | |
| 3640 | | tc0480scp->dblwidth = 0; |
| 3641 | | |
| 3642 | | for (i = 0; i < 0x18; i++) |
| 3643 | | tc0480scp->ctrl[i] = 0; |
| 3644 | | |
| 3641 | save_pointer(NAME(m_ram), TC0150ROD_RAM_SIZE / 2); |
| 3645 | 3642 | } |
| 3646 | 3643 | |
| 3647 | 3644 | |
| 3648 | | /***************************************************************************/ |
| 3649 | | /* */ |
| 3650 | | /* TC0150ROD */ |
| 3651 | | /* */ |
| 3652 | | /***************************************************************************/ |
| 3653 | | |
| 3654 | | struct tc0150rod_state |
| 3655 | | { |
| 3656 | | UINT16 * ram; |
| 3657 | | |
| 3658 | | const char *gfx_region; /* gfx region for the road */ |
| 3659 | | }; |
| 3660 | | |
| 3661 | | #define TC0150ROD_RAM_SIZE 0x2000 |
| 3662 | | |
| 3663 | 3645 | /***************************************************************************** |
| 3664 | | INLINE FUNCTIONS |
| 3665 | | *****************************************************************************/ |
| 3666 | | |
| 3667 | | INLINE tc0150rod_state *tc0150rod_get_safe_token( device_t *device ) |
| 3668 | | { |
| 3669 | | assert(device != NULL); |
| 3670 | | assert(device->type() == TC0150ROD); |
| 3671 | | |
| 3672 | | return (tc0150rod_state *)downcast<tc0150rod_device *>(device)->token(); |
| 3673 | | } |
| 3674 | | |
| 3675 | | INLINE const tc0150rod_interface *tc0150rod_get_interface( device_t *device ) |
| 3676 | | { |
| 3677 | | assert(device != NULL); |
| 3678 | | assert((device->type() == TC0150ROD)); |
| 3679 | | return (const tc0150rod_interface *) device->static_config(); |
| 3680 | | } |
| 3681 | | |
| 3682 | | /***************************************************************************** |
| 3683 | 3646 | DEVICE HANDLERS |
| 3684 | 3647 | *****************************************************************************/ |
| 3685 | 3648 | |
| 3686 | | READ16_DEVICE_HANDLER( tc0150rod_word_r ) |
| 3649 | READ16_MEMBER( tc0150rod_device::word_r ) |
| 3687 | 3650 | { |
| 3688 | | tc0150rod_state *tc0150rod = tc0150rod_get_safe_token(device); |
| 3689 | | return tc0150rod->ram[offset]; |
| 3651 | return m_ram[offset]; |
| 3690 | 3652 | } |
| 3691 | 3653 | |
| 3692 | | WRITE16_DEVICE_HANDLER( tc0150rod_word_w ) |
| 3654 | WRITE16_MEMBER( tc0150rod_device::word_w ) |
| 3693 | 3655 | { |
| 3694 | | tc0150rod_state *tc0150rod = tc0150rod_get_safe_token(device); |
| 3695 | | COMBINE_DATA(&tc0150rod->ram[offset]); |
| 3656 | COMBINE_DATA(&m_ram[offset]); |
| 3696 | 3657 | } |
| 3697 | 3658 | |
| 3698 | 3659 | /****************************************************************************** |
| r24008 | r24009 | |
| 3858 | 3819 | |
| 3859 | 3820 | ******************************************************************************/ |
| 3860 | 3821 | |
| 3861 | | void tc0150rod_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs, int palette_offs, int type, int road_trans, UINT32 low_priority, UINT32 high_priority ) |
| 3822 | void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs, int palette_offs, int type, int road_trans, UINT32 low_priority, UINT32 high_priority ) |
| 3862 | 3823 | { |
| 3863 | | tc0150rod_state *tc0150rod = tc0150rod_get_safe_token(device); |
| 3864 | | |
| 3865 | | #ifdef MAME_DEBUG |
| 3824 | #ifdef MAME_DEBUG |
| 3866 | 3825 | static int dislayer[6]; /* Road Layer toggles to help get road correct */ |
| 3867 | | #endif |
| 3826 | #endif |
| 3868 | 3827 | |
| 3869 | 3828 | int x_offs = 0xa7; /* Increasing this shifts road to right */ |
| 3870 | 3829 | UINT16 scanline[512]; |
| 3871 | 3830 | UINT16 roada_line[512], roadb_line[512]; |
| 3872 | 3831 | UINT16 *dst16; |
| 3873 | 3832 | UINT16 *roada, *roadb; |
| 3874 | | UINT16 *roadgfx = (UINT16 *)device->machine().root_device().memregion(tc0150rod->gfx_region)->base(); |
| 3833 | UINT16 *roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base(); |
| 3875 | 3834 | |
| 3876 | 3835 | UINT16 pixel, color, gfx_word; |
| 3877 | 3836 | UINT16 roada_clipl, roada_clipr, roada_bodyctrl; |
| r24008 | r24009 | |
| 3881 | 3840 | int x_index, roadram_index, roadram2_index, i; |
| 3882 | 3841 | int xoffset, paloffs, palloffs, palroffs; |
| 3883 | 3842 | int road_gfx_tilenum, colbank, road_center; |
| 3884 | | int road_ctrl = tc0150rod->ram[0xfff]; |
| 3843 | int road_ctrl = m_ram[0xfff]; |
| 3885 | 3844 | int left_edge, right_edge, begin, end, right_over, left_over; |
| 3886 | 3845 | int line_needs_drawing, draw_top_road_line, background_only; |
| 3887 | 3846 | |
| r24008 | r24009 | |
| 3902 | 3861 | int priority_switch_line = (road_ctrl & 0x00ff) - y_offs; |
| 3903 | 3862 | |
| 3904 | 3863 | #ifdef MAME_DEBUG |
| 3905 | | if (device->machine().input().code_pressed_once (KEYCODE_X)) |
| 3864 | if (machine().input().code_pressed_once (KEYCODE_X)) |
| 3906 | 3865 | { |
| 3907 | 3866 | dislayer[0] ^= 1; |
| 3908 | 3867 | popmessage("RoadA body: %01x",dislayer[0]); |
| 3909 | 3868 | } |
| 3910 | 3869 | |
| 3911 | | if (device->machine().input().code_pressed_once (KEYCODE_C)) |
| 3870 | if (machine().input().code_pressed_once (KEYCODE_C)) |
| 3912 | 3871 | { |
| 3913 | 3872 | dislayer[1] ^= 1; |
| 3914 | 3873 | popmessage("RoadA l-edge: %01x",dislayer[1]); |
| 3915 | 3874 | } |
| 3916 | 3875 | |
| 3917 | | if (device->machine().input().code_pressed_once (KEYCODE_V)) |
| 3876 | if (machine().input().code_pressed_once (KEYCODE_V)) |
| 3918 | 3877 | { |
| 3919 | 3878 | dislayer[2] ^= 1; |
| 3920 | 3879 | popmessage("RoadA r-edge: %01x",dislayer[2]); |
| 3921 | 3880 | } |
| 3922 | 3881 | |
| 3923 | | if (device->machine().input().code_pressed_once (KEYCODE_B)) |
| 3882 | if (machine().input().code_pressed_once (KEYCODE_B)) |
| 3924 | 3883 | { |
| 3925 | 3884 | dislayer[3] ^= 1; |
| 3926 | 3885 | popmessage("RoadB body: %01x",dislayer[3]); |
| 3927 | 3886 | } |
| 3928 | 3887 | |
| 3929 | | if (device->machine().input().code_pressed_once (KEYCODE_N)) |
| 3888 | if (machine().input().code_pressed_once (KEYCODE_N)) |
| 3930 | 3889 | { |
| 3931 | 3890 | dislayer[4] ^= 1; |
| 3932 | 3891 | popmessage("RoadB l-edge: %01x",dislayer[4]); |
| 3933 | 3892 | } |
| 3934 | | if (device->machine().input().code_pressed_once (KEYCODE_M)) |
| 3893 | if (machine().input().code_pressed_once (KEYCODE_M)) |
| 3935 | 3894 | { |
| 3936 | 3895 | dislayer[5] ^= 1; |
| 3937 | 3896 | popmessage("RoadB r-edge: %01x",dislayer[5]); |
| r24008 | r24009 | |
| 3971 | 3930 | priorities[4] = 3; |
| 3972 | 3931 | priorities[5] = 4; |
| 3973 | 3932 | |
| 3974 | | roada_clipr = tc0150rod->ram[roadram_index]; |
| 3975 | | roada_clipl = tc0150rod->ram[roadram_index + 1]; |
| 3976 | | roada_bodyctrl = tc0150rod->ram[roadram_index + 2]; |
| 3977 | | roadb_clipr = tc0150rod->ram[roadram2_index]; |
| 3978 | | roadb_clipl = tc0150rod->ram[roadram2_index + 1]; |
| 3979 | | roadb_bodyctrl = tc0150rod->ram[roadram2_index + 2]; |
| 3933 | roada_clipr = m_ram[roadram_index]; |
| 3934 | roada_clipl = m_ram[roadram_index + 1]; |
| 3935 | roada_bodyctrl = m_ram[roadram_index + 2]; |
| 3936 | roadb_clipr = m_ram[roadram2_index]; |
| 3937 | roadb_clipl = m_ram[roadram2_index + 1]; |
| 3938 | roadb_bodyctrl = m_ram[roadram2_index + 2]; |
| 3980 | 3939 | |
| 3981 | 3940 | /* Not very logical, but seems to work */ |
| 3982 | 3941 | if (roada_bodyctrl & 0x2000) priorities[2] += 2; |
| r24008 | r24009 | |
| 4001 | 3960 | palloffs =(roada_clipl & 0x1000) >> 11; |
| 4002 | 3961 | xoffset = roada_bodyctrl & 0x7ff; |
| 4003 | 3962 | paloffs =(roada_bodyctrl & 0x1800) >> 11; |
| 4004 | | colbank =(tc0150rod->ram[roadram_index + 3] & 0xf000) >> 10; |
| 4005 | | road_gfx_tilenum = tc0150rod->ram[roadram_index + 3] & 0x3ff; |
| 3963 | colbank =(m_ram[roadram_index + 3] & 0xf000) >> 10; |
| 3964 | road_gfx_tilenum = m_ram[roadram_index + 3] & 0x3ff; |
| 4006 | 3965 | right_over = 0; |
| 4007 | 3966 | left_over = 0; |
| 4008 | 3967 | |
| r24008 | r24009 | |
| 4190 | 4149 | palloffs = (roadb_clipl & 0x1000) >> 11; |
| 4191 | 4150 | xoffset = roadb_bodyctrl & 0x7ff; |
| 4192 | 4151 | paloffs = (roadb_bodyctrl & 0x1800) >> 11; |
| 4193 | | colbank = (tc0150rod->ram[roadram2_index + 3] & 0xf000) >> 10; |
| 4194 | | road_gfx_tilenum = tc0150rod->ram[roadram2_index + 3] & 0x3ff; |
| 4152 | colbank = (m_ram[roadram2_index + 3] & 0xf000) >> 10; |
| 4153 | road_gfx_tilenum = m_ram[roadram2_index + 3] & 0x3ff; |
| 4195 | 4154 | right_over = 0; |
| 4196 | 4155 | left_over = 0; |
| 4197 | 4156 | |
| r24008 | r24009 | |
| 4418 | 4377 | } |
| 4419 | 4378 | } |
| 4420 | 4379 | |
| 4421 | | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, 1, ROT0, device->machine().priority_bitmap, (y > priority_switch_line) ? high_priority : low_priority); |
| 4380 | taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, 1, ROT0, machine().priority_bitmap, (y > priority_switch_line) ? high_priority : low_priority); |
| 4422 | 4381 | } |
| 4423 | 4382 | |
| 4424 | 4383 | y++; |
| r24008 | r24009 | |
| 4435 | 4394 | #endif |
| 4436 | 4395 | } |
| 4437 | 4396 | |
| 4438 | | /***************************************************************************** |
| 4439 | | DEVICE INTERFACE |
| 4440 | | *****************************************************************************/ |
| 4441 | 4397 | |
| 4442 | | static DEVICE_START( tc0150rod ) |
| 4443 | | { |
| 4444 | | tc0150rod_state *tc0150rod = tc0150rod_get_safe_token(device); |
| 4445 | | const tc0150rod_interface *intf = tc0150rod_get_interface(device); |
| 4398 | /***************************************************************************/ |
| 4399 | /* */ |
| 4400 | /* TC0110PCR */ |
| 4401 | /* */ |
| 4402 | /***************************************************************************/ |
| 4446 | 4403 | |
| 4447 | | tc0150rod->gfx_region = intf->gfx_region; |
| 4404 | #define TC0110PCR_RAM_SIZE 0x2000 |
| 4448 | 4405 | |
| 4449 | | tc0150rod->ram = auto_alloc_array(device->machine(), UINT16, TC0150ROD_RAM_SIZE / 2); |
| 4450 | 4406 | |
| 4451 | | device->save_pointer(NAME(tc0150rod->ram), TC0150ROD_RAM_SIZE / 2); |
| 4407 | const device_type TC0110PCR = &device_creator<tc0110pcr_device>; |
| 4452 | 4408 | |
| 4453 | | } |
| 4454 | | |
| 4455 | | const device_type TC0150ROD = &device_creator<tc0150rod_device>; |
| 4456 | | |
| 4457 | | tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 4458 | | : device_t(mconfig, TC0150ROD, "Taito TC0150ROD", tag, owner, clock, "tc0150rod", __FILE__) |
| 4409 | tc0110pcr_device::tc0110pcr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 4410 | : device_t(mconfig, TC0110PCR, "Taito TC0110PCR", tag, owner, clock, "tc0110pcr", __FILE__), |
| 4411 | m_ram(NULL), |
| 4412 | m_type(0), |
| 4413 | m_addr(0) |
| 4459 | 4414 | { |
| 4460 | | m_token = global_alloc_clear(tc0150rod_state); |
| 4461 | 4415 | } |
| 4462 | 4416 | |
| 4463 | 4417 | //------------------------------------------------- |
| r24008 | r24009 | |
| 4466 | 4420 | // complete |
| 4467 | 4421 | //------------------------------------------------- |
| 4468 | 4422 | |
| 4469 | | void tc0150rod_device::device_config_complete() |
| 4423 | void tc0110pcr_device::device_config_complete() |
| 4470 | 4424 | { |
| 4425 | // inherit a copy of the static data |
| 4426 | const tc0110pcr_interface *intf = reinterpret_cast<const tc0110pcr_interface *>(static_config()); |
| 4427 | if (intf != NULL) |
| 4428 | *static_cast<tc0110pcr_interface *>(this) = *intf; |
| 4429 | |
| 4430 | // or initialize to defaults if none provided |
| 4431 | else |
| 4432 | { |
| 4433 | } |
| 4471 | 4434 | } |
| 4472 | 4435 | |
| 4473 | 4436 | //------------------------------------------------- |
| 4474 | 4437 | // device_start - device-specific startup |
| 4475 | 4438 | //------------------------------------------------- |
| 4476 | 4439 | |
| 4477 | | void tc0150rod_device::device_start() |
| 4440 | void tc0110pcr_device::device_start() |
| 4478 | 4441 | { |
| 4479 | | DEVICE_START_NAME( tc0150rod )(this); |
| 4480 | | } |
| 4442 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0110PCR_RAM_SIZE); |
| 4481 | 4443 | |
| 4444 | save_pointer(NAME(m_ram), TC0110PCR_RAM_SIZE); |
| 4445 | save_item(NAME(m_type)); |
| 4446 | machine().save().register_postload(save_prepost_delegate(FUNC(tc0110pcr_device::restore_colors), this)); |
| 4482 | 4447 | |
| 4483 | | /***************************************************************************/ |
| 4484 | | /* */ |
| 4485 | | /* TC0110PCR */ |
| 4486 | | /* */ |
| 4487 | | /***************************************************************************/ |
| 4448 | } |
| 4488 | 4449 | |
| 4489 | | struct tc0110pcr_state |
| 4490 | | { |
| 4491 | | running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } |
| 4492 | | UINT16 * ram; |
| 4493 | | int type; |
| 4494 | | int addr; |
| 4495 | | int pal_offs; |
| 4496 | | running_machine *m_machine; |
| 4497 | | }; |
| 4450 | //------------------------------------------------- |
| 4451 | // device_reset - device-specific reset |
| 4452 | //------------------------------------------------- |
| 4498 | 4453 | |
| 4499 | | #define TC0110PCR_RAM_SIZE 0x2000 |
| 4500 | | |
| 4501 | | /***************************************************************************** |
| 4502 | | INLINE FUNCTIONS |
| 4503 | | *****************************************************************************/ |
| 4504 | | |
| 4505 | | INLINE tc0110pcr_state *tc0110pcr_get_safe_token( device_t *device ) |
| 4454 | void tc0110pcr_device::device_reset() |
| 4506 | 4455 | { |
| 4507 | | assert(device != NULL); |
| 4508 | | assert(device->type() == TC0110PCR); |
| 4509 | | |
| 4510 | | return (tc0110pcr_state *)downcast<tc0110pcr_device *>(device)->token(); |
| 4456 | m_type = 0; /* default, xBBBBBGGGGGRRRRR */ |
| 4511 | 4457 | } |
| 4512 | 4458 | |
| 4513 | | INLINE const tc0110pcr_interface *tc0110pcr_get_interface( device_t *device ) |
| 4514 | | { |
| 4515 | | assert(device != NULL); |
| 4516 | | assert((device->type() == TC0110PCR)); |
| 4517 | | return (const tc0110pcr_interface *) device->static_config(); |
| 4518 | | } |
| 4519 | | |
| 4520 | 4459 | /***************************************************************************** |
| 4521 | 4460 | DEVICE HANDLERS |
| 4522 | 4461 | *****************************************************************************/ |
| 4523 | 4462 | |
| 4524 | | void tc0110pcr_device::tc0110pcr_restore_colors() |
| 4463 | void tc0110pcr_device::restore_colors() |
| 4525 | 4464 | { |
| 4526 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(this); |
| 4527 | | |
| 4528 | 4465 | int i, color, r = 0, g = 0, b = 0; |
| 4529 | 4466 | |
| 4530 | 4467 | for (i = 0; i < (256 * 16); i++) |
| 4531 | 4468 | { |
| 4532 | | color = tc0110pcr->ram[i]; |
| 4469 | color = m_ram[i]; |
| 4533 | 4470 | |
| 4534 | | switch (tc0110pcr->type) |
| 4471 | switch (m_type) |
| 4535 | 4472 | { |
| 4536 | 4473 | case 0x00: |
| 4537 | 4474 | { |
| r24008 | r24009 | |
| 4558 | 4495 | } |
| 4559 | 4496 | } |
| 4560 | 4497 | |
| 4561 | | palette_set_color(tc0110pcr->machine(), i + (tc0110pcr->pal_offs << 12), MAKE_RGB(r, g, b)); |
| 4498 | palette_set_color(machine(), i + (m_pal_offs << 12), MAKE_RGB(r, g, b)); |
| 4562 | 4499 | } |
| 4563 | 4500 | } |
| 4564 | 4501 | |
| 4565 | 4502 | |
| 4566 | | READ16_DEVICE_HANDLER( tc0110pcr_word_r ) |
| 4503 | READ16_MEMBER(tc0110pcr_device::word_r ) |
| 4567 | 4504 | { |
| 4568 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(device); |
| 4569 | | |
| 4570 | 4505 | switch (offset) |
| 4571 | 4506 | { |
| 4572 | 4507 | case 1: |
| 4573 | | return tc0110pcr->ram[tc0110pcr->addr]; |
| 4508 | return m_ram[m_addr]; |
| 4574 | 4509 | |
| 4575 | 4510 | default: |
| 4576 | 4511 | //logerror("PC %06x: warning - read TC0110PCR address %02x\n",space.device().safe_pc(),offset); |
| r24008 | r24009 | |
| 4578 | 4513 | } |
| 4579 | 4514 | } |
| 4580 | 4515 | |
| 4581 | | WRITE16_DEVICE_HANDLER( tc0110pcr_word_w ) |
| 4516 | WRITE16_MEMBER(tc0110pcr_device::word_w ) |
| 4582 | 4517 | { |
| 4583 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(device); |
| 4584 | | |
| 4585 | 4518 | switch (offset) |
| 4586 | 4519 | { |
| 4587 | 4520 | case 0: |
| 4588 | 4521 | /* In test mode game writes to odd register number so (data>>1) */ |
| 4589 | | tc0110pcr->addr = (data >> 1) & 0xfff; |
| 4522 | m_addr = (data >> 1) & 0xfff; |
| 4590 | 4523 | if (data > 0x1fff) |
| 4591 | 4524 | logerror ("Write to palette index > 0x1fff\n"); |
| 4592 | 4525 | break; |
| 4593 | 4526 | |
| 4594 | 4527 | case 1: |
| 4595 | | tc0110pcr->ram[tc0110pcr->addr] = data & 0xffff; |
| 4596 | | palette_set_color_rgb(space.machine(), tc0110pcr->addr, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); |
| 4528 | m_ram[m_addr] = data & 0xffff; |
| 4529 | palette_set_color_rgb(space.machine(), m_addr, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); |
| 4597 | 4530 | break; |
| 4598 | 4531 | |
| 4599 | 4532 | default: |
| r24008 | r24009 | |
| 4602 | 4535 | } |
| 4603 | 4536 | } |
| 4604 | 4537 | |
| 4605 | | WRITE16_DEVICE_HANDLER( tc0110pcr_step1_word_w ) |
| 4538 | WRITE16_MEMBER(tc0110pcr_device::step1_word_w ) |
| 4606 | 4539 | { |
| 4607 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(device); |
| 4608 | | |
| 4609 | 4540 | switch (offset) |
| 4610 | 4541 | { |
| 4611 | 4542 | case 0: |
| 4612 | | tc0110pcr->addr = data & 0xfff; |
| 4543 | m_addr = data & 0xfff; |
| 4613 | 4544 | if (data > 0xfff) |
| 4614 | | logerror ("Write to palette index (color area %d) > 0xfff\n", tc0110pcr->pal_offs); |
| 4545 | logerror ("Write to palette index (color area %d) > 0xfff\n", m_pal_offs); |
| 4615 | 4546 | break; |
| 4616 | 4547 | |
| 4617 | 4548 | case 1: |
| 4618 | | tc0110pcr->ram[tc0110pcr->addr] = data & 0xffff; |
| 4619 | | palette_set_color_rgb(space.machine(), tc0110pcr->addr + (tc0110pcr->pal_offs << 12), pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); |
| 4549 | m_ram[m_addr] = data & 0xffff; |
| 4550 | palette_set_color_rgb(space.machine(), m_addr + (m_pal_offs << 12), pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); |
| 4620 | 4551 | break; |
| 4621 | 4552 | |
| 4622 | 4553 | default: |
| r24008 | r24009 | |
| 4625 | 4556 | } |
| 4626 | 4557 | } |
| 4627 | 4558 | |
| 4628 | | WRITE16_DEVICE_HANDLER( tc0110pcr_step1_rbswap_word_w ) |
| 4559 | WRITE16_MEMBER(tc0110pcr_device::step1_rbswap_word_w ) |
| 4629 | 4560 | { |
| 4630 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(device); |
| 4561 | m_type = 1; /* xRRRRRGGGGGBBBBB */ |
| 4631 | 4562 | |
| 4632 | | tc0110pcr->type = 1; /* xRRRRRGGGGGBBBBB */ |
| 4633 | | |
| 4634 | 4563 | switch (offset) |
| 4635 | 4564 | { |
| 4636 | 4565 | case 0: |
| 4637 | | tc0110pcr->addr = data & 0xfff; |
| 4566 | m_addr = data & 0xfff; |
| 4638 | 4567 | if (data > 0xfff) |
| 4639 | 4568 | logerror ("Write to palette index > 0xfff\n"); |
| 4640 | 4569 | break; |
| 4641 | 4570 | |
| 4642 | 4571 | case 1: |
| 4643 | | tc0110pcr->ram[tc0110pcr->addr] = data & 0xffff; |
| 4644 | | palette_set_color_rgb(space.machine(), tc0110pcr->addr, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 4572 | m_ram[m_addr] = data & 0xffff; |
| 4573 | palette_set_color_rgb(space.machine(), m_addr, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 4645 | 4574 | break; |
| 4646 | 4575 | |
| 4647 | 4576 | default: |
| r24008 | r24009 | |
| 4650 | 4579 | } |
| 4651 | 4580 | } |
| 4652 | 4581 | |
| 4653 | | WRITE16_DEVICE_HANDLER( tc0110pcr_step1_4bpg_word_w ) |
| 4582 | WRITE16_MEMBER(tc0110pcr_device::step1_4bpg_word_w ) |
| 4654 | 4583 | { |
| 4655 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(device); |
| 4584 | m_type = 2; /* xxxxBBBBGGGGRRRR */ |
| 4656 | 4585 | |
| 4657 | | tc0110pcr->type = 2; /* xxxxBBBBGGGGRRRR */ |
| 4658 | | |
| 4659 | 4586 | switch (offset) |
| 4660 | 4587 | { |
| 4661 | 4588 | case 0: |
| 4662 | | tc0110pcr->addr = data & 0xfff; |
| 4589 | m_addr = data & 0xfff; |
| 4663 | 4590 | if (data > 0xfff) |
| 4664 | 4591 | logerror ("Write to palette index > 0xfff\n"); |
| 4665 | 4592 | break; |
| 4666 | 4593 | |
| 4667 | 4594 | case 1: |
| 4668 | | tc0110pcr->ram[tc0110pcr->addr] = data & 0xffff; |
| 4669 | | palette_set_color_rgb(space.machine(), tc0110pcr->addr, pal4bit(data >> 0), pal4bit(data >> 4), pal4bit(data >> 8)); |
| 4595 | m_ram[m_addr] = data & 0xffff; |
| 4596 | palette_set_color_rgb(space.machine(), m_addr, pal4bit(data >> 0), pal4bit(data >> 4), pal4bit(data >> 8)); |
| 4670 | 4597 | break; |
| 4671 | 4598 | |
| 4672 | 4599 | default: |
| r24008 | r24009 | |
| 4675 | 4602 | } |
| 4676 | 4603 | } |
| 4677 | 4604 | |
| 4678 | | /***************************************************************************** |
| 4679 | | DEVICE INTERFACE |
| 4680 | | *****************************************************************************/ |
| 4681 | 4605 | |
| 4682 | | const device_type TC0110PCR = &device_creator<tc0110pcr_device>; |
| 4683 | 4606 | |
| 4684 | | tc0110pcr_device::tc0110pcr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 4685 | | : device_t(mconfig, TC0110PCR, "Taito TC0110PCR", tag, owner, clock, "tc0110pcr", __FILE__) |
| 4607 | /***************************************************************************/ |
| 4608 | /* */ |
| 4609 | /* TC0180VCU */ |
| 4610 | /* */ |
| 4611 | /***************************************************************************/ |
| 4612 | |
| 4613 | |
| 4614 | #define TC0180VCU_RAM_SIZE 0x10000 |
| 4615 | #define TC0180VCU_SCROLLRAM_SIZE 0x0800 |
| 4616 | |
| 4617 | |
| 4618 | const device_type TC0180VCU = &device_creator<tc0180vcu_device>; |
| 4619 | |
| 4620 | tc0180vcu_device::tc0180vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 4621 | : device_t(mconfig, TC0180VCU, "Taito TC0180VCU", tag, owner, clock, "tc0180vcu", __FILE__), |
| 4622 | m_ram(NULL), |
| 4623 | //m_scrollram(NULL), |
| 4624 | //m_bg_rambank(0), |
| 4625 | //m_fg_rambank(0), |
| 4626 | //m_tx_rambank(0), |
| 4627 | m_framebuffer_page(0), |
| 4628 | m_video_control(0) |
| 4686 | 4629 | { |
| 4687 | | m_token = global_alloc_clear(tc0110pcr_state); |
| 4688 | 4630 | } |
| 4689 | 4631 | |
| 4690 | 4632 | //------------------------------------------------- |
| r24008 | r24009 | |
| 4693 | 4635 | // complete |
| 4694 | 4636 | //------------------------------------------------- |
| 4695 | 4637 | |
| 4696 | | void tc0110pcr_device::device_config_complete() |
| 4638 | void tc0180vcu_device::device_config_complete() |
| 4697 | 4639 | { |
| 4640 | // inherit a copy of the static data |
| 4641 | const tc0180vcu_interface *intf = reinterpret_cast<const tc0180vcu_interface *>(static_config()); |
| 4642 | if (intf != NULL) |
| 4643 | *static_cast<tc0180vcu_interface *>(this) = *intf; |
| 4644 | |
| 4645 | // or initialize to defaults if none provided |
| 4646 | else |
| 4647 | { |
| 4648 | } |
| 4698 | 4649 | } |
| 4699 | 4650 | |
| 4700 | 4651 | //------------------------------------------------- |
| 4701 | 4652 | // device_start - device-specific startup |
| 4702 | 4653 | //------------------------------------------------- |
| 4703 | 4654 | |
| 4704 | | void tc0110pcr_device::device_start() |
| 4655 | void tc0180vcu_device::device_start() |
| 4705 | 4656 | { |
| 4706 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(this); |
| 4707 | | const tc0110pcr_interface *intf = tc0110pcr_get_interface(this); |
| 4657 | m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); |
| 4658 | m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); |
| 4659 | m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); |
| 4708 | 4660 | |
| 4709 | | tc0110pcr->m_machine = &machine(); |
| 4661 | m_tilemap[1]->set_transparent_pen(0); |
| 4662 | m_tilemap[2]->set_transparent_pen(0); |
| 4710 | 4663 | |
| 4711 | | tc0110pcr->pal_offs = intf->pal_offs; |
| 4664 | m_tilemap[0]->set_scrolldx(0, 24 * 8); |
| 4665 | m_tilemap[1]->set_scrolldx(0, 24 * 8); |
| 4666 | m_tilemap[2]->set_scrolldx(0, 24 * 8); |
| 4712 | 4667 | |
| 4713 | | tc0110pcr->ram = auto_alloc_array(machine(), UINT16, TC0110PCR_RAM_SIZE); |
| 4668 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_RAM_SIZE / 2); |
| 4669 | m_scrollram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_SCROLLRAM_SIZE / 2); |
| 4714 | 4670 | |
| 4715 | | save_pointer(NAME(tc0110pcr->ram), TC0110PCR_RAM_SIZE); |
| 4716 | | save_item(NAME(tc0110pcr->type)); |
| 4717 | | machine().save().register_postload(save_prepost_delegate(FUNC(tc0110pcr_device::tc0110pcr_restore_colors), this)); |
| 4671 | save_pointer(NAME(m_ram), TC0180VCU_RAM_SIZE / 2); |
| 4672 | save_pointer(NAME(m_scrollram), TC0180VCU_SCROLLRAM_SIZE / 2); |
| 4718 | 4673 | |
| 4674 | save_item(NAME(m_bg_rambank)); |
| 4675 | save_item(NAME(m_fg_rambank)); |
| 4676 | save_item(NAME(m_tx_rambank)); |
| 4677 | |
| 4678 | save_item(NAME(m_framebuffer_page)); |
| 4679 | |
| 4680 | save_item(NAME(m_video_control)); |
| 4681 | save_item(NAME(m_ctrl)); |
| 4719 | 4682 | } |
| 4720 | 4683 | |
| 4721 | 4684 | //------------------------------------------------- |
| 4722 | 4685 | // device_reset - device-specific reset |
| 4723 | 4686 | //------------------------------------------------- |
| 4724 | 4687 | |
| 4725 | | void tc0110pcr_device::device_reset() |
| 4688 | void tc0180vcu_device::device_reset() |
| 4726 | 4689 | { |
| 4727 | | tc0110pcr_state *tc0110pcr = tc0110pcr_get_safe_token(this); |
| 4728 | | tc0110pcr->type = 0; /* default, xBBBBBGGGGGRRRRR */ |
| 4729 | | } |
| 4690 | int i; |
| 4730 | 4691 | |
| 4692 | for (i = 0; i < 0x10; i++) |
| 4693 | m_ctrl[i] = 0; |
| 4731 | 4694 | |
| 4732 | | /***************************************************************************/ |
| 4733 | | /* */ |
| 4734 | | /* TC0180VCU */ |
| 4735 | | /* */ |
| 4736 | | /***************************************************************************/ |
| 4695 | m_bg_rambank[0] = 0; |
| 4696 | m_bg_rambank[1] = 0; |
| 4697 | m_fg_rambank[0] = 0; |
| 4698 | m_fg_rambank[1] = 0; |
| 4699 | m_tx_rambank = 0; |
| 4737 | 4700 | |
| 4738 | | struct tc0180vcu_state |
| 4739 | | { |
| 4740 | | UINT16 ctrl[0x10]; |
| 4741 | | |
| 4742 | | UINT16 * ram; |
| 4743 | | UINT16 * scrollram; |
| 4744 | | |
| 4745 | | tilemap_t *tilemap[3]; |
| 4746 | | |
| 4747 | | UINT16 bg_rambank[2], fg_rambank[2], tx_rambank; |
| 4748 | | UINT8 framebuffer_page; |
| 4749 | | UINT8 video_control; |
| 4750 | | |
| 4751 | | int bg_color_base; |
| 4752 | | int fg_color_base; |
| 4753 | | int tx_color_base; |
| 4754 | | }; |
| 4755 | | |
| 4756 | | #define TC0180VCU_RAM_SIZE 0x10000 |
| 4757 | | #define TC0180VCU_SCROLLRAM_SIZE 0x0800 |
| 4758 | | |
| 4759 | | /***************************************************************************** |
| 4760 | | INLINE FUNCTIONS |
| 4761 | | *****************************************************************************/ |
| 4762 | | |
| 4763 | | INLINE tc0180vcu_state *tc0180vcu_get_safe_token( device_t *device ) |
| 4764 | | { |
| 4765 | | assert(device != NULL); |
| 4766 | | assert(device->type() == TC0180VCU); |
| 4767 | | |
| 4768 | | return (tc0180vcu_state *)downcast<tc0180vcu_device *>(device)->token(); |
| 4701 | m_framebuffer_page = 0; |
| 4702 | m_video_control = 0; |
| 4769 | 4703 | } |
| 4770 | 4704 | |
| 4771 | | INLINE const tc0180vcu_interface *tc0180vcu_get_interface( device_t *device ) |
| 4772 | | { |
| 4773 | | assert(device != NULL); |
| 4774 | | assert((device->type() == TC0180VCU)); |
| 4775 | | return (const tc0180vcu_interface *) device->static_config(); |
| 4776 | | } |
| 4777 | 4705 | |
| 4778 | 4706 | /***************************************************************************** |
| 4779 | 4707 | DEVICE HANDLERS |
| r24008 | r24009 | |
| 4822 | 4750 | * |
| 4823 | 4751 | */ |
| 4824 | 4752 | |
| 4825 | | READ8_DEVICE_HANDLER( tc0180vcu_get_fb_page ) |
| 4753 | READ8_MEMBER( tc0180vcu_device::get_fb_page ) |
| 4826 | 4754 | { |
| 4827 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4828 | | return tc0180vcu->framebuffer_page; |
| 4755 | return m_framebuffer_page; |
| 4829 | 4756 | } |
| 4830 | 4757 | |
| 4831 | | WRITE8_DEVICE_HANDLER( tc0180vcu_set_fb_page ) |
| 4758 | WRITE8_MEMBER( tc0180vcu_device::set_fb_page ) |
| 4832 | 4759 | { |
| 4833 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4834 | | tc0180vcu->framebuffer_page = data; |
| 4760 | m_framebuffer_page = data; |
| 4835 | 4761 | } |
| 4836 | 4762 | |
| 4837 | | READ8_DEVICE_HANDLER( tc0180vcu_get_videoctrl ) |
| 4763 | READ8_MEMBER( tc0180vcu_device::get_videoctrl ) |
| 4838 | 4764 | { |
| 4839 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4840 | | return tc0180vcu->video_control; |
| 4765 | return m_video_control; |
| 4841 | 4766 | } |
| 4842 | 4767 | |
| 4843 | | static void tc0180vcu_video_control( device_t *device, UINT8 data ) |
| 4768 | void tc0180vcu_device::video_control( UINT8 data ) |
| 4844 | 4769 | { |
| 4845 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4846 | 4770 | #if 0 |
| 4847 | | if (data != tc0180vcu->video_control) |
| 4771 | if (data != m_video_control) |
| 4848 | 4772 | popmessage("video control = %02x", data); |
| 4849 | 4773 | #endif |
| 4850 | 4774 | |
| 4851 | | tc0180vcu->video_control = data; |
| 4775 | m_video_control = data; |
| 4852 | 4776 | |
| 4853 | | if (tc0180vcu->video_control & 0x80) |
| 4854 | | tc0180vcu->framebuffer_page = (~tc0180vcu->video_control & 0x40) >> 6; |
| 4777 | if (m_video_control & 0x80) |
| 4778 | m_framebuffer_page = (~m_video_control & 0x40) >> 6; |
| 4855 | 4779 | |
| 4856 | | device->machine().tilemap().set_flip_all((tc0180vcu->video_control & 0x10) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0 ); |
| 4780 | machine().tilemap().set_flip_all((m_video_control & 0x10) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0 ); |
| 4857 | 4781 | } |
| 4858 | 4782 | |
| 4859 | | READ16_DEVICE_HANDLER( tc0180vcu_ctrl_r ) |
| 4783 | READ16_MEMBER( tc0180vcu_device::ctrl_r ) |
| 4860 | 4784 | { |
| 4861 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4862 | | return tc0180vcu->ctrl[offset]; |
| 4785 | return m_ctrl[offset]; |
| 4863 | 4786 | } |
| 4864 | 4787 | |
| 4865 | | WRITE16_DEVICE_HANDLER( tc0180vcu_ctrl_w ) |
| 4788 | WRITE16_MEMBER( tc0180vcu_device::ctrl_w ) |
| 4866 | 4789 | { |
| 4867 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4868 | | UINT16 oldword = tc0180vcu->ctrl[offset]; |
| 4790 | UINT16 oldword = m_ctrl[offset]; |
| 4869 | 4791 | |
| 4870 | | COMBINE_DATA (&tc0180vcu->ctrl[offset]); |
| 4792 | COMBINE_DATA (&m_ctrl[offset]); |
| 4871 | 4793 | |
| 4872 | | if (oldword != tc0180vcu->ctrl[offset]) |
| 4794 | if (oldword != m_ctrl[offset]) |
| 4873 | 4795 | { |
| 4874 | 4796 | if (ACCESSING_BITS_8_15) |
| 4875 | 4797 | { |
| 4876 | 4798 | switch(offset) |
| 4877 | 4799 | { |
| 4878 | 4800 | case 0: |
| 4879 | | tc0180vcu->tilemap[1]->mark_all_dirty(); |
| 4880 | | tc0180vcu->fg_rambank[0] = (((tc0180vcu->ctrl[offset] >> 8) & 0x0f) << 12); |
| 4881 | | tc0180vcu->fg_rambank[1] = (((tc0180vcu->ctrl[offset] >> 12) & 0x0f) << 12); |
| 4801 | m_tilemap[1]->mark_all_dirty(); |
| 4802 | m_fg_rambank[0] = (((m_ctrl[offset] >> 8) & 0x0f) << 12); |
| 4803 | m_fg_rambank[1] = (((m_ctrl[offset] >> 12) & 0x0f) << 12); |
| 4882 | 4804 | break; |
| 4883 | 4805 | case 1: |
| 4884 | | tc0180vcu->tilemap[0]->mark_all_dirty(); |
| 4885 | | tc0180vcu->bg_rambank[0] = (((tc0180vcu->ctrl[offset] >> 8) & 0x0f) << 12); |
| 4886 | | tc0180vcu->bg_rambank[1] = (((tc0180vcu->ctrl[offset] >> 12) & 0x0f) << 12); |
| 4806 | m_tilemap[0]->mark_all_dirty(); |
| 4807 | m_bg_rambank[0] = (((m_ctrl[offset] >> 8) & 0x0f) << 12); |
| 4808 | m_bg_rambank[1] = (((m_ctrl[offset] >> 12) & 0x0f) << 12); |
| 4887 | 4809 | break; |
| 4888 | 4810 | case 4: |
| 4889 | 4811 | case 5: |
| 4890 | | tc0180vcu->tilemap[2]->mark_all_dirty(); |
| 4812 | m_tilemap[2]->mark_all_dirty(); |
| 4891 | 4813 | break; |
| 4892 | 4814 | case 6: |
| 4893 | | tc0180vcu->tilemap[2]->mark_all_dirty(); |
| 4894 | | tc0180vcu->tx_rambank = (((tc0180vcu->ctrl[offset] >> 8) & 0x0f) << 11); |
| 4815 | m_tilemap[2]->mark_all_dirty(); |
| 4816 | m_tx_rambank = (((m_ctrl[offset] >> 8) & 0x0f) << 11); |
| 4895 | 4817 | break; |
| 4896 | 4818 | case 7: |
| 4897 | | tc0180vcu_video_control(device, (tc0180vcu->ctrl[offset] >> 8) & 0xff); |
| 4819 | video_control((m_ctrl[offset] >> 8) & 0xff); |
| 4898 | 4820 | break; |
| 4899 | 4821 | default: |
| 4900 | 4822 | break; |
| r24008 | r24009 | |
| 4905 | 4827 | |
| 4906 | 4828 | TILE_GET_INFO_MEMBER(tc0180vcu_device::get_bg_tile_info) |
| 4907 | 4829 | { |
| 4908 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(this); |
| 4909 | | int tile = tc0180vcu->ram[tile_index + tc0180vcu->bg_rambank[0]]; |
| 4910 | | int color = tc0180vcu->ram[tile_index + tc0180vcu->bg_rambank[1]]; |
| 4830 | int tile = m_ram[tile_index + m_bg_rambank[0]]; |
| 4831 | int color = m_ram[tile_index + m_bg_rambank[1]]; |
| 4911 | 4832 | |
| 4912 | 4833 | SET_TILE_INFO_MEMBER( |
| 4913 | 4834 | 1, |
| 4914 | 4835 | tile, |
| 4915 | | tc0180vcu->bg_color_base + (color & 0x3f), |
| 4836 | m_bg_color_base + (color & 0x3f), |
| 4916 | 4837 | TILE_FLIPYX((color & 0x00c0) >> 6)); |
| 4917 | 4838 | } |
| 4918 | 4839 | |
| 4919 | 4840 | TILE_GET_INFO_MEMBER(tc0180vcu_device::get_fg_tile_info) |
| 4920 | 4841 | { |
| 4921 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(this); |
| 4922 | | int tile = tc0180vcu->ram[tile_index + tc0180vcu->fg_rambank[0]]; |
| 4923 | | int color = tc0180vcu->ram[tile_index + tc0180vcu->fg_rambank[1]]; |
| 4842 | int tile = m_ram[tile_index + m_fg_rambank[0]]; |
| 4843 | int color = m_ram[tile_index + m_fg_rambank[1]]; |
| 4924 | 4844 | |
| 4925 | 4845 | SET_TILE_INFO_MEMBER( |
| 4926 | 4846 | 1, |
| 4927 | 4847 | tile, |
| 4928 | | tc0180vcu->fg_color_base + (color & 0x3f), |
| 4848 | m_fg_color_base + (color & 0x3f), |
| 4929 | 4849 | TILE_FLIPYX((color & 0x00c0) >> 6)); |
| 4930 | 4850 | } |
| 4931 | 4851 | |
| 4932 | 4852 | TILE_GET_INFO_MEMBER(tc0180vcu_device::get_tx_tile_info) |
| 4933 | 4853 | { |
| 4934 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(this); |
| 4935 | | int tile = tc0180vcu->ram[tile_index + tc0180vcu->tx_rambank]; |
| 4854 | int tile = m_ram[tile_index + m_tx_rambank]; |
| 4936 | 4855 | |
| 4937 | 4856 | SET_TILE_INFO_MEMBER( |
| 4938 | 4857 | 0, |
| 4939 | | (tile & 0x07ff) | ((tc0180vcu->ctrl[4 + ((tile & 0x800) >> 11)]>>8) << 11), |
| 4940 | | tc0180vcu->tx_color_base + ((tile >> 12) & 0x0f), |
| 4858 | (tile & 0x07ff) | ((m_ctrl[4 + ((tile & 0x800) >> 11)]>>8) << 11), |
| 4859 | m_tx_color_base + ((tile >> 12) & 0x0f), |
| 4941 | 4860 | 0); |
| 4942 | 4861 | } |
| 4943 | 4862 | |
| 4944 | | READ16_DEVICE_HANDLER( tc0180vcu_scroll_r ) |
| 4863 | READ16_MEMBER( tc0180vcu_device::scroll_r ) |
| 4945 | 4864 | { |
| 4946 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4947 | | return tc0180vcu->scrollram[offset]; |
| 4865 | return m_scrollram[offset]; |
| 4948 | 4866 | } |
| 4949 | 4867 | |
| 4950 | | WRITE16_DEVICE_HANDLER( tc0180vcu_scroll_w ) |
| 4868 | WRITE16_MEMBER( tc0180vcu_device::scroll_w ) |
| 4951 | 4869 | { |
| 4952 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4953 | | COMBINE_DATA(&tc0180vcu->scrollram[offset]); |
| 4870 | COMBINE_DATA(&m_scrollram[offset]); |
| 4954 | 4871 | } |
| 4955 | 4872 | |
| 4956 | | READ16_DEVICE_HANDLER( tc0180vcu_word_r ) |
| 4873 | READ16_MEMBER( tc0180vcu_device::word_r ) |
| 4957 | 4874 | { |
| 4958 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4959 | | return tc0180vcu->ram[offset]; |
| 4875 | return m_ram[offset]; |
| 4960 | 4876 | } |
| 4961 | 4877 | |
| 4962 | | WRITE16_DEVICE_HANDLER( tc0180vcu_word_w ) |
| 4878 | WRITE16_MEMBER( tc0180vcu_device::word_w ) |
| 4963 | 4879 | { |
| 4964 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4965 | | COMBINE_DATA(&tc0180vcu->ram[offset]); |
| 4880 | COMBINE_DATA(&m_ram[offset]); |
| 4966 | 4881 | |
| 4967 | | if ((offset & 0x7000) == tc0180vcu->fg_rambank[0] || (offset & 0x7000) == tc0180vcu->fg_rambank[1]) |
| 4968 | | tc0180vcu->tilemap[1]->mark_tile_dirty(offset & 0x0fff); |
| 4882 | if ((offset & 0x7000) == m_fg_rambank[0] || (offset & 0x7000) == m_fg_rambank[1]) |
| 4883 | m_tilemap[1]->mark_tile_dirty(offset & 0x0fff); |
| 4969 | 4884 | |
| 4970 | | if ((offset & 0x7000) == tc0180vcu->bg_rambank[0] || (offset & 0x7000) == tc0180vcu->bg_rambank[1]) |
| 4971 | | tc0180vcu->tilemap[0]->mark_tile_dirty(offset & 0x0fff); |
| 4885 | if ((offset & 0x7000) == m_bg_rambank[0] || (offset & 0x7000) == m_bg_rambank[1]) |
| 4886 | m_tilemap[0]->mark_tile_dirty(offset & 0x0fff); |
| 4972 | 4887 | |
| 4973 | | if ((offset & 0x7800) == tc0180vcu->tx_rambank) |
| 4974 | | tc0180vcu->tilemap[2]->mark_tile_dirty(offset & 0x7ff); |
| 4888 | if ((offset & 0x7800) == m_tx_rambank) |
| 4889 | m_tilemap[2]->mark_tile_dirty(offset & 0x7ff); |
| 4975 | 4890 | } |
| 4976 | 4891 | |
| 4977 | | void tc0180vcu_tilemap_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, int plane ) |
| 4892 | void tc0180vcu_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, int plane ) |
| 4978 | 4893 | { |
| 4979 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); |
| 4980 | | |
| 4981 | 4894 | assert(tmap_num < 3); |
| 4982 | 4895 | |
| 4983 | 4896 | if (tmap_num == 2) |
| 4984 | | tc0180vcu->tilemap[2]->draw(bitmap, cliprect, 0, 0); /* not much to do for tx_tilemap */ |
| 4897 | m_tilemap[2]->draw(bitmap, cliprect, 0, 0); /* not much to do for tx_tilemap */ |
| 4985 | 4898 | else |
| 4986 | 4899 | { |
| 4987 | 4900 | /*plane = 0 fg tilemap*/ |
| r24008 | r24009 | |
| 4992 | 4905 | int lines_per_block; /* number of lines scrolled by the same amount (per one scroll value) */ |
| 4993 | 4906 | int number_of_blocks; /* number of such blocks per _screen_ (256 lines) */ |
| 4994 | 4907 | |
| 4995 | | lines_per_block = 256 - (tc0180vcu->ctrl[2 + plane] >> 8); |
| 4908 | lines_per_block = 256 - (m_ctrl[2 + plane] >> 8); |
| 4996 | 4909 | number_of_blocks = 256 / lines_per_block; |
| 4997 | 4910 | |
| 4998 | 4911 | my_clip.min_x = cliprect.min_x; |
| r24008 | r24009 | |
| 5000 | 4913 | |
| 5001 | 4914 | for (i = 0; i < number_of_blocks; i++) |
| 5002 | 4915 | { |
| 5003 | | scrollx = tc0180vcu->scrollram[plane * 0x200 + i * 2 * lines_per_block]; |
| 5004 | | scrolly = tc0180vcu->scrollram[plane * 0x200 + i * 2 * lines_per_block + 1]; |
| 4916 | scrollx = m_scrollram[plane * 0x200 + i * 2 * lines_per_block]; |
| 4917 | scrolly = m_scrollram[plane * 0x200 + i * 2 * lines_per_block + 1]; |
| 5005 | 4918 | |
| 5006 | 4919 | my_clip.min_y = i * lines_per_block; |
| 5007 | 4920 | my_clip.max_y = (i + 1) * lines_per_block - 1; |
| 5008 | 4921 | |
| 5009 | | if (tc0180vcu->video_control & 0x10) /*flip screen*/ |
| 4922 | if (m_video_control & 0x10) /*flip screen*/ |
| 5010 | 4923 | { |
| 5011 | 4924 | my_clip.min_y = bitmap.height() - 1 - (i + 1) * lines_per_block - 1; |
| 5012 | 4925 | my_clip.max_y = bitmap.height() - 1 - i * lines_per_block; |
| r24008 | r24009 | |
| 5016 | 4929 | |
| 5017 | 4930 | if (my_clip.min_y <= my_clip.max_y) |
| 5018 | 4931 | { |
| 5019 | | tc0180vcu->tilemap[tmap_num]->set_scrollx(0, -scrollx); |
| 5020 | | tc0180vcu->tilemap[tmap_num]->set_scrolly(0, -scrolly); |
| 5021 | | tc0180vcu->tilemap[tmap_num]->draw(bitmap, my_clip, 0, 0); |
| 4932 | m_tilemap[tmap_num]->set_scrollx(0, -scrollx); |
| 4933 | m_tilemap[tmap_num]->set_scrolly(0, -scrolly); |
| 4934 | m_tilemap[tmap_num]->draw(bitmap, my_clip, 0, 0); |
| 5022 | 4935 | } |
| 5023 | 4936 | } |
| 5024 | 4937 | } |
| 5025 | 4938 | } |
| 5026 | | |
| 5027 | | const device_type TC0180VCU = &device_creator<tc0180vcu_device>; |
| 5028 | | |
| 5029 | | tc0180vcu_device::tc0180vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 5030 | | : device_t(mconfig, TC0180VCU, "Taito TC0180VCU", tag, owner, clock, "tc0180vcu", __FILE__) |
| 5031 | | { |
| 5032 | | m_token = global_alloc_clear(tc0180vcu_state); |
| 5033 | | } |
| 5034 | | |
| 5035 | | //------------------------------------------------- |
| 5036 | | // device_config_complete - perform any |
| 5037 | | // operations now that the configuration is |
| 5038 | | // complete |
| 5039 | | //------------------------------------------------- |
| 5040 | | |
| 5041 | | void tc0180vcu_device::device_config_complete() |
| 5042 | | { |
| 5043 | | } |
| 5044 | | |
| 5045 | | //------------------------------------------------- |
| 5046 | | // device_start - device-specific startup |
| 5047 | | //------------------------------------------------- |
| 5048 | | |
| 5049 | | void tc0180vcu_device::device_start() |
| 5050 | | { |
| 5051 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(this); |
| 5052 | | const tc0180vcu_interface *intf = tc0180vcu_get_interface(this); |
| 5053 | | |
| 5054 | | tc0180vcu->bg_color_base = intf->bg_color_base; |
| 5055 | | tc0180vcu->fg_color_base = intf->fg_color_base; |
| 5056 | | tc0180vcu->tx_color_base = intf->tx_color_base; |
| 5057 | | |
| 5058 | | tc0180vcu->tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); |
| 5059 | | tc0180vcu->tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); |
| 5060 | | tc0180vcu->tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(tc0180vcu_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); |
| 5061 | | |
| 5062 | | tc0180vcu->tilemap[1]->set_transparent_pen(0); |
| 5063 | | tc0180vcu->tilemap[2]->set_transparent_pen(0); |
| 5064 | | |
| 5065 | | tc0180vcu->tilemap[0]->set_scrolldx(0, 24 * 8); |
| 5066 | | tc0180vcu->tilemap[1]->set_scrolldx(0, 24 * 8); |
| 5067 | | tc0180vcu->tilemap[2]->set_scrolldx(0, 24 * 8); |
| 5068 | | |
| 5069 | | tc0180vcu->ram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_RAM_SIZE / 2); |
| 5070 | | tc0180vcu->scrollram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_SCROLLRAM_SIZE / 2); |
| 5071 | | |
| 5072 | | save_pointer(NAME(tc0180vcu->ram), TC0180VCU_RAM_SIZE / 2); |
| 5073 | | save_pointer(NAME(tc0180vcu->scrollram), TC0180VCU_SCROLLRAM_SIZE / 2); |
| 5074 | | |
| 5075 | | save_item(NAME(tc0180vcu->bg_rambank)); |
| 5076 | | save_item(NAME(tc0180vcu->fg_rambank)); |
| 5077 | | save_item(NAME(tc0180vcu->tx_rambank)); |
| 5078 | | |
| 5079 | | save_item(NAME(tc0180vcu->framebuffer_page)); |
| 5080 | | |
| 5081 | | save_item(NAME(tc0180vcu->video_control)); |
| 5082 | | save_item(NAME(tc0180vcu->ctrl)); |
| 5083 | | } |
| 5084 | | |
| 5085 | | //------------------------------------------------- |
| 5086 | | // device_reset - device-specific reset |
| 5087 | | //------------------------------------------------- |
| 5088 | | |
| 5089 | | void tc0180vcu_device::device_reset() |
| 5090 | | { |
| 5091 | | tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(this); |
| 5092 | | int i; |
| 5093 | | |
| 5094 | | for (i = 0; i < 0x10; i++) |
| 5095 | | tc0180vcu->ctrl[i] = 0; |
| 5096 | | |
| 5097 | | tc0180vcu->bg_rambank[0] = 0; |
| 5098 | | tc0180vcu->bg_rambank[1] = 0; |
| 5099 | | tc0180vcu->fg_rambank[0] = 0; |
| 5100 | | tc0180vcu->fg_rambank[1] = 0; |
| 5101 | | tc0180vcu->tx_rambank = 0; |
| 5102 | | |
| 5103 | | tc0180vcu->framebuffer_page = 0; |
| 5104 | | tc0180vcu->video_control = 0; |
| 5105 | | } |