| Previous | 199869 Revisions | Next |
| r20978 Tuesday 12th February, 2013 at 13:26:06 UTC by Miodrag Milanović |
|---|
| Modernization of drivers part 18 (no whatsnew) |
| [src/mame/drivers] | jclub2.c segag80r.c segag80v.c segas32.c seibuspi.c seta.c seta2.c sf.c simpsons.c skullxbo.c slapfght.c snk.c snk6502.c snowbros.c spacefb.c spdodgeb.c speedatk.c splash.c sprint2.c sprint8.c spy.c srmp2.c sshangha.c ssv.c stactics.c starwars.c suna8.c superqix.c suprnova.c suprridr.c system1.c system16.c |
| [src/mame/includes] | sauro.h sbasketb.h scotrsht.h scramble.h sderby.h segag80r.h segag80v.h segas32.h seibuspi.h seicross.h senjyo.h seta.h seta2.h sf.h shadfrce.h shangkid.h shaolins.h shootout.h sidearms.h sidepckt.h silkroad.h simpsons.h skullxbo.h skydiver.h skyfox.h skykid.h skyraid.h slapfght.h slapshot.h snk.h snk6502.h snk68.h snowbros.h solomon.h sonson.h spacefb.h spdodgeb.h speedatk.h speedbal.h speedspn.h splash.h sprcros2.h sprint2.h sprint8.h spy.h srmp2.h srumbler.h sshangha.h sslam.h ssozumo.h sspeedr.h ssrj.h ssv.h st0016.h stactics.h starcrus.h starfire.h starshp1.h starwars.h stfight.h stlforce.h strnskil.h subs.h suna16.h suna8.h superchs.h superqix.h suprloco.h suprnova.h suprridr.h system1.h system16.h |
| [src/mame/machine] | scramble.c segas32.c simpsons.c starwars.c subs.c |
| [src/mame/video] | sauro.c sbasketb.c scotrsht.c sderby.c segag80r.c segag80v.c segas32.c seibuspi.c seicross.c senjyo.c seta.c seta2.c sf.c shadfrce.c shangkid.c shaolins.c shootout.c sidearms.c sidepckt.c silkroad.c simpsons.c skullxbo.c skydiver.c skyfox.c skykid.c skyraid.c slapfght.c slapshot.c snk.c snk68.c solomon.c sonson.c spacefb.c spdodgeb.c speedbal.c speedspn.c splash.c sprcros2.c sprint2.c sprint8.c srumbler.c sslam.c ssozumo.c sspeedr.c ssrj.c ssv.c st0016.c stactics.c starcrus.c starfire.c starshp1.c stfight.c stlforce.c strnskil.c suna16.c suna8.c superchs.c superqix.c suprloco.c suprnova.c suprridr.c system1.c system16.c |
| r20977 | r20978 | |
|---|---|---|
| 22 | 22 | #include "includes/sprint2.h" |
| 23 | 23 | #include "sound/discrete.h" |
| 24 | 24 | |
| 25 | #define GAME_IS_SPRINT1 (state->m_game == 1) | |
| 26 | #define GAME_IS_SPRINT2 (state->m_game == 2) | |
| 27 | #define GAME_IS_DOMINOS (state->m_game == 3) | |
| 25 | #define GAME_IS_SPRINT1 (m_game == 1) | |
| 26 | #define GAME_IS_SPRINT2 (m_game == 2) | |
| 27 | #define GAME_IS_DOMINOS (m_game == 3) | |
| 28 | 28 | |
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | 29 | DRIVER_INIT_MEMBER(sprint2_state,sprint1) |
| 34 | 30 | { |
| 35 | 31 | m_game = 1; |
| r20977 | r20978 | |
| 43 | 39 | m_game = 3; |
| 44 | 40 | } |
| 45 | 41 | |
| 46 | ||
| 47 | static int service_mode(running_machine &machine) | |
| 42 | int sprint2_state::service_mode() | |
| 48 | 43 | { |
| 49 | sprint2_state *state = machine.driver_data<sprint2_state>(); | |
| 50 | UINT8 v = state->ioport("INB")->read(); | |
| 44 | UINT8 v = ioport("INB")->read(); | |
| 51 | 45 | |
| 52 | 46 | if (GAME_IS_SPRINT1) |
| 53 | 47 | { |
| r20977 | r20978 | |
| 68 | 62 | |
| 69 | 63 | INTERRUPT_GEN_MEMBER(sprint2_state::sprint2) |
| 70 | 64 | { |
| 71 | sprint2_state *state = machine().driver_data<sprint2_state>(); | |
| 72 | 65 | device_t *discrete = machine().device("discrete"); |
| 73 | 66 | |
| 74 | 67 | /* handle steering wheels */ |
| r20977 | r20978 | |
| 109 | 102 | |
| 110 | 103 | /* interrupts and watchdog are disabled during service mode */ |
| 111 | 104 | |
| 112 | machine().watchdog_enable(!service_mode( | |
| 105 | machine().watchdog_enable(!service_mode()); | |
| 113 | 106 | |
| 114 | if (!service_mode( | |
| 107 | if (!service_mode()) | |
| 115 | 108 | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 116 | 109 | } |
| 117 | 110 |
| r20977 | r20978 | |
|---|---|---|
| 394 | 394 | * |
| 395 | 395 | *************************************/ |
| 396 | 396 | |
| 397 | ||
| 397 | void system1_state::bank44_custom_w(UINT8 data, UINT8 prevdata) | |
| 398 | 398 | { |
| 399 | 399 | /* bank bits are bits 6 and 2 */ |
| 400 | machine.root_device().membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2)); | |
| 400 | machine().root_device().membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2)); | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | |
| 404 | ||
| 404 | void system1_state::bank0c_custom_w(UINT8 data, UINT8 prevdata) | |
| 405 | 405 | { |
| 406 | 406 | /* bank bits are bits 3 and 2 */ |
| 407 | machine.root_device().membank("bank1")->set_entry((data & 0x0c) >> 2); | |
| 407 | machine().root_device().membank("bank1")->set_entry((data & 0x0c) >> 2); | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | |
| r20977 | r20978 | |
| 418 | 418 | |
| 419 | 419 | /* handle any custom banking or other stuff */ |
| 420 | 420 | if (m_videomode_custom != NULL) |
| 421 | (*m_videomode_custom)( | |
| 421 | (this->*m_videomode_custom)(data, m_videomode_prev); | |
| 422 | 422 | m_videomode_prev = data; |
| 423 | 423 | |
| 424 | 424 | /* bit 0 is for the coin counters */ |
| r20977 | r20978 | |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | |
| 453 | ||
| 453 | void system1_state::dakkochn_custom_w(UINT8 data, UINT8 prevdata) | |
| 454 | 454 | { |
| 455 | system1_state *state = machine.driver_data<system1_state>(); | |
| 456 | 455 | /* bit 1 toggling on clocks the mux; we store the previous state in the high bit of dakkochn_mux_data */ |
| 457 | 456 | if ((data & 0x02) && !(prevdata & 0x02)) |
| 458 | | |
| 457 | m_dakkochn_mux_data = (m_dakkochn_mux_data + 1) % 7; | |
| 459 | 458 | |
| 460 | 459 | /* remaining stuff acts like bank0c */ |
| 461 | bank0c_custom_w( | |
| 460 | bank0c_custom_w(data, prevdata); | |
| 462 | 461 | } |
| 463 | 462 | |
| 464 | 463 | |
| r20977 | r20978 | |
| 4677 | 4676 | } |
| 4678 | 4677 | DRIVER_INIT_MEMBER(system1_state,bank44) |
| 4679 | 4678 | { |
| 4680 | m_videomode_custom = bank44_custom_w; | |
| 4679 | m_videomode_custom = &system1_state::bank44_custom_w; | |
| 4681 | 4680 | } |
| 4682 | 4681 | |
| 4683 | 4682 | DRIVER_INIT_MEMBER(system1_state,bank0c) |
| 4684 | 4683 | { |
| 4685 | m_videomode_custom = bank0c_custom_w; | |
| 4684 | m_videomode_custom = &system1_state::bank0c_custom_w; | |
| 4686 | 4685 | } |
| 4687 | 4686 | |
| 4688 | 4687 | DRIVER_INIT_MEMBER(system1_state,regulus) { DRIVER_INIT_CALL(bank00); regulus_decode(machine(), "maincpu"); } |
| r20977 | r20978 | |
| 4715 | 4714 | |
| 4716 | 4715 | DRIVER_INIT_MEMBER(system1_state,dakkochn) |
| 4717 | 4716 | { |
| 4718 | m_videomode_custom = dakkochn_custom_w; | |
| 4717 | m_videomode_custom = &system1_state::dakkochn_custom_w; | |
| 4719 | 4718 | |
| 4720 | 4719 | mc8123_decrypt_rom(machine(), "maincpu", "key", "bank1", 4); |
| 4721 | 4720 |
| r20977 | r20978 | |
|---|---|---|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| 250 | ||
| 250 | UINT8 srmp2_state::iox_key_matrix_calc(UINT8 p_side) | |
| 251 | 251 | { |
| 252 | 252 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" }; |
| 253 | 253 | int i, j, t; |
| r20977 | r20978 | |
| 258 | 258 | |
| 259 | 259 | for (t = 0 ; t < 8 ; t ++) |
| 260 | 260 | { |
| 261 | if (!(machine.root_device().ioport(keynames[j+p_side])->read() & ( 1 << t ))) | |
| 261 | if (!(machine().root_device().ioport(keynames[j+p_side])->read() & ( 1 << t ))) | |
| 262 | 262 | { |
| 263 | 263 | return (i + t) | (p_side ? 0x20 : 0x00); |
| 264 | 264 | } |
| r20977 | r20978 | |
| 297 | 297 | /* both side checks */ |
| 298 | 298 | if(iox.mux == 1) |
| 299 | 299 | { |
| 300 | UINT8 p1_side = iox_key_matrix_calc(machine(),0); | |
| 301 | UINT8 p2_side = iox_key_matrix_calc(machine(),4); | |
| 300 | UINT8 p1_side = iox_key_matrix_calc(0); | |
| 301 | UINT8 p2_side = iox_key_matrix_calc(4); | |
| 302 | 302 | |
| 303 | 303 | if(p1_side != 0) |
| 304 | 304 | return p1_side; |
| r20977 | r20978 | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /* check individual input side */ |
| 310 | return iox_key_matrix_calc( | |
| 310 | return iox_key_matrix_calc((iox.mux == 2) ? 0 : 4); | |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | return ioport("SERVICE")->read() & 0xff; |
| r20977 | r20978 | |
|---|---|---|
| 52 | 52 | /* The protection of the Japanese (and alt US) version */ |
| 53 | 53 | /* I'd love to see someone dump the 68705 / i8751 roms */ |
| 54 | 54 | |
| 55 | ||
| 55 | void sf_state::write_dword( address_space &space, offs_t offset, UINT32 data ) | |
| 56 | 56 | { |
| 57 | 57 | space.write_word(offset, data >> 16); |
| 58 | 58 | space.write_word(offset + 2, data); |
| r20977 | r20978 | |
|---|---|---|
| 576 | 576 | // low 6 bits might indicate radius, but it's not clear |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | ||
| 579 | int snk_state::hardflags_check(int num) | |
| 580 | 580 | { |
| 581 | snk_state *state = machine.driver_data<snk_state>(); | |
| 582 | const UINT8 *sr = &state->m_spriteram[0x800 + 4*num]; | |
| 581 | const UINT8 *sr = &m_spriteram[0x800 + 4*num]; | |
| 583 | 582 | int x = sr[2] + ((sr[3] & 0x80) << 1); |
| 584 | 583 | int y = sr[0] + ((sr[3] & 0x10) << 4); |
| 585 | 584 | |
| 586 | int dx = (x - state->m_hf_posx) & 0x1ff; | |
| 587 | int dy = (y - state->m_hf_posy) & 0x1ff; | |
| 585 | int dx = (x - m_hf_posx) & 0x1ff; | |
| 586 | int dy = (y - m_hf_posy) & 0x1ff; | |
| 588 | 587 | |
| 589 | 588 | if (dx > 0x20 && dx <= 0x1e0 && dy > 0x20 && dy <= 0x1e0) |
| 590 | 589 | return 0; |
| r20977 | r20978 | |
| 592 | 591 | return 1; |
| 593 | 592 | } |
| 594 | 593 | |
| 595 | ||
| 594 | int snk_state::hardflags_check8(int num) | |
| 596 | 595 | { |
| 597 | 596 | return |
| 598 | (hardflags_check(machine, num + 0) << 0) | | |
| 599 | (hardflags_check(machine, num + 1) << 1) | | |
| 600 | (hardflags_check(machine, num + 2) << 2) | | |
| 601 | (hardflags_check(machine, num + 3) << 3) | | |
| 602 | (hardflags_check(machine, num + 4) << 4) | | |
| 603 | (hardflags_check(machine, num + 5) << 5) | | |
| 604 | (hardflags_check(machine, num + 6) << 6) | | |
| 605 | (hardflags_check(machine, num + 7) << 7); | |
| 597 | (hardflags_check(num + 0) << 0) | | |
| 598 | (hardflags_check(num + 1) << 1) | | |
| 599 | (hardflags_check(num + 2) << 2) | | |
| 600 | (hardflags_check(num + 3) << 3) | | |
| 601 | (hardflags_check(num + 4) << 4) | | |
| 602 | (hardflags_check(num + 5) << 5) | | |
| 603 | (hardflags_check(num + 6) << 6) | | |
| 604 | (hardflags_check(num + 7) << 7); | |
| 606 | 605 | } |
| 607 | 606 | |
| 608 | READ8_MEMBER(snk_state::hardflags1_r){ return hardflags_check8(machine(), 0*8); } | |
| 609 | READ8_MEMBER(snk_state::hardflags2_r){ return hardflags_check8(machine(), 1*8); } | |
| 610 | READ8_MEMBER(snk_state::hardflags3_r){ return hardflags_check8(machine(), 2*8); } | |
| 611 | READ8_MEMBER(snk_state::hardflags4_r){ return hardflags_check8(machine(), 3*8); } | |
| 612 | READ8_MEMBER(snk_state::hardflags5_r){ return hardflags_check8(machine(), 4*8); } | |
| 613 | READ8_MEMBER(snk_state::hardflags6_r){ return hardflags_check8(machine(), 5*8); } | |
| 607 | READ8_MEMBER(snk_state::hardflags1_r){ return hardflags_check8(0*8); } | |
| 608 | READ8_MEMBER(snk_state::hardflags2_r){ return hardflags_check8(1*8); } | |
| 609 | READ8_MEMBER(snk_state::hardflags3_r){ return hardflags_check8(2*8); } | |
| 610 | READ8_MEMBER(snk_state::hardflags4_r){ return hardflags_check8(3*8); } | |
| 611 | READ8_MEMBER(snk_state::hardflags5_r){ return hardflags_check8(4*8); } | |
| 612 | READ8_MEMBER(snk_state::hardflags6_r){ return hardflags_check8(5*8); } | |
| 614 | 613 | READ8_MEMBER(snk_state::hardflags7_r) |
| 615 | 614 | { |
| 616 | 615 | // apparently the startup tests use bits 0&1 while the game uses bits 4&5 |
| 617 | 616 | return |
| 618 | (hardflags_check(machine(), 6*8 + 0) << 0) | | |
| 619 | (hardflags_check(machine(), 6*8 + 1) << 1) | | |
| 620 | (hardflags_check(machine(), 6*8 + 0) << 4) | | |
| 621 | (hardflags_check(machine(), 6*8 + 1) << 5); | |
| 617 | (hardflags_check(6*8 + 0) << 0) | | |
| 618 | (hardflags_check(6*8 + 1) << 1) | | |
| 619 | (hardflags_check(6*8 + 0) << 4) | | |
| 620 | (hardflags_check(6*8 + 1) << 5); | |
| 622 | 621 | } |
| 623 | 622 | |
| 624 | 623 | |
| r20977 | r20978 | |
| 669 | 668 | // low 6 bits might indicate radius, but it's not clear |
| 670 | 669 | } |
| 671 | 670 | |
| 672 | ||
| 671 | int snk_state::turbofront_check(int small, int num) | |
| 673 | 672 | { |
| 674 | snk_state *state = machine.driver_data<snk_state>(); | |
| 675 | const UINT8 *sr = &state->m_spriteram[0x800*small + 4*num]; | |
| 673 | const UINT8 *sr = &m_spriteram[0x800*small + 4*num]; | |
| 676 | 674 | int x = sr[2] + ((sr[3] & 0x80) << 1); |
| 677 | 675 | int y = sr[0] + ((sr[3] & 0x10) << 4); |
| 678 | 676 | |
| 679 | int dx = (x - (small ? state->m_tc16_posx : state->m_tc32_posx)) & 0x1ff; | |
| 680 | int dy = (y - (small ? state->m_tc16_posy : state->m_tc32_posy)) & 0x1ff; | |
| 677 | int dx = (x - (small ? m_tc16_posx : m_tc32_posx)) & 0x1ff; | |
| 678 | int dy = (y - (small ? m_tc16_posy : m_tc32_posy)) & 0x1ff; | |
| 681 | 679 | |
| 682 | 680 | if (dx > 0x20 && dx <= 0x1e0 && dy > 0x20 && dy <= 0x1e0) |
| 683 | 681 | return 0; |
| r20977 | r20978 | |
| 685 | 683 | return 1; |
| 686 | 684 | } |
| 687 | 685 | |
| 688 | ||
| 686 | int snk_state::turbofront_check8(int small, int num) | |
| 689 | 687 | { |
| 690 | 688 | return |
| 691 | (turbofront_check(machine, small, num + 0) << 0) | | |
| 692 | (turbofront_check(machine, small, num + 1) << 1) | | |
| 693 | (turbofront_check(machine, small, num + 2) << 2) | | |
| 694 | (turbofront_check(machine, small, num + 3) << 3) | | |
| 695 | (turbofront_check(machine, small, num + 4) << 4) | | |
| 696 | (turbofront_check(machine, small, num + 5) << 5) | | |
| 697 | (turbofront_check(machine, small, num + 6) << 6) | | |
| 698 | (turbofront_check(machine, small, num + 7) << 7); | |
| 689 | (turbofront_check(small, num + 0) << 0) | | |
| 690 | (turbofront_check(small, num + 1) << 1) | | |
| 691 | (turbofront_check(small, num + 2) << 2) | | |
| 692 | (turbofront_check(small, num + 3) << 3) | | |
| 693 | (turbofront_check(small, num + 4) << 4) | | |
| 694 | (turbofront_check(small, num + 5) << 5) | | |
| 695 | (turbofront_check(small, num + 6) << 6) | | |
| 696 | (turbofront_check(small, num + 7) << 7); | |
| 699 | 697 | } |
| 700 | 698 | |
| 701 | READ8_MEMBER(snk_state::turbocheck16_1_r){ return turbofront_check8(machine(), 1, 0*8); } | |
| 702 | READ8_MEMBER(snk_state::turbocheck16_2_r){ return turbofront_check8(machine(), 1, 1*8); } | |
| 703 | READ8_MEMBER(snk_state::turbocheck16_3_r){ return turbofront_check8(machine(), 1, 2*8); } | |
| 704 | READ8_MEMBER(snk_state::turbocheck16_4_r){ return turbofront_check8(machine(), 1, 3*8); } | |
| 705 | READ8_MEMBER(snk_state::turbocheck16_5_r){ return turbofront_check8(machine(), 1, 4*8); } | |
| 706 | READ8_MEMBER(snk_state::turbocheck16_6_r){ return turbofront_check8(machine(), 1, 5*8); } | |
| 707 | READ8_MEMBER(snk_state::turbocheck16_7_r){ return turbofront_check8(machine(), 1, 6*8); } | |
| 708 | READ8_MEMBER(snk_state::turbocheck16_8_r){ return turbofront_check8(machine(), 1, 7*8); } | |
| 709 | READ8_MEMBER(snk_state::turbocheck32_1_r){ return turbofront_check8(machine(), 0, 0*8); } | |
| 710 | READ8_MEMBER(snk_state::turbocheck32_2_r){ return turbofront_check8(machine(), 0, 1*8); } | |
| 711 | READ8_MEMBER(snk_state::turbocheck32_3_r){ return turbofront_check8(machine(), 0, 2*8); } | |
| 712 | READ8_MEMBER(snk_state::turbocheck32_4_r){ return turbofront_check8(machine(), 0, 3*8); } | |
| 699 | READ8_MEMBER(snk_state::turbocheck16_1_r){ return turbofront_check8(1, 0*8); } | |
| 700 | READ8_MEMBER(snk_state::turbocheck16_2_r){ return turbofront_check8(1, 1*8); } | |
| 701 | READ8_MEMBER(snk_state::turbocheck16_3_r){ return turbofront_check8(1, 2*8); } | |
| 702 | READ8_MEMBER(snk_state::turbocheck16_4_r){ return turbofront_check8(1, 3*8); } | |
| 703 | READ8_MEMBER(snk_state::turbocheck16_5_r){ return turbofront_check8(1, 4*8); } | |
| 704 | READ8_MEMBER(snk_state::turbocheck16_6_r){ return turbofront_check8(1, 5*8); } | |
| 705 | READ8_MEMBER(snk_state::turbocheck16_7_r){ return turbofront_check8(1, 6*8); } | |
| 706 | READ8_MEMBER(snk_state::turbocheck16_8_r){ return turbofront_check8(1, 7*8); } | |
| 707 | READ8_MEMBER(snk_state::turbocheck32_1_r){ return turbofront_check8(0, 0*8); } | |
| 708 | READ8_MEMBER(snk_state::turbocheck32_2_r){ return turbofront_check8(0, 1*8); } | |
| 709 | READ8_MEMBER(snk_state::turbocheck32_3_r){ return turbofront_check8(0, 2*8); } | |
| 710 | READ8_MEMBER(snk_state::turbocheck32_4_r){ return turbofront_check8(0, 3*8); } | |
| 713 | 711 | |
| 714 | 712 | |
| 715 | 713 |
| r20977 | r20978 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | |
| 14 | void sprint8_set_collision( | |
| 14 | void sprint8_state::sprint8_set_collision(int n) | |
| 15 | 15 | { |
| 16 | sprint8_state *state = machine.driver_data<sprint8_state>(); | |
| 17 | if (state->m_collision_reset == 0) | |
| 16 | if (m_collision_reset == 0) | |
| 18 | 17 | { |
| 19 | machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
| 18 | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
| 20 | 19 | |
| 21 | | |
| 20 | m_collision_index = n; | |
| 22 | 21 | } |
| 23 | 22 | } |
| 24 | 23 |
| r20977 | r20978 | |
|---|---|---|
| 342 | 342 | * connected to the 68705 which acts as a counter. |
| 343 | 343 | */ |
| 344 | 344 | |
| 345 | ||
| 345 | int superqix_state::read_dial(int player) | |
| 346 | 346 | { |
| 347 | superqix_state *state = machine.driver_data<superqix_state>(); | |
| 348 | 347 | int newpos; |
| 349 | 348 | |
| 350 | 349 | /* get the new position and adjust the result */ |
| 351 | newpos = state->ioport(player ? "DIAL2" : "DIAL1")->read(); | |
| 352 | if (newpos != state->m_oldpos[player]) | |
| 350 | newpos = ioport(player ? "DIAL2" : "DIAL1")->read(); | |
| 351 | if (newpos != m_oldpos[player]) | |
| 353 | 352 | { |
| 354 | state->m_sign[player] = ((newpos - state->m_oldpos[player]) & 0x80) >> 7; | |
| 355 | state->m_oldpos[player] = newpos; | |
| 353 | m_sign[player] = ((newpos - m_oldpos[player]) & 0x80) >> 7; | |
| 354 | m_oldpos[player] = newpos; | |
| 356 | 355 | } |
| 357 | 356 | |
| 358 | 357 | if (player == 0) |
| 359 | return (( | |
| 358 | return ((m_oldpos[player] & 1) << 2) | (m_sign[player] << 3); | |
| 360 | 359 | else // player == 1 |
| 361 | return (( | |
| 360 | return ((m_oldpos[player] & 1) << 3) | (m_sign[player] << 2); | |
| 362 | 361 | } |
| 363 | 362 | |
| 364 | 363 | |
| r20977 | r20978 | |
| 446 | 445 | break; |
| 447 | 446 | |
| 448 | 447 | case 0x6: |
| 449 | m_portA_in = read_dial( | |
| 448 | m_portA_in = read_dial(0); | |
| 450 | 449 | break; |
| 451 | 450 | |
| 452 | 451 | case 0x7: |
| 453 | m_portA_in = read_dial( | |
| 452 | m_portA_in = read_dial(1); | |
| 454 | 453 | break; |
| 455 | 454 | } |
| 456 | 455 | } |
| r20977 | r20978 | |
| 517 | 516 | } |
| 518 | 517 | |
| 519 | 518 | |
| 520 | ||
| 519 | void superqix_state::machine_init_common() | |
| 521 | 520 | { |
| 522 | superqix_state *state = machine.driver_data<superqix_state>(); | |
| 523 | state->save_item(NAME(state->m_invert_coin_lockout)); | |
| 524 | state->save_item(NAME(state->m_from_mcu_pending)); | |
| 525 | state->save_item(NAME(state->m_from_z80_pending)); | |
| 526 | state->save_item(NAME(state->m_port1)); | |
| 527 | state->save_item(NAME(state->m_port2)); | |
| 528 | state->save_item(NAME(state->m_port3)); | |
| 529 | state->save_item(NAME(state->m_port3_latch)); | |
| 530 | state->save_item(NAME(state->m_from_mcu)); | |
| 531 | state->save_item(NAME(state->m_from_z80)); | |
| 532 | state->save_item(NAME(state->m_portb)); | |
| 521 | save_item(NAME(m_invert_coin_lockout)); | |
| 522 | save_item(NAME(m_from_mcu_pending)); | |
| 523 | save_item(NAME(m_from_z80_pending)); | |
| 524 | save_item(NAME(m_port1)); | |
| 525 | save_item(NAME(m_port2)); | |
| 526 | save_item(NAME(m_port3)); | |
| 527 | save_item(NAME(m_port3_latch)); | |
| 528 | save_item(NAME(m_from_mcu)); | |
| 529 | save_item(NAME(m_from_z80)); | |
| 530 | save_item(NAME(m_portb)); | |
| 533 | 531 | |
| 534 | 532 | // hotsmash ??? |
| 535 | state->save_item(NAME(state->m_portA_in)); | |
| 536 | state->save_item(NAME(state->m_portB_out)); | |
| 537 | state->save_item(NAME(state->m_portC)); | |
| 533 | save_item(NAME(m_portA_in)); | |
| 534 | save_item(NAME(m_portB_out)); | |
| 535 | save_item(NAME(m_portC)); | |
| 538 | 536 | } |
| 539 | 537 | |
| 540 | 538 | MACHINE_START_MEMBER(superqix_state,superqix) |
| r20977 | r20978 | |
| 542 | 540 | /* configure the banks */ |
| 543 | 541 | machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000); |
| 544 | 542 | |
| 545 | machine_init_common( | |
| 543 | machine_init_common(); | |
| 546 | 544 | } |
| 547 | 545 | |
| 548 | 546 | MACHINE_START_MEMBER(superqix_state,pbillian) |
| r20977 | r20978 | |
| 550 | 548 | /* configure the banks */ |
| 551 | 549 | machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000); |
| 552 | 550 | |
| 553 | machine_init_common( | |
| 551 | machine_init_common(); | |
| 554 | 552 | } |
| 555 | 553 | |
| 556 | 554 |
| r20977 | r20978 | |
|---|---|---|
| 1801 | 1801 | return 0; |
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | ||
| 1804 | void slapfght_state::getstar_init( ) | |
| 1805 | 1805 | { |
| 1806 | slapfght_state *state = machine.driver_data<slapfght_state>(); | |
| 1807 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::getstar_e803_r),state), write8_delegate(FUNC(slapfght_state::getstar_e803_w),state)); | |
| 1808 | machine.device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_port_00_r),state)); | |
| 1806 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::getstar_e803_r),this), write8_delegate(FUNC(slapfght_state::getstar_e803_w),this)); | |
| 1807 | machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_port_00_r),this)); | |
| 1809 | 1808 | } |
| 1810 | 1809 | |
| 1811 | 1810 | DRIVER_INIT_MEMBER(slapfght_state,getstar) |
| 1812 | 1811 | { |
| 1813 | 1812 | m_getstar_id = GETSTAR; |
| 1814 | getstar_init( | |
| 1813 | getstar_init(); | |
| 1815 | 1814 | } |
| 1816 | 1815 | |
| 1817 | 1816 | DRIVER_INIT_MEMBER(slapfght_state,getstarj) |
| 1818 | 1817 | { |
| 1819 | 1818 | m_getstar_id = GETSTARJ; |
| 1820 | getstar_init( | |
| 1819 | getstar_init(); | |
| 1821 | 1820 | } |
| 1822 | 1821 | |
| 1823 | 1822 | DRIVER_INIT_MEMBER(slapfght_state,gtstarb1) |
| r20977 | r20978 | |
| 1825 | 1824 | UINT8 *ROM = memregion("maincpu")->base(); |
| 1826 | 1825 | |
| 1827 | 1826 | m_getstar_id = GTSTARB1; |
| 1828 | getstar_init( | |
| 1827 | getstar_init(); | |
| 1829 | 1828 | |
| 1830 | 1829 | /* specific handlers for this bootleg */ |
| 1831 | 1830 | machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0, 0x0, read8_delegate(FUNC(slapfght_state::gtstarb1_port_0_read),this)); |
| r20977 | r20978 | |
| 1839 | 1838 | DRIVER_INIT_MEMBER(slapfght_state,gtstarb2) |
| 1840 | 1839 | { |
| 1841 | 1840 | m_getstar_id = GTSTARB2; |
| 1842 | getstar_init( | |
| 1841 | getstar_init(); | |
| 1843 | 1842 | } |
| 1844 | 1843 | |
| 1845 | 1844 | DRIVER_INIT_MEMBER(slapfght_state,slapfigh) |
| r20977 | r20978 | |
|---|---|---|
| 700 | 700 | return ret; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | ||
| 703 | void seta2_state::funcube_debug_outputs() | |
| 704 | 704 | { |
| 705 | 705 | #ifdef MAME_DEBUG |
| 706 | // seta2_state *state = machine.driver_data<seta2_state>(); | |
| 707 | // popmessage("LED: %02x OUT: %02x", (int)*state->m_funcube_leds, (int)*state->m_funcube_outputs); | |
| 706 | // popmessage("LED: %02x OUT: %02x", (int)*m_funcube_leds, (int)*m_funcube_outputs); | |
| 708 | 707 | #endif |
| 709 | 708 | } |
| 710 | 709 | |
| r20977 | r20978 | |
| 721 | 720 | set_led_status( machine(), 4, (~data) & 0x40 ); |
| 722 | 721 | set_led_status( machine(), 5, (~data) & 0x80 ); |
| 723 | 722 | |
| 724 | funcube_debug_outputs( | |
| 723 | funcube_debug_outputs(); | |
| 725 | 724 | } |
| 726 | 725 | |
| 727 | 726 | READ8_MEMBER(seta2_state::funcube_outputs_r) |
| r20977 | r20978 | |
| 744 | 743 | // Bit 3: low after coining up, blinks on pay out |
| 745 | 744 | set_led_status( machine(), 6, (~data) & 0x08 ); |
| 746 | 745 | |
| 747 | funcube_debug_outputs( | |
| 746 | funcube_debug_outputs(); | |
| 748 | 747 | } |
| 749 | 748 | |
| 750 | 749 | READ8_MEMBER(seta2_state::funcube_battery_r) |
| r20977 | r20978 | |
|---|---|---|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /* reset the matrix processor */ |
| 73 | starwars_mproc_reset( | |
| 73 | starwars_mproc_reset(); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| r20977 | r20978 | |
| 94 | 94 | * |
| 95 | 95 | *************************************/ |
| 96 | 96 | |
| 97 | ||
| 97 | void starwars_state::esb_slapstic_tweak(address_space &space, offs_t offset) | |
| 98 | 98 | { |
| 99 | starwars_state *state = space.machine().driver_data<starwars_state>(); | |
| 100 | 99 | int new_bank = slapstic_tweak(space, offset); |
| 101 | 100 | |
| 102 | 101 | /* update for the new bank */ |
| 103 | if (new_bank != | |
| 102 | if (new_bank != m_slapstic_current_bank) | |
| 104 | 103 | { |
| 105 | state->m_slapstic_current_bank = new_bank; | |
| 106 | memcpy(state->m_slapstic_base, &state->m_slapstic_source[state->m_slapstic_current_bank * 0x2000], 0x2000); | |
| 104 | m_slapstic_current_bank = new_bank; | |
| 105 | memcpy(m_slapstic_base, &m_slapstic_source[m_slapstic_current_bank * 0x2000], 0x2000); | |
| 107 | 106 | } |
| 108 | 107 | } |
| 109 | 108 | |
| r20977 | r20978 | |
| 506 | 505 | { |
| 507 | 506 | /* prepare the mathbox */ |
| 508 | 507 | m_is_esb = 0; |
| 509 | starwars_mproc_init( | |
| 508 | starwars_mproc_init(); | |
| 510 | 509 | |
| 511 | 510 | /* initialize banking */ |
| 512 | 511 | membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x6000, 0x10000 - 0x6000); |
| r20977 | r20978 | |
| 535 | 534 | |
| 536 | 535 | /* prepare the matrix processor */ |
| 537 | 536 | m_is_esb = 1; |
| 538 | starwars_mproc_init( | |
| 537 | starwars_mproc_init(); | |
| 539 | 538 | |
| 540 | 539 | /* initialize banking */ |
| 541 | 540 | membank("bank1")->configure_entries(0, 2, rom + 0x6000, 0x10000 - 0x6000); |
| r20977 | r20978 | |
|---|---|---|
| 741 | 741 | |
| 742 | 742 | /********************************************************************/ |
| 743 | 743 | |
| 744 | ||
| 744 | UINT8 seibuspi_state::z80_fifoout_pop(address_space &space) | |
| 745 | 745 | { |
| 746 | seibuspi_state *state = space.machine().driver_data<seibuspi_state>(); | |
| 747 | 746 | UINT8 r; |
| 748 | if ( | |
| 747 | if (m_fifoout_wpos == m_fifoout_rpos) | |
| 749 | 748 | { |
| 750 | 749 | logerror("Sound FIFOOUT underflow at %08X\n", space.device().safe_pc()); |
| 751 | 750 | } |
| 752 | r = state->m_fifoout_data[state->m_fifoout_rpos++]; | |
| 753 | if(state->m_fifoout_rpos == FIFO_SIZE) | |
| 751 | r = m_fifoout_data[m_fifoout_rpos++]; | |
| 752 | if(m_fifoout_rpos == FIFO_SIZE) | |
| 754 | 753 | { |
| 755 | | |
| 754 | m_fifoout_rpos = 0; | |
| 756 | 755 | } |
| 757 | 756 | |
| 758 | if ( | |
| 757 | if (m_fifoout_wpos == m_fifoout_rpos) | |
| 759 | 758 | { |
| 760 | | |
| 759 | m_fifoout_read_request = 0; | |
| 761 | 760 | } |
| 762 | 761 | |
| 763 | 762 | return r; |
| 764 | 763 | } |
| 765 | 764 | |
| 766 | ||
| 765 | void seibuspi_state::z80_fifoout_push(address_space &space, UINT8 data) | |
| 767 | 766 | { |
| 768 | seibuspi_state *state = space.machine().driver_data<seibuspi_state>(); | |
| 769 | state->m_fifoout_data[state->m_fifoout_wpos++] = data; | |
| 770 | if (state->m_fifoout_wpos == FIFO_SIZE) | |
| 767 | m_fifoout_data[m_fifoout_wpos++] = data; | |
| 768 | if (m_fifoout_wpos == FIFO_SIZE) | |
| 771 | 769 | { |
| 772 | | |
| 770 | m_fifoout_wpos = 0; | |
| 773 | 771 | } |
| 774 | if( | |
| 772 | if(m_fifoout_wpos == m_fifoout_rpos) | |
| 775 | 773 | { |
| 776 | 774 | fatalerror("Sound FIFOOUT overflow at %08X\n", space.device().safe_pc()); |
| 777 | 775 | } |
| 778 | 776 | |
| 779 | | |
| 777 | m_fifoout_read_request = 1; | |
| 780 | 778 | } |
| 781 | 779 | |
| 782 | ||
| 780 | UINT8 seibuspi_state::z80_fifoin_pop(address_space &space) | |
| 783 | 781 | { |
| 784 | seibuspi_state *state = space.machine().driver_data<seibuspi_state>(); | |
| 785 | 782 | UINT8 r; |
| 786 | if ( | |
| 783 | if (m_fifoin_wpos == m_fifoin_rpos) | |
| 787 | 784 | { |
| 788 | 785 | fatalerror("Sound FIFOIN underflow at %08X\n", space.device().safe_pc()); |
| 789 | 786 | } |
| 790 | r = state->m_fifoin_data[state->m_fifoin_rpos++]; | |
| 791 | if(state->m_fifoin_rpos == FIFO_SIZE) | |
| 787 | r = m_fifoin_data[m_fifoin_rpos++]; | |
| 788 | if(m_fifoin_rpos == FIFO_SIZE) | |
| 792 | 789 | { |
| 793 | | |
| 790 | m_fifoin_rpos = 0; | |
| 794 | 791 | } |
| 795 | 792 | |
| 796 | if ( | |
| 793 | if (m_fifoin_wpos == m_fifoin_rpos) | |
| 797 | 794 | { |
| 798 | | |
| 795 | m_fifoin_read_request = 0; | |
| 799 | 796 | } |
| 800 | 797 | |
| 801 | 798 | return r; |
| 802 | 799 | } |
| 803 | 800 | |
| 804 | ||
| 801 | void seibuspi_state::z80_fifoin_push(address_space &space, UINT8 data) | |
| 805 | 802 | { |
| 806 | seibuspi_state *state = space.machine().driver_data<seibuspi_state>(); | |
| 807 | state->m_fifoin_data[state->m_fifoin_wpos++] = data; | |
| 808 | if(state->m_fifoin_wpos == FIFO_SIZE) | |
| 803 | m_fifoin_data[m_fifoin_wpos++] = data; | |
| 804 | if(m_fifoin_wpos == FIFO_SIZE) | |
| 809 | 805 | { |
| 810 | | |
| 806 | m_fifoin_wpos = 0; | |
| 811 | 807 | } |
| 812 | if( | |
| 808 | if(m_fifoin_wpos == m_fifoin_rpos) | |
| 813 | 809 | { |
| 814 | 810 | fatalerror("Sound FIFOIN overflow at %08X\n", space.device().safe_pc()); |
| 815 | 811 | } |
| 816 | 812 | |
| 817 | | |
| 813 | m_fifoin_read_request = 1; | |
| 818 | 814 | } |
| 819 | 815 | |
| 820 | 816 | READ32_MEMBER(seibuspi_state::sb_coin_r) |
| r20977 | r20978 | |
| 875 | 871 | |
| 876 | 872 | // tile banks |
| 877 | 873 | if( ACCESSING_BITS_16_23 ) { |
| 878 | rf2_set_layer_banks( | |
| 874 | rf2_set_layer_banks(data >> 16); | |
| 879 | 875 | |
| 880 | 876 | eeprom_device *eeprom = downcast<eeprom_device *>(device); |
| 881 | 877 | eeprom->write_bit((data & 0x800000) ? 1 : 0); |
| r20977 | r20978 | |
| 900 | 896 | { |
| 901 | 897 | // tile banks |
| 902 | 898 | if( ACCESSING_BITS_16_23 ) { |
| 903 | rf2_set_layer_banks( | |
| 899 | rf2_set_layer_banks(data >> 16); | |
| 904 | 900 | } |
| 905 | 901 | |
| 906 | 902 | logerror("z80 data = %08x mask = %08x\n",data,mem_mask); |
| r20977 | r20978 | |
| 2063 | 2059 | return m_spimainram[(0x002894c-0x800)/4]; |
| 2064 | 2060 | } |
| 2065 | 2061 | |
| 2066 | ||
| 2062 | void seibuspi_state::init_spi() | |
| 2067 | 2063 | { |
| 2068 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 2069 | state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0"); | |
| 2070 | state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1"); | |
| 2064 | m_flash[0] = machine().device<intel_e28f008sa_device>("flash0"); | |
| 2065 | m_flash[1] = machine().device<intel_e28f008sa_device>("flash1"); | |
| 2071 | 2066 | |
| 2072 | seibuspi_text_decrypt(state->memregion("gfx1")->base()); | |
| 2073 | seibuspi_bg_decrypt(state->memregion("gfx2")->base(), state->memregion("gfx2")->bytes()); | |
| 2074 | seibuspi_sprite_decrypt(state->memregion("gfx3")->base(), 0x400000); | |
| 2067 | seibuspi_text_decrypt(memregion("gfx1")->base()); | |
| 2068 | seibuspi_bg_decrypt(memregion("gfx2")->base(), memregion("gfx2")->bytes()); | |
| 2069 | seibuspi_sprite_decrypt(memregion("gfx3")->base(), 0x400000); | |
| 2075 | 2070 | } |
| 2076 | 2071 | |
| 2077 | 2072 | DRIVER_INIT_MEMBER(seibuspi_state,rdft) |
| 2078 | 2073 | { |
| 2079 | 2074 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00298d0, 0x00298d3, read32_delegate(FUNC(seibuspi_state::rdft_speedup_r),this)); |
| 2080 | 2075 | |
| 2081 | init_spi( | |
| 2076 | init_spi(); | |
| 2082 | 2077 | } |
| 2083 | 2078 | |
| 2084 | 2079 | DRIVER_INIT_MEMBER(seibuspi_state,senkyu) |
| 2085 | 2080 | { |
| 2086 | 2081 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018cb4, 0x0018cb7, read32_delegate(FUNC(seibuspi_state::senkyu_speedup_r),this)); |
| 2087 | 2082 | |
| 2088 | init_spi( | |
| 2083 | init_spi(); | |
| 2089 | 2084 | } |
| 2090 | 2085 | |
| 2091 | 2086 | DRIVER_INIT_MEMBER(seibuspi_state,senkyua) |
| 2092 | 2087 | { |
| 2093 | 2088 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018c9c, 0x0018c9f, read32_delegate(FUNC(seibuspi_state::senkyua_speedup_r),this)); |
| 2094 | 2089 | |
| 2095 | init_spi( | |
| 2090 | init_spi(); | |
| 2096 | 2091 | } |
| 2097 | 2092 | |
| 2098 | 2093 | DRIVER_INIT_MEMBER(seibuspi_state,batlball) |
| 2099 | 2094 | { |
| 2100 | 2095 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018db4, 0x0018db7, read32_delegate(FUNC(seibuspi_state::batlball_speedup_r),this)); |
| 2101 | 2096 | |
| 2102 | init_spi( | |
| 2097 | init_spi(); | |
| 2103 | 2098 | } |
| 2104 | 2099 | |
| 2105 | 2100 | DRIVER_INIT_MEMBER(seibuspi_state,ejanhs) |
| r20977 | r20978 | |
| 2107 | 2102 | // idle skip doesn't work properly? |
| 2108 | 2103 | // machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002d224, 0x002d227, read32_delegate(FUNC(seibuspi_state::ejanhs_speedup_r),this)); |
| 2109 | 2104 | |
| 2110 | init_spi( | |
| 2105 | init_spi(); | |
| 2111 | 2106 | } |
| 2112 | 2107 | |
| 2113 | 2108 | DRIVER_INIT_MEMBER(seibuspi_state,viprp1) |
| 2114 | 2109 | { |
| 2115 | 2110 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001e2e0, 0x001e2e3, read32_delegate(FUNC(seibuspi_state::viprp1_speedup_r),this)); |
| 2116 | 2111 | |
| 2117 | init_spi( | |
| 2112 | init_spi(); | |
| 2118 | 2113 | } |
| 2119 | 2114 | |
| 2120 | 2115 | DRIVER_INIT_MEMBER(seibuspi_state,viprp1o) |
| 2121 | 2116 | { |
| 2122 | 2117 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001d49c, 0x001d49f, read32_delegate(FUNC(seibuspi_state::viprp1o_speedup_r),this)); |
| 2123 | 2118 | |
| 2124 | init_spi( | |
| 2119 | init_spi(); | |
| 2125 | 2120 | } |
| 2126 | 2121 | |
| 2127 | 2122 | |
| 2128 | 2123 | |
| 2129 | ||
| 2124 | void seibuspi_state::init_rf2_common() | |
| 2130 | 2125 | { |
| 2131 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 2132 | state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0"); | |
| 2133 | state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1"); | |
| 2126 | m_flash[0] = machine().device<intel_e28f008sa_device>("flash0"); | |
| 2127 | m_flash[1] = machine().device<intel_e28f008sa_device>("flash1"); | |
| 2134 | 2128 | |
| 2135 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),state)); | |
| 2136 | seibuspi_rise10_text_decrypt(state->memregion("gfx1")->base()); | |
| 2137 | seibuspi_rise10_bg_decrypt(state->memregion("gfx2")->base(), state->memregion("gfx2")->bytes()); | |
| 2138 | seibuspi_rise10_sprite_decrypt(state->memregion("gfx3")->base(), 0x600000); | |
| 2129 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),this)); | |
| 2130 | seibuspi_rise10_text_decrypt(memregion("gfx1")->base()); | |
| 2131 | seibuspi_rise10_bg_decrypt(memregion("gfx2")->base(), memregion("gfx2")->bytes()); | |
| 2132 | seibuspi_rise10_sprite_decrypt(memregion("gfx3")->base(), 0x600000); | |
| 2139 | 2133 | |
| 2140 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w), | |
| 2134 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),this)); | |
| 2141 | 2135 | } |
| 2142 | 2136 | |
| 2143 | 2137 | DRIVER_INIT_MEMBER(seibuspi_state,rdft2) |
| 2144 | 2138 | { |
| 2145 | init_rf2_common( | |
| 2139 | init_rf2_common(); | |
| 2146 | 2140 | } |
| 2147 | 2141 | |
| 2148 | 2142 | DRIVER_INIT_MEMBER(seibuspi_state,rdft2us) |
| 2149 | 2143 | { |
| 2150 | init_rf2_common( | |
| 2144 | init_rf2_common(); | |
| 2151 | 2145 | } |
| 2152 | 2146 | |
| 2153 | 2147 | |
| 2154 | ||
| 2148 | void seibuspi_state::init_rfjet_common() | |
| 2155 | 2149 | { |
| 2156 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 2157 | state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0"); | |
| 2158 | state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1"); | |
| 2150 | m_flash[0] = machine().device<intel_e28f008sa_device>("flash0"); | |
| 2151 | m_flash[1] = machine().device<intel_e28f008sa_device>("flash1"); | |
| 2159 | 2152 | |
| 2160 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),state)); | |
| 2161 | seibuspi_rise11_text_decrypt(state->memregion("gfx1")->base()); | |
| 2162 | seibuspi_rise11_bg_decrypt(state->memregion("gfx2")->base(), state->memregion("gfx2")->bytes()); | |
| 2163 | seibuspi_rise11_sprite_decrypt_rfjet(state->memregion("gfx3")->base(), 0x800000); | |
| 2153 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),this)); | |
| 2154 | seibuspi_rise11_text_decrypt(memregion("gfx1")->base()); | |
| 2155 | seibuspi_rise11_bg_decrypt(memregion("gfx2")->base(), memregion("gfx2")->bytes()); | |
| 2156 | seibuspi_rise11_sprite_decrypt_rfjet(memregion("gfx3")->base(), 0x800000); | |
| 2164 | 2157 | |
| 2165 | machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w), | |
| 2158 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),this)); | |
| 2166 | 2159 | } |
| 2167 | 2160 | |
| 2168 | 2161 | DRIVER_INIT_MEMBER(seibuspi_state,rfjet) |
| 2169 | 2162 | { |
| 2170 | init_rfjet_common( | |
| 2163 | init_rfjet_common(); | |
| 2171 | 2164 | } |
| 2172 | 2165 | |
| 2173 | 2166 | /* SYS386 */ |
| 2174 | 2167 | |
| 2175 | 2168 | DRIVER_INIT_MEMBER(seibuspi_state,rdft22kc) |
| 2176 | 2169 | { |
| 2177 | init_rf2_common( | |
| 2170 | init_rf2_common(); | |
| 2178 | 2171 | } |
| 2179 | 2172 | |
| 2180 | 2173 | DRIVER_INIT_MEMBER(seibuspi_state,rfjet2k) |
| 2181 | 2174 | { |
| 2182 | init_rfjet_common( | |
| 2175 | init_rfjet_common(); | |
| 2183 | 2176 | } |
| 2184 | 2177 | |
| 2185 | 2178 | MACHINE_RESET_MEMBER(seibuspi_state,seibu386) |
| r20977 | r20978 | |
|---|---|---|
| 82 | 82 | Brick Zone |
| 83 | 83 | ***************************************************************************/ |
| 84 | 84 | |
| 85 | ||
| 85 | UINT8 *suna8_state::brickzn_decrypt() | |
| 86 | 86 | { |
| 87 | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); | |
| 88 | UINT8 *RAM = machine.root_device().memregion("maincpu")->base(); | |
| 89 | size_t size = machine.root_device().memregion("maincpu")->bytes(); | |
| 90 | UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); | |
| 87 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 88 | UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); | |
| 89 | size_t size = machine().root_device().memregion("maincpu")->bytes(); | |
| 90 | UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); | |
| 91 | 91 | int i; |
| 92 | 92 | |
| 93 | 93 | space.set_decrypted_region(0x0000, 0x7fff, decrypt); |
| r20977 | r20978 | |
| 132 | 132 | DRIVER_INIT_MEMBER(suna8_state,brickzn) |
| 133 | 133 | { |
| 134 | 134 | UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); |
| 135 | UINT8 *decrypt = brickzn_decrypt( | |
| 135 | UINT8 *decrypt = brickzn_decrypt(); | |
| 136 | 136 | int i; |
| 137 | 137 | |
| 138 | 138 | // Opcodes decrypted as data (to do: activated at run-time) |
| r20977 | r20978 | |
| 171 | 171 | DRIVER_INIT_MEMBER(suna8_state,brickznv4) |
| 172 | 172 | { |
| 173 | 173 | UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); |
| 174 | UINT8 *decrypt = brickzn_decrypt( | |
| 174 | UINT8 *decrypt = brickzn_decrypt(); | |
| 175 | 175 | int i; |
| 176 | 176 | |
| 177 | 177 | // Opcodes decrypted as data (to do: activated at run-time) |
| r20977 | r20978 | |
|---|---|---|
| 190 | 190 | *x_in = x1r-x2l; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | ||
| 193 | void skns_state::hit_recalc() | |
| 194 | 194 | { |
| 195 | skns_state *state = machine.driver_data<skns_state>(); | |
| 196 | hit_t &hit = state->m_hit; | |
| 195 | hit_t &hit = m_hit; | |
| 197 | 196 | |
| 198 | 197 | hit_calc_axis(hit.x1p, hit.x1s, hit.x2p, hit.x2s, hit.org, |
| 199 | 198 | &hit.x1_p1, &hit.x1_p2, &hit.x2_p1, &hit.x2_p2, |
| r20977 | r20978 | |
| 287 | 286 | // log_write("HIT", adr, data, type); |
| 288 | 287 | break; |
| 289 | 288 | } |
| 290 | hit_recalc( | |
| 289 | hit_recalc(); | |
| 291 | 290 | } |
| 292 | 291 | |
| 293 | 292 | WRITE32_MEMBER(skns_state::skns_hit2_w) |
| r20977 | r20978 | |
| 956 | 955 | return m_main_ram[0xb7380/4]; |
| 957 | 956 | } |
| 958 | 957 | |
| 959 | ||
| 958 | void skns_state::init_skns() | |
| 960 | 959 | { |
| 961 | 960 | // init DRC to fastest options |
| 962 | sh2drc_set_options(machine.device("maincpu"), SH2DRC_FASTEST_OPTIONS); | |
| 961 | sh2drc_set_options(machine().device("maincpu"), SH2DRC_FASTEST_OPTIONS); | |
| 963 | 962 | } |
| 964 | 963 | |
| 965 | ||
| 964 | void skns_state::set_drc_pcflush(UINT32 addr) | |
| 966 | 965 | { |
| 967 | sh2drc_add_pcflush(machine.device("maincpu"), addr); | |
| 966 | sh2drc_add_pcflush(machine().device("maincpu"), addr); | |
| 968 | 967 | } |
| 969 | 968 | |
| 970 | DRIVER_INIT_MEMBER(skns_state,galpani4) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(machine()); } | |
| 971 | DRIVER_INIT_MEMBER(skns_state,galpanis) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(machine()); } | |
| 972 | DRIVER_INIT_MEMBER(skns_state,cyvern) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+2); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x604d3c8, 0x604d3cb, read32_delegate(FUNC(skns_state::cyvern_speedup_r),this) ); set_drc_pcflush(machine(), 0x402ebd2); } | |
| 973 | DRIVER_INIT_MEMBER(skns_state,galpans2) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60fb6bc, 0x60fb6bf, read32_delegate(FUNC(skns_state::galpans2_speedup_r),this) ); set_drc_pcflush(machine(), 0x4049ae2); } | |
| 974 | DRIVER_INIT_MEMBER(skns_state,gutsn) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+0); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x600c780, 0x600c783, read32_delegate(FUNC(skns_state::gutsn_speedup_r),this) ); set_drc_pcflush(machine(), 0x402206e); } | |
| 975 | DRIVER_INIT_MEMBER(skns_state,panicstr) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60f19e4, 0x60f19e7, read32_delegate(FUNC(skns_state::panicstr_speedup_r),this) ); set_drc_pcflush(machine(), 0x404e68a); } | |
| 976 | DRIVER_INIT_MEMBER(skns_state,senknow) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+1,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60000dc, 0x60000df, read32_delegate(FUNC(skns_state::senknow_speedup_r),this) ); set_drc_pcflush(machine(), 0x4017dce); } | |
| 977 | DRIVER_INIT_MEMBER(skns_state,puzzloope) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6081d38, 0x6081d3b, read32_delegate(FUNC(skns_state::puzzloope_speedup_r),this) ); set_drc_pcflush(machine(), 0x401da14); } | |
| 978 | DRIVER_INIT_MEMBER(skns_state,puzzloopj) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6086714, 0x6086717, read32_delegate(FUNC(skns_state::puzzloopj_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dca0); } | |
| 979 | DRIVER_INIT_MEMBER(skns_state,puzzloopa) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085bcc, 0x6085bcf, read32_delegate(FUNC(skns_state::puzzloopa_speedup_r),this) ); set_drc_pcflush(machine(), 0x401d9d4); } | |
| 980 | DRIVER_INIT_MEMBER(skns_state,puzzloopu) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085cec, 0x6085cef, read32_delegate(FUNC(skns_state::puzzloopu_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dab0); } | |
| 981 | DRIVER_INIT_MEMBER(skns_state,jjparads) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000994, 0x6000997, read32_delegate(FUNC(skns_state::jjparads_speedup_r),this) ); set_drc_pcflush(machine(), 0x4015e84); } | |
| 982 | DRIVER_INIT_MEMBER(skns_state,jjparad2) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000984, 0x6000987, read32_delegate(FUNC(skns_state::jjparad2_speedup_r),this) ); set_drc_pcflush(machine(), 0x401620a); } | |
| 983 | DRIVER_INIT_MEMBER(skns_state,ryouran) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000a14, 0x6000a17, read32_delegate(FUNC(skns_state::ryouran_speedup_r),this) ); set_drc_pcflush(machine(), 0x40182ce); } | |
| 984 | DRIVER_INIT_MEMBER(skns_state,teljan) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6002fb4, 0x6002fb7, read32_delegate(FUNC(skns_state::teljan_speedup_r),this) ); set_drc_pcflush(machine(), 0x401ba32); } | |
| 985 | DRIVER_INIT_MEMBER(skns_state,sengekis) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b74bc, 0x60b74bf, read32_delegate(FUNC(skns_state::sengekis_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); } | |
| 986 | DRIVER_INIT_MEMBER(skns_state,sengekij) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b7380, 0x60b7383, read32_delegate(FUNC(skns_state::sengekij_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); } | |
| 987 | DRIVER_INIT_MEMBER(skns_state,sarukani) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine()); set_drc_pcflush(machine(), 0x4013b42); } // Speedup is in skns_io_w() | |
| 988 | DRIVER_INIT_MEMBER(skns_state,galpans3) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine()); } | |
| 969 | DRIVER_INIT_MEMBER(skns_state,galpani4) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(); } | |
| 970 | DRIVER_INIT_MEMBER(skns_state,galpanis) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(); } | |
| 971 | DRIVER_INIT_MEMBER(skns_state,cyvern) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+2); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x604d3c8, 0x604d3cb, read32_delegate(FUNC(skns_state::cyvern_speedup_r),this) ); set_drc_pcflush(0x402ebd2); } | |
| 972 | DRIVER_INIT_MEMBER(skns_state,galpans2) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60fb6bc, 0x60fb6bf, read32_delegate(FUNC(skns_state::galpans2_speedup_r),this) ); set_drc_pcflush(0x4049ae2); } | |
| 973 | DRIVER_INIT_MEMBER(skns_state,gutsn) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+0); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x600c780, 0x600c783, read32_delegate(FUNC(skns_state::gutsn_speedup_r),this) ); set_drc_pcflush(0x402206e); } | |
| 974 | DRIVER_INIT_MEMBER(skns_state,panicstr) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60f19e4, 0x60f19e7, read32_delegate(FUNC(skns_state::panicstr_speedup_r),this) ); set_drc_pcflush(0x404e68a); } | |
| 975 | DRIVER_INIT_MEMBER(skns_state,senknow) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+1,+1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60000dc, 0x60000df, read32_delegate(FUNC(skns_state::senknow_speedup_r),this) ); set_drc_pcflush(0x4017dce); } | |
| 976 | DRIVER_INIT_MEMBER(skns_state,puzzloope) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6081d38, 0x6081d3b, read32_delegate(FUNC(skns_state::puzzloope_speedup_r),this) ); set_drc_pcflush(0x401da14); } | |
| 977 | DRIVER_INIT_MEMBER(skns_state,puzzloopj) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6086714, 0x6086717, read32_delegate(FUNC(skns_state::puzzloopj_speedup_r),this) ); set_drc_pcflush(0x401dca0); } | |
| 978 | DRIVER_INIT_MEMBER(skns_state,puzzloopa) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085bcc, 0x6085bcf, read32_delegate(FUNC(skns_state::puzzloopa_speedup_r),this) ); set_drc_pcflush(0x401d9d4); } | |
| 979 | DRIVER_INIT_MEMBER(skns_state,puzzloopu) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085cec, 0x6085cef, read32_delegate(FUNC(skns_state::puzzloopu_speedup_r),this) ); set_drc_pcflush(0x401dab0); } | |
| 980 | DRIVER_INIT_MEMBER(skns_state,jjparads) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000994, 0x6000997, read32_delegate(FUNC(skns_state::jjparads_speedup_r),this) ); set_drc_pcflush(0x4015e84); } | |
| 981 | DRIVER_INIT_MEMBER(skns_state,jjparad2) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000984, 0x6000987, read32_delegate(FUNC(skns_state::jjparad2_speedup_r),this) ); set_drc_pcflush(0x401620a); } | |
| 982 | DRIVER_INIT_MEMBER(skns_state,ryouran) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000a14, 0x6000a17, read32_delegate(FUNC(skns_state::ryouran_speedup_r),this) ); set_drc_pcflush(0x40182ce); } | |
| 983 | DRIVER_INIT_MEMBER(skns_state,teljan) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6002fb4, 0x6002fb7, read32_delegate(FUNC(skns_state::teljan_speedup_r),this) ); set_drc_pcflush(0x401ba32); } | |
| 984 | DRIVER_INIT_MEMBER(skns_state,sengekis) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b74bc, 0x60b74bf, read32_delegate(FUNC(skns_state::sengekis_speedup_r),this) ); set_drc_pcflush(0x60006ec); } | |
| 985 | DRIVER_INIT_MEMBER(skns_state,sengekij) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns();machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b7380, 0x60b7383, read32_delegate(FUNC(skns_state::sengekij_speedup_r),this) ); set_drc_pcflush(0x60006ec); } | |
| 986 | DRIVER_INIT_MEMBER(skns_state,sarukani) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(); set_drc_pcflush(0x4013b42); } // Speedup is in skns_io_w() | |
| 987 | DRIVER_INIT_MEMBER(skns_state,galpans3) { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(); } | |
| 989 | 988 | |
| 990 | 989 | |
| 991 | 990 |
| r20977 | r20978 | |
|---|---|---|
| 475 | 475 | |
| 476 | 476 | /***************************************************************************/ |
| 477 | 477 | |
| 478 | ||
| 478 | void segas1x_bootleg_state::set_tile_bank( int data ) | |
| 479 | 479 | { |
| 480 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 481 | state->m_tile_bank0 = (data >> 4) & 0x0f; | |
| 482 | state->m_tile_bank1 = data & 0x0f; | |
| 480 | m_tile_bank0 = (data >> 4) & 0x0f; | |
| 481 | m_tile_bank1 = data & 0x0f; | |
| 483 | 482 | } |
| 484 | 483 | |
| 485 | ||
| 484 | void segas1x_bootleg_state::set_fg_page( int data ) | |
| 486 | 485 | { |
| 487 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 488 | state->m_fg_page[0] = data >> 12; | |
| 489 | state->m_fg_page[1] = (data >> 8) & 0x0f; | |
| 490 | state->m_fg_page[2] = (data >> 4) & 0x0f; | |
| 491 | state->m_fg_page[3] = data & 0x0f; | |
| 486 | m_fg_page[0] = data >> 12; | |
| 487 | m_fg_page[1] = (data >> 8) & 0x0f; | |
| 488 | m_fg_page[2] = (data >> 4) & 0x0f; | |
| 489 | m_fg_page[3] = data & 0x0f; | |
| 492 | 490 | } |
| 493 | 491 | |
| 494 | ||
| 492 | void segas1x_bootleg_state::set_bg_page( int data ) | |
| 495 | 493 | { |
| 496 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 497 | state->m_bg_page[0] = data >> 12; | |
| 498 | state->m_bg_page[1] = (data >> 8) & 0x0f; | |
| 499 | state->m_bg_page[2] = (data >> 4) & 0x0f; | |
| 500 | state->m_bg_page[3] = data & 0x0f; | |
| 494 | m_bg_page[0] = data >> 12; | |
| 495 | m_bg_page[1] = (data >> 8) & 0x0f; | |
| 496 | m_bg_page[2] = (data >> 4) & 0x0f; | |
| 497 | m_bg_page[3] = data & 0x0f; | |
| 501 | 498 | } |
| 502 | 499 | |
| 503 | 500 | #ifdef UNUSED_CODE |
| r20977 | r20978 | |
| 536 | 533 | |
| 537 | 534 | WRITE16_MEMBER(segas1x_bootleg_state::s16bl_bgpage_w) |
| 538 | 535 | { |
| 539 | set_bg_page( | |
| 536 | set_bg_page(data); | |
| 540 | 537 | } |
| 541 | 538 | |
| 542 | 539 | WRITE16_MEMBER(segas1x_bootleg_state::s16bl_fgpage_w) |
| 543 | 540 | { |
| 544 | set_fg_page( | |
| 541 | set_fg_page(data); | |
| 545 | 542 | } |
| 546 | 543 | |
| 547 | 544 | WRITE16_MEMBER(segas1x_bootleg_state::s16bl_fgscrollx_bank_w) |
| r20977 | r20978 | |
| 550 | 547 | int bank = (data & 0xc000) >> 14; |
| 551 | 548 | |
| 552 | 549 | scroll += 0x200; |
| 553 | set_tile_bank( | |
| 550 | set_tile_bank(bank); | |
| 554 | 551 | |
| 555 | 552 | scroll += 3; // so that the character portraits in attract mode are properly aligned (alighnment on character select no longer matches original tho?) |
| 556 | 553 | m_fg_scrollx = -scroll; |
| r20977 | r20978 | |
| 636 | 633 | AM_RANGE(0x902002, 0x902003) AM_READ_PORT("DSW1") |
| 637 | 634 | ADDRESS_MAP_END |
| 638 | 635 | |
| 639 | ||
| 636 | void segas1x_bootleg_state::datsu_set_pages( ) | |
| 640 | 637 | { |
| 641 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 642 | 638 | UINT16 page; |
| 643 | 639 | |
| 644 | page = ((state->m_datsu_page[0] & 0x00f0) >>0) | | |
| 645 | ((state->m_datsu_page[1] & 0x00f0) >>4) | | |
| 646 | ((state->m_datsu_page[2] & 0x00f0) <<8) | | |
| 647 | ((state->m_datsu_page[3] & 0x00f0) <<4); | |
| 640 | page = ((m_datsu_page[0] & 0x00f0) >>0) | | |
| 641 | ((m_datsu_page[1] & 0x00f0) >>4) | | |
| 642 | ((m_datsu_page[2] & 0x00f0) <<8) | | |
| 643 | ((m_datsu_page[3] & 0x00f0) <<4); | |
| 648 | 644 | |
| 649 | 645 | |
| 650 | set_fg_page( | |
| 646 | set_fg_page(page); | |
| 651 | 647 | |
| 652 | page = ((state->m_datsu_page[0] & 0x000f) <<4) | | |
| 653 | ((state->m_datsu_page[1] & 0x000f) <<0) | | |
| 654 | ((state->m_datsu_page[2] & 0x000f) <<12) | | |
| 655 | ((state->m_datsu_page[3] & 0x000f) <<8); | |
| 648 | page = ((m_datsu_page[0] & 0x000f) <<4) | | |
| 649 | ((m_datsu_page[1] & 0x000f) <<0) | | |
| 650 | ((m_datsu_page[2] & 0x000f) <<12) | | |
| 651 | ((m_datsu_page[3] & 0x000f) <<8); | |
| 656 | 652 | |
| 657 | set_bg_page( | |
| 653 | set_bg_page(page); | |
| 658 | 654 | } |
| 659 | 655 | |
| 660 | 656 | WRITE16_MEMBER(segas1x_bootleg_state::datsu_page0_w) |
| 661 | 657 | { |
| 662 | 658 | COMBINE_DATA(&m_datsu_page[0]); |
| 663 | datsu_set_pages( | |
| 659 | datsu_set_pages(); | |
| 664 | 660 | } |
| 665 | 661 | |
| 666 | 662 | WRITE16_MEMBER(segas1x_bootleg_state::datsu_page1_w) |
| 667 | 663 | { |
| 668 | 664 | COMBINE_DATA(&m_datsu_page[1]); |
| 669 | datsu_set_pages( | |
| 665 | datsu_set_pages(); | |
| 670 | 666 | } |
| 671 | 667 | |
| 672 | 668 | WRITE16_MEMBER(segas1x_bootleg_state::datsu_page2_w) |
| 673 | 669 | { |
| 674 | 670 | COMBINE_DATA(&m_datsu_page[2]); |
| 675 | datsu_set_pages( | |
| 671 | datsu_set_pages(); | |
| 676 | 672 | } |
| 677 | 673 | |
| 678 | 674 | WRITE16_MEMBER(segas1x_bootleg_state::datsu_page3_w) |
| 679 | 675 | { |
| 680 | 676 | COMBINE_DATA(&m_datsu_page[3]); |
| 681 | datsu_set_pages( | |
| 677 | datsu_set_pages(); | |
| 682 | 678 | } |
| 683 | 679 | |
| 684 | 680 | static ADDRESS_MAP_START( bayrouteb2_map, AS_PROGRAM, 16, segas1x_bootleg_state ) |
| r20977 | r20978 | |
| 737 | 733 | int scroll = data & 0x1ff; |
| 738 | 734 | int bank = (data & 0xc000) >> 14; |
| 739 | 735 | |
| 740 | set_tile_bank( | |
| 736 | set_tile_bank(bank); | |
| 741 | 737 | scroll += 0x1f6; |
| 742 | 738 | scroll &= 0x3ff; |
| 743 | 739 | m_fg_scrollx = -scroll; |
| r20977 | r20978 | |
| 780 | 776 | ((m_goldnaxeb2_fgpage[3] & 0xf) << 8) | |
| 781 | 777 | ((m_goldnaxeb2_fgpage[2] & 0xf) << 12); |
| 782 | 778 | |
| 783 | set_fg_page( | |
| 779 | set_fg_page(page ^ 0xffff); | |
| 784 | 780 | |
| 785 | 781 | } |
| 786 | 782 | |
| r20977 | r20978 | |
| 795 | 791 | ((m_goldnaxeb2_bgpage[3] & 0xf) << 8) | |
| 796 | 792 | ((m_goldnaxeb2_bgpage[2] & 0xf) << 12); |
| 797 | 793 | |
| 798 | set_bg_page( | |
| 794 | set_bg_page(page ^ 0xffff); | |
| 799 | 795 | } |
| 800 | 796 | |
| 801 | 797 | static ADDRESS_MAP_START( goldnaxeb2_map, AS_PROGRAM, 16, segas1x_bootleg_state ) |
| r20977 | r20978 | |
|---|---|---|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | #if 0 |
| 115 | ||
| 115 | void simpsons_state::sound_nmi_callback( int param ) | |
| 116 | 116 | { |
| 117 | simpsons_state *state = machine.driver_data<simpsons_state>(); | |
| 118 | state->m_audiocpu->set_input_line(INPUT_LINE_NMI, (state->m_nmi_enabled) ? CLEAR_LINE : ASSERT_LINE ); | |
| 119 | state->m_nmi_enabled = 0; | |
| 117 | m_audiocpu->set_input_line(INPUT_LINE_NMI, (m_nmi_enabled) ? CLEAR_LINE : ASSERT_LINE ); | |
| 118 | m_nmi_enabled = 0; | |
| 120 | 119 | } |
| 121 | 120 | #endif |
| 122 | 121 | |
| r20977 | r20978 | |
| 225 | 224 | |
| 226 | 225 | ***************************************************************************/ |
| 227 | 226 | |
| 228 | ||
| 227 | void simpsons_state::simpsons_objdma( ) | |
| 229 | 228 | { |
| 230 | simpsons_state *state = machine.driver_data<simpsons_state>(); | |
| 231 | 229 | int counter, num_inactive; |
| 232 | 230 | UINT16 *src, *dst; |
| 233 | 231 | |
| 234 | k053247_get_ram(state->m_k053246, &dst); | |
| 235 | counter = k053247_get_dy(state->m_k053246); | |
| 232 | k053247_get_ram(m_k053246, &dst); | |
| 233 | counter = k053247_get_dy(m_k053246); | |
| 236 | 234 | |
| 237 | src = | |
| 235 | src = m_spriteram; | |
| 238 | 236 | num_inactive = counter = 256; |
| 239 | 237 | |
| 240 | 238 | do { |
| r20977 | r20978 | |
| 262 | 260 | { |
| 263 | 261 | if (k053246_is_irq_enabled(m_k053246)) |
| 264 | 262 | { |
| 265 | simpsons_objdma( | |
| 263 | simpsons_objdma(); | |
| 266 | 264 | // 32+256us delay at 8MHz dotclock; artificially shortened since actual V-blank length is unknown |
| 267 | 265 | machine().scheduler().timer_set(attotime::from_usec(30), timer_expired_delegate(FUNC(simpsons_state::dmaend_callback),this)); |
| 268 | 266 | } |
| r20977 | r20978 | |
|---|---|---|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | ||
| 76 | void stactics_state::move_motor() | |
| 77 | 77 | { |
| 78 | 78 | /* monitor motor under joystick control */ |
| 79 | if (* | |
| 79 | if (*m_motor_on & 0x01) | |
| 80 | 80 | { |
| 81 | int ip3 = machine.root_device().ioport("IN3")->read(); | |
| 82 | int ip4 = machine.root_device().ioport("FAKE")->read(); | |
| 81 | int ip3 = machine().root_device().ioport("IN3")->read(); | |
| 82 | int ip4 = machine().root_device().ioport("FAKE")->read(); | |
| 83 | 83 | |
| 84 | 84 | /* up */ |
| 85 | if (((ip4 & 0x01) == 0) && (state->m_vert_pos > -128)) | |
| 86 | state->m_vert_pos--; | |
| 85 | if (((ip4 & 0x01) == 0) && (m_vert_pos > -128)) | |
| 86 | m_vert_pos--; | |
| 87 | 87 | |
| 88 | 88 | /* down */ |
| 89 | if (((ip4 & 0x02) == 0) && (state->m_vert_pos < 127)) | |
| 90 | state->m_vert_pos++; | |
| 89 | if (((ip4 & 0x02) == 0) && (m_vert_pos < 127)) | |
| 90 | m_vert_pos++; | |
| 91 | 91 | |
| 92 | 92 | /* left */ |
| 93 | if (((ip3 & 0x20) == 0) && (state->m_horiz_pos < 127)) | |
| 94 | state->m_horiz_pos++; | |
| 93 | if (((ip3 & 0x20) == 0) && (m_horiz_pos < 127)) | |
| 94 | m_horiz_pos++; | |
| 95 | 95 | |
| 96 | 96 | /* right */ |
| 97 | if (((ip3 & 0x40) == 0) && (state->m_horiz_pos > -128)) | |
| 98 | state->m_horiz_pos--; | |
| 97 | if (((ip3 & 0x40) == 0) && (m_horiz_pos > -128)) | |
| 98 | m_horiz_pos--; | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /* monitor motor under self-centering control */ |
| 102 | 102 | else |
| 103 | 103 | { |
| 104 | if (state->m_horiz_pos > 0) | |
| 105 | state->m_horiz_pos--; | |
| 106 | else if (state->m_horiz_pos < 0) | |
| 107 | state->m_horiz_pos++; | |
| 104 | if (m_horiz_pos > 0) | |
| 105 | m_horiz_pos--; | |
| 106 | else if (m_horiz_pos < 0) | |
| 107 | m_horiz_pos++; | |
| 108 | 108 | |
| 109 | if (state->m_vert_pos > 0) | |
| 110 | state->m_vert_pos--; | |
| 111 | else if (state->m_vert_pos < 0) | |
| 112 | state->m_vert_pos++; | |
| 109 | if (m_vert_pos > 0) | |
| 110 | m_vert_pos--; | |
| 111 | else if (m_vert_pos < 0) | |
| 112 | m_vert_pos++; | |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| r20977 | r20978 | |
| 150 | 150 | |
| 151 | 151 | INTERRUPT_GEN_MEMBER(stactics_state::stactics_interrupt) |
| 152 | 152 | { |
| 153 | move_motor( | |
| 153 | move_motor(); | |
| 154 | 154 | |
| 155 | 155 | device.execute().set_input_line(0, HOLD_LINE); |
| 156 | 156 | } |
| r20977 | r20978 | |
|---|---|---|
| 166 | 166 | * |
| 167 | 167 | *************************************/ |
| 168 | 168 | |
| 169 | ||
| 169 | offs_t segag80r_state::decrypt_offset(address_space &space, offs_t offset) | |
| 170 | 170 | { |
| 171 | segag80r_state *state = space.machine().driver_data<segag80r_state>(); | |
| 172 | ||
| 173 | 171 | /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */ |
| 174 | 172 | offs_t pc = space.device().safe_pcbase(); |
| 175 | 173 | if ((UINT16)pc == 0xffff || space.read_byte(pc) != 0x32) |
| 176 | 174 | return offset; |
| 177 | 175 | |
| 178 | 176 | /* fetch the low byte of the address and munge it */ |
| 179 | return (offset & 0xff00) | (* | |
| 177 | return (offset & 0xff00) | (*m_decrypt)(pc, space.read_byte(pc + 1)); | |
| 180 | 178 | } |
| 181 | 179 | |
| 182 | 180 | WRITE8_MEMBER(segag80r_state::mainram_w) |
| r20977 | r20978 | |
| 198 | 196 | * |
| 199 | 197 | *************************************/ |
| 200 | 198 | |
| 201 | ||
| 199 | inline UINT8 segag80r_state::demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0) | |
| 202 | 200 | { |
| 203 | 201 | return ((d7d6 << 7) & 0x80) | ((d7d6 << 2) & 0x40) | |
| 204 | 202 | ((d5d4 << 5) & 0x20) | ((d5d4 << 0) & 0x10) | |
| r20977 | r20978 | |
| 1415 | 1413 | * |
| 1416 | 1414 | *************************************/ |
| 1417 | 1415 | |
| 1418 | ||
| 1416 | void segag80r_state::monsterb_expand_gfx(const char *region) | |
| 1419 | 1417 | { |
| 1420 | 1418 | UINT8 *temp, *dest; |
| 1421 | 1419 | int i; |
| 1422 | 1420 | |
| 1423 | 1421 | /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */ |
| 1424 | 1422 | /* banking */ |
| 1425 | dest = machine.root_device().memregion(region)->base(); | |
| 1426 | temp = auto_alloc_array(machine, UINT8, 0x4000); | |
| 1423 | dest = machine().root_device().memregion(region)->base(); | |
| 1424 | temp = auto_alloc_array(machine(), UINT8, 0x4000); | |
| 1427 | 1425 | memcpy(temp, dest, 0x4000); |
| 1428 | 1426 | |
| 1429 | 1427 | /* 16 effective total banks */ |
| r20977 | r20978 | |
| 1432 | 1430 | memcpy(&dest[0x0000 + i * 0x800], &temp[0x0000 + (i & 3) * 0x800], 0x800); |
| 1433 | 1431 | memcpy(&dest[0x8000 + i * 0x800], &temp[0x2000 + (i >> 2) * 0x800], 0x800); |
| 1434 | 1432 | } |
| 1435 | auto_free(machine, temp); | |
| 1433 | auto_free(machine(), temp); | |
| 1436 | 1434 | } |
| 1437 | 1435 | |
| 1438 | 1436 | |
| r20977 | r20978 | |
| 1505 | 1503 | |
| 1506 | 1504 | /* configure video */ |
| 1507 | 1505 | m_background_pcb = G80_BACKGROUND_MONSTERB; |
| 1508 | monsterb_expand_gfx( | |
| 1506 | monsterb_expand_gfx("gfx1"); | |
| 1509 | 1507 | |
| 1510 | 1508 | /* install background board handlers */ |
| 1511 | 1509 | iospace.install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::monsterb_back_port_w),this)); |
| r20977 | r20978 | |
| 1524 | 1522 | |
| 1525 | 1523 | /* configure video */ |
| 1526 | 1524 | m_background_pcb = G80_BACKGROUND_PIGNEWT; |
| 1527 | monsterb_expand_gfx( | |
| 1525 | monsterb_expand_gfx("gfx1"); | |
| 1528 | 1526 | |
| 1529 | 1527 | /* install background board handlers */ |
| 1530 | 1528 | iospace.install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this)); |
| r20977 | r20978 | |
| 1544 | 1542 | |
| 1545 | 1543 | /* configure video */ |
| 1546 | 1544 | m_background_pcb = G80_BACKGROUND_PIGNEWT; |
| 1547 | monsterb_expand_gfx( | |
| 1545 | monsterb_expand_gfx("gfx1"); | |
| 1548 | 1546 | |
| 1549 | 1547 | /* install background board handlers */ |
| 1550 | 1548 | iospace.install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this)); |
| r20977 | r20978 | |
|---|---|---|
| 226 | 226 | UINT32 ret; |
| 227 | 227 | |
| 228 | 228 | /* screen flip multiplexes controls */ |
| 229 | if (suprridr_is_screen_flipped( | |
| 229 | if (suprridr_is_screen_flipped()) | |
| 230 | 230 | ret = ioport(SUPRRIDR_P2_CONTROL_PORT_TAG)->read(); |
| 231 | 231 | else |
| 232 | 232 | ret = ioport(SUPRRIDR_P1_CONTROL_PORT_TAG)->read(); |
| r20977 | r20978 | |
|---|---|---|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /* update the playfield and motion objects */ |
| 62 | skullxbo_scanline_update( | |
| 62 | skullxbo_scanline_update(scanline); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 |
| r20977 | r20978 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | #if 0 // default - more sensitive (state change and timing measured on real board?) |
| 90 | ||
| 90 | void spdodgeb_state::mcu63705_update_inputs() | |
| 91 | 91 | { |
| 92 | spdodgeb_state *state = machine.driver_data<spdodgeb_state>(); | |
| 93 | 92 | int buttons[2]; |
| 94 | 93 | int p,j; |
| 95 | 94 | |
| r20977 | r20978 | |
| 98 | 97 | { |
| 99 | 98 | int curr[2][2]; |
| 100 | 99 | |
| 101 | curr[p][0] = state->ioport(p ? "P2" : "P1")->read() & 0x01; | |
| 102 | curr[p][1] = state->ioport(p ? "P2" : "P1")->read() & 0x02; | |
| 100 | curr[p][0] = ioport(p ? "P2" : "P1")->read() & 0x01; | |
| 101 | curr[p][1] = ioport(p ? "P2" : "P1")->read() & 0x02; | |
| 103 | 102 | |
| 104 | 103 | for (j = 0;j <= 1;j++) |
| 105 | 104 | { |
| 106 | 105 | if (curr[p][j] == 0) |
| 107 | 106 | { |
| 108 | if (state->m_prev[p][j] != 0) | |
| 109 | state->m_countup[p][j] = 0; | |
| 107 | if (m_prev[p][j] != 0) | |
| 108 | m_countup[p][j] = 0; | |
| 110 | 109 | if (curr[p][j^1]) |
| 111 | state->m_countup[p][j] = 100; | |
| 112 | state->m_countup[p][j]++; | |
| 113 | state->m_running[p] &= ~(1 << j); | |
| 110 | m_countup[p][j] = 100; | |
| 111 | m_countup[p][j]++; | |
| 112 | m_running[p] &= ~(1 << j); | |
| 114 | 113 | } |
| 115 | 114 | else |
| 116 | 115 | { |
| 117 | if ( | |
| 116 | if (m_prev[p][j] == 0) | |
| 118 | 117 | { |
| 119 | if (state->m_countup[p][j] < 10 && state->m_countdown[p][j] < 5) | |
| 120 | state->m_running[p] |= 1 << j; | |
| 121 | state->m_countdown[p][j] = 0; | |
| 118 | if (m_countup[p][j] < 10 && m_countdown[p][j] < 5) | |
| 119 | m_running[p] |= 1 << j; | |
| 120 | m_countdown[p][j] = 0; | |
| 122 | 121 | } |
| 123 | | |
| 122 | m_countdown[p][j]++; | |
| 124 | 123 | } |
| 125 | 124 | } |
| 126 | 125 | |
| 127 | state->m_prev[p][0] = curr[p][0]; | |
| 128 | state->m_prev[p][1] = curr[p][1]; | |
| 126 | m_prev[p][0] = curr[p][0]; | |
| 127 | m_prev[p][1] = curr[p][1]; | |
| 129 | 128 | } |
| 130 | 129 | |
| 131 | 130 | /* update jumping and buttons state */ |
| r20977 | r20978 | |
| 133 | 132 | { |
| 134 | 133 | int curr[2]; |
| 135 | 134 | |
| 136 | curr[p] = machine.root_device().ioport(p ? "P2" : "P1")->read() & 0x30; | |
| 135 | curr[p] = machine().root_device().ioport(p ? "P2" : "P1")->read() & 0x30; | |
| 137 | 136 | |
| 138 | if ( | |
| 137 | if (m_jumped[p]) buttons[p] = 0; /* jump only momentarily flips the buttons */ | |
| 139 | 138 | else buttons[p] = curr[p]; |
| 140 | 139 | |
| 141 | if (buttons[p] == 0x30) state->m_jumped[p] = 1; | |
| 142 | if (curr[p] == 0x00) state->m_jumped[p] = 0; | |
| 140 | if (buttons[p] == 0x30) m_jumped[p] = 1; | |
| 141 | if (curr[p] == 0x00) m_jumped[p] = 0; | |
| 143 | 142 | |
| 144 | | |
| 143 | m_prev[p] = curr[p]; | |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | state->m_inputs[0] = machine.root_device().ioport("P1")->read() & 0xcf; | |
| 148 | state->m_inputs[1] = machine.root_device().ioport("P2")->read() & 0x0f; | |
| 149 | state->m_inputs[2] = state->m_running[0] | buttons[0]; | |
| 150 | state->m_inputs[3] = state->m_running[1] | buttons[1]; | |
| 146 | m_inputs[0] = machine().root_device().ioport("P1")->read() & 0xcf; | |
| 147 | m_inputs[1] = machine().root_device().ioport("P2")->read() & 0x0f; | |
| 148 | m_inputs[2] = m_running[0] | buttons[0]; | |
| 149 | m_inputs[3] = m_running[1] | buttons[1]; | |
| 151 | 150 | } |
| 152 | 151 | #else // alternate - less sensitive |
| 153 | ||
| 152 | void spdodgeb_state::mcu63705_update_inputs() | |
| 154 | 153 | { |
| 155 | spdodgeb_state *state = machine.driver_data<spdodgeb_state>(); | |
| 156 | 154 | #define DBLTAP_TOLERANCE 5 |
| 157 | 155 | |
| 158 | 156 | #define R 0x01 |
| r20977 | r20978 | |
| 166 | 164 | |
| 167 | 165 | for (p=0; p<=1; p++) |
| 168 | 166 | { |
| 169 | curr_port[p] = | |
| 167 | curr_port[p] = ioport(p ? "P2" : "P1")->read(); | |
| 170 | 168 | curr_dash[p] = 0; |
| 171 | 169 | |
| 172 | 170 | if (curr_port[p] & R) |
| 173 | 171 | { |
| 174 | if (!( | |
| 172 | if (!(m_last_port[p] & R)) | |
| 175 | 173 | { |
| 176 | if ( | |
| 174 | if (m_tapc[p]) curr_dash[p] |= R; else m_tapc[p] = DBLTAP_TOLERANCE; | |
| 177 | 175 | } |
| 178 | else if ( | |
| 176 | else if (m_last_dash[p] & R) curr_dash[p] |= R; | |
| 179 | 177 | } |
| 180 | 178 | else if (curr_port[p] & L) |
| 181 | 179 | { |
| 182 | if (!( | |
| 180 | if (!(m_last_port[p] & L)) | |
| 183 | 181 | { |
| 184 | if ( | |
| 182 | if (m_tapc[p+2]) curr_dash[p] |= L; else m_tapc[p+2] = DBLTAP_TOLERANCE; | |
| 185 | 183 | } |
| 186 | else if ( | |
| 184 | else if (m_last_dash[p] & L) curr_dash[p] |= L; | |
| 187 | 185 | } |
| 188 | 186 | |
| 189 | if (curr_port[p] & A && !(state->m_last_port[p] & A)) curr_dash[p] |= A; | |
| 190 | if (curr_port[p] & D && !(state->m_last_port[p] & D)) curr_dash[p] |= D; | |
| 187 | if (curr_port[p] & A && !(m_last_port[p] & A)) curr_dash[p] |= A; | |
| 188 | if (curr_port[p] & D && !(m_last_port[p] & D)) curr_dash[p] |= D; | |
| 191 | 189 | |
| 192 | state->m_last_port[p] = curr_port[p]; | |
| 193 | state->m_last_dash[p] = curr_dash[p]; | |
| 190 | m_last_port[p] = curr_port[p]; | |
| 191 | m_last_dash[p] = curr_dash[p]; | |
| 194 | 192 | |
| 195 | if (state->m_tapc[p ]) state->m_tapc[p ]--; | |
| 196 | if (state->m_tapc[p+2]) state->m_tapc[p+2]--; | |
| 193 | if (m_tapc[p ]) m_tapc[p ]--; | |
| 194 | if (m_tapc[p+2]) m_tapc[p+2]--; | |
| 197 | 195 | } |
| 198 | 196 | |
| 199 | state->m_inputs[0] = curr_port[0] & 0xcf; | |
| 200 | state->m_inputs[1] = curr_port[1] & 0x0f; | |
| 201 | state->m_inputs[2] = curr_dash[0]; | |
| 202 | state->m_inputs[3] = curr_dash[1]; | |
| 197 | m_inputs[0] = curr_port[0] & 0xcf; | |
| 198 | m_inputs[1] = curr_port[1] & 0x0f; | |
| 199 | m_inputs[2] = curr_dash[0]; | |
| 200 | m_inputs[3] = curr_dash[1]; | |
| 203 | 201 | |
| 204 | 202 | #undef DBLTAP_TOLERANCE |
| 205 | 203 | #undef R |
| r20977 | r20978 | |
| 229 | 227 | { |
| 230 | 228 | // logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",space.device().safe_pc(),data); |
| 231 | 229 | m_mcu63701_command = data; |
| 232 | mcu63705_update_inputs( | |
| 230 | mcu63705_update_inputs(); | |
| 233 | 231 | } |
| 234 | 232 | |
| 235 | 233 |
| r20977 | r20978 | |
|---|---|---|
| 184 | 184 | * |
| 185 | 185 | *************************************/ |
| 186 | 186 | |
| 187 | ||
| 187 | offs_t segag80v_state::decrypt_offset(address_space &space, offs_t offset) | |
| 188 | 188 | { |
| 189 | segag80v_state *state = space.machine().driver_data<segag80v_state>(); | |
| 190 | ||
| 191 | 189 | /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */ |
| 192 | 190 | offs_t pc = space.device().safe_pcbase(); |
| 193 | 191 | if ((UINT16)pc == 0xffff || space.read_byte(pc) != 0x32) |
| 194 | 192 | return offset; |
| 195 | 193 | |
| 196 | 194 | /* fetch the low byte of the address and munge it */ |
| 197 | return (offset & 0xff00) | (* | |
| 195 | return (offset & 0xff00) | (*m_decrypt)(pc, space.read_byte(pc + 1)); | |
| 198 | 196 | } |
| 199 | 197 | |
| 200 | 198 | WRITE8_MEMBER(segag80v_state::mainram_w) |
| r20977 | r20978 | |
| 216 | 214 | * |
| 217 | 215 | *************************************/ |
| 218 | 216 | |
| 219 | ||
| 217 | inline UINT8 segag80v_state::demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0) | |
| 220 | 218 | { |
| 221 | 219 | return ((d7d6 << 7) & 0x80) | ((d7d6 << 2) & 0x40) | |
| 222 | 220 | ((d5d4 << 5) & 0x20) | ((d5d4 << 0) & 0x10) | |
| r20977 | r20978 | |
|---|---|---|
| 1412 | 1412 | /*------------------------------ |
| 1413 | 1413 | initialize |
| 1414 | 1414 | ------------------------------*/ |
| 1415 | ||
| 1415 | void seta_state::uPD71054_timer_init( ) | |
| 1416 | 1416 | { |
| 1417 | seta_state *state = machine.driver_data<seta_state>(); | |
| 1418 | uPD71054_state *uPD71054 = &state->m_uPD71054; | |
| 1417 | uPD71054_state *uPD71054 = &m_uPD71054; | |
| 1419 | 1418 | int no; |
| 1420 | 1419 | |
| 1421 | 1420 | uPD71054->write_select = 0; |
| r20977 | r20978 | |
| 1424 | 1423 | uPD71054->max[no] = 0xffff; |
| 1425 | 1424 | } |
| 1426 | 1425 | for( no = 0; no < USED_TIMER_NUM; no++ ) { |
| 1427 | uPD71054->timer[no] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(seta_state::uPD71054_timer_callback), | |
| 1426 | uPD71054->timer[no] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seta_state::uPD71054_timer_callback),this)); | |
| 1428 | 1427 | } |
| 1429 | 1428 | } |
| 1430 | 1429 | |
| r20977 | r20978 | |
| 1787 | 1786 | machine().tilemap().mark_all_dirty(); |
| 1788 | 1787 | m_tiles_offset = tiles_offset; |
| 1789 | 1788 | |
| 1790 | seta_coin_lockout_w( | |
| 1789 | seta_coin_lockout_w(data); | |
| 1791 | 1790 | } |
| 1792 | 1791 | } |
| 1793 | 1792 | |
| r20977 | r20978 | |
| 3073 | 3072 | WRITE8_MEMBER(seta_state::sub_bankswitch_lockout_w) |
| 3074 | 3073 | { |
| 3075 | 3074 | sub_bankswitch_w(space,offset,data); |
| 3076 | seta_coin_lockout_w( | |
| 3075 | seta_coin_lockout_w(data); | |
| 3077 | 3076 | } |
| 3078 | 3077 | |
| 3079 | 3078 | |
| r20977 | r20978 | |
| 8140 | 8139 | device.execute().set_input_line(2, HOLD_LINE ); |
| 8141 | 8140 | } |
| 8142 | 8141 | |
| 8143 | MACHINE_START_MEMBER(seta_state,wrofaero){ uPD71054_timer_init( | |
| 8142 | MACHINE_START_MEMBER(seta_state,wrofaero){ uPD71054_timer_init(); } | |
| 8144 | 8143 | #endif // __uPD71054_TIMER |
| 8145 | 8144 | |
| 8146 | 8145 |
| r20977 | r20978 | |
|---|---|---|
| 160 | 160 | membank("bank1")->set_entry(bank); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | ||
| 163 | void spy_state::spy_collision( ) | |
| 164 | 164 | { |
| 165 | 165 | #define MAX_SPRITES 64 |
| 166 | 166 | #define DEF_NEAR_PLANE 0x6400 |
| 167 | 167 | #define NEAR_PLANE_ZOOM 0x0100 |
| 168 | 168 | #define FAR_PLANE_ZOOM 0x0000 |
| 169 | 169 | |
| 170 | spy_state *state = machine.driver_data<spy_state>(); | |
| 171 | 170 | int op1, x1, w1, z1, d1, y1, h1; |
| 172 | 171 | int op2, x2, w2, z2, d2, y2, h2; |
| 173 | 172 | int mode, i, loopend, nearplane; |
| 174 | 173 | |
| 175 | mode = state->m_pmcram[0x1]; | |
| 176 | op1 = state->m_pmcram[0x2]; | |
| 174 | mode = m_pmcram[0x1]; | |
| 175 | op1 = m_pmcram[0x2]; | |
| 177 | 176 | if (op1 == 1) |
| 178 | 177 | { |
| 179 | x1 = (state->m_pmcram[0x3] << 8) + state->m_pmcram[0x4]; | |
| 180 | w1 = (state->m_pmcram[0x5] << 8) + state->m_pmcram[0x6]; | |
| 181 | z1 = (state->m_pmcram[0x7] << 8) + state->m_pmcram[0x8]; | |
| 182 | d1 = (state->m_pmcram[0x9] << 8) + state->m_pmcram[0xa]; | |
| 183 | y1 = (state->m_pmcram[0xb] << 8) + state->m_pmcram[0xc]; | |
| 184 | h1 = (state->m_pmcram[0xd] << 8) + state->m_pmcram[0xe]; | |
| 178 | x1 = (m_pmcram[0x3] << 8) + m_pmcram[0x4]; | |
| 179 | w1 = (m_pmcram[0x5] << 8) + m_pmcram[0x6]; | |
| 180 | z1 = (m_pmcram[0x7] << 8) + m_pmcram[0x8]; | |
| 181 | d1 = (m_pmcram[0x9] << 8) + m_pmcram[0xa]; | |
| 182 | y1 = (m_pmcram[0xb] << 8) + m_pmcram[0xc]; | |
| 183 | h1 = (m_pmcram[0xd] << 8) + m_pmcram[0xe]; | |
| 185 | 184 | |
| 186 | 185 | for (i = 16; i < 14 * MAX_SPRITES + 2; i += 14) |
| 187 | 186 | { |
| 188 | op2 = | |
| 187 | op2 = m_pmcram[i]; | |
| 189 | 188 | if (op2 || mode == 0x0c) |
| 190 | 189 | { |
| 191 | x2 = (state->m_pmcram[i + 0x1] << 8) + state->m_pmcram[i + 0x2]; | |
| 192 | w2 = (state->m_pmcram[i + 0x3] << 8) + state->m_pmcram[i + 0x4]; | |
| 193 | z2 = (state->m_pmcram[i + 0x5] << 8) + state->m_pmcram[i + 0x6]; | |
| 194 | d2 = (state->m_pmcram[i + 0x7] << 8) + state->m_pmcram[i + 0x8]; | |
| 195 | y2 = (state->m_pmcram[i + 0x9] << 8) + state->m_pmcram[i + 0xa]; | |
| 196 | h2 = (state->m_pmcram[i + 0xb] << 8) + state->m_pmcram[i + 0xc]; | |
| 190 | x2 = (m_pmcram[i + 0x1] << 8) + m_pmcram[i + 0x2]; | |
| 191 | w2 = (m_pmcram[i + 0x3] << 8) + m_pmcram[i + 0x4]; | |
| 192 | z2 = (m_pmcram[i + 0x5] << 8) + m_pmcram[i + 0x6]; | |
| 193 | d2 = (m_pmcram[i + 0x7] << 8) + m_pmcram[i + 0x8]; | |
| 194 | y2 = (m_pmcram[i + 0x9] << 8) + m_pmcram[i + 0xa]; | |
| 195 | h2 = (m_pmcram[i + 0xb] << 8) + m_pmcram[i + 0xc]; | |
| 197 | 196 | /* |
| 198 | 197 | The mad scientist's laser truck has both a high sprite center and a small height value. |
| 199 | 198 | It has to be measured from the ground to detect correctly. |
| r20977 | r20978 | |
| 204 | 203 | // what other sprites fall into: |
| 205 | 204 | if ((abs(x1 - x2) < w1 + w2) && (abs(z1 - z2) < d1 + d2) && (abs(y1 - y2) < h1 + h2)) |
| 206 | 205 | { |
| 207 | state->m_pmcram[0xf] = 0; | |
| 208 | state->m_pmcram[i + 0xd] = 0; | |
| 206 | m_pmcram[0xf] = 0; | |
| 207 | m_pmcram[i + 0xd] = 0; | |
| 209 | 208 | } |
| 210 | 209 | else |
| 211 | | |
| 210 | m_pmcram[i + 0xd] = 1; | |
| 212 | 211 | } |
| 213 | 212 | } |
| 214 | 213 | } |
| r20977 | r20978 | |
| 219 | 218 | the scale factors from the PMCU code. Plugging 0 and 0x100 to the far and near planes seems |
| 220 | 219 | to do the trick though. |
| 221 | 220 | */ |
| 222 | loopend = (state->m_pmcram[0] << 8) + state->m_pmcram[1]; | |
| 223 | nearplane = (state->m_pmcram[2] << 8) + state->m_pmcram[3]; | |
| 221 | loopend = (m_pmcram[0] << 8) + m_pmcram[1]; | |
| 222 | nearplane = (m_pmcram[2] << 8) + m_pmcram[3]; | |
| 224 | 223 | |
| 225 | 224 | // fail safe |
| 226 | 225 | if (loopend > MAX_SPRITES) |
| r20977 | r20978 | |
| 232 | 231 | |
| 233 | 232 | for (i = 4; i < loopend; i += 2) |
| 234 | 233 | { |
| 235 | op2 = ( | |
| 234 | op2 = (m_pmcram[i] << 8) + m_pmcram[i + 1]; | |
| 236 | 235 | op2 = (op2 * (NEAR_PLANE_ZOOM - FAR_PLANE_ZOOM)) / nearplane + FAR_PLANE_ZOOM; |
| 237 | state->m_pmcram[i] = op2 >> 8; | |
| 238 | state->m_pmcram[i + 1] = op2 & 0xff; | |
| 236 | m_pmcram[i] = op2 >> 8; | |
| 237 | m_pmcram[i + 1] = op2 & 0xff; | |
| 239 | 238 | } |
| 240 | 239 | |
| 241 | memset( | |
| 240 | memset(m_pmcram + loopend, 0, 0x800 - loopend); // clean up for next frame | |
| 242 | 241 | } |
| 243 | 242 | } |
| 244 | 243 | |
| r20977 | r20978 | |
| 317 | 316 | logerror("\n"); |
| 318 | 317 | } |
| 319 | 318 | } |
| 320 | spy_collision( | |
| 319 | spy_collision(); | |
| 321 | 320 | //ZT |
| 322 | 321 | m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); |
| 323 | 322 | } |
| r20977 | r20978 | |
|---|---|---|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | ||
| 146 | void spacefb_state::create_interrupt_timer() | |
| 147 | 147 | { |
| 148 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 149 | state->m_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefb_state::interrupt_callback),state)); | |
| 148 | m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefb_state::interrupt_callback),this)); | |
| 150 | 149 | } |
| 151 | 150 | |
| 152 | 151 | |
| 153 | ||
| 152 | void spacefb_state::start_interrupt_timer() | |
| 154 | 153 | { |
| 155 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 156 | state->m_interrupt_timer->adjust(machine.primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1)); | |
| 154 | m_interrupt_timer->adjust(machine().primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1)); | |
| 157 | 155 | } |
| 158 | 156 | |
| 159 | 157 | |
| r20977 | r20978 | |
| 166 | 164 | |
| 167 | 165 | void spacefb_state::machine_start() |
| 168 | 166 | { |
| 169 | create_interrupt_timer( | |
| 167 | create_interrupt_timer(); | |
| 170 | 168 | } |
| 171 | 169 | |
| 172 | 170 | |
| r20977 | r20978 | |
| 185 | 183 | spacefb_port_1_w(space, 0, 0); |
| 186 | 184 | spacefb_port_2_w(space, 0, 0); |
| 187 | 185 | |
| 188 | start_interrupt_timer( | |
| 186 | start_interrupt_timer(); | |
| 189 | 187 | } |
| 190 | 188 | |
| 191 | 189 |
| r20977 | r20978 | |
|---|---|---|
| 295 | 295 | coin_counter_w(machine(), 1, data & 0x04); |
| 296 | 296 | coin_counter_w(machine(), 0, data & 0x08); |
| 297 | 297 | // data & 0x40? |
| 298 | ssv_enable_video( | |
| 298 | ssv_enable_video(data & 0x80); | |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
| r20977 | r20978 | |
| 310 | 310 | coin_counter_w(machine(), 1, data & 0x04); |
| 311 | 311 | coin_counter_w(machine(), 0, data & 0x08); |
| 312 | 312 | // data & 0x40? |
| 313 | ssv_enable_video( | |
| 313 | ssv_enable_video(data & 0x80); | |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| r20977 | r20978 | |
| 2508 | 2508 | |
| 2509 | 2509 | ***************************************************************************/ |
| 2510 | 2510 | |
| 2511 | ||
| 2511 | void ssv_state::init_ssv(int interrupt_ultrax) | |
| 2512 | 2512 | { |
| 2513 | ssv_state *state = machine.driver_data<ssv_state>(); | |
| 2514 | 2513 | int i; |
| 2515 | 2514 | for (i = 0; i < 16; i++) |
| 2516 | | |
| 2515 | m_tile_code[i] = ( (i & 8) ? (1 << 16) : 0 ) + | |
| 2517 | 2516 | ( (i & 4) ? (2 << 16) : 0 ) + |
| 2518 | 2517 | ( (i & 2) ? (4 << 16) : 0 ) + |
| 2519 | 2518 | ( (i & 1) ? (8 << 16) : 0 ) ; |
| 2520 | ssv_enable_video(machine, 1); | |
| 2521 | state->m_interrupt_ultrax = interrupt_ultrax; | |
| 2519 | ssv_enable_video(1); | |
| 2520 | m_interrupt_ultrax = interrupt_ultrax; | |
| 2522 | 2521 | } |
| 2523 | 2522 | |
| 2524 | ||
| 2523 | void ssv_state::init_hypreac2_common() | |
| 2525 | 2524 | { |
| 2526 | ssv_state *state = machine.driver_data<ssv_state>(); | |
| 2527 | 2525 | int i; |
| 2528 | 2526 | |
| 2529 | 2527 | for (i = 0; i < 16; i++) |
| 2530 | | |
| 2528 | m_tile_code[i] = (i << 16); | |
| 2531 | 2529 | } |
| 2532 | 2530 | |
| 2533 | 2531 | // massages the data from the BPMicro-compatible dump to runnable form |
| 2534 | ||
| 2532 | void ssv_state::init_st010() | |
| 2535 | 2533 | { |
| 2536 | UINT8 *dspsrc = (UINT8 *)machine.root_device().memregion("st010")->base(); | |
| 2537 | UINT32 *dspprg = (UINT32 *)machine.root_device().memregion("dspprg")->base(); | |
| 2538 | UINT16 *dspdata = (UINT16 *)machine.root_device().memregion("dspdata")->base(); | |
| 2534 | UINT8 *dspsrc = (UINT8 *)machine().root_device().memregion("st010")->base(); | |
| 2535 | UINT32 *dspprg = (UINT32 *)machine().root_device().memregion("dspprg")->base(); | |
| 2536 | UINT16 *dspdata = (UINT16 *)machine().root_device().memregion("dspdata")->base(); | |
| 2539 | 2537 | |
| 2540 | 2538 | // copy DSP program |
| 2541 | 2539 | for (int i = 0; i < 0x10000; i+= 4) |
| r20977 | r20978 | |
| 2551 | 2549 | } |
| 2552 | 2550 | } |
| 2553 | 2551 | |
| 2554 | DRIVER_INIT_MEMBER(ssv_state,drifto94) { init_ssv(machine(), 0); init_st010(machine()); } | |
| 2555 | DRIVER_INIT_MEMBER(ssv_state,eaglshot) { init_ssv(machine(), 0); init_hypreac2_common(machine()); } | |
| 2556 | DRIVER_INIT_MEMBER(ssv_state,gdfs) { init_ssv(machine(), 0); } | |
| 2557 | DRIVER_INIT_MEMBER(ssv_state,hypreact) { init_ssv(machine(), 0); } | |
| 2558 | DRIVER_INIT_MEMBER(ssv_state,hypreac2) { init_ssv(machine(), 0); init_hypreac2_common(machine()); } | |
| 2559 | DRIVER_INIT_MEMBER(ssv_state,janjans1) { init_ssv(machine(), 0); } | |
| 2560 | DRIVER_INIT_MEMBER(ssv_state,keithlcy) { init_ssv(machine(), 0); } | |
| 2561 | DRIVER_INIT_MEMBER(ssv_state,meosism) { init_ssv(machine(), 0); } | |
| 2562 | DRIVER_INIT_MEMBER(ssv_state,mslider) { init_ssv(machine(), 0); } | |
| 2563 | DRIVER_INIT_MEMBER(ssv_state,ryorioh) { init_ssv(machine(), 0); } | |
| 2564 | DRIVER_INIT_MEMBER(ssv_state,srmp4) { init_ssv(machine(), 0); | |
| 2552 | DRIVER_INIT_MEMBER(ssv_state,drifto94) { init_ssv(0); init_st010(); } | |
| 2553 | DRIVER_INIT_MEMBER(ssv_state,eaglshot) { init_ssv(0); init_hypreac2_common(); } | |
| 2554 | DRIVER_INIT_MEMBER(ssv_state,gdfs) { init_ssv(0); } | |
| 2555 | DRIVER_INIT_MEMBER(ssv_state,hypreact) { init_ssv(0); } | |
| 2556 | DRIVER_INIT_MEMBER(ssv_state,hypreac2) { init_ssv(0); init_hypreac2_common(); } | |
| 2557 | DRIVER_INIT_MEMBER(ssv_state,janjans1) { init_ssv(0); } | |
| 2558 | DRIVER_INIT_MEMBER(ssv_state,keithlcy) { init_ssv(0); } | |
| 2559 | DRIVER_INIT_MEMBER(ssv_state,meosism) { init_ssv(0); } | |
| 2560 | DRIVER_INIT_MEMBER(ssv_state,mslider) { init_ssv(0); } | |
| 2561 | DRIVER_INIT_MEMBER(ssv_state,ryorioh) { init_ssv(0); } | |
| 2562 | DRIVER_INIT_MEMBER(ssv_state,srmp4) { init_ssv(0); | |
| 2565 | 2563 | // ((UINT16 *)machine().root_device().memregion("user1")->base())[0x2b38/2] = 0x037a; /* patch to see gal test mode */ |
| 2566 | 2564 | } |
| 2567 | DRIVER_INIT_MEMBER(ssv_state,srmp7) { init_ssv(machine(), 0); } | |
| 2568 | DRIVER_INIT_MEMBER(ssv_state,stmblade) { init_ssv(machine(), 0); init_st010(machine()); } | |
| 2569 | DRIVER_INIT_MEMBER(ssv_state,survarts) { init_ssv(machine(), 0); } | |
| 2570 | DRIVER_INIT_MEMBER(ssv_state,dynagear) { init_ssv(machine(), 0); } | |
| 2571 | DRIVER_INIT_MEMBER(ssv_state,sxyreact) { init_ssv(machine(), 0); init_hypreac2_common(machine()); } | |
| 2572 | DRIVER_INIT_MEMBER(ssv_state,cairblad) { init_ssv(machine(), 0); init_hypreac2_common(machine()); } | |
| 2573 | DRIVER_INIT_MEMBER(ssv_state,sxyreac2) { init_ssv(machine(), 0); init_hypreac2_common(machine()); } | |
| 2574 | DRIVER_INIT_MEMBER(ssv_state,twineag2) { init_ssv(machine(), 1); init_st010(machine()); } | |
| 2575 | DRIVER_INIT_MEMBER(ssv_state,ultrax) { init_ssv(machine(), 1); } | |
| 2576 | DRIVER_INIT_MEMBER(ssv_state,vasara) { init_ssv(machine(), 0); } | |
| 2577 | DRIVER_INIT_MEMBER(ssv_state,jsk) { init_ssv(machine(), 0); } | |
| 2565 | DRIVER_INIT_MEMBER(ssv_state,srmp7) { init_ssv(0); } | |
| 2566 | DRIVER_INIT_MEMBER(ssv_state,stmblade) { init_ssv(0); init_st010(); } | |
| 2567 | DRIVER_INIT_MEMBER(ssv_state,survarts) { init_ssv(0); } | |
| 2568 | DRIVER_INIT_MEMBER(ssv_state,dynagear) { init_ssv(0); } | |
| 2569 | DRIVER_INIT_MEMBER(ssv_state,sxyreact) { init_ssv(0); init_hypreac2_common(); } | |
| 2570 | DRIVER_INIT_MEMBER(ssv_state,cairblad) { init_ssv(0); init_hypreac2_common(); } | |
| 2571 | DRIVER_INIT_MEMBER(ssv_state,sxyreac2) { init_ssv(0); init_hypreac2_common(); } | |
| 2572 | DRIVER_INIT_MEMBER(ssv_state,twineag2) { init_ssv(1); init_st010(); } | |
| 2573 | DRIVER_INIT_MEMBER(ssv_state,ultrax) { init_ssv(1); } | |
| 2574 | DRIVER_INIT_MEMBER(ssv_state,vasara) { init_ssv(0); } | |
| 2575 | DRIVER_INIT_MEMBER(ssv_state,jsk) { init_ssv(0); } | |
| 2578 | 2576 | |
| 2579 | 2577 | |
| 2580 | 2578 | static MACHINE_CONFIG_START( ssv, ssv_state ) |
| r20977 | r20978 | |
|---|---|---|
| 303 | 303 | m_sasuke_counter += 0x10; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | ||
| 306 | void snk6502_state::sasuke_start_counter() | |
| 307 | 307 | { |
| 308 | snk6502_state *state = machine.driver_data<snk6502_state>(); | |
| 309 | 308 | |
| 310 | | |
| 309 | m_sasuke_counter = 0; | |
| 311 | 310 | } |
| 312 | 311 | |
| 313 | 312 | |
| r20977 | r20978 | |
| 784 | 783 | // adjusted (measured through audio recording of pcb) |
| 785 | 784 | snk6502_set_music_freq(machine(), 35300); |
| 786 | 785 | |
| 787 | sasuke_start_counter( | |
| 786 | sasuke_start_counter(); | |
| 788 | 787 | } |
| 789 | 788 | |
| 790 | 789 | MACHINE_RESET_MEMBER(snk6502_state,satansat) |
| r20977 | r20978 | |
| 793 | 792 | // NOTE: this was set before sasuke was adjusted to a lower freq, please don't modify until measured/confirmed on pcb |
| 794 | 793 | snk6502_set_music_freq(machine(), 38000); |
| 795 | 794 | |
| 796 | sasuke_start_counter( | |
| 795 | sasuke_start_counter(); | |
| 797 | 796 | } |
| 798 | 797 | |
| 799 | 798 | MACHINE_RESET_MEMBER(snk6502_state,vanguard) |
| r20977 | r20978 | |
|---|---|---|
| 405 | 405 | return 0x0003; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | ||
| 408 | void snowbros_state::sb3_play_music(int data) | |
| 409 | 409 | { |
| 410 | snowbros_state *state = machine.driver_data<snowbros_state>(); | |
| 411 | 410 | UINT8 *snd; |
| 412 | 411 | |
| 413 | 412 | /* sample is actually played in interrupt function so it loops */ |
| 414 | | |
| 413 | m_sb3_music = data; | |
| 415 | 414 | |
| 416 | 415 | switch (data) |
| 417 | 416 | { |
| 418 | 417 | case 0x23: |
| 419 | 418 | case 0x26: |
| 420 | snd = | |
| 419 | snd = memregion("oki")->base(); | |
| 421 | 420 | memcpy(snd+0x20000, snd+0x80000+0x00000, 0x20000); |
| 422 | | |
| 421 | m_sb3_music_is_playing = 1; | |
| 423 | 422 | break; |
| 424 | 423 | |
| 425 | 424 | case 0x24: |
| 426 | snd = | |
| 425 | snd = memregion("oki")->base(); | |
| 427 | 426 | memcpy(snd+0x20000, snd+0x80000+0x20000, 0x20000); |
| 428 | | |
| 427 | m_sb3_music_is_playing = 1; | |
| 429 | 428 | break; |
| 430 | 429 | |
| 431 | 430 | case 0x25: |
| r20977 | r20978 | |
| 436 | 435 | case 0x2b: |
| 437 | 436 | case 0x2c: |
| 438 | 437 | case 0x2d: |
| 439 | snd = | |
| 438 | snd = memregion("oki")->base(); | |
| 440 | 439 | memcpy(snd+0x20000, snd+0x80000+0x40000, 0x20000); |
| 441 | | |
| 440 | m_sb3_music_is_playing = 1; | |
| 442 | 441 | break; |
| 443 | 442 | |
| 444 | 443 | case 0x2e: |
| 445 | | |
| 444 | m_sb3_music_is_playing = 0; | |
| 446 | 445 | break; |
| 447 | 446 | } |
| 448 | 447 | } |
| 449 | 448 | |
| 450 | ||
| 449 | void snowbros_state::sb3_play_sound (okim6295_device *oki, int data) | |
| 451 | 450 | { |
| 452 | 451 | int status = oki->read_status(); |
| 453 | 452 | |
| r20977 | r20978 | |
| 490 | 489 | |
| 491 | 490 | if (data>=0x22 && data<=0x31) |
| 492 | 491 | { |
| 493 | sb3_play_music( | |
| 492 | sb3_play_music(data); | |
| 494 | 493 | } |
| 495 | 494 | |
| 496 | 495 | if ((data>=0x30) && (data<=0x51)) |
| r20977 | r20978 | |
| 500 | 499 | |
| 501 | 500 | if (data>=0x52 && data<=0x5f) |
| 502 | 501 | { |
| 503 | sb3_play_music( | |
| 502 | sb3_play_music(data-0x30); | |
| 504 | 503 | } |
| 505 | 504 | |
| 506 | 505 | } |
| r20977 | r20978 | |
|---|---|---|
| 374 | 374 | * |
| 375 | 375 | *************************************/ |
| 376 | 376 | |
| 377 | static void signal_v60_irq(running_machine &machine, int data); | |
| 378 | 377 | static void signal_sound_irq(running_machine &machine, int which); |
| 379 | 378 | |
| 380 | 379 | |
| r20977 | r20978 | |
| 406 | 405 | * |
| 407 | 406 | *************************************/ |
| 408 | 407 | |
| 409 | ||
| 408 | void segas32_state::update_irq_state() | |
| 410 | 409 | { |
| 411 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 412 | UINT8 effirq = state->m_v60_irq_control[7] & ~state->m_v60_irq_control[6] & 0x1f; | |
| 410 | UINT8 effirq = m_v60_irq_control[7] & ~m_v60_irq_control[6] & 0x1f; | |
| 413 | 411 | int vector; |
| 414 | 412 | |
| 415 | 413 | /* loop over interrupt vectors, finding the highest priority one with */ |
| r20977 | r20978 | |
| 417 | 415 | for (vector = 0; vector < 5; vector++) |
| 418 | 416 | if (effirq & (1 << vector)) |
| 419 | 417 | { |
| 420 | machine.device("maincpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, vector); | |
| 418 | machine().device("maincpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, vector); | |
| 421 | 419 | break; |
| 422 | 420 | } |
| 423 | 421 | |
| 424 | 422 | /* if we didn't find any, clear the interrupt line */ |
| 425 | 423 | if (vector == 5) |
| 426 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
| 424 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
| 427 | 425 | } |
| 428 | 426 | |
| 429 | 427 | |
| 430 | ||
| 428 | void segas32_state::signal_v60_irq(int which) | |
| 431 | 429 | { |
| 432 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 433 | 430 | int i; |
| 434 | 431 | |
| 435 | 432 | /* see if this interrupt input is mapped to any vectors; if so, mark them */ |
| 436 | 433 | for (i = 0; i < 5; i++) |
| 437 | if (state->m_v60_irq_control[i] == which) | |
| 438 | state->m_v60_irq_control[7] |= 1 << i; | |
| 439 | update_irq_state(machine); | |
| 434 | if (m_v60_irq_control[i] == which) | |
| 435 | m_v60_irq_control[7] |= 1 << i; | |
| 436 | update_irq_state(); | |
| 440 | 437 | } |
| 441 | 438 | |
| 442 | 439 | |
| 443 | 440 | TIMER_DEVICE_CALLBACK_MEMBER(segas32_state::signal_v60_irq_callback) |
| 444 | 441 | { |
| 445 | signal_v60_irq( | |
| 442 | signal_v60_irq(param); | |
| 446 | 443 | } |
| 447 | 444 | |
| 448 | 445 | |
| 449 | ||
| 446 | void segas32_state::int_control_w(address_space &space, int offset, UINT8 data) | |
| 450 | 447 | { |
| 451 | segas32_state *state = space.machine().driver_data<segas32_state>(); | |
| 452 | 448 | int duration; |
| 453 | 449 | |
| 454 | 450 | // logerror("%06X:int_control_w(%X) = %02X\n", space.device().safe_pc(), offset, data); |
| r20977 | r20978 | |
| 459 | 455 | case 2: |
| 460 | 456 | case 3: |
| 461 | 457 | case 4: /* vectors */ |
| 462 | | |
| 458 | m_v60_irq_control[offset] = data; | |
| 463 | 459 | break; |
| 464 | 460 | |
| 465 | 461 | case 5: /* unknown */ |
| 466 | | |
| 462 | m_v60_irq_control[offset] = data; | |
| 467 | 463 | break; |
| 468 | 464 | |
| 469 | 465 | case 6: /* mask */ |
| 470 | state->m_v60_irq_control[offset] = data; | |
| 471 | update_irq_state(space.machine()); | |
| 466 | m_v60_irq_control[offset] = data; | |
| 467 | update_irq_state(); | |
| 472 | 468 | break; |
| 473 | 469 | |
| 474 | 470 | case 7: /* acknowledge */ |
| 475 | state->m_v60_irq_control[offset] &= data; | |
| 476 | update_irq_state(space.machine()); | |
| 471 | m_v60_irq_control[offset] &= data; | |
| 472 | update_irq_state(); | |
| 477 | 473 | break; |
| 478 | 474 | |
| 479 | 475 | case 8: |
| 480 | 476 | case 9: /* timer 0 count */ |
| 481 | state->m_v60_irq_control[offset] = data; | |
| 482 | duration = state->m_v60_irq_control[8] + ((state->m_v60_irq_control[9] << 8) & 0xf00); | |
| 477 | m_v60_irq_control[offset] = data; | |
| 478 | duration = m_v60_irq_control[8] + ((m_v60_irq_control[9] << 8) & 0xf00); | |
| 483 | 479 | if (duration) |
| 484 | 480 | { |
| 485 | 481 | attotime period = attotime::from_hz(TIMER_0_CLOCK) * duration; |
| 486 | | |
| 482 | m_v60_irq_timer[0]->adjust(period, MAIN_IRQ_TIMER0); | |
| 487 | 483 | } |
| 488 | 484 | break; |
| 489 | 485 | |
| 490 | 486 | case 10: |
| 491 | 487 | case 11: /* timer 1 count */ |
| 492 | state->m_v60_irq_control[offset] = data; | |
| 493 | duration = state->m_v60_irq_control[10] + ((state->m_v60_irq_control[11] << 8) & 0xf00); | |
| 488 | m_v60_irq_control[offset] = data; | |
| 489 | duration = m_v60_irq_control[10] + ((m_v60_irq_control[11] << 8) & 0xf00); | |
| 494 | 490 | if (duration) |
| 495 | 491 | { |
| 496 | 492 | attotime period = attotime::from_hz(TIMER_1_CLOCK) * duration; |
| 497 | | |
| 493 | m_v60_irq_timer[1]->adjust(period, MAIN_IRQ_TIMER1); | |
| 498 | 494 | } |
| 499 | 495 | break; |
| 500 | 496 | |
| r20977 | r20978 | |
| 502 | 498 | case 13: |
| 503 | 499 | case 14: |
| 504 | 500 | case 15: /* signal IRQ to sound CPU */ |
| 505 | signal_sound_irq( | |
| 501 | signal_sound_irq(machine(),SOUND_IRQ_V60); | |
| 506 | 502 | break; |
| 507 | 503 | } |
| 508 | 504 | } |
| r20977 | r20978 | |
| 564 | 560 | |
| 565 | 561 | TIMER_CALLBACK_MEMBER(segas32_state::end_of_vblank_int) |
| 566 | 562 | { |
| 567 | signal_v60_irq(machine(), MAIN_IRQ_VBSTOP); | |
| 568 | system32_set_vblank(machine(), 0); | |
| 563 | signal_v60_irq(MAIN_IRQ_VBSTOP); | |
| 564 | system32_set_vblank(0); | |
| 569 | 565 | } |
| 570 | 566 | |
| 571 | 567 | |
| 572 | 568 | INTERRUPT_GEN_MEMBER(segas32_state::start_of_vblank_int) |
| 573 | 569 | { |
| 574 | signal_v60_irq(machine(), MAIN_IRQ_VBSTART); | |
| 575 | system32_set_vblank(machine(), 1); | |
| 570 | signal_v60_irq(MAIN_IRQ_VBSTART); | |
| 571 | system32_set_vblank(1); | |
| 576 | 572 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(segas32_state::end_of_vblank_int),this)); |
| 577 | 573 | if (m_system32_prot_vblank) |
| 578 | 574 | (*m_system32_prot_vblank)(&device); |
| r20977 | r20978 | |
| 586 | 582 | * |
| 587 | 583 | *************************************/ |
| 588 | 584 | |
| 589 | ||
| 585 | UINT16 segas32_state::common_io_chip_r(address_space &space, int which, offs_t offset, UINT16 mem_mask) | |
| 590 | 586 | { |
| 591 | segas32_state *state = space.machine().driver_data<segas32_state>(); | |
| 592 | 587 | static const char *const portnames[2][8] = |
| 593 | 588 | { |
| 594 | 589 | { "P1_A", "P2_A", "PORTC_A", "PORTD_A", "SERVICE12_A", "SERVICE34_A", "PORTG_A", "PORTH_A" }, |
| r20977 | r20978 | |
| 608 | 603 | case 0x0c/2: |
| 609 | 604 | case 0x0e/2: |
| 610 | 605 | /* if the port is configured as an output, return the last thing written */ |
| 611 | if (state->m_misc_io_data[which][0x1e/2] & (1 << offset)) | |
| 612 | return state->m_misc_io_data[which][offset]; | |
| 606 | if (m_misc_io_data[which][0x1e/2] & (1 << offset)) | |
| 607 | return m_misc_io_data[which][offset]; | |
| 613 | 608 | |
| 614 | 609 | /* otherwise, return an input port */ |
| 615 | return | |
| 610 | return ioport(portnames[which][offset])->read_safe(0xffff); | |
| 616 | 611 | |
| 617 | 612 | /* 'SEGA' protection */ |
| 618 | 613 | case 0x10/2: |
| r20977 | r20978 | |
| 627 | 622 | /* CNT register & mirror */ |
| 628 | 623 | case 0x18/2: |
| 629 | 624 | case 0x1c/2: |
| 630 | return | |
| 625 | return m_misc_io_data[which][0x1c/2]; | |
| 631 | 626 | |
| 632 | 627 | /* port direction register & mirror */ |
| 633 | 628 | case 0x1a/2: |
| 634 | 629 | case 0x1e/2: |
| 635 | return | |
| 630 | return m_misc_io_data[which][0x1e/2]; | |
| 636 | 631 | } |
| 637 | 632 | return 0xffff; |
| 638 | 633 | } |
| 639 | 634 | |
| 640 | 635 | |
| 641 | ||
| 636 | void segas32_state::common_io_chip_w(address_space &space, int which, offs_t offset, UINT16 data, UINT16 mem_mask) | |
| 642 | 637 | { |
| 643 | segas32_state *state = space.machine().driver_data<segas32_state>(); | |
| 644 | 638 | // UINT8 old; |
| 645 | 639 | |
| 646 | 640 | /* only LSB matters */ |
| r20977 | r20978 | |
| 649 | 643 | |
| 650 | 644 | /* generic implementation */ |
| 651 | 645 | offset &= 0x1f/2; |
| 652 | // old = state->m_misc_io_data[which][offset]; | |
| 653 | state->m_misc_io_data[which][offset] = data; | |
| 646 | // old = m_misc_io_data[which][offset]; | |
| 647 | m_misc_io_data[which][offset] = data; | |
| 654 | 648 | |
| 655 | 649 | switch (offset) |
| 656 | 650 | { |
| r20977 | r20978 | |
| 661 | 655 | case 0x08/2: |
| 662 | 656 | case 0x0a/2: |
| 663 | 657 | case 0x0c/2: |
| 664 | if (state->m_sw2_output) | |
| 665 | state->m_sw2_output(which, data); | |
| 658 | if (m_sw2_output) | |
| 659 | (this->*m_sw2_output)(which, data); | |
| 666 | 660 | break; |
| 667 | 661 | |
| 668 | 662 | /* miscellaneous output */ |
| 669 | 663 | case 0x06/2: |
| 670 | if (state->m_sw1_output) | |
| 671 | state->m_sw1_output(which, data); | |
| 664 | if (m_sw1_output) | |
| 665 | (this->*m_sw1_output)(which, data); | |
| 672 | 666 | |
| 673 | 667 | if (which == 0) |
| 674 | 668 | { |
| r20977 | r20978 | |
| 686 | 680 | /* tile banking */ |
| 687 | 681 | case 0x0e/2: |
| 688 | 682 | if (which == 0) |
| 689 | | |
| 683 | m_system32_tilebank_external = data; | |
| 690 | 684 | else |
| 691 | 685 | { |
| 692 | 686 | /* multi-32 EEPROM access */ |
| r20977 | r20978 | |
| 699 | 693 | |
| 700 | 694 | /* CNT register */ |
| 701 | 695 | case 0x1c/2: |
| 702 | | |
| 696 | m_system32_displayenable[which] = (data & 0x02); | |
| 703 | 697 | if (which == 0) |
| 704 | 698 | space.machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE); |
| 705 | 699 | break; |
| r20977 | r20978 | |
| 801 | 795 | { |
| 802 | 796 | /* harddunk uses bits 4,5 for output lamps */ |
| 803 | 797 | if (m_sw3_output) |
| 804 | m_sw3_output(0, data & 0xff); | |
| 798 | (this->*m_sw3_output)(0, data & 0xff); | |
| 805 | 799 | |
| 806 | 800 | if (!m_custom_io_w[0].isnull()) |
| 807 | 801 | (m_custom_io_w[0])(space, offset*2+0, data, mem_mask); |
| r20977 | r20978 | |
| 1043 | 1037 | * |
| 1044 | 1038 | *************************************/ |
| 1045 | 1039 | |
| 1046 | ||
| 1040 | void segas32_state::update_sound_irq_state() | |
| 1047 | 1041 | { |
| 1048 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 1049 | UINT8 effirq = state->m_sound_irq_input & ~state->m_sound_irq_control[3] & 0x07; | |
| 1042 | UINT8 effirq = m_sound_irq_input & ~m_sound_irq_control[3] & 0x07; | |
| 1050 | 1043 | int vector; |
| 1051 | 1044 | |
| 1052 | 1045 | /* loop over interrupt vectors, finding the highest priority one with */ |
| r20977 | r20978 | |
| 1054 | 1047 | for (vector = 0; vector < 3; vector++) |
| 1055 | 1048 | if (effirq & (1 << vector)) |
| 1056 | 1049 | { |
| 1057 | machine.device("soundcpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, 2 * vector); | |
| 1050 | machine().device("soundcpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, 2 * vector); | |
| 1058 | 1051 | break; |
| 1059 | 1052 | } |
| 1060 | 1053 | |
| 1061 | 1054 | /* if we didn't find any, clear the interrupt line */ |
| 1062 | 1055 | if (vector == 3) |
| 1063 | machine.device("soundcpu")->execute().set_input_line(0, CLEAR_LINE); | |
| 1056 | machine().device("soundcpu")->execute().set_input_line(0, CLEAR_LINE); | |
| 1064 | 1057 | } |
| 1065 | 1058 | |
| 1066 | 1059 | |
| r20977 | r20978 | |
| 1073 | 1066 | for (i = 0; i < 3; i++) |
| 1074 | 1067 | if (state->m_sound_irq_control[i] == which) |
| 1075 | 1068 | state->m_sound_irq_input |= 1 << i; |
| 1076 | update_sound_irq_state( | |
| 1069 | state->update_sound_irq_state(); | |
| 1077 | 1070 | } |
| 1078 | 1071 | |
| 1079 | 1072 | |
| r20977 | r20978 | |
| 1084 | 1077 | for (i = 0; i < 3; i++) |
| 1085 | 1078 | if (state->m_sound_irq_control[i] == which) |
| 1086 | 1079 | state->m_sound_irq_input &= ~(1 << i); |
| 1087 | update_sound_irq_state( | |
| 1080 | state->update_sound_irq_state(); | |
| 1088 | 1081 | } |
| 1089 | 1082 | |
| 1090 | 1083 | |
| r20977 | r20978 | |
| 1094 | 1087 | if (offset & 1) |
| 1095 | 1088 | { |
| 1096 | 1089 | m_sound_irq_input &= data; |
| 1097 | update_sound_irq_state( | |
| 1090 | update_sound_irq_state(); | |
| 1098 | 1091 | } |
| 1099 | 1092 | |
| 1100 | 1093 | /* high offsets signal an IRQ to the v60 */ |
| 1101 | 1094 | if (offset & 4) |
| 1102 | signal_v60_irq( | |
| 1095 | signal_v60_irq(MAIN_IRQ_SOUND); | |
| 1103 | 1096 | } |
| 1104 | 1097 | |
| 1105 | 1098 | |
| 1106 | 1099 | WRITE8_MEMBER(segas32_state::sound_int_control_hi_w) |
| 1107 | 1100 | { |
| 1108 | 1101 | m_sound_irq_control[offset] = data; |
| 1109 | update_sound_irq_state( | |
| 1102 | update_sound_irq_state(); | |
| 1110 | 1103 | } |
| 1111 | 1104 | |
| 1112 | 1105 | |
| r20977 | r20978 | |
| 4026 | 4019 | * |
| 4027 | 4020 | *************************************/ |
| 4028 | 4021 | |
| 4029 | ||
| 4022 | void segas32_state::segas32_common_init(read16_delegate custom_r, write16_delegate custom_w) | |
| 4030 | 4023 | { |
| 4031 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 4032 | 4024 | /* reset the custom handlers and other pointers */ |
| 4033 | state->m_custom_io_r[0] = custom_r; | |
| 4034 | state->m_custom_io_w[0] = custom_w; | |
| 4035 | state->m_system32_prot_vblank = NULL; | |
| 4036 | state->m_sw1_output = NULL; | |
| 4037 | state->m_sw2_output = NULL; | |
| 4038 | state->m_sw3_output = NULL; | |
| 4025 | m_custom_io_r[0] = custom_r; | |
| 4026 | m_custom_io_w[0] = custom_w; | |
| 4027 | m_system32_prot_vblank = NULL; | |
| 4028 | m_sw1_output = NULL; | |
| 4029 | m_sw2_output = NULL; | |
| 4030 | m_sw3_output = NULL; | |
| 4039 | 4031 | } |
| 4040 | 4032 | |
| 4041 | 4033 | |
| r20977 | r20978 | |
| 4053 | 4045 | * switches we need to fix |
| 4054 | 4046 | *************************************/ |
| 4055 | 4047 | |
| 4056 | ||
| 4048 | void segas32_state::radm_sw1_output( int which, UINT16 data ) | |
| 4057 | 4049 | { |
| 4058 | 4050 | if (which == 0) |
| 4059 | 4051 | output_set_value("Start_lamp", BIT(data, 2)); |
| 4060 | 4052 | } |
| 4061 | 4053 | |
| 4062 | ||
| 4054 | void segas32_state::radm_sw2_output( int which, UINT16 data ) | |
| 4063 | 4055 | { |
| 4064 | 4056 | if (which == 0) |
| 4065 | 4057 | { |
| r20977 | r20978 | |
| 4068 | 4060 | } |
| 4069 | 4061 | } |
| 4070 | 4062 | |
| 4071 | ||
| 4063 | void segas32_state::radr_sw2_output( int which, UINT16 data ) | |
| 4072 | 4064 | { |
| 4073 | 4065 | if (which == 0) |
| 4074 | 4066 | { |
| r20977 | r20978 | |
| 4077 | 4069 | } |
| 4078 | 4070 | } |
| 4079 | 4071 | |
| 4080 | ||
| 4072 | void segas32_state::alien3_sw1_output( int which, UINT16 data ) | |
| 4081 | 4073 | { |
| 4082 | 4074 | if (which == 0) |
| 4083 | 4075 | { |
| r20977 | r20978 | |
| 4086 | 4078 | } |
| 4087 | 4079 | } |
| 4088 | 4080 | |
| 4089 | ||
| 4081 | void segas32_state::arescue_sw1_output( int which, UINT16 data ) | |
| 4090 | 4082 | { |
| 4091 | 4083 | if (which == 0) |
| 4092 | 4084 | { |
| r20977 | r20978 | |
| 4095 | 4087 | } |
| 4096 | 4088 | } |
| 4097 | 4089 | |
| 4098 | ||
| 4090 | void segas32_state::f1lap_sw1_output( int which, UINT16 data ) | |
| 4099 | 4091 | { |
| 4100 | 4092 | if (which == 0) |
| 4101 | 4093 | { |
| r20977 | r20978 | |
| 4104 | 4096 | } |
| 4105 | 4097 | } |
| 4106 | 4098 | |
| 4107 | ||
| 4099 | void segas32_state::jpark_sw1_output( int which, UINT16 data ) | |
| 4108 | 4100 | { |
| 4109 | 4101 | if (which == 0) |
| 4110 | 4102 | { |
| r20977 | r20978 | |
| 4113 | 4105 | } |
| 4114 | 4106 | } |
| 4115 | 4107 | |
| 4116 | ||
| 4108 | void segas32_state::orunners_sw1_output( int which, UINT16 data ) | |
| 4117 | 4109 | { |
| 4118 | 4110 | /* note ma = monitor A and mb = Monitor B */ |
| 4119 | 4111 | if (which == 0) |
| r20977 | r20978 | |
| 4130 | 4122 | } |
| 4131 | 4123 | } |
| 4132 | 4124 | |
| 4133 | ||
| 4125 | void segas32_state::orunners_sw2_output( int which, UINT16 data ) | |
| 4134 | 4126 | { |
| 4135 | 4127 | /* note ma = monitor A and mb = Monitor B */ |
| 4136 | 4128 | /* also note that the remaining bits are for the game's lcd display */ |
| r20977 | r20978 | |
| 4147 | 4139 | } |
| 4148 | 4140 | } |
| 4149 | 4141 | |
| 4150 | ||
| 4142 | void segas32_state::harddunk_sw1_output( int which, UINT16 data ) | |
| 4151 | 4143 | { |
| 4152 | 4144 | if (which == 0) |
| 4153 | 4145 | { |
| r20977 | r20978 | |
| 4161 | 4153 | } |
| 4162 | 4154 | } |
| 4163 | 4155 | |
| 4164 | ||
| 4156 | void segas32_state::harddunk_sw2_output( int which, UINT16 data ) | |
| 4165 | 4157 | { |
| 4166 | 4158 | if (which == 0) |
| 4167 | 4159 | output_set_value("Left_Winner_lamp", BIT(data, 0)); |
| r20977 | r20978 | |
| 4169 | 4161 | output_set_value("Right_Winner_lamp", BIT(data, 0)); |
| 4170 | 4162 | } |
| 4171 | 4163 | |
| 4172 | ||
| 4164 | void segas32_state::harddunk_sw3_output( int which, UINT16 data ) | |
| 4173 | 4165 | { |
| 4174 | 4166 | output_set_value("3P_Start_lamp", BIT(data, 4)); |
| 4175 | 4167 | output_set_value("6P_Start_lamp", BIT(data, 5)); |
| 4176 | 4168 | } |
| 4177 | 4169 | |
| 4178 | ||
| 4170 | void segas32_state::titlef_sw1_output( int which, UINT16 data ) | |
| 4179 | 4171 | { |
| 4180 | 4172 | if (which == 0) |
| 4181 | 4173 | { |
| r20977 | r20978 | |
| 4189 | 4181 | } |
| 4190 | 4182 | } |
| 4191 | 4183 | |
| 4192 | ||
| 4184 | void segas32_state::titlef_sw2_output( int which, UINT16 data ) | |
| 4193 | 4185 | { |
| 4194 | 4186 | if (which == 0) |
| 4195 | 4187 | output_set_value("Blue_Corner_lamp", BIT(data, 0)); |
| r20977 | r20978 | |
| 4197 | 4189 | output_set_value("Red_Corner_lamp", BIT(data, 0)); |
| 4198 | 4190 | } |
| 4199 | 4191 | |
| 4200 | ||
| 4192 | void segas32_state::scross_sw1_output( int which, UINT16 data ) | |
| 4201 | 4193 | { |
| 4202 | 4194 | /* note ma = monitor A and mb = Monitor B */ |
| 4203 | 4195 | if (which == 0) |
| r20977 | r20978 | |
| 4206 | 4198 | output_set_value("MB_Start_lamp", BIT(data, 2)); |
| 4207 | 4199 | } |
| 4208 | 4200 | |
| 4209 | ||
| 4201 | void segas32_state::scross_sw2_output( int which, UINT16 data ) | |
| 4210 | 4202 | { |
| 4211 | 4203 | /* Note: I'm not an expert on digits, so I didn't know the right map to use, I just added it manually and it seems to work fine. */ |
| 4212 | 4204 | if (which == 0) |
| r20977 | r20978 | |
| 4223 | 4215 | |
| 4224 | 4216 | DRIVER_INIT_MEMBER(segas32_state,alien3) |
| 4225 | 4217 | { |
| 4226 | segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4227 | m_sw1_output = alien3_sw1_output; | |
| 4218 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4219 | m_sw1_output = &segas32_state::alien3_sw1_output; | |
| 4228 | 4220 | } |
| 4229 | 4221 | |
| 4230 | 4222 | READ16_MEMBER(segas32_state::arescue_handshake_r) |
| r20977 | r20978 | |
| 4239 | 4231 | |
| 4240 | 4232 | DRIVER_INIT_MEMBER(segas32_state,arescue) |
| 4241 | 4233 | { |
| 4242 | segas32_common_init( | |
| 4234 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4243 | 4235 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00007, read16_delegate(FUNC(segas32_state::arescue_dsp_r),this), write16_delegate(FUNC(segas32_state::arescue_dsp_w),this)); |
| 4244 | 4236 | |
| 4245 | 4237 | m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2); |
| r20977 | r20978 | |
| 4249 | 4241 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x810000, 0x810001, read16_delegate(FUNC(segas32_state::arescue_handshake_r),this)); |
| 4250 | 4242 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x81000e, 0x81000f, read16_delegate(FUNC(segas32_state::arescue_slavebusy_r),this)); |
| 4251 | 4243 | |
| 4252 | m_sw1_output = arescue_sw1_output; | |
| 4244 | m_sw1_output = &segas32_state::arescue_sw1_output; | |
| 4253 | 4245 | } |
| 4254 | 4246 | |
| 4255 | 4247 | |
| 4256 | 4248 | DRIVER_INIT_MEMBER(segas32_state,arabfgt) |
| 4257 | 4249 | { |
| 4258 | segas32_common_init( | |
| 4250 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4259 | 4251 | |
| 4260 | 4252 | /* install protection handlers */ |
| 4261 | 4253 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa00100, 0xa0011f, read16_delegate(FUNC(segas32_state::arf_wakeup_protection_r),this)); |
| r20977 | r20978 | |
| 4265 | 4257 | |
| 4266 | 4258 | DRIVER_INIT_MEMBER(segas32_state,brival) |
| 4267 | 4259 | { |
| 4268 | segas32_common_init( | |
| 4260 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4269 | 4261 | |
| 4270 | 4262 | /* install protection handlers */ |
| 4271 | 4263 | m_system32_protram = auto_alloc_array(machine(), UINT16, 0x1000/2); |
| r20977 | r20978 | |
| 4276 | 4268 | |
| 4277 | 4269 | DRIVER_INIT_MEMBER(segas32_state,darkedge) |
| 4278 | 4270 | { |
| 4279 | segas32_common_init( | |
| 4271 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4280 | 4272 | |
| 4281 | 4273 | /* install protection handlers */ |
| 4282 | 4274 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::darkedge_protection_r),this), write16_delegate(FUNC(segas32_state::darkedge_protection_w),this)); |
| r20977 | r20978 | |
| 4285 | 4277 | |
| 4286 | 4278 | DRIVER_INIT_MEMBER(segas32_state,dbzvrvs) |
| 4287 | 4279 | { |
| 4288 | segas32_common_init( | |
| 4280 | segas32_common_init(read16_delegate(), write16_delegate()); | |
| 4289 | 4281 | |
| 4290 | 4282 | /* install protection handlers */ |
| 4291 | 4283 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::dbzvrvs_protection_r),this), write16_delegate(FUNC(segas32_state::dbzvrvs_protection_w),this)); |
| r20977 | r20978 | |
| 4300 | 4292 | |
| 4301 | 4293 | DRIVER_INIT_MEMBER(segas32_state,f1en) |
| 4302 | 4294 | { |
| 4303 | segas32_common_init( | |
| 4295 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4304 | 4296 | |
| 4305 | 4297 | m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2); |
| 4306 | 4298 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this)); |
| r20977 | r20978 | |
| 4308 | 4300 | |
| 4309 | 4301 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x810048, 0x810049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this)); |
| 4310 | 4302 | |
| 4311 | m_sw1_output = radm_sw1_output; | |
| 4303 | m_sw1_output = &segas32_state::radm_sw1_output; | |
| 4312 | 4304 | } |
| 4313 | 4305 | |
| 4314 | 4306 | |
| r20977 | r20978 | |
| 4316 | 4308 | |
| 4317 | 4309 | DRIVER_INIT_MEMBER(segas32_state,f1lap) |
| 4318 | 4310 | { |
| 4319 | segas32_common_init( | |
| 4311 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4320 | 4312 | |
| 4321 | 4313 | m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2); |
| 4322 | 4314 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0x800fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this)); |
| r20977 | r20978 | |
| 4325 | 4317 | // machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this)); |
| 4326 | 4318 | m_system32_prot_vblank = f1lap_fd1149_vblank; |
| 4327 | 4319 | |
| 4328 | m_sw1_output = f1lap_sw1_output; | |
| 4320 | m_sw1_output = &segas32_state::f1lap_sw1_output; | |
| 4329 | 4321 | } |
| 4330 | 4322 | |
| 4331 | 4323 | |
| 4332 | 4324 | DRIVER_INIT_MEMBER(segas32_state,ga2) |
| 4333 | 4325 | { |
| 4334 | segas32_common_init( | |
| 4326 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4335 | 4327 | |
| 4336 | decrypt_ga2_protrom( | |
| 4328 | decrypt_ga2_protrom(); | |
| 4337 | 4329 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::ga2_dpram_r),this), write16_delegate(FUNC(segas32_state::ga2_dpram_w),this)); |
| 4338 | 4330 | } |
| 4339 | 4331 | |
| 4340 | 4332 | |
| 4341 | 4333 | DRIVER_INIT_MEMBER(segas32_state,harddunk) |
| 4342 | 4334 | { |
| 4343 | segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4344 | m_sw1_output = harddunk_sw1_output; | |
| 4345 | m_sw2_output = harddunk_sw2_output; | |
| 4346 | m_sw3_output = harddunk_sw3_output; | |
| 4335 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4336 | m_sw1_output = &segas32_state::harddunk_sw1_output; | |
| 4337 | m_sw2_output = &segas32_state::harddunk_sw2_output; | |
| 4338 | m_sw3_output = &segas32_state::harddunk_sw3_output; | |
| 4347 | 4339 | } |
| 4348 | 4340 | |
| 4349 | 4341 | |
| 4350 | 4342 | DRIVER_INIT_MEMBER(segas32_state,holo) |
| 4351 | 4343 | { |
| 4352 | segas32_common_init( | |
| 4344 | segas32_common_init(read16_delegate(), write16_delegate()); | |
| 4353 | 4345 | } |
| 4354 | 4346 | |
| 4355 | 4347 | |
| r20977 | r20978 | |
| 4358 | 4350 | /* Temp. Patch until we emulate the 'Drive Board', thanks to Malice */ |
| 4359 | 4351 | UINT16 *pROM = (UINT16 *)memregion("maincpu")->base(); |
| 4360 | 4352 | |
| 4361 | segas32_common_init( | |
| 4353 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4362 | 4354 | |
| 4363 | 4355 | pROM[0xC15A8/2] = 0xCD70; |
| 4364 | 4356 | pROM[0xC15AA/2] = 0xD8CD; |
| 4365 | 4357 | |
| 4366 | m_sw1_output = jpark_sw1_output; | |
| 4358 | m_sw1_output = &segas32_state::jpark_sw1_output; | |
| 4367 | 4359 | } |
| 4368 | 4360 | |
| 4369 | 4361 | |
| 4370 | 4362 | DRIVER_INIT_MEMBER(segas32_state,orunners) |
| 4371 | 4363 | { |
| 4372 | segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::orunners_custom_io_w),this)); | |
| 4373 | m_sw1_output = orunners_sw1_output; | |
| 4374 | m_sw2_output = orunners_sw2_output; | |
| 4364 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::orunners_custom_io_w),this)); | |
| 4365 | m_sw1_output = &segas32_state::orunners_sw1_output; | |
| 4366 | m_sw2_output = &segas32_state::orunners_sw2_output; | |
| 4375 | 4367 | } |
| 4376 | 4368 | |
| 4377 | 4369 | |
| 4378 | 4370 | DRIVER_INIT_MEMBER(segas32_state,radm) |
| 4379 | 4371 | { |
| 4380 | segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4381 | m_sw1_output = radm_sw1_output; | |
| 4382 | m_sw2_output = radm_sw2_output; | |
| 4372 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4373 | m_sw1_output = &segas32_state::radm_sw1_output; | |
| 4374 | m_sw2_output = &segas32_state::radm_sw2_output; | |
| 4383 | 4375 | } |
| 4384 | 4376 | |
| 4385 | 4377 | |
| 4386 | 4378 | DRIVER_INIT_MEMBER(segas32_state,radr) |
| 4387 | 4379 | { |
| 4388 | segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4389 | m_sw1_output = radm_sw1_output; | |
| 4390 | m_sw2_output = radr_sw2_output; | |
| 4380 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4381 | m_sw1_output = &segas32_state::radm_sw1_output; | |
| 4382 | m_sw2_output = &segas32_state::radr_sw2_output; | |
| 4391 | 4383 | } |
| 4392 | 4384 | |
| 4393 | 4385 | |
| 4394 | 4386 | DRIVER_INIT_MEMBER(segas32_state,scross) |
| 4395 | 4387 | { |
| 4396 | segas32_common_init( | |
| 4388 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4397 | 4389 | machine().device("soundcpu")->memory().space(AS_PROGRAM).install_write_handler(0xb0, 0xbf, write8_delegate(FUNC(segas32_state::scross_bank_w),this)); |
| 4398 | 4390 | |
| 4399 | m_sw1_output = scross_sw1_output; | |
| 4400 | m_sw2_output = scross_sw2_output; | |
| 4391 | m_sw1_output = &segas32_state::scross_sw1_output; | |
| 4392 | m_sw2_output = &segas32_state::scross_sw2_output; | |
| 4401 | 4393 | } |
| 4402 | 4394 | |
| 4403 | 4395 | |
| 4404 | 4396 | DRIVER_INIT_MEMBER(segas32_state,slipstrm) |
| 4405 | 4397 | { |
| 4406 | segas32_common_init( | |
| 4398 | segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); | |
| 4407 | 4399 | } |
| 4408 | 4400 | |
| 4409 | 4401 | |
| 4410 | 4402 | DRIVER_INIT_MEMBER(segas32_state,sonic) |
| 4411 | 4403 | { |
| 4412 | segas32_common_init( | |
| 4404 | segas32_common_init(read16_delegate(FUNC(segas32_state::sonic_custom_io_r),this), write16_delegate(FUNC(segas32_state::sonic_custom_io_w),this)); | |
| 4413 | 4405 | |
| 4414 | 4406 | /* install protection handlers */ |
| 4415 | 4407 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20E5C4, 0x20E5C5, write16_delegate(FUNC(segas32_state::sonic_level_load_protection),this)); |
| r20977 | r20978 | |
| 4418 | 4410 | |
| 4419 | 4411 | DRIVER_INIT_MEMBER(segas32_state,sonicp) |
| 4420 | 4412 | { |
| 4421 | segas32_common_init( | |
| 4413 | segas32_common_init(read16_delegate(FUNC(segas32_state::sonic_custom_io_r),this), write16_delegate(FUNC(segas32_state::sonic_custom_io_w),this)); | |
| 4422 | 4414 | } |
| 4423 | 4415 | |
| 4424 | 4416 | |
| 4425 | 4417 | DRIVER_INIT_MEMBER(segas32_state,spidman) |
| 4426 | 4418 | { |
| 4427 | segas32_common_init( | |
| 4419 | segas32_common_init(read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate()); | |
| 4428 | 4420 | } |
| 4429 | 4421 | |
| 4430 | 4422 | |
| 4431 | 4423 | DRIVER_INIT_MEMBER(segas32_state,svf) |
| 4432 | 4424 | { |
| 4433 | segas32_common_init( | |
| 4425 | segas32_common_init(read16_delegate(), write16_delegate()); | |
| 4434 | 4426 | } |
| 4435 | 4427 | |
| 4436 | 4428 | |
| 4437 | 4429 | DRIVER_INIT_MEMBER(segas32_state,jleague) |
| 4438 | 4430 | { |
| 4439 | segas32_common_init( | |
| 4431 | segas32_common_init(read16_delegate(), write16_delegate()); | |
| 4440 | 4432 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20F700, 0x20F705, write16_delegate(FUNC(segas32_state::jleague_protection_w),this)); |
| 4441 | 4433 | } |
| 4442 | 4434 | |
| 4443 | 4435 | |
| 4444 | 4436 | DRIVER_INIT_MEMBER(segas32_state,titlef) |
| 4445 | 4437 | { |
| 4446 | segas32_common_init(machine(), read16_delegate(), write16_delegate()); | |
| 4447 | m_sw1_output = titlef_sw1_output; | |
| 4448 | m_sw2_output = titlef_sw2_output; | |
| 4438 | segas32_common_init(read16_delegate(), write16_delegate()); | |
| 4439 | m_sw1_output = &segas32_state::titlef_sw1_output; | |
| 4440 | m_sw2_output = &segas32_state::titlef_sw2_output; | |
| 4449 | 4441 | } |
| 4450 | 4442 | |
| 4451 | 4443 |
| r20977 | r20978 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | #define MASTER_CLOCK XTAL_12MHz |
| 84 | 84 | |
| 85 | ||
| 85 | UINT8 speedatk_state::iox_key_matrix_calc(UINT8 p_side) | |
| 86 | 86 | { |
| 87 | 87 | static const char *const keynames[] = { "P1_ROW0", "P1_ROW1", "P2_ROW0", "P2_ROW1" }; |
| 88 | 88 | |
| r20977 | r20978 | |
| 94 | 94 | |
| 95 | 95 | for (t = 0 ; t < 8 ; t ++) |
| 96 | 96 | { |
| 97 | if (!(machine.root_device().ioport(keynames[j+p_side])->read() & ( 1 << t ))) | |
| 97 | if (!(machine().root_device().ioport(keynames[j+p_side])->read() & ( 1 << t ))) | |
| 98 | 98 | { |
| 99 | 99 | return (i + t) | (p_side ? 0x20 : 0x00); |
| 100 | 100 | } |
| r20977 | r20978 | |
| 125 | 125 | /* both side checks */ |
| 126 | 126 | if(m_mux_data == 1) |
| 127 | 127 | { |
| 128 | UINT8 p1_side = iox_key_matrix_calc(machine(),0); | |
| 129 | UINT8 p2_side = iox_key_matrix_calc(machine(),2); | |
| 128 | UINT8 p1_side = iox_key_matrix_calc(0); | |
| 129 | UINT8 p2_side = iox_key_matrix_calc(2); | |
| 130 | 130 | |
| 131 | 131 | if(p1_side != 0) |
| 132 | 132 | return p1_side; |
| r20977 | r20978 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /* check individual input side */ |
| 138 | return iox_key_matrix_calc( | |
| 138 | return iox_key_matrix_calc((m_mux_data == 2) ? 0 : 2); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | WRITE8_MEMBER(speedatk_state::key_matrix_w) |
| r20977 | r20978 | |
|---|---|---|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | ||
| 145 | void splash_state::roldfrog_update_irq( ) | |
| 146 | 146 | { |
| 147 | splash_state * state = machine.driver_data<splash_state>(); | |
| 148 | int irq = (state->m_sound_irq ? 0x08 : 0) | ((state->m_vblank_irq) ? 0x18 : 0); | |
| 149 | machine.device("audiocpu")->execute().set_input_line_and_vector(0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); | |
| 147 | int irq = (m_sound_irq ? 0x08 : 0) | ((m_vblank_irq) ? 0x18 : 0); | |
| 148 | machine().device("audiocpu")->execute().set_input_line_and_vector(0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); | |
| 150 | 149 | } |
| 151 | 150 | |
| 152 | 151 | WRITE8_MEMBER(splash_state::roldfrog_vblank_ack_w) |
| 153 | 152 | { |
| 154 | 153 | m_vblank_irq = 0; |
| 155 | roldfrog_update_irq( | |
| 154 | roldfrog_update_irq(); | |
| 156 | 155 | } |
| 157 | 156 | |
| 158 | 157 | |
| r20977 | r20978 | |
| 160 | 159 | { |
| 161 | 160 | splash_state * driver_state = device->machine().driver_data<splash_state>(); |
| 162 | 161 | driver_state->m_sound_irq = state; |
| 163 | roldfrog_update_irq( | |
| 162 | driver_state->roldfrog_update_irq(); | |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | 165 | static ADDRESS_MAP_START( roldfrog_map, AS_PROGRAM, 16, splash_state ) |
| r20977 | r20978 | |
| 538 | 537 | INTERRUPT_GEN_MEMBER(splash_state::roldfrog_interrupt) |
| 539 | 538 | { |
| 540 | 539 | m_vblank_irq = 1; |
| 541 | roldfrog_update_irq( | |
| 540 | roldfrog_update_irq(); | |
| 542 | 541 | } |
| 543 | 542 | |
| 544 | 543 | static MACHINE_CONFIG_START( roldfrog, splash_state ) |
| r20977 | r20978 | |
|---|---|---|
| 147 | 147 | UINT32 screen_update_jclub2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 148 | 148 | UINT32 screen_update_jclub2o(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 149 | 149 | TIMER_DEVICE_CALLBACK_MEMBER(darkhors_irq); |
| 150 | void draw_sprites_darkhors(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 150 | 151 | }; |
| 151 | 152 | |
| 152 | 153 | |
| r20977 | r20978 | |
| 189 | 190 | m_tmap2->mark_tile_dirty(offset); |
| 190 | 191 | } |
| 191 | 192 | |
| 192 | ||
| 193 | void darkhors_state::draw_sprites_darkhors(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 193 | 194 | { |
| 194 | darkhors_state *state = machine.driver_data<darkhors_state>(); | |
| 195 | UINT32 *s = state->m_spriteram; | |
| 196 | UINT32 *end = state->m_spriteram + 0x02000/4; | |
| 195 | UINT32 *s = m_spriteram; | |
| 196 | UINT32 *end = m_spriteram + 0x02000/4; | |
| 197 | 197 | |
| 198 | 198 | for ( ; s < end; s += 8/4 ) |
| 199 | 199 | { |
| r20977 | r20978 | |
| 218 | 218 | sy = -sy; |
| 219 | 219 | sy += 0xf8; |
| 220 | 220 | |
| 221 | drawgfx_transpen( bitmap, cliprect, machine.gfx[0], | |
| 221 | drawgfx_transpen( bitmap, cliprect, machine().gfx[0], | |
| 222 | 222 | code/2, color, |
| 223 | 223 | flipx, flipy, sx, sy, 0); |
| 224 | 224 | } |
| r20977 | r20978 | |
| 258 | 258 | m_tmap2->set_scrollx(0, (m_tmapscroll2[0] >> 16) - 5); |
| 259 | 259 | m_tmap2->set_scrolly(0, (m_tmapscroll2[0] & 0xffff) - 0xff ); |
| 260 | 260 | if (layers_ctrl & 2) m_tmap2->draw(bitmap, cliprect, 0, 0); |
| 261 | if (layers_ctrl & 4) draw_sprites_darkhors(bitmap,cliprect); | |
| 261 | 262 | |
| 262 | if (layers_ctrl & 4) draw_sprites(machine(),bitmap,cliprect); | |
| 263 | 263 | |
| 264 | 264 | #if DARKHORS_DEBUG |
| 265 | 265 | #if 0 |
| r20977 | r20978 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | /******************************************************************************/ |
| 116 | 116 | |
| 117 | ||
| 117 | inline void sshangha_state::sshangha_set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data) | |
| 118 | 118 | { |
| 119 | palette_set_color_rgb(machine, color, (data >> rshift) & 0xff, (data >> gshift) & 0xff, (data >> bshift) & 0xff); | |
| 119 | palette_set_color_rgb(machine(), color, (data >> rshift) & 0xff, (data >> gshift) & 0xff, (data >> bshift) & 0xff); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | WRITE16_MEMBER(sshangha_state::paletteram16_xbgr_word_be_sprites2_w) |
| 124 | 124 | { |
| 125 | 125 | COMBINE_DATA(&m_sprite_paletteram2[offset]); |
| 126 | sshangha_set_color_888( | |
| 126 | sshangha_set_color_888((offset/2)+0x100, 0, 8, 16, m_sprite_paletteram2[(offset) | 1] | (m_sprite_paletteram2[(offset) & ~1] << 16) ); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | WRITE16_MEMBER(sshangha_state::paletteram16_xbgr_word_be_sprites_w) |
| r20977 | r20978 | |
| 136 | 136 | paletteram16_xbgr_word_be_sprites2_w(space,offset,data,mem_mask); |
| 137 | 137 | |
| 138 | 138 | COMBINE_DATA(&m_sprite_paletteram[offset]); |
| 139 | sshangha_set_color_888( | |
| 139 | sshangha_set_color_888((offset/2)+0x000, 0, 8, 16, m_sprite_paletteram[(offset) | 1] | (m_sprite_paletteram[(offset) & ~1] << 16) ); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | WRITE16_MEMBER(sshangha_state::paletteram16_xbgr_word_be_tilelow_w) |
| 143 | 143 | { |
| 144 | 144 | COMBINE_DATA(&m_tile_paletteram1[offset]); |
| 145 | sshangha_set_color_888( | |
| 145 | sshangha_set_color_888((offset/2)+0x200, 0, 8, 16, m_tile_paletteram1[(offset) | 1] | (m_tile_paletteram1[(offset) & ~1] << 16) ); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | WRITE16_MEMBER(sshangha_state::paletteram16_xbgr_word_be_tilehigh_w) |
| 149 | 149 | { |
| 150 | 150 | COMBINE_DATA(&m_tile_paletteram2[offset]); |
| 151 | sshangha_set_color_888( | |
| 151 | sshangha_set_color_888((offset/2)+0x300, 0, 8, 16, m_tile_paletteram2[(offset) | 1] | (m_tile_paletteram2[(offset) & ~1] << 16) ); | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | static ADDRESS_MAP_START( sshangha_map, AS_PROGRAM, 16, sshangha_state ) |
| r20977 | r20978 | |
|---|---|---|
| 19 | 19 | ioport("EEPROMOUT")->write(data, 0xff); |
| 20 | 20 | |
| 21 | 21 | m_video_bank = data & 0x03; |
| 22 | simpsons_video_banking(m | |
| 22 | simpsons_video_banking(m_video_bank); | |
| 23 | 23 | |
| 24 | 24 | m_firq_enabled = data & 0x04; |
| 25 | 25 | } |
| r20977 | r20978 | |
| 68 | 68 | |
| 69 | 69 | void simpsons_state::simpsons_postload() |
| 70 | 70 | { |
| 71 | simpsons_video_banking(m | |
| 71 | simpsons_video_banking(m_video_bank); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | void simpsons_state::machine_start() |
| r20977 | r20978 | |
| 118 | 118 | membank("bank2")->configure_entries(2, 6, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000); |
| 119 | 119 | membank("bank2")->set_entry(0); |
| 120 | 120 | |
| 121 | simpsons_video_banking( | |
| 121 | simpsons_video_banking(0); | |
| 122 | 122 | } |
| r20977 | r20978 | |
|---|---|---|
| 33 | 33 | |
| 34 | 34 | #undef xxxx |
| 35 | 35 | |
| 36 | void decrypt_ga2_protrom( | |
| 36 | void segas32_state::decrypt_ga2_protrom() | |
| 37 | 37 | { |
| 38 | 38 | int i; |
| 39 | UINT8 *rom = machine.root_device().memregion("mcu")->base(); | |
| 40 | UINT8* temp = auto_alloc_array(machine, UINT8, 0x100000); | |
| 39 | UINT8 *rom = machine().root_device().memregion("mcu")->base(); | |
| 40 | UINT8* temp = auto_alloc_array(machine(), UINT8, 0x100000); | |
| 41 | 41 | |
| 42 | 42 | // make copy of ROM so original can be overwritten |
| 43 | 43 | memcpy(temp, rom, 0x10000); |
| r20977 | r20978 | |
| 46 | 46 | for(i = 0; i < 0x10000; i++) |
| 47 | 47 | rom[i] = temp[BITSWAP16(i, 14, 11, 15, 12, 13, 4, 3, 7, 5, 10, 2, 8, 9, 6, 1, 0)]; |
| 48 | 48 | |
| 49 | auto_free(machine, temp); | |
| 49 | auto_free(machine(), temp); | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | WRITE16_MEMBER(segas32_state::ga2_dpram_w) |
| r20977 | r20978 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | ||
| 104 | void scramble_state::cavelon_banksw() | |
| 105 | 105 | { |
| 106 | scramble_state *state = machine.driver_data<scramble_state>(); | |
| 107 | 106 | /* any read/write access in the 0x8000-0xffff region causes a bank switch. |
| 108 | 107 | Only the lower 0x2000 is switched but we switch the whole region |
| 109 | 108 | to keep the CPU core happy at the boundaries */ |
| 110 | 109 | |
| 111 | state->m_cavelon_bank = !state->m_cavelon_bank; | |
| 112 | state->membank("bank1")->set_entry(state->m_cavelon_bank); | |
| 110 | m_cavelon_bank = !m_cavelon_bank; | |
| 111 | membank("bank1")->set_entry(m_cavelon_bank); | |
| 113 | 112 | } |
| 114 | 113 | |
| 115 | 114 | static READ8_HANDLER( cavelon_banksw_r ) |
| 116 | 115 | { |
| 117 | 116 | scramble_state *state = space.machine().driver_data<scramble_state>(); |
| 118 | cavelon_banksw( | |
| 117 | state->cavelon_banksw(); | |
| 119 | 118 | |
| 120 | 119 | if ((offset >= 0x0100) && (offset <= 0x0103)) |
| 121 | 120 | return state->m_ppi8255_0->read(space, offset - 0x0100); |
| r20977 | r20978 | |
| 128 | 127 | static WRITE8_HANDLER( cavelon_banksw_w ) |
| 129 | 128 | { |
| 130 | 129 | scramble_state *state = space.machine().driver_data<scramble_state>(); |
| 131 | cavelon_banksw( | |
| 130 | state->cavelon_banksw(); | |
| 132 | 131 | |
| 133 | 132 | if ((offset >= 0x0100) && (offset <= 0x0103)) |
| 134 | 133 | state->m_ppi8255_0->write(space, offset - 0x0100, data); |
| r20977 | r20978 | |
| 277 | 276 | /* banked ROM */ |
| 278 | 277 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1"); |
| 279 | 278 | membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000); |
| 280 | cavelon_banksw( | |
| 279 | cavelon_banksw(); | |
| 281 | 280 | |
| 282 | 281 | /* A15 switches memory banks */ |
| 283 | 282 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x8000, 0xffff, FUNC(cavelon_banksw_r), FUNC(cavelon_banksw_w)); |
| r20977 | r20978 | |
| 341 | 340 | } |
| 342 | 341 | |
| 343 | 342 | |
| 344 | ||
| 343 | inline int scramble_state::bit(int i,int n) | |
| 345 | 344 | { |
| 346 | 345 | return ((i >> n) & 1); |
| 347 | 346 | } |
| r20977 | r20978 | |
|---|---|---|
| 36 | 36 | If D6 is high, it moved left. If D6 is low, it moved right. |
| 37 | 37 | Be sure to keep returning a direction until steer_reset is called. |
| 38 | 38 | ***************************************************************************/ |
| 39 | ||
| 39 | int subs_state::subs_steering_1() | |
| 40 | 40 | { |
| 41 | subs_state *state = machine.driver_data<subs_state>(); | |
| 42 | 41 | int this_val; |
| 43 | 42 | int delta; |
| 44 | 43 | |
| 45 | this_val= | |
| 44 | this_val=ioport("DIAL2")->read(); | |
| 46 | 45 | |
| 47 | delta=this_val-state->m_last_val_1; | |
| 48 | state->m_last_val_1=this_val; | |
| 46 | delta=this_val-m_last_val_1; | |
| 47 | m_last_val_1=this_val; | |
| 49 | 48 | if (delta>128) delta-=256; |
| 50 | 49 | else if (delta<-128) delta+=256; |
| 51 | 50 | /* Divide by four to make our steering less sensitive */ |
| 52 | | |
| 51 | m_steering_buf1+=(delta/4); | |
| 53 | 52 | |
| 54 | if ( | |
| 53 | if (m_steering_buf1>0) | |
| 55 | 54 | { |
| 56 | state->m_steering_buf1--; | |
| 57 | state->m_steering_val1=0xC0; | |
| 55 | m_steering_buf1--; | |
| 56 | m_steering_val1=0xC0; | |
| 58 | 57 | } |
| 59 | else if ( | |
| 58 | else if (m_steering_buf1<0) | |
| 60 | 59 | { |
| 61 | state->m_steering_buf1++; | |
| 62 | state->m_steering_val1=0x80; | |
| 60 | m_steering_buf1++; | |
| 61 | m_steering_val1=0x80; | |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | return | |
| 64 | return m_steering_val1; | |
| 66 | 65 | } |
| 67 | 66 | |
| 68 | ||
| 67 | int subs_state::subs_steering_2() | |
| 69 | 68 | { |
| 70 | subs_state *state = machine.driver_data<subs_state>(); | |
| 71 | 69 | int this_val; |
| 72 | 70 | int delta; |
| 73 | 71 | |
| 74 | this_val= | |
| 72 | this_val=ioport("DIAL1")->read(); | |
| 75 | 73 | |
| 76 | delta=this_val-state->m_last_val_2; | |
| 77 | state->m_last_val_2=this_val; | |
| 74 | delta=this_val-m_last_val_2; | |
| 75 | m_last_val_2=this_val; | |
| 78 | 76 | if (delta>128) delta-=256; |
| 79 | 77 | else if (delta<-128) delta+=256; |
| 80 | 78 | /* Divide by four to make our steering less sensitive */ |
| 81 | | |
| 79 | m_steering_buf2+=(delta/4); | |
| 82 | 80 | |
| 83 | if ( | |
| 81 | if (m_steering_buf2>0) | |
| 84 | 82 | { |
| 85 | state->m_steering_buf2--; | |
| 86 | state->m_steering_val2=0xC0; | |
| 83 | m_steering_buf2--; | |
| 84 | m_steering_val2=0xC0; | |
| 87 | 85 | } |
| 88 | else if ( | |
| 86 | else if (m_steering_buf2<0) | |
| 89 | 87 | { |
| 90 | state->m_steering_buf2++; | |
| 91 | state->m_steering_val2=0x80; | |
| 88 | m_steering_buf2++; | |
| 89 | m_steering_val2=0x80; | |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | return | |
| 92 | return m_steering_val2; | |
| 95 | 93 | } |
| 96 | 94 | |
| 97 | 95 | /*************************************************************************** |
| r20977 | r20978 | |
| 116 | 114 | case 0x01: return ((inport & 0x02) << 6); /* diag hold */ |
| 117 | 115 | case 0x02: return ((inport & 0x04) << 5); /* slam */ |
| 118 | 116 | case 0x03: return ((inport & 0x08) << 4); /* spare */ |
| 119 | case 0x04: return ((subs_steering_1(machine()) & 0x40) << 1); /* steer dir 1 */ | |
| 120 | case 0x05: return ((subs_steering_1(machine()) & 0x80) << 0); /* steer flag 1 */ | |
| 121 | case 0x06: return ((subs_steering_2(machine()) & 0x40) << 1); /* steer dir 2 */ | |
| 122 | case 0x07: return ((subs_steering_2(machine()) & 0x80) << 0); /* steer flag 2 */ | |
| 117 | case 0x04: return ((subs_steering_1() & 0x40) << 1); /* steer dir 1 */ | |
| 118 | case 0x05: return ((subs_steering_1() & 0x80) << 0); /* steer flag 1 */ | |
| 119 | case 0x06: return ((subs_steering_2() & 0x40) << 1); /* steer dir 2 */ | |
| 120 | case 0x07: return ((subs_steering_2() & 0x80) << 0); /* steer flag 2 */ | |
| 123 | 121 | } |
| 124 | 122 | |
| 125 | 123 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 149 | 149 | * |
| 150 | 150 | *************************************/ |
| 151 | 151 | |
| 152 | void starwars_mproc_init( | |
| 152 | void starwars_state::starwars_mproc_init() | |
| 153 | 153 | { |
| 154 | starwars_state *state = machine.driver_data<starwars_state>(); | |
| 155 | UINT8 *src = state->memregion("user2")->base(); | |
| 154 | UINT8 *src = memregion("user2")->base(); | |
| 156 | 155 | int cnt, val; |
| 157 | 156 | |
| 158 | state->m_PROM_STR = auto_alloc_array(machine, UINT8, 1024); | |
| 159 | state->m_PROM_MAS = auto_alloc_array(machine, UINT8, 1024); | |
| 160 | state->m_PROM_AM = auto_alloc_array(machine, UINT8, 1024); | |
| 157 | m_PROM_STR = auto_alloc_array(machine(), UINT8, 1024); | |
| 158 | m_PROM_MAS = auto_alloc_array(machine(), UINT8, 1024); | |
| 159 | m_PROM_AM = auto_alloc_array(machine(), UINT8, 1024); | |
| 161 | 160 | |
| 162 | 161 | for (cnt = 0; cnt < 1024; cnt++) |
| 163 | 162 | { |
| r20977 | r20978 | |
| 168 | 167 | val |= (src[0x0000 + cnt] << 12) & 0xf000; /* Set MS nibble */ |
| 169 | 168 | |
| 170 | 169 | /* perform pre-decoding */ |
| 171 | state->m_PROM_STR[cnt] = (val >> 8) & 0x00ff; | |
| 172 | state->m_PROM_MAS[cnt] = val & 0x007f; | |
| 173 | state->m_PROM_AM[cnt] = (val >> 7) & 0x0001; | |
| 170 | m_PROM_STR[cnt] = (val >> 8) & 0x00ff; | |
| 171 | m_PROM_MAS[cnt] = val & 0x007f; | |
| 172 | m_PROM_AM[cnt] = (val >> 7) & 0x0001; | |
| 174 | 173 | } |
| 175 | 174 | |
| 176 | | |
| 175 | m_math_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(starwars_state::math_run_clear),this)); | |
| 177 | 176 | } |
| 178 | 177 | |
| 179 | 178 | |
| r20977 | r20978 | |
| 184 | 183 | * |
| 185 | 184 | *************************************/ |
| 186 | 185 | |
| 187 | void starwars_mproc_reset( | |
| 186 | void starwars_state::starwars_mproc_reset() | |
| 188 | 187 | { |
| 189 | starwars_state *state = machine.driver_data<starwars_state>(); | |
| 190 | state->m_MPA = state->m_BIC = 0; | |
| 191 | state->m_math_run = 0; | |
| 188 | m_MPA = m_BIC = 0; | |
| 189 | m_math_run = 0; | |
| 192 | 190 | } |
| 193 | 191 | |
| 194 | 192 | |
| r20977 | r20978 | |
| 199 | 197 | * |
| 200 | 198 | *************************************/ |
| 201 | 199 | |
| 202 | ||
| 200 | void starwars_state::run_mproc() | |
| 203 | 201 | { |
| 204 | starwars_state *state = machine.driver_data<starwars_state>(); | |
| 205 | 202 | |
| 206 | 203 | int RAMWORD = 0; |
| 207 | 204 | int MA_byte; |
| r20977 | r20978 | |
| 214 | 211 | logerror("Running Matrix Processor...\n"); |
| 215 | 212 | |
| 216 | 213 | mptime = 0; |
| 217 | | |
| 214 | m_math_run = 1; | |
| 218 | 215 | |
| 219 | 216 | /* loop until finished */ |
| 220 | 217 | while (M_STOP > 0) |
| r20977 | r20978 | |
| 223 | 220 | mptime += 5; |
| 224 | 221 | |
| 225 | 222 | /* fetch the current instruction data */ |
| 226 | IP15_8 = state->m_PROM_STR[state->m_MPA]; | |
| 227 | IP7 = state->m_PROM_AM[state->m_MPA]; | |
| 228 | IP6_0 = state->m_PROM_MAS[state->m_MPA]; | |
| 223 | IP15_8 = m_PROM_STR[m_MPA]; | |
| 224 | IP7 = m_PROM_AM[m_MPA]; | |
| 225 | IP6_0 = m_PROM_MAS[m_MPA]; | |
| 229 | 226 | |
| 230 | 227 | #if (MATHDEBUG) |
| 231 | mame_printf_debug("\n(MPA:%x), Strobe: %x, IP7: %d, IP6_0:%x\n",state->m_MPA, IP15_8, IP7, IP6_0); | |
| 232 | mame_printf_debug("(BIC: %x), A: %x, B: %x, C: %x, ACC: %x\n",state->m_BIC,state->m_A,state->m_B,state->m_C,state->m_ACC); | |
| 228 | mame_printf_debug("\n(MPA:%x), Strobe: %x, IP7: %d, IP6_0:%x\n",m_MPA, IP15_8, IP7, IP6_0); | |
| 229 | mame_printf_debug("(BIC: %x), A: %x, B: %x, C: %x, ACC: %x\n",m_BIC,m_A,m_B,m_C,m_ACC); | |
| 233 | 230 | #endif |
| 234 | 231 | |
| 235 | 232 | /* construct the current RAM address */ |
| 236 | 233 | if (IP7 == 0) |
| 237 | MA = (IP6_0 & 3) | (( | |
| 234 | MA = (IP6_0 & 3) | ((m_BIC & 0x01ff) << 2); /* MA10-2 set to BIC8-0 */ | |
| 238 | 235 | else |
| 239 | 236 | MA = IP6_0; |
| 240 | 237 | |
| r20977 | r20978 | |
| 242 | 239 | and apply base address offset */ |
| 243 | 240 | |
| 244 | 241 | MA_byte = MA << 1; |
| 245 | RAMWORD = ( | |
| 242 | RAMWORD = (m_mathram[MA_byte + 1] & 0x00ff) | ((m_mathram[MA_byte] & 0x00ff) << 8); | |
| 246 | 243 | |
| 247 | 244 | // logerror("MATH ADDR: %x, CPU ADDR: %x, RAMWORD: %x\n", MA, MA_byte, RAMWORD); |
| 248 | 245 | |
| r20977 | r20978 | |
| 264 | 261 | /* 0x10 - CLEAR_ACC */ |
| 265 | 262 | if (IP15_8 & CLEAR_ACC) |
| 266 | 263 | { |
| 267 | | |
| 264 | m_ACC = 0; | |
| 268 | 265 | } |
| 269 | 266 | |
| 270 | 267 | /* 0x01 - LAC (also clears lsb)*/ |
| 271 | 268 | if (IP15_8 & LAC) |
| 272 | | |
| 269 | m_ACC = (RAMWORD << 16); | |
| 273 | 270 | |
| 274 | 271 | /* 0x02 - READ_ACC */ |
| 275 | 272 | if (IP15_8 & READ_ACC) |
| 276 | 273 | { |
| 277 | state->m_mathram[MA_byte+1] = ((state->m_ACC >> 16) & 0xff); | |
| 278 | state->m_mathram[MA_byte ] = ((state->m_ACC >> 24) & 0xff); | |
| 274 | m_mathram[MA_byte+1] = ((m_ACC >> 16) & 0xff); | |
| 275 | m_mathram[MA_byte ] = ((m_ACC >> 24) & 0xff); | |
| 279 | 276 | } |
| 280 | 277 | |
| 281 | 278 | /* 0x04 - M_HALT */ |
| r20977 | r20978 | |
| 284 | 281 | |
| 285 | 282 | /* 0x08 - INC_BIC */ |
| 286 | 283 | if (IP15_8 & INC_BIC) |
| 287 | | |
| 284 | m_BIC = (m_BIC + 1) & 0x1ff; /* Restrict to 9 bits */ | |
| 288 | 285 | |
| 289 | 286 | /* 0x20 - LDC*/ |
| 290 | 287 | if (IP15_8 & LDC) |
| 291 | 288 | { |
| 292 | | |
| 289 | m_C = RAMWORD; | |
| 293 | 290 | |
| 294 | 291 | /* This is a serial subtractor - multiplier (74ls384) - |
| 295 | 292 | * accumulator. For the full calculation 33 GMCLK pulses |
| r20977 | r20978 | |
| 320 | 317 | * takes 33 clock pulses to do a full rotation. |
| 321 | 318 | */ |
| 322 | 319 | |
| 323 | | |
| 320 | m_ACC += (((INT32)(m_A - m_B) << 1) * m_C) << 1; | |
| 324 | 321 | |
| 325 | 322 | /* A and B are sign extended (requred by the ls384). After |
| 326 | 323 | * multiplication they just contain the sign. |
| 327 | 324 | */ |
| 328 | state->m_A = (state->m_A & 0x8000)? 0xffff: 0; | |
| 329 | state->m_B = (state->m_B & 0x8000)? 0xffff: 0; | |
| 325 | m_A = (m_A & 0x8000)? 0xffff: 0; | |
| 326 | m_B = (m_B & 0x8000)? 0xffff: 0; | |
| 330 | 327 | |
| 331 | 328 | /* The multiply-add holds the main matrix processor counter |
| 332 | 329 | * for 33 cycles |
| r20977 | r20978 | |
| 336 | 333 | |
| 337 | 334 | /* 0x40 - LDB */ |
| 338 | 335 | if (IP15_8 & LDB) |
| 339 | | |
| 336 | m_B = RAMWORD; | |
| 340 | 337 | |
| 341 | 338 | /* 0x80 - LDA */ |
| 342 | 339 | if (IP15_8 & LDA) |
| 343 | | |
| 340 | m_A = RAMWORD; | |
| 344 | 341 | |
| 345 | 342 | /* |
| 346 | 343 | * Now update the PROM address counter |
| r20977 | r20978 | |
| 348 | 345 | * This means that each of the four pages should wrap around rather than |
| 349 | 346 | * leaking from one to another. It may not matter, but I've put it in anyway |
| 350 | 347 | */ |
| 351 | tmp = state->m_MPA + 1; | |
| 352 | state->m_MPA = (state->m_MPA & 0x0300) | (tmp & 0x00ff); /* New MPA value */ | |
| 348 | tmp = m_MPA + 1; | |
| 349 | m_MPA = (m_MPA & 0x0300) | (tmp & 0x00ff); /* New MPA value */ | |
| 353 | 350 | |
| 354 | 351 | M_STOP--; /* Decrease count */ |
| 355 | 352 | } |
| 356 | 353 | |
| 357 | | |
| 354 | m_math_timer->adjust(attotime::from_hz(MASTER_CLOCK) * mptime, 1); | |
| 358 | 355 | } |
| 359 | 356 | |
| 360 | 357 | |
| r20977 | r20978 | |
| 412 | 409 | { |
| 413 | 410 | case 0: /* mw0 */ |
| 414 | 411 | m_MPA = data << 2; /* Set starting PROM address */ |
| 415 | run_mproc( | |
| 412 | run_mproc(); /* and run the Matrix Processor */ | |
| 416 | 413 | break; |
| 417 | 414 | |
| 418 | 415 | case 1: /* mw1 */ |
| r20977 | r20978 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | |
| 159 | ||
| 159 | inline void suprloco_state::draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip) | |
| 160 | 160 | { |
| 161 | 161 | if (flip) |
| 162 | 162 | { |
| r20977 | r20978 | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
| 172 | ||
| 172 | void suprloco_state::draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect,int spr_number) | |
| 173 | 173 | { |
| 174 | suprloco_state *state = machine.driver_data<suprloco_state>(); | |
| 175 | int flip = state->flip_screen(); | |
| 174 | int flip = flip_screen(); | |
| 176 | 175 | int sx,sy,col,row,height,src,adjy,dy; |
| 177 | 176 | UINT8 *spr_reg; |
| 178 | 177 | UINT8 *gfx2; |
| r20977 | r20978 | |
| 180 | 179 | short skip; /* bytes to skip before drawing each row (can be negative) */ |
| 181 | 180 | |
| 182 | 181 | |
| 183 | spr_reg = | |
| 182 | spr_reg = m_spriteram + 0x10 * spr_number; | |
| 184 | 183 | |
| 185 | 184 | src = spr_reg[SPR_GFXOFS_LO] + (spr_reg[SPR_GFXOFS_HI] << 8); |
| 186 | 185 | skip = spr_reg[SPR_SKIP_LO] + (spr_reg[SPR_SKIP_HI] << 8); |
| 187 | 186 | |
| 188 | 187 | height = spr_reg[SPR_Y_BOTTOM] - spr_reg[SPR_Y_TOP]; |
| 189 | pen_base = 0x100 + 0x10 * (spr_reg[SPR_COL]&0x03) + (( | |
| 188 | pen_base = 0x100 + 0x10 * (spr_reg[SPR_COL]&0x03) + ((m_control & 0x20)?0x100:0); | |
| 190 | 189 | sx = spr_reg[SPR_X]; |
| 191 | 190 | sy = spr_reg[SPR_Y_TOP] + 1; |
| 192 | 191 | |
| 193 | if (! | |
| 192 | if (!flip_screen()) | |
| 194 | 193 | { |
| 195 | 194 | adjy = sy; |
| 196 | 195 | dy = 1; |
| r20977 | r20978 | |
| 201 | 200 | dy = -1; |
| 202 | 201 | } |
| 203 | 202 | |
| 204 | gfx2 = machine.root_device().memregion("gfx2")->base(); | |
| 203 | gfx2 = machine().root_device().memregion("gfx2")->base(); | |
| 205 | 204 | for (row = 0;row < height;row++,adjy+=dy) |
| 206 | 205 | { |
| 207 | 206 | int color1,color2,flipx; |
| r20977 | r20978 | |
| 244 | 243 | } |
| 245 | 244 | } |
| 246 | 245 | |
| 247 | ||
| 246 | void suprloco_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 248 | 247 | { |
| 249 | suprloco_state *state = machine.driver_data<suprloco_state>(); | |
| 250 | 248 | int spr_number; |
| 251 | 249 | UINT8 *spr_reg; |
| 252 | 250 | |
| 253 | 251 | |
| 254 | for (spr_number = 0;spr_number < ( | |
| 252 | for (spr_number = 0;spr_number < (m_spriteram.bytes() >> 4);spr_number++) | |
| 255 | 253 | { |
| 256 | spr_reg = | |
| 254 | spr_reg = m_spriteram + 0x10 * spr_number; | |
| 257 | 255 | if (spr_reg[SPR_X] != 0xff) |
| 258 | draw_sprite( | |
| 256 | draw_sprite(bitmap, cliprect, spr_number); | |
| 259 | 257 | } |
| 260 | 258 | } |
| 261 | 259 | |
| 262 | 260 | UINT32 suprloco_state::screen_update_suprloco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 263 | 261 | { |
| 264 | 262 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 265 | draw_sprites( | |
| 263 | draw_sprites(bitmap,cliprect); | |
| 266 | 264 | m_bg_tilemap->draw(bitmap, cliprect, 1,0); |
| 267 | 265 | return 0; |
| 268 | 266 | } |
| r20977 | r20978 | |
|---|---|---|
| 76 | 76 | m_bg_tilemap[offset >> 11]->mark_tile_dirty(((offset << 1) & 0x0fff) >> 1); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | ||
| 79 | void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 80 | 80 | { |
| 81 | splash_state *state = machine.driver_data<splash_state>(); | |
| 82 | 81 | int sx,sy,color,count,colxor,bitswap; |
| 83 | 82 | colxor = 0; /* splash and some bitmap modes in roldfrog */ |
| 84 | 83 | bitswap = 0; |
| 85 | 84 | |
| 86 | if ( | |
| 85 | if (m_bitmap_type == 1) /* roldfrog */ | |
| 87 | 86 | { |
| 88 | if ( | |
| 87 | if (m_bitmap_mode[0] == 0x0000) | |
| 89 | 88 | { |
| 90 | 89 | colxor = 0x7f; |
| 91 | 90 | } |
| 92 | else if ( | |
| 91 | else if (m_bitmap_mode[0] == 0x0100) | |
| 93 | 92 | { |
| 94 | 93 | bitswap = 1; |
| 95 | 94 | } |
| 96 | else if ( | |
| 95 | else if (m_bitmap_mode[0] == 0x0200) | |
| 97 | 96 | { |
| 98 | 97 | colxor = 0x55; |
| 99 | 98 | } |
| 100 | else if ( | |
| 99 | else if (m_bitmap_mode[0] == 0x0300) | |
| 101 | 100 | { |
| 102 | 101 | bitswap = 2; |
| 103 | 102 | colxor = 0x7f; |
| 104 | 103 | } |
| 105 | else if ( | |
| 104 | else if (m_bitmap_mode[0] == 0x0400) | |
| 106 | 105 | { |
| 107 | 106 | bitswap = 3; |
| 108 | 107 | } |
| 109 | else if ( | |
| 108 | else if (m_bitmap_mode[0] == 0x0500) | |
| 110 | 109 | { |
| 111 | 110 | bitswap = 4; |
| 112 | 111 | } |
| 113 | else if ( | |
| 112 | else if (m_bitmap_mode[0] == 0x0600) | |
| 114 | 113 | { |
| 115 | 114 | bitswap = 5; |
| 116 | 115 | colxor = 0x7f; |
| 117 | 116 | } |
| 118 | else if ( | |
| 117 | else if (m_bitmap_mode[0] == 0x0700) | |
| 119 | 118 | { |
| 120 | 119 | bitswap = 6; |
| 121 | 120 | colxor = 0x55; |
| r20977 | r20978 | |
| 127 | 126 | { |
| 128 | 127 | for (sx=0;sx<512;sx++) |
| 129 | 128 | { |
| 130 | color = | |
| 129 | color = m_pixelram[count]&0xff; | |
| 131 | 130 | count++; |
| 132 | 131 | |
| 133 | 132 | switch( bitswap ) |
| r20977 | r20978 | |
| 204 | 203 | 400| xxxxxxxx -------- | unused |
| 205 | 204 | */ |
| 206 | 205 | |
| 207 | ||
| 206 | void splash_state::splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 208 | 207 | { |
| 209 | splash_state *state = machine.driver_data<splash_state>(); | |
| 210 | 208 | int i; |
| 211 | gfx_element *gfx = machine.gfx[1]; | |
| 209 | gfx_element *gfx = machine().gfx[1]; | |
| 212 | 210 | |
| 213 | 211 | for (i = 0; i < 0x400; i += 4){ |
| 214 | int sx = state->m_spriteram[i+2] & 0xff; | |
| 215 | int sy = (240 - (state->m_spriteram[i+1] & 0xff)) & 0xff; | |
| 216 | int attr = state->m_spriteram[i+3] & 0xff; | |
| 217 | int attr2 = state->m_spriteram[i+0x400] >> state->m_sprite_attr2_shift; | |
| 218 | int number = (state->m_spriteram[i] & 0xff) + (attr & 0xf)*256; | |
| 212 | int sx = m_spriteram[i+2] & 0xff; | |
| 213 | int sy = (240 - (m_spriteram[i+1] & 0xff)) & 0xff; | |
| 214 | int attr = m_spriteram[i+3] & 0xff; | |
| 215 | int attr2 = m_spriteram[i+0x400] >> m_sprite_attr2_shift; | |
| 216 | int number = (m_spriteram[i] & 0xff) + (attr & 0xf)*256; | |
| 219 | 217 | |
| 220 | 218 | if (attr2 & 0x80) sx += 256; |
| 221 | 219 | |
| r20977 | r20978 | |
| 225 | 223 | } |
| 226 | 224 | } |
| 227 | 225 | |
| 228 | ||
| 226 | void splash_state::funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 229 | 227 | { |
| 230 | splash_state *state = machine.driver_data<splash_state>(); | |
| 231 | 228 | int i; |
| 232 | gfx_element *gfx = machine.gfx[1]; | |
| 229 | gfx_element *gfx = machine().gfx[1]; | |
| 233 | 230 | |
| 234 | 231 | for (i = 0; i < 0x400; i += 4){ |
| 235 | int sx = state->m_spriteram[i+2] & 0xff; | |
| 236 | int sy = (240 - (state->m_spriteram[i+1] & 0xff)) & 0xff; | |
| 237 | int attr = state->m_spriteram[i+3] & 0xff; | |
| 238 | int attr2 = state->m_spriteram[i+0x400] >> state->m_sprite_attr2_shift; | |
| 239 | int number = (state->m_spriteram[i] & 0xff) + (attr & 0xf)*256; | |
| 232 | int sx = m_spriteram[i+2] & 0xff; | |
| 233 | int sy = (240 - (m_spriteram[i+1] & 0xff)) & 0xff; | |
| 234 | int attr = m_spriteram[i+3] & 0xff; | |
| 235 | int attr2 = m_spriteram[i+0x400] >> m_sprite_attr2_shift; | |
| 236 | int number = (m_spriteram[i] & 0xff) + (attr & 0xf)*256; | |
| 240 | 237 | |
| 241 | 238 | if (attr2 & 0x80) sx += 256; |
| 242 | 239 | |
| r20977 | r20978 | |
| 258 | 255 | m_bg_tilemap[0]->set_scrolly(0, m_vregs[0]); |
| 259 | 256 | m_bg_tilemap[1]->set_scrolly(0, m_vregs[1]); |
| 260 | 257 | |
| 261 | draw_bitmap( | |
| 258 | draw_bitmap(bitmap, cliprect); | |
| 262 | 259 | |
| 263 | 260 | m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0); |
| 264 | splash_draw_sprites( | |
| 261 | splash_draw_sprites(bitmap, cliprect); | |
| 265 | 262 | m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0); |
| 266 | 263 | return 0; |
| 267 | 264 | } |
| r20977 | r20978 | |
| 272 | 269 | m_bg_tilemap[0]->set_scrolly(0, m_vregs[0]); |
| 273 | 270 | m_bg_tilemap[1]->set_scrolly(0, m_vregs[1]); |
| 274 | 271 | |
| 275 | draw_bitmap( | |
| 272 | draw_bitmap(bitmap, cliprect); | |
| 276 | 273 | |
| 277 | 274 | m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0); |
| 278 | 275 | /*Sprite chip is similar but not the same*/ |
| 279 | funystrp_draw_sprites( | |
| 276 | funystrp_draw_sprites(bitmap, cliprect); | |
| 280 | 277 | m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0); |
| 281 | 278 | return 0; |
| 282 | 279 | } |
| r20977 | r20978 | |
|---|---|---|
| 22 | 22 | palette_set_color_rgb(machine(), offset, pal5bit(r), pal5bit(g), pal5bit(b)); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | ||
| 25 | void sslam_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 26 | 26 | { |
| 27 | sslam_state *state = machine.driver_data<sslam_state>(); | |
| 28 | gfx_element *gfx = machine.gfx[0]; | |
| 29 | UINT16 *source = state->m_spriteram; | |
| 27 | gfx_element *gfx = machine().gfx[0]; | |
| 28 | UINT16 *source = m_spriteram; | |
| 30 | 29 | UINT16 *finish = source + 0x1000/2; |
| 31 | 30 | |
| 32 | 31 | source += 3; // strange |
| r20977 | r20978 | |
| 44 | 43 | flipx = source[0] & 0x4000; |
| 45 | 44 | number = source[3]; |
| 46 | 45 | |
| 47 | xpos -=16; xpos -=7; xpos += | |
| 46 | xpos -=16; xpos -=7; xpos += m_sprites_x_offset; | |
| 48 | 47 | ypos = 0xff - ypos; |
| 49 | 48 | ypos -=16; ypos -=7; |
| 50 | 49 | |
| r20977 | r20978 | |
| 208 | 207 | m_md_tilemap->draw(bitmap, cliprect, 0,0); |
| 209 | 208 | } |
| 210 | 209 | |
| 211 | draw_sprites( | |
| 210 | draw_sprites(bitmap,cliprect); | |
| 212 | 211 | m_tx_tilemap->draw(bitmap, cliprect, 0,0); |
| 213 | 212 | return 0; |
| 214 | 213 | } |
| r20977 | r20978 | |
| 225 | 224 | m_bg_tilemap->set_scrolly(0, m_regs[1]-240); |
| 226 | 225 | |
| 227 | 226 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 228 | draw_sprites( | |
| 227 | draw_sprites(bitmap,cliprect); | |
| 229 | 228 | return 0; |
| 230 | 229 | } |
| r20977 | r20978 | |
|---|---|---|
| 89 | 89 | m_palette_bank = 0; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | ||
| 92 | void sauro_state::sauro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 93 | 93 | { |
| 94 | sauro_state *state = machine.driver_data<sauro_state>(); | |
| 95 | UINT8 *spriteram = state->m_spriteram; | |
| 94 | UINT8 *spriteram = m_spriteram; | |
| 96 | 95 | int offs,code,sx,sy,color,flipx; |
| 97 | int flipy = | |
| 96 | int flipy = flip_screen(); | |
| 98 | 97 | |
| 99 | for (offs = 3; offs < | |
| 98 | for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) | |
| 100 | 99 | { |
| 101 | 100 | sy = spriteram[offs]; |
| 102 | 101 | if (sy == 0xf8) continue; |
| r20977 | r20978 | |
| 104 | 103 | code = spriteram[offs+1] + ((spriteram[offs+3] & 0x03) << 8); |
| 105 | 104 | sx = spriteram[offs+2]; |
| 106 | 105 | sy = 236 - sy; |
| 107 | color = ((spriteram[offs+3] >> 4) & 0x0f) | | |
| 106 | color = ((spriteram[offs+3] >> 4) & 0x0f) | m_palette_bank; | |
| 108 | 107 | |
| 109 | 108 | // I'm not really sure how this bit works |
| 110 | 109 | if (spriteram[offs+3] & 0x08) |
| r20977 | r20978 | |
| 129 | 128 | sy = 240 - sy; |
| 130 | 129 | } |
| 131 | 130 | |
| 132 | drawgfx_transpen(bitmap, cliprect, machine.gfx[2], | |
| 131 | drawgfx_transpen(bitmap, cliprect, machine().gfx[2], | |
| 133 | 132 | code, |
| 134 | 133 | color, |
| 135 | 134 | flipx, flipy, |
| r20977 | r20978 | |
| 141 | 140 | { |
| 142 | 141 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 143 | 142 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 144 | sauro_draw_sprites( | |
| 143 | sauro_draw_sprites(bitmap, cliprect); | |
| 145 | 144 | return 0; |
| 146 | 145 | } |
| 147 | 146 | |
| r20977 | r20978 | |
| 153 | 152 | 8, 8, 32, 32); |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | ||
| 155 | void sauro_state::trckydoc_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 157 | 156 | { |
| 158 | sauro_state *state = machine.driver_data<sauro_state>(); | |
| 159 | UINT8 *spriteram = state->m_spriteram; | |
| 157 | UINT8 *spriteram = m_spriteram; | |
| 160 | 158 | int offs,code,sy,color,flipx,sx; |
| 161 | int flipy = | |
| 159 | int flipy = flip_screen(); | |
| 162 | 160 | |
| 163 | 161 | /* Weird, sprites entries don't start on DWORD boundary */ |
| 164 | for (offs = 3; offs < | |
| 162 | for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) | |
| 165 | 163 | { |
| 166 | 164 | sy = spriteram[offs]; |
| 167 | 165 | |
| r20977 | r20978 | |
| 201 | 199 | sy = 240 - sy; |
| 202 | 200 | } |
| 203 | 201 | |
| 204 | drawgfx_transpen(bitmap, cliprect,machine.gfx[1], | |
| 202 | drawgfx_transpen(bitmap, cliprect,machine().gfx[1], | |
| 205 | 203 | code, |
| 206 | 204 | color, |
| 207 | 205 | flipx, flipy, |
| r20977 | r20978 | |
| 212 | 210 | UINT32 sauro_state::screen_update_trckydoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 213 | 211 | { |
| 214 | 212 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 215 | trckydoc_draw_sprites( | |
| 213 | trckydoc_draw_sprites(bitmap, cliprect); | |
| 216 | 214 | return 0; |
| 217 | 215 | } |
| r20977 | r20978 | |
|---|---|---|
| 104 | 104 | |
| 105 | 105 | ***************************************************************************/ |
| 106 | 106 | |
| 107 | ||
| 107 | void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 108 | 108 | { |
| 109 | sidepckt_state *state = machine.driver_data<sidepckt_state>(); | |
| 110 | UINT8 *spriteram = state->m_spriteram; | |
| 109 | UINT8 *spriteram = m_spriteram; | |
| 111 | 110 | int offs; |
| 112 | 111 | |
| 113 | for (offs = 0;offs < | |
| 112 | for (offs = 0;offs < m_spriteram.bytes(); offs += 4) | |
| 114 | 113 | { |
| 115 | 114 | int sx,sy,code,color,flipx,flipy; |
| 116 | 115 | |
| r20977 | r20978 | |
| 123 | 122 | flipx = spriteram[offs+1] & 0x08; |
| 124 | 123 | flipy = spriteram[offs+1] & 0x04; |
| 125 | 124 | |
| 126 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 125 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 127 | 126 | code, |
| 128 | 127 | color, |
| 129 | 128 | flipx,flipy, |
| 130 | 129 | sx,sy,0); |
| 131 | 130 | /* wraparound */ |
| 132 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 131 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 133 | 132 | code, |
| 134 | 133 | color, |
| 135 | 134 | flipx,flipy, |
| r20977 | r20978 | |
| 141 | 140 | UINT32 sidepckt_state::screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 142 | 141 | { |
| 143 | 142 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
| 144 | draw_sprites( | |
| 143 | draw_sprites(bitmap,cliprect); | |
| 145 | 144 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
| 146 | 145 | return 0; |
| 147 | 146 | } |
| r20977 | r20978 | |
|---|---|---|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | ||
| 214 | void seta2_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 215 | 215 | { |
| 216 | 216 | // Sprites list |
| 217 | 217 | |
| 218 | seta2_state *state = machine.driver_data<seta2_state>(); | |
| 219 | // When debugging, use state->m_spriteram here, and run mame -update_in_pause | |
| 220 | UINT16 *buffered_spriteram16 = state->m_buffered_spriteram; | |
| 218 | // When debugging, use m_spriteram here, and run mame -update_in_pause | |
| 219 | UINT16 *buffered_spriteram16 = m_buffered_spriteram; | |
| 221 | 220 | UINT16 *s1 = buffered_spriteram16 + 0x3000/2; |
| 222 | UINT16 *end = &buffered_spriteram16[ | |
| 221 | UINT16 *end = &buffered_spriteram16[m_spriteram.bytes()/2]; | |
| 223 | 222 | |
| 224 | 223 | // for ( ; s1 < end; s1+=4 ) |
| 225 | 224 | for ( ; s1 < buffered_spriteram16 + 0x4000/2; s1+=4 ) // more reasonable (and it cures MAME lockup in e.g. funcube3 boot) |
| r20977 | r20978 | |
| 250 | 249 | default: |
| 251 | 250 | popmessage("unknown gfxset %x",(num & 0x0700)>>8); |
| 252 | 251 | shadow_depth = 0; |
| 253 | gfx = machine.gfx[machine.rand()&3]; | |
| 252 | gfx = machine().gfx[machine().rand()&3]; | |
| 254 | 253 | break; |
| 255 | 254 | case 0x0700: // 8bpp tiles (76543210) |
| 256 | 255 | shadow_depth = 8; // ? |
| 257 | gfx = machine.gfx[3]; | |
| 256 | gfx = machine().gfx[3]; | |
| 258 | 257 | break; |
| 259 | 258 | case 0x0600: // 6bpp tiles (--543210) (myangel sliding blocks test) |
| 260 | 259 | shadow_depth = 6; // ? |
| 261 | gfx = machine.gfx[2]; | |
| 260 | gfx = machine().gfx[2]; | |
| 262 | 261 | break; |
| 263 | 262 | case 0x0500: // 4bpp tiles (3210----) |
| 264 | 263 | shadow_depth = 4; // ? |
| 265 | gfx = machine.gfx[1]; | |
| 264 | gfx = machine().gfx[1]; | |
| 266 | 265 | break; |
| 267 | 266 | case 0x0400: // 4bpp tiles (----3210) |
| 268 | 267 | shadow_depth = 3; // reelquak |
| 269 | gfx = machine.gfx[0]; | |
| 268 | gfx = machine().gfx[0]; | |
| 270 | 269 | break; |
| 271 | 270 | // case 0x0300: |
| 272 | 271 | // unknown |
| 273 | 272 | case 0x0200: // 3bpp tiles? (-----210) (myangel "Graduate Tests") |
| 274 | 273 | shadow_depth = 3; // ? |
| 275 | gfx = machine.gfx[4]; | |
| 274 | gfx = machine().gfx[4]; | |
| 276 | 275 | break; |
| 277 | 276 | case 0x0100: // 2bpp tiles??? (--10----) (myangel2 question bubble, myangel endgame) |
| 278 | 277 | shadow_depth = 2; // myangel2 |
| 279 | gfx = machine.gfx[5]; | |
| 278 | gfx = machine().gfx[5]; | |
| 280 | 279 | break; |
| 281 | 280 | case 0x0000: // no idea! |
| 282 | 281 | shadow_depth = 4; // ? |
| 283 | gfx = machine.gfx[0]; | |
| 282 | gfx = machine().gfx[0]; | |
| 284 | 283 | break; |
| 285 | 284 | } |
| 286 | 285 | if (!use_shadow) |
| r20977 | r20978 | |
| 318 | 317 | sx &= 0x3ff; |
| 319 | 318 | sy &= 0x1ff; |
| 320 | 319 | |
| 321 | scrollx += | |
| 320 | scrollx += m_xoffset; | |
| 322 | 321 | scrollx &= 0x3ff; |
| 323 | 322 | scrolly &= 0x1ff; |
| 324 | 323 | |
| r20977 | r20978 | |
| 333 | 332 | if (clip.max_x > cliprect.max_x) clip.max_x = cliprect.max_x; |
| 334 | 333 | |
| 335 | 334 | // sprite clipping region (y) |
| 336 | clip.min_y = ((sy + yoffs) & 0x1ff) - | |
| 335 | clip.min_y = ((sy + yoffs) & 0x1ff) - m_yoffset; | |
| 337 | 336 | clip.max_y = clip.min_y + height * 0x10 - 1; |
| 338 | 337 | |
| 339 | 338 | if (clip.min_y > cliprect.max_y) continue; |
| r20977 | r20978 | |
| 346 | 345 | // Draw the rows |
| 347 | 346 | for (y = 0; y < (0x40 >> tilesize); y++) |
| 348 | 347 | { |
| 349 | int py = ((scrolly - (y+1) * (8 << tilesize) + 0x10) & 0x1ff) - 0x10 - | |
| 348 | int py = ((scrolly - (y+1) * (8 << tilesize) + 0x10) & 0x1ff) - 0x10 - m_yoffset; | |
| 350 | 349 | |
| 351 | 350 | for (x = 0; x < 0x40; x++) |
| 352 | 351 | { |
| r20977 | r20978 | |
| 410 | 409 | sx = (sx & 0x1ff) - (sx & 0x200); |
| 411 | 410 | |
| 412 | 411 | sy &= 0x1ff; |
| 413 | sy -= | |
| 412 | sy -= m_yoffset; | |
| 414 | 413 | |
| 415 | 414 | code &= ~((sizex+1) * (sizey+1) - 1); // see myangel, myangel2 and grdians |
| 416 | 415 | |
| r20977 | r20978 | |
| 478 | 477 | bitmap.fill(machine().pens[0], cliprect); |
| 479 | 478 | |
| 480 | 479 | if ( (m_vregs[0x30/2] & 1) == 0 ) // 1 = BLANK SCREEN |
| 481 | draw_sprites( | |
| 480 | draw_sprites(bitmap, cliprect); | |
| 482 | 481 | |
| 483 | 482 | return 0; |
| 484 | 483 | } |
| r20977 | r20978 | |
|---|---|---|
| 214 | 214 | ---- --1- Coin #1 Counter |
| 215 | 215 | ---- ---0 Coin #0 Counter */ |
| 216 | 216 | |
| 217 | void seta_coin_lockout_w( | |
| 217 | void seta_state::seta_coin_lockout_w(int data) | |
| 218 | 218 | { |
| 219 | seta_state *state = machine.driver_data<seta_state>(); | |
| 220 | 219 | static const char *const seta_nolockout[] = |
| 221 | 220 | { "blandia", "eightfrc", "extdwnhl", "gundhara", "kamenrid", "magspeed", "sokonuke", "zingzip", "zombraid"}; |
| 222 | 221 | |
| 223 | 222 | /* Only compute seta_coin_lockout when confronted with a new gamedrv */ |
| 224 | if (! | |
| 223 | if (!m_coin_lockout_initialized) | |
| 225 | 224 | { |
| 226 | | |
| 225 | m_coin_lockout_initialized = true; | |
| 227 | 226 | int i; |
| 228 | 227 | |
| 229 | | |
| 228 | m_coin_lockout = 1; | |
| 230 | 229 | for (i=0; i<ARRAY_LENGTH(seta_nolockout); i++) |
| 231 | 230 | { |
| 232 | if (strcmp(machine.system().name, seta_nolockout[i]) == 0 || | |
| 233 | strcmp(machine.system().parent, seta_nolockout[i]) == 0) | |
| 231 | if (strcmp(machine().system().name, seta_nolockout[i]) == 0 || | |
| 232 | strcmp(machine().system().parent, seta_nolockout[i]) == 0) | |
| 234 | 233 | { |
| 235 | | |
| 234 | m_coin_lockout = 0; | |
| 236 | 235 | break; |
| 237 | 236 | } |
| 238 | 237 | } |
| 239 | 238 | } |
| 240 | 239 | |
| 241 | coin_counter_w (machine, 0, (( data) >> 0) & 1 ); | |
| 242 | coin_counter_w (machine, 1, (( data) >> 1) & 1 ); | |
| 240 | coin_counter_w (machine(), 0, (( data) >> 0) & 1 ); | |
| 241 | coin_counter_w (machine(), 1, (( data) >> 1) & 1 ); | |
| 243 | 242 | |
| 244 | 243 | /* some games haven't the coin lockout device */ |
| 245 | if ( ! | |
| 244 | if ( !m_coin_lockout ) | |
| 246 | 245 | return; |
| 247 | coin_lockout_w (machine, 0, ((~data) >> 2) & 1 ); | |
| 248 | coin_lockout_w (machine, 1, ((~data) >> 3) & 1 ); | |
| 246 | coin_lockout_w (machine(), 0, ((~data) >> 2) & 1 ); | |
| 247 | coin_lockout_w (machine(), 1, ((~data) >> 3) & 1 ); | |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | |
| r20977 | r20978 | |
| 267 | 266 | if (ACCESSING_BITS_0_7) |
| 268 | 267 | { |
| 269 | 268 | device_t *x1_010 = machine().device("x1snd"); |
| 270 | seta_coin_lockout_w ( | |
| 269 | seta_coin_lockout_w (data & 0x0f); | |
| 271 | 270 | if (x1_010 != NULL) |
| 272 | 271 | seta_sound_enable_w (x1_010, data & 0x20); |
| 273 | 272 | coin_counter_w(machine(), 0,data & 0x01); |
| r20977 | r20978 | |
| 362 | 361 | |
| 363 | 362 | ***************************************************************************/ |
| 364 | 363 | |
| 365 | ||
| 364 | inline void seta_state::twineagl_tile_info( tile_data &tileinfo, int tile_index, int offset ) | |
| 366 | 365 | { |
| 367 | seta_state *state = machine.driver_data<seta_state>(); | |
| 368 | UINT16 *vram = state->m_vram_0 + offset; | |
| 366 | UINT16 *vram = m_vram_0 + offset; | |
| 369 | 367 | UINT16 code = vram[ tile_index ]; |
| 370 | 368 | UINT16 attr = vram[ tile_index + 0x800 ]; |
| 371 | 369 | if ((code & 0x3e00) == 0x3e00) |
| 372 | code = (code & 0xc07f) | ((state->m_twineagl_tilebank[(code & 0x0180) >> 7] >> 1) << 7); | |
| 373 | SET_TILE_INFO( 1, (code & 0x3fff), attr & 0x1f, TILE_FLIPXY((code & 0xc000) >> 14) ); | |
| 370 | code = (code & 0xc07f) | ((m_twineagl_tilebank[(code & 0x0180) >> 7] >> 1) << 7); | |
| 371 | SET_TILE_INFO_MEMBER( 1, (code & 0x3fff), attr & 0x1f, TILE_FLIPXY((code & 0xc000) >> 14) ); | |
| 374 | 372 | } |
| 375 | 373 | |
| 376 | TILE_GET_INFO_MEMBER(seta_state::twineagl_get_tile_info_0){ twineagl_tile_info( machine(), tileinfo, tile_index, 0x0000 ); } | |
| 377 | TILE_GET_INFO_MEMBER(seta_state::twineagl_get_tile_info_1){ twineagl_tile_info( machine(), tileinfo, tile_index, 0x1000 ); } | |
| 374 | TILE_GET_INFO_MEMBER(seta_state::twineagl_get_tile_info_0){ twineagl_tile_info(tileinfo, tile_index, 0x0000 ); } | |
| 375 | TILE_GET_INFO_MEMBER(seta_state::twineagl_get_tile_info_1){ twineagl_tile_info(tileinfo, tile_index, 0x1000 ); } | |
| 378 | 376 | |
| 379 | 377 | |
| 380 | ||
| 378 | inline void seta_state::get_tile_info( tile_data &tileinfo, int tile_index, int layer, int offset ) | |
| 381 | 379 | { |
| 382 | seta_state *state = machine.driver_data<seta_state>(); | |
| 383 | 380 | int gfx = 1 + layer; |
| 384 | UINT16 *vram = (layer == 0) ? state->m_vram_0 + offset : state->m_vram_2 + offset; | |
| 385 | UINT16 *vctrl = (layer == 0) ? state->m_vctrl_0 : state->m_vctrl_2; | |
| 381 | UINT16 *vram = (layer == 0) ? m_vram_0 + offset : m_vram_2 + offset; | |
| 382 | UINT16 *vctrl = (layer == 0) ? m_vctrl_0 : m_vctrl_2; | |
| 386 | 383 | UINT16 code = vram[ tile_index ]; |
| 387 | 384 | UINT16 attr = vram[ tile_index + 0x800 ]; |
| 388 | 385 | |
| 389 | if(machine.gfx[gfx + ((vctrl[ 4/2 ] & 0x10) >> | |
| 386 | if(machine().gfx[gfx + ((vctrl[ 4/2 ] & 0x10) >> m_color_mode_shift)] != NULL) | |
| 390 | 387 | { |
| 391 | gfx += (vctrl[ 4/2 ] & 0x10) >> | |
| 388 | gfx += (vctrl[ 4/2 ] & 0x10) >> m_color_mode_shift; | |
| 392 | 389 | } |
| 393 | 390 | else |
| 394 | 391 | { |
| 395 | 392 | popmessage("Missing Color Mode = 1 for Layer = %d. Contact MAMETesters.",layer); |
| 396 | 393 | } |
| 397 | 394 | |
| 398 | SET_TILE_INFO( gfx, | |
| 395 | SET_TILE_INFO_MEMBER( gfx, m_tiles_offset + (code & 0x3fff), attr & 0x1f, TILE_FLIPXY((code & 0xc000) >> 14) ); | |
| 399 | 396 | } |
| 400 | 397 | |
| 401 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_0){ get_tile_info( machine(), tileinfo, tile_index, 0, 0x0000 ); } | |
| 402 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_1){ get_tile_info( machine(), tileinfo, tile_index, 0, 0x1000 ); } | |
| 403 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_2){ get_tile_info( machine(), tileinfo, tile_index, 1, 0x0000 ); } | |
| 404 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_3){ get_tile_info( machine(), tileinfo, tile_index, 1, 0x1000 ); } | |
| 398 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_0){ get_tile_info(tileinfo, tile_index, 0, 0x0000 ); } | |
| 399 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_1){ get_tile_info(tileinfo, tile_index, 0, 0x1000 ); } | |
| 400 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 1, 0x0000 ); } | |
| 401 | TILE_GET_INFO_MEMBER(seta_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 1, 0x1000 ); } | |
| 405 | 402 | |
| 406 | 403 | |
| 407 | 404 | WRITE16_MEMBER(seta_state::seta_vram_0_w) |
| r20977 | r20978 | |
| 511 | 508 | |
| 512 | 509 | int setac_gfxbank_callback( running_machine &machine, UINT16 code, UINT8 color ) |
| 513 | 510 | { |
| 514 | //seta_state *state = machine.driver_data<seta_state>(); | |
| 515 | 511 | |
| 516 | 512 | int bank = (color & 0x06) >> 1; |
| 517 | 513 | code = (code & 0x3fff) + (bank * 0x4000); |
| r20977 | r20978 | |
| 704 | 700 | } |
| 705 | 701 | |
| 706 | 702 | |
| 707 | ||
| 703 | void seta_state::set_pens() | |
| 708 | 704 | { |
| 709 | seta_state *state = machine.driver_data<seta_state>(); | |
| 710 | 705 | offs_t i; |
| 711 | 706 | |
| 712 | for (i = 0; i < | |
| 707 | for (i = 0; i < m_paletteram.bytes() / 2; i++) | |
| 713 | 708 | { |
| 714 | UINT16 data = | |
| 709 | UINT16 data = m_paletteram[i]; | |
| 715 | 710 | |
| 716 | 711 | rgb_t color = MAKE_RGB(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 717 | 712 | |
| 718 | if (machine.colortable != NULL) | |
| 719 | colortable_palette_set_color(machine.colortable, i, color); | |
| 713 | if (machine().colortable != NULL) | |
| 714 | colortable_palette_set_color(machine().colortable, i, color); | |
| 720 | 715 | else |
| 721 | palette_set_color(machine, i, color); | |
| 716 | palette_set_color(machine(), i, color); | |
| 722 | 717 | } |
| 723 | 718 | |
| 724 | if( | |
| 719 | if(m_paletteram2 != NULL) | |
| 725 | 720 | { |
| 726 | for (i = 0; i < | |
| 721 | for (i = 0; i < m_paletteram2.bytes() / 2; i++) | |
| 727 | 722 | { |
| 728 | UINT16 data = | |
| 723 | UINT16 data = m_paletteram2[i]; | |
| 729 | 724 | |
| 730 | 725 | rgb_t color = MAKE_RGB(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 731 | 726 | |
| 732 | if (machine.colortable != NULL) | |
| 733 | colortable_palette_set_color(machine.colortable, i + state->m_paletteram.bytes() / 2, color); | |
| 727 | if (machine().colortable != NULL) | |
| 728 | colortable_palette_set_color(machine().colortable, i + m_paletteram.bytes() / 2, color); | |
| 734 | 729 | else |
| 735 | palette_set_color(machine, i + | |
| 730 | palette_set_color(machine(), i + m_paletteram.bytes() / 2, color); | |
| 736 | 731 | } |
| 737 | 732 | } |
| 738 | 733 | } |
| 739 | 734 | |
| 740 | 735 | |
| 741 | ||
| 736 | void seta_state::usclssic_set_pens() | |
| 742 | 737 | { |
| 743 | seta_state *state = machine.driver_data<seta_state>(); | |
| 744 | 738 | offs_t i; |
| 745 | 739 | |
| 746 | 740 | for (i = 0; i < 0x200; i++) |
| 747 | 741 | { |
| 748 | UINT16 data = | |
| 742 | UINT16 data = m_paletteram[i]; | |
| 749 | 743 | |
| 750 | 744 | rgb_t color = MAKE_RGB(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 751 | 745 | |
| 752 | 746 | if (i >= 0x100) |
| 753 | colortable_palette_set_color(machine.colortable, i - 0x100, color); | |
| 747 | colortable_palette_set_color(machine().colortable, i - 0x100, color); | |
| 754 | 748 | else |
| 755 | colortable_palette_set_color(machine.colortable, i + 0x200, color); | |
| 749 | colortable_palette_set_color(machine().colortable, i + 0x200, color); | |
| 756 | 750 | } |
| 757 | 751 | } |
| 758 | 752 | |
| 759 | 753 | |
| 760 | 754 | |
| 761 | 755 | |
| 762 | ||
| 756 | void seta_state::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen) | |
| 763 | 757 | { |
| 764 | 758 | int y; |
| 765 | gfx_element *gfx_tilemap = machine.gfx[gfxnum]; | |
| 759 | gfx_element *gfx_tilemap = machine().gfx[gfxnum]; | |
| 766 | 760 | const bitmap_ind16 &src_bitmap = tilemap->pixmap(); |
| 767 | 761 | int width_mask, height_mask; |
| 768 | 762 | int opaque_mask = gfx_tilemap->granularity() - 1; |
| r20977 | r20978 | |
| 794 | 788 | // pixels with the last color are not drawn and the 2nd palette is added to the current bitmap color |
| 795 | 789 | if((p & pixel_effect_mask) == pixel_effect_mask) |
| 796 | 790 | { |
| 797 | dest[x] = machine.total_colors() / 2 + dest[x]; | |
| 791 | dest[x] = machine().total_colors() / 2 + dest[x]; | |
| 798 | 792 | } |
| 799 | 793 | else |
| 800 | 794 | { |
| 801 | dest[x] = machine.pens[p]; | |
| 795 | dest[x] = machine().pens[p]; | |
| 802 | 796 | } |
| 803 | 797 | } |
| 804 | 798 | } |
| r20977 | r20978 | |
| 819 | 813 | /* For games without tilemaps */ |
| 820 | 814 | UINT32 seta_state::screen_update_seta_no_layers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 821 | 815 | { |
| 822 | set_pens( | |
| 816 | set_pens(); | |
| 823 | 817 | bitmap.fill(0x1f0, cliprect); |
| 824 | 818 | |
| 825 | 819 | machine().device<seta001_device>("spritegen")->seta001_draw_sprites(machine(),bitmap,cliprect,0x1000, 1); |
| r20977 | r20978 | |
| 828 | 822 | |
| 829 | 823 | |
| 830 | 824 | /* For games with 1 or 2 tilemaps */ |
| 831 | void seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_bank_size, int sprite_setac ) | |
| 825 | void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_bank_size, int sprite_setac ) | |
| 832 | 826 | { |
| 833 | seta_state *state = screen.machine().driver_data<seta_state>(); | |
| 834 | 827 | int layers_ctrl = -1; |
| 835 | 828 | int enab_0, enab_1, x_0, x_1=0, y_0, y_1=0; |
| 836 | 829 | |
| 837 | 830 | int order = 0; |
| 838 | int flip = | |
| 831 | int flip = machine().device<seta001_device>("spritegen")->is_flipped(); | |
| 839 | 832 | |
| 840 | 833 | const rectangle &visarea = screen.visible_area(); |
| 841 | 834 | int vis_dimy = visarea.max_y - visarea.min_y + 1; |
| 842 | 835 | |
| 843 | 836 | // check tilemaps color modes |
| 844 | 837 | |
| 845 | if( | |
| 838 | if(m_current_tilemap_mode[0] != (m_vctrl_0[ 4/2 ] & 0x10)) | |
| 846 | 839 | { |
| 847 | state->m_current_tilemap_mode[0] = state->m_vctrl_0[ 4/2 ] & 0x10; | |
| 848 | state->m_tilemap_0->mark_all_dirty(); | |
| 849 | state->m_tilemap_1->mark_all_dirty(); | |
| 840 | m_current_tilemap_mode[0] = m_vctrl_0[ 4/2 ] & 0x10; | |
| 841 | m_tilemap_0->mark_all_dirty(); | |
| 842 | m_tilemap_1->mark_all_dirty(); | |
| 850 | 843 | } |
| 851 | 844 | |
| 852 | if( | |
| 845 | if(m_tilemap_2 != NULL && m_tilemap_3 != NULL) | |
| 853 | 846 | { |
| 854 | if( | |
| 847 | if(m_current_tilemap_mode[1] != (m_vctrl_2[ 4/2 ] & 0x10)) | |
| 855 | 848 | { |
| 856 | state->m_current_tilemap_mode[1] = state->m_vctrl_2[ 4/2 ] & 0x10; | |
| 857 | state->m_tilemap_2->mark_all_dirty(); | |
| 858 | state->m_tilemap_3->mark_all_dirty(); | |
| 849 | m_current_tilemap_mode[1] = m_vctrl_2[ 4/2 ] & 0x10; | |
| 850 | m_tilemap_2->mark_all_dirty(); | |
| 851 | m_tilemap_3->mark_all_dirty(); | |
| 859 | 852 | } |
| 860 | 853 | } |
| 861 | 854 | |
| 862 | flip ^= | |
| 855 | flip ^= m_tilemaps_flip; | |
| 863 | 856 | |
| 864 | 857 | screen.machine().tilemap().set_flip_all(flip ? (TILEMAP_FLIPX|TILEMAP_FLIPY) : 0 ); |
| 865 | 858 | |
| 866 | x_0 = state->m_vctrl_0[ 0/2 ]; | |
| 867 | y_0 = state->m_vctrl_0[ 2/2 ]; | |
| 868 | enab_0 = state->m_vctrl_0[ 4/2 ]; | |
| 859 | x_0 = m_vctrl_0[ 0/2 ]; | |
| 860 | y_0 = m_vctrl_0[ 2/2 ]; | |
| 861 | enab_0 = m_vctrl_0[ 4/2 ]; | |
| 869 | 862 | |
| 870 | 863 | /* Only one tilemap per layer is enabled! */ |
| 871 | state->m_tilemap_0->enable((!(enab_0 & 0x0008)) /*&& (enab_0 & 0x0001)*/ ); | |
| 872 | state->m_tilemap_1->enable(( (enab_0 & 0x0008)) /*&& (enab_0 & 0x0001)*/ ); | |
| 864 | m_tilemap_0->enable((!(enab_0 & 0x0008)) /*&& (enab_0 & 0x0001)*/ ); | |
| 865 | m_tilemap_1->enable(( (enab_0 & 0x0008)) /*&& (enab_0 & 0x0001)*/ ); | |
| 873 | 866 | |
| 874 | 867 | /* the hardware wants different scroll values when flipped */ |
| 875 | 868 | |
| r20977 | r20978 | |
| 879 | 872 | fff0 0260 = -$10, $400-$190 -$10 |
| 880 | 873 | ffe8 0272 = -$18, $400-$190 -$18 + $1a */ |
| 881 | 874 | |
| 882 | x_0 += 0x10 - | |
| 875 | x_0 += 0x10 - m_global_offsets->tilemap_offs[flip ? 1 : 0]; | |
| 883 | 876 | y_0 -= (256 - vis_dimy)/2; |
| 884 | 877 | if (flip) |
| 885 | 878 | { |
| r20977 | r20978 | |
| 887 | 880 | y_0 = y_0 - vis_dimy; |
| 888 | 881 | } |
| 889 | 882 | |
| 890 | state->m_tilemap_0->set_scrollx(0, x_0); | |
| 891 | state->m_tilemap_1->set_scrollx(0, x_0); | |
| 892 | state->m_tilemap_0->set_scrolly(0, y_0); | |
| 893 | state->m_tilemap_1->set_scrolly(0, y_0); | |
| 883 | m_tilemap_0->set_scrollx(0, x_0); | |
| 884 | m_tilemap_1->set_scrollx(0, x_0); | |
| 885 | m_tilemap_0->set_scrolly(0, y_0); | |
| 886 | m_tilemap_1->set_scrolly(0, y_0); | |
| 894 | 887 | |
| 895 | if ( | |
| 888 | if (m_tilemap_2) | |
| 896 | 889 | { |
| 897 | x_1 = state->m_vctrl_2[ 0/2 ]; | |
| 898 | y_1 = state->m_vctrl_2[ 2/2 ]; | |
| 899 | enab_1 = state->m_vctrl_2[ 4/2 ]; | |
| 890 | x_1 = m_vctrl_2[ 0/2 ]; | |
| 891 | y_1 = m_vctrl_2[ 2/2 ]; | |
| 892 | enab_1 = m_vctrl_2[ 4/2 ]; | |
| 900 | 893 | |
| 901 | state->m_tilemap_2->enable((!(enab_1 & 0x0008)) /*&& (enab_1 & 0x0001)*/ ); | |
| 902 | state->m_tilemap_3->enable(( (enab_1 & 0x0008)) /*&& (enab_1 & 0x0001)*/ ); | |
| 894 | m_tilemap_2->enable((!(enab_1 & 0x0008)) /*&& (enab_1 & 0x0001)*/ ); | |
| 895 | m_tilemap_3->enable(( (enab_1 & 0x0008)) /*&& (enab_1 & 0x0001)*/ ); | |
| 903 | 896 | |
| 904 | x_1 += 0x10 - | |
| 897 | x_1 += 0x10 - m_global_offsets->tilemap_offs[flip ? 1 : 0]; | |
| 905 | 898 | y_1 -= (256 - vis_dimy)/2; |
| 906 | 899 | if (flip) |
| 907 | 900 | { |
| r20977 | r20978 | |
| 909 | 902 | y_1 = y_1 - vis_dimy; |
| 910 | 903 | } |
| 911 | 904 | |
| 912 | state->m_tilemap_2->set_scrollx(0, x_1); | |
| 913 | state->m_tilemap_3->set_scrollx(0, x_1); | |
| 914 | state->m_tilemap_2->set_scrolly(0, y_1); | |
| 915 | state->m_tilemap_3->set_scrolly(0, y_1); | |
| 905 | m_tilemap_2->set_scrollx(0, x_1); | |
| 906 | m_tilemap_3->set_scrollx(0, x_1); | |
| 907 | m_tilemap_2->set_scrolly(0, y_1); | |
| 908 | m_tilemap_3->set_scrolly(0, y_1); | |
| 916 | 909 | |
| 917 | order = | |
| 910 | order = m_vregs[ 2/2 ]; | |
| 918 | 911 | } |
| 919 | 912 | |
| 920 | 913 | |
| r20977 | r20978 | |
| 926 | 919 | if (screen.machine().input().code_pressed(KEYCODE_A)) msk |= 8; |
| 927 | 920 | if (msk != 0) layers_ctrl &= msk; |
| 928 | 921 | |
| 929 | if ( | |
| 922 | if (m_tilemap_2) | |
| 930 | 923 | popmessage("VR:%04X-%04X-%04X L0:%04X L1:%04X", |
| 931 | state->m_vregs[0], state->m_vregs[1], state->m_vregs[2], state->m_vctrl_0[4/2], state->m_vctrl_2[4/2]); | |
| 932 | else if (state->m_tilemap_0) popmessage("L0:%04X", state->m_vctrl_0[4/2]); | |
| 924 | m_vregs[0], m_vregs[1], m_vregs[2], m_vctrl_0[4/2], m_vctrl_2[4/2]); | |
| 925 | else if (m_tilemap_0) popmessage("L0:%04X", m_vctrl_0[4/2]); | |
| 933 | 926 | } |
| 934 | 927 | #endif |
| 935 | 928 | |
| r20977 | r20978 | |
| 937 | 930 | |
| 938 | 931 | if (order & 1) // swap the layers? |
| 939 | 932 | { |
| 940 | if ( | |
| 933 | if (m_tilemap_2) | |
| 941 | 934 | { |
| 942 | if (layers_ctrl & 2) state->m_tilemap_2->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 943 | if (layers_ctrl & 2) state->m_tilemap_3->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 935 | if (layers_ctrl & 2) m_tilemap_2->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 936 | if (layers_ctrl & 2) m_tilemap_3->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 944 | 937 | } |
| 945 | 938 | |
| 946 | 939 | if (order & 2) // layer-sprite priority? |
| r20977 | r20978 | |
| 952 | 945 | popmessage("Missing palette effect. Contact MAMETesters."); |
| 953 | 946 | } |
| 954 | 947 | |
| 955 | if (layers_ctrl & 1) state->m_tilemap_0->draw(bitmap, cliprect, 0, 0); | |
| 956 | if (layers_ctrl & 1) state->m_tilemap_1->draw(bitmap, cliprect, 0, 0); | |
| 948 | if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, 0, 0); | |
| 949 | if (layers_ctrl & 1) m_tilemap_1->draw(bitmap, cliprect, 0, 0); | |
| 957 | 950 | } |
| 958 | 951 | else |
| 959 | 952 | { |
| r20977 | r20978 | |
| 962 | 955 | popmessage("Missing palette effect. Contact MAMETesters."); |
| 963 | 956 | } |
| 964 | 957 | |
| 965 | if (layers_ctrl & 1) state->m_tilemap_0->draw(bitmap, cliprect, 0, 0); | |
| 966 | if (layers_ctrl & 1) state->m_tilemap_1->draw(bitmap, cliprect, 0, 0); | |
| 958 | if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, 0, 0); | |
| 959 | if (layers_ctrl & 1) m_tilemap_1->draw(bitmap, cliprect, 0, 0); | |
| 967 | 960 | |
| 968 | if (layers_ctrl & 8) | |
| 961 | if (layers_ctrl & 8) machine().device<seta001_device>("spritegen")->seta001_draw_sprites(screen.machine(),bitmap,cliprect,sprite_bank_size, sprite_setac); | |
| 969 | 962 | } |
| 970 | 963 | } |
| 971 | 964 | else |
| 972 | 965 | { |
| 973 | if (layers_ctrl & 1) state->m_tilemap_0->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 974 | if (layers_ctrl & 1) state->m_tilemap_1->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 966 | if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 967 | if (layers_ctrl & 1) m_tilemap_1->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); | |
| 975 | 968 | |
| 976 | 969 | if (order & 2) // layer-sprite priority? |
| 977 | 970 | { |
| 978 | if (layers_ctrl & 8) | |
| 971 | if (layers_ctrl & 8) machine().device<seta001_device>("spritegen")->seta001_draw_sprites(screen.machine(),bitmap,cliprect,sprite_bank_size, sprite_setac); | |
| 979 | 972 | |
| 980 | if((order & 4) && | |
| 973 | if((order & 4) && m_paletteram2 != NULL) | |
| 981 | 974 | { |
| 982 | if( | |
| 975 | if(m_tilemap_2->enabled()) | |
| 983 | 976 | { |
| 984 | draw_tilemap_palette_effect( | |
| 977 | draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap_2, x_1, y_1, 2 + ((m_vctrl_2[ 4/2 ] & 0x10) >> m_color_mode_shift), flip); | |
| 985 | 978 | } |
| 986 | 979 | else |
| 987 | 980 | { |
| 988 | draw_tilemap_palette_effect( | |
| 981 | draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap_3, x_1, y_1, 2 + ((m_vctrl_2[ 4/2 ] & 0x10) >> m_color_mode_shift), flip); | |
| 989 | 982 | } |
| 990 | 983 | } |
| 991 | 984 | else |
| r20977 | r20978 | |
| 995 | 988 | popmessage("Missing palette effect. Contact MAMETesters."); |
| 996 | 989 | } |
| 997 | 990 | |
| 998 | if ( | |
| 991 | if (m_tilemap_2) | |
| 999 | 992 | { |
| 1000 | if (layers_ctrl & 2) state->m_tilemap_2->draw(bitmap, cliprect, 0, 0); | |
| 1001 | if (layers_ctrl & 2) state->m_tilemap_3->draw(bitmap, cliprect, 0, 0); | |
| 993 | if (layers_ctrl & 2) m_tilemap_2->draw(bitmap, cliprect, 0, 0); | |
| 994 | if (layers_ctrl & 2) m_tilemap_3->draw(bitmap, cliprect, 0, 0); | |
| 1002 | 995 | } |
| 1003 | 996 | } |
| 1004 | 997 | } |
| 1005 | 998 | else |
| 1006 | 999 | { |
| 1007 | if((order & 4) && | |
| 1000 | if((order & 4) && m_paletteram2 != NULL) | |
| 1008 | 1001 | { |
| 1009 | if( | |
| 1002 | if(m_tilemap_2->enabled()) | |
| 1010 | 1003 | { |
| 1011 | draw_tilemap_palette_effect( | |
| 1004 | draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap_2, x_1, y_1, 2 + ((m_vctrl_2[ 4/2 ] & 0x10) >> m_color_mode_shift), flip); | |
| 1012 | 1005 | } |
| 1013 | 1006 | else |
| 1014 | 1007 | { |
| 1015 | draw_tilemap_palette_effect( | |
| 1008 | draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap_3, x_1, y_1, 2 + ((m_vctrl_2[ 4/2 ] & 0x10) >> m_color_mode_shift), flip); | |
| 1016 | 1009 | } |
| 1017 | 1010 | } |
| 1018 | 1011 | else |
| r20977 | r20978 | |
| 1022 | 1015 | popmessage("Missing palette effect. Contact MAMETesters."); |
| 1023 | 1016 | } |
| 1024 | 1017 | |
| 1025 | if ( | |
| 1018 | if (m_tilemap_2) | |
| 1026 | 1019 | { |
| 1027 | if (layers_ctrl & 2) state->m_tilemap_2->draw(bitmap, cliprect, 0, 0); | |
| 1028 | if (layers_ctrl & 2) state->m_tilemap_3->draw(bitmap, cliprect, 0, 0); | |
| 1020 | if (layers_ctrl & 2) m_tilemap_2->draw(bitmap, cliprect, 0, 0); | |
| 1021 | if (layers_ctrl & 2) m_tilemap_3->draw(bitmap, cliprect, 0, 0); | |
| 1029 | 1022 | } |
| 1030 | 1023 | } |
| 1031 | 1024 | |
| 1032 | if (layers_ctrl & 8) | |
| 1025 | if (layers_ctrl & 8) machine().device<seta001_device>("spritegen")->seta001_draw_sprites(screen.machine(),bitmap,cliprect,sprite_bank_size, sprite_setac); | |
| 1033 | 1026 | } |
| 1034 | 1027 | } |
| 1035 | 1028 | |
| r20977 | r20978 | |
| 1065 | 1058 | |
| 1066 | 1059 | UINT32 seta_state::screen_update_seta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1067 | 1060 | { |
| 1068 | set_pens( | |
| 1061 | set_pens(); | |
| 1069 | 1062 | return screen_update_seta_layers(screen, bitmap, cliprect); |
| 1070 | 1063 | } |
| 1071 | 1064 | |
| 1072 | 1065 | |
| 1073 | 1066 | UINT32 seta_state::screen_update_usclssic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1074 | 1067 | { |
| 1075 | usclssic_set_pens( | |
| 1068 | usclssic_set_pens(); | |
| 1076 | 1069 | return screen_update_seta_layers(screen, bitmap, cliprect); |
| 1077 | 1070 | } |
| 1078 | 1071 |
| r20977 | r20978 | |
|---|---|---|
| 176 | 176 | ***************************************************************************/ |
| 177 | 177 | |
| 178 | 178 | /* the sprite generator IC is the same as Mappy */ |
| 179 | ||
| 179 | void skykid_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 180 | 180 | { |
| 181 | skykid_state *state = machine.driver_data<skykid_state>(); | |
| 182 | UINT8 *spriteram = state->m_spriteram + 0x780; | |
| 181 | UINT8 *spriteram = m_spriteram + 0x780; | |
| 183 | 182 | UINT8 *spriteram_2 = spriteram + 0x0800; |
| 184 | 183 | UINT8 *spriteram_3 = spriteram_2 + 0x0800; |
| 185 | 184 | int offs; |
| r20977 | r20978 | |
| 204 | 203 | sprite &= ~sizex; |
| 205 | 204 | sprite &= ~(sizey << 1); |
| 206 | 205 | |
| 207 | if ( | |
| 206 | if (flip_screen()) | |
| 208 | 207 | { |
| 209 | 208 | flipx ^= 1; |
| 210 | 209 | flipy ^= 1; |
| r20977 | r20978 | |
| 217 | 216 | { |
| 218 | 217 | for (x = 0;x <= sizex;x++) |
| 219 | 218 | { |
| 220 | drawgfx_transmask(bitmap,cliprect,machine.gfx[2], | |
| 219 | drawgfx_transmask(bitmap,cliprect,machine().gfx[2], | |
| 221 | 220 | sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], |
| 222 | 221 | color, |
| 223 | 222 | flipx,flipy, |
| 224 | 223 | sx + 16*x,sy + 16*y, |
| 225 | colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0xff)); | |
| 224 | colortable_get_transpen_mask(machine().colortable, machine().gfx[2], color, 0xff)); | |
| 226 | 225 | } |
| 227 | 226 | } |
| 228 | 227 | } |
| r20977 | r20978 | |
| 252 | 251 | // draw low priority tiles |
| 253 | 252 | m_tx_tilemap->draw(bitmap, cliprect, pri, 0); |
| 254 | 253 | |
| 255 | draw_sprites( | |
| 254 | draw_sprites(bitmap, cliprect); | |
| 256 | 255 | |
| 257 | 256 | // draw the other tiles |
| 258 | 257 | for (cat = 0; cat < 0xf; cat++) |
| r20977 | r20978 | |
| 260 | 259 | } |
| 261 | 260 | else |
| 262 | 261 | { |
| 263 | draw_sprites( | |
| 262 | draw_sprites(bitmap, cliprect); | |
| 264 | 263 | m_tx_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_ALL_CATEGORIES, 0); |
| 265 | 264 | } |
| 266 | 265 |
| r20977 | r20978 | |
|---|---|---|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | ||
| 31 | void sprint8_state::set_pens(sprint8_state *state, colortable_t *colortable) | |
| 32 | 32 | { |
| 33 | 33 | int i; |
| 34 | 34 | |
| 35 | 35 | for (i = 0; i < 0x10; i += 8) |
| 36 | 36 | { |
| 37 | if (* | |
| 37 | if (*m_team & 1) | |
| 38 | 38 | { |
| 39 | 39 | colortable_palette_set_color(colortable, i + 0, MAKE_RGB(0xff, 0x00, 0x00)); /* red */ |
| 40 | 40 | colortable_palette_set_color(colortable, i + 1, MAKE_RGB(0x00, 0x00, 0xff)); /* blue */ |
| r20977 | r20978 | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | ||
| 127 | void sprint8_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 128 | 128 | { |
| 129 | sprint8_state *state = machine.driver_data<sprint8_state>(); | |
| 130 | 129 | int i; |
| 131 | 130 | |
| 132 | 131 | for (i = 0; i < 16; i++) |
| 133 | 132 | { |
| 134 | UINT8 code = | |
| 133 | UINT8 code = m_pos_d_ram[i]; | |
| 135 | 134 | |
| 136 | int x = state->m_pos_h_ram[i]; | |
| 137 | int y = state->m_pos_v_ram[i]; | |
| 135 | int x = m_pos_h_ram[i]; | |
| 136 | int y = m_pos_v_ram[i]; | |
| 138 | 137 | |
| 139 | 138 | if (code & 0x80) |
| 140 | 139 | x |= 0x100; |
| 141 | 140 | |
| 142 | drawgfx_transpen(bitmap, cliprect, machine.gfx[2], | |
| 141 | drawgfx_transpen(bitmap, cliprect, machine().gfx[2], | |
| 143 | 142 | code ^ 7, |
| 144 | 143 | i, |
| 145 | 144 | !(code & 0x10), !(code & 0x08), |
| r20977 | r20978 | |
| 150 | 149 | |
| 151 | 150 | TIMER_CALLBACK_MEMBER(sprint8_state::sprint8_collision_callback) |
| 152 | 151 | { |
| 153 | sprint8_set_collision( | |
| 152 | sprint8_set_collision(param); | |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | |
| r20977 | r20978 | |
| 158 | 157 | { |
| 159 | 158 | set_pens(this, machine().colortable); |
| 160 | 159 | m_tilemap1->draw(bitmap, cliprect, 0, 0); |
| 161 | draw_sprites( | |
| 160 | draw_sprites(bitmap, cliprect); | |
| 162 | 161 | return 0; |
| 163 | 162 | } |
| 164 | 163 | |
| r20977 | r20978 | |
| 176 | 175 | |
| 177 | 176 | m_helper1.fill(0x20, visarea); |
| 178 | 177 | |
| 179 | draw_sprites(m | |
| 178 | draw_sprites(m_helper1, visarea); | |
| 180 | 179 | |
| 181 | 180 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 182 | 181 | { |
| r20977 | r20978 | |
|---|---|---|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | void rf2_set_layer_banks( | |
| 26 | void seibuspi_state::rf2_set_layer_banks(int banks) | |
| 27 | 27 | { |
| 28 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 29 | if (state->m_rf2_layer_bank[0] != BIT(banks,0)) | |
| 28 | if (m_rf2_layer_bank[0] != BIT(banks,0)) | |
| 30 | 29 | { |
| 31 | state->m_rf2_layer_bank[0] = BIT(banks,0); | |
| 32 | state->m_back_layer->mark_all_dirty(); | |
| 30 | m_rf2_layer_bank[0] = BIT(banks,0); | |
| 31 | m_back_layer->mark_all_dirty(); | |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | if ( | |
| 34 | if (m_rf2_layer_bank[1] != BIT(banks,1)) | |
| 36 | 35 | { |
| 37 | state->m_rf2_layer_bank[1] = BIT(banks,1); | |
| 38 | state->m_mid_layer->mark_all_dirty(); | |
| 36 | m_rf2_layer_bank[1] = BIT(banks,1); | |
| 37 | m_mid_layer->mark_all_dirty(); | |
| 39 | 38 | } |
| 40 | 39 | |
| 41 | if ( | |
| 40 | if (m_rf2_layer_bank[2] != BIT(banks,2)) | |
| 42 | 41 | { |
| 43 | state->m_rf2_layer_bank[2] = BIT(banks,2); | |
| 44 | state->m_fore_layer->mark_all_dirty(); | |
| 42 | m_rf2_layer_bank[2] = BIT(banks,2); | |
| 43 | m_fore_layer->mark_all_dirty(); | |
| 45 | 44 | } |
| 46 | 45 | } |
| 47 | 46 | |
| r20977 | r20978 | |
| 209 | 208 | COMBINE_DATA( &m_video_dma_address ); |
| 210 | 209 | } |
| 211 | 210 | |
| 212 | static void drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy) | |
| 213 | { | |
| 214 | seibuspi_state *state = gfx->machine().driver_data<seibuspi_state>(); | |
| 211 | void seibuspi_state::drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy) | |
| 212 | { | |
| 215 | 213 | const pen_t *pens = &gfx->machine().pens[gfx->colorbase()]; |
| 216 | 214 | const UINT8 *dp; |
| 217 | 215 | int i, j; |
| r20977 | r20978 | |
| 298 | 296 | for (j=y1; j <= y2; j++) |
| 299 | 297 | { |
| 300 | 298 | UINT32 *p = &bitmap.pix32(j); |
| 301 | UINT8 trans_pen = (1 << | |
| 299 | UINT8 trans_pen = (1 << m_sprite_bpp) - 1; | |
| 302 | 300 | int dp_i = (py * width) + px; |
| 303 | 301 | py += yd; |
| 304 | 302 | |
| r20977 | r20978 | |
| 307 | 305 | UINT8 pen = dp[dp_i]; |
| 308 | 306 | if (pen != trans_pen) |
| 309 | 307 | { |
| 310 | int global_pen = pen + (color << state->m_sprite_bpp); | |
| 311 | UINT8 alpha = state->m_alpha_table[global_pen]; | |
| 308 | int global_pen = pen + (color << m_sprite_bpp); | |
| 309 | UINT8 alpha = m_alpha_table[global_pen]; | |
| 312 | 310 | if (alpha) |
| 313 | 311 | { |
| 314 | 312 | p[i] = alpha_blend_r32(p[i], pens[global_pen], 0x7f); |
| r20977 | r20978 | |
| 334 | 332 | { 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 } |
| 335 | 333 | }; |
| 336 | 334 | |
| 337 | ||
| 335 | void seibuspi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri_mask) | |
| 338 | 336 | { |
| 339 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 340 | 337 | INT16 xpos, ypos; |
| 341 | 338 | int tile_num, color; |
| 342 | 339 | int width, height; |
| r20977 | r20978 | |
| 344 | 341 | int a; |
| 345 | 342 | int priority; |
| 346 | 343 | int x,y, x1, y1; |
| 347 | gfx_element *gfx = machine.gfx[2]; | |
| 344 | gfx_element *gfx = machine().gfx[2]; | |
| 348 | 345 | |
| 349 | if( | |
| 346 | if( m_layer_enable & 0x10 ) | |
| 350 | 347 | return; |
| 351 | 348 | |
| 352 | for( a = (state->m_sprite_dma_length / 4) - 2; a >= 0; a -= 2 ) { | |
| 353 | tile_num = (state->m_sprite_ram[a + 0] >> 16) & 0xffff; | |
| 354 | if( state->m_sprite_ram[a + 1] & 0x1000 ) | |
| 349 | for( a = (m_sprite_dma_length / 4) - 2; a >= 0; a -= 2 ) { | |
| 350 | tile_num = (m_sprite_ram[a + 0] >> 16) & 0xffff; | |
| 351 | if( m_sprite_ram[a + 1] & 0x1000 ) | |
| 355 | 352 | tile_num |= 0x10000; |
| 356 | 353 | |
| 357 | 354 | if( !tile_num ) |
| 358 | 355 | continue; |
| 359 | 356 | |
| 360 | priority = ( | |
| 357 | priority = (m_sprite_ram[a + 0] >> 6) & 0x3; | |
| 361 | 358 | if( pri_mask != priority ) |
| 362 | 359 | continue; |
| 363 | 360 | |
| 364 | xpos = | |
| 361 | xpos = m_sprite_ram[a + 1] & 0x3ff; | |
| 365 | 362 | if( xpos & 0x200 ) |
| 366 | 363 | xpos |= 0xfc00; |
| 367 | ypos = ( | |
| 364 | ypos = (m_sprite_ram[a + 1] >> 16) & 0x1ff; | |
| 368 | 365 | if( ypos & 0x100 ) |
| 369 | 366 | ypos |= 0xfe00; |
| 370 | color = ( | |
| 367 | color = (m_sprite_ram[a + 0] & 0x3f); | |
| 371 | 368 | |
| 372 | width = ((state->m_sprite_ram[a + 0] >> 8) & 0x7) + 1; | |
| 373 | height = ((state->m_sprite_ram[a + 0] >> 12) & 0x7) + 1; | |
| 374 | flip_x = (state->m_sprite_ram[a + 0] >> 11) & 0x1; | |
| 375 | flip_y = (state->m_sprite_ram[a + 0] >> 15) & 0x1; | |
| 369 | width = ((m_sprite_ram[a + 0] >> 8) & 0x7) + 1; | |
| 370 | height = ((m_sprite_ram[a + 0] >> 12) & 0x7) + 1; | |
| 371 | flip_x = (m_sprite_ram[a + 0] >> 11) & 0x1; | |
| 372 | flip_y = (m_sprite_ram[a + 0] >> 15) & 0x1; | |
| 376 | 373 | x1 = 0; |
| 377 | 374 | y1 = 0; |
| 378 | 375 | |
| r20977 | r20978 | |
| 520 | 517 | } |
| 521 | 518 | |
| 522 | 519 | #ifdef UNUSED_FUNCTION |
| 523 | ||
| 520 | void seibuspi_state::set_rowscroll(tilemap_t *layer, int scroll, INT16* rows) | |
| 524 | 521 | { |
| 525 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 526 | 522 | int i; |
| 527 | int x = state->m_spi_scrollram[scroll] & 0xffff; | |
| 528 | int y = (state->m_spi_scrollram[scroll] >> 16) & 0xffff; | |
| 523 | int x = m_spi_scrollram[scroll] & 0xffff; | |
| 524 | int y = (m_spi_scrollram[scroll] >> 16) & 0xffff; | |
| 529 | 525 | layer->set_scroll_rows(512); |
| 530 | 526 | for( i=0; i < 512; i++ ) { |
| 531 | 527 | layer->set_scrollx(i, x + rows[i]); |
| r20977 | r20978 | |
| 533 | 529 | layer->set_scrolly(0, y); |
| 534 | 530 | } |
| 535 | 531 | |
| 536 | ||
| 532 | void seibuspi_state::set_scroll(tilemap_t *layer, int scroll) | |
| 537 | 533 | { |
| 538 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 539 | int x = state->m_spi_scrollram[scroll] & 0xffff; | |
| 540 | int y = (state->m_spi_scrollram[scroll] >> 16) & 0xffff; | |
| 534 | int x = m_spi_scrollram[scroll] & 0xffff; | |
| 535 | int y = (m_spi_scrollram[scroll] >> 16) & 0xffff; | |
| 541 | 536 | layer->set_scrollx(0, x); |
| 542 | 537 | layer->set_scrolly(0, y); |
| 543 | 538 | } |
| 544 | 539 | #endif |
| 545 | 540 | |
| 546 | 541 | |
| 547 | ||
| 542 | void seibuspi_state::combine_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tile, int x, int y, int opaque, INT16 *rowscroll) | |
| 548 | 543 | { |
| 549 | seibuspi_state *state = machine.driver_data<seibuspi_state>(); | |
| 550 | 544 | int i,j; |
| 551 | 545 | UINT16 *s; |
| 552 | 546 | UINT32 *d; |
| r20977 | r20978 | |
| 574 | 568 | if (opaque || (t[i & xscroll_mask] & (TILEMAP_PIXEL_LAYER0 | TILEMAP_PIXEL_LAYER1))) |
| 575 | 569 | { |
| 576 | 570 | UINT16 pen = s[i & xscroll_mask]; |
| 577 | UINT8 alpha = | |
| 571 | UINT8 alpha = m_alpha_table[pen]; | |
| 578 | 572 | if (alpha) |
| 579 | 573 | { |
| 580 | *d = alpha_blend_r32(*d, machine.pens[pen], 0x7f); | |
| 574 | *d = alpha_blend_r32(*d, machine().pens[pen], 0x7f); | |
| 581 | 575 | } |
| 582 | 576 | else |
| 583 | 577 | { |
| 584 | *d = machine.pens[pen]; | |
| 578 | *d = machine().pens[pen]; | |
| 585 | 579 | } |
| 586 | 580 | } |
| 587 | 581 | ++d; |
| r20977 | r20978 | |
| 608 | 602 | bitmap.fill(0, cliprect); |
| 609 | 603 | |
| 610 | 604 | if (!(m_layer_enable & 0x1)) |
| 611 | combine_tilemap( | |
| 605 | combine_tilemap(bitmap, cliprect, m_back_layer, m_spi_scrollram[0] & 0xffff, (m_spi_scrollram[0] >> 16) & 0xffff, 1, back_rowscroll); | |
| 612 | 606 | |
| 613 | draw_sprites( | |
| 607 | draw_sprites(bitmap, cliprect, 0); | |
| 614 | 608 | |
| 615 | 609 | // if fore layer is enabled, draw priority 1 sprites behind mid layer |
| 616 | 610 | if (!(m_layer_enable & 0x4)) |
| 617 | draw_sprites( | |
| 611 | draw_sprites(bitmap, cliprect, 1); | |
| 618 | 612 | |
| 619 | 613 | if (!(m_layer_enable & 0x2)) |
| 620 | combine_tilemap( | |
| 614 | combine_tilemap(bitmap, cliprect, m_mid_layer, m_spi_scrollram[1] & 0xffff, (m_spi_scrollram[1] >> 16) & 0xffff, 0, mid_rowscroll); | |
| 621 | 615 | |
| 622 | 616 | // if fore layer is disabled, draw priority 1 sprites above mid layer |
| 623 | 617 | if ((m_layer_enable & 0x4)) |
| 624 | draw_sprites( | |
| 618 | draw_sprites(bitmap, cliprect, 1); | |
| 625 | 619 | |
| 626 | draw_sprites( | |
| 620 | draw_sprites(bitmap, cliprect, 2); | |
| 627 | 621 | |
| 628 | 622 | if (!(m_layer_enable & 0x4)) |
| 629 | combine_tilemap( | |
| 623 | combine_tilemap(bitmap, cliprect, m_fore_layer, m_spi_scrollram[2] & 0xffff, (m_spi_scrollram[2] >> 16) & 0xffff, 0, fore_rowscroll); | |
| 630 | 624 | |
| 631 | draw_sprites( | |
| 625 | draw_sprites(bitmap, cliprect, 3); | |
| 632 | 626 | |
| 633 | combine_tilemap( | |
| 627 | combine_tilemap(bitmap, cliprect, m_text_layer, 0, 0, 0, NULL); | |
| 634 | 628 | return 0; |
| 635 | 629 | } |
| 636 | 630 | |
| r20977 | r20978 | |
| 655 | 649 | UINT32 seibuspi_state::screen_update_sys386f2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 656 | 650 | { |
| 657 | 651 | bitmap.fill(0, cliprect); |
| 658 | draw_sprites(machine(), bitmap, cliprect, 0); | |
| 659 | draw_sprites(machine(), bitmap, cliprect, 1); | |
| 660 | draw_sprites(machine(), bitmap, cliprect, 2); | |
| 661 | draw_sprites(machine(), bitmap, cliprect, 3); | |
| 652 | draw_sprites(bitmap, cliprect, 0); | |
| 653 | draw_sprites(bitmap, cliprect, 1); | |
| 654 | draw_sprites(bitmap, cliprect, 2); | |
| 655 | draw_sprites(bitmap, cliprect, 3); | |
| 662 | 656 | return 0; |
| 663 | 657 | } |
| r20977 | r20978 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | /* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ |
| 9 | ||
| 9 | void skns_state::suprnova_draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram) | |
| 10 | 10 | { |
| 11 | 11 | //bitmap_ind16 *destbitmap = bitmap; |
| 12 | 12 | bitmap_ind16 &srcbitmap = tmap->pixmap(); |
| r20977 | r20978 | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
| 220 | ||
| 220 | void skns_state::palette_set_rgb_brightness (int offset, UINT8 brightness_r, UINT8 brightness_g, UINT8 brightness_b) | |
| 221 | 221 | { |
| 222 | skns_state *state = machine.driver_data<skns_state>(); | |
| 223 | 222 | int use_bright, r, g, b/*, alpha*/; |
| 224 | 223 | |
| 225 | b = ((state->m_palette_ram[offset] >> 0 ) & 0x1f); | |
| 226 | g = ((state->m_palette_ram[offset] >> 5 ) & 0x1f); | |
| 227 | r = ((state->m_palette_ram[offset] >> 10 ) & 0x1f); | |
| 224 | b = ((m_palette_ram[offset] >> 0 ) & 0x1f); | |
| 225 | g = ((m_palette_ram[offset] >> 5 ) & 0x1f); | |
| 226 | r = ((m_palette_ram[offset] >> 10 ) & 0x1f); | |
| 228 | 227 | |
| 229 | //alpha = (( | |
| 228 | //alpha = ((m_palette_ram[offset] >> 15 ) & 0x1); | |
| 230 | 229 | |
| 231 | 230 | if(offset<(0x40*256)) { // 1st half is for Sprites |
| 232 | use_bright = | |
| 231 | use_bright = m_use_spc_bright; | |
| 233 | 232 | } else { // V3 bg's |
| 234 | use_bright = | |
| 233 | use_bright = m_use_v3_bright; | |
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | if(use_bright) { |
| r20977 | r20978 | |
| 247 | 246 | r <<= 3; |
| 248 | 247 | } |
| 249 | 248 | |
| 250 | palette_set_color(machine,offset,MAKE_RGB(r,g,b)); | |
| 249 | palette_set_color(machine(),offset,MAKE_RGB(r,g,b)); | |
| 251 | 250 | } |
| 252 | 251 | |
| 253 | 252 | |
| 254 | ||
| 253 | void skns_state::palette_update() | |
| 255 | 254 | { |
| 256 | skns_state *state = machine.driver_data<skns_state>(); | |
| 257 | 255 | int i; |
| 258 | 256 | |
| 259 | if ( | |
| 257 | if (m_palette_updated) | |
| 260 | 258 | { |
| 261 | if( | |
| 259 | if(m_spc_changed) | |
| 262 | 260 | for(i=0; i<=((0x40*256)-1); i++) |
| 263 | palette_set_rgb_brightness ( | |
| 261 | palette_set_rgb_brightness (i, m_bright_spc_r, m_bright_spc_g, m_bright_spc_b); | |
| 264 | 262 | |
| 265 | if( | |
| 263 | if(m_v3_changed) | |
| 266 | 264 | for(i=(0x40*256); i<=((0x80*256)-1); i++) |
| 267 | palette_set_rgb_brightness (machine, i, state->m_bright_v3_r, state->m_bright_v3_g, state->m_bright_v3_b); | |
| 268 | state->m_palette_updated =0; | |
| 265 | palette_set_rgb_brightness (i, m_bright_v3_r, m_bright_v3_g, m_bright_v3_b); | |
| 266 | m_palette_updated =0; | |
| 269 | 267 | } |
| 270 | 268 | } |
| 271 | 269 | |
| r20977 | r20978 | |
| 380 | 378 | m_alt_enable_background = m_alt_enable_sprites = 1; |
| 381 | 379 | } |
| 382 | 380 | |
| 383 | ||
| 381 | void skns_state::supernova_draw_a( bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_flags, const rectangle &cliprect, int tran ) | |
| 384 | 382 | { |
| 385 | skns_state *state = machine.driver_data<skns_state>(); | |
| 386 | int enable_a = (state->m_v3_regs[0x10/4] >> 0) & 0x0001; | |
| 387 | int nowrap_a = (state->m_v3_regs[0x10/4] >> 0) & 0x0004; | |
| 383 | int enable_a = (m_v3_regs[0x10/4] >> 0) & 0x0001; | |
| 384 | int nowrap_a = (m_v3_regs[0x10/4] >> 0) & 0x0004; | |
| 388 | 385 | |
| 389 | 386 | |
| 390 | 387 | UINT32 startx,starty; |
| r20977 | r20978 | |
| 393 | 390 | |
| 394 | 391 | //if(nowrap_a) printf("a\n"); |
| 395 | 392 | |
| 396 | if (enable_a && | |
| 393 | if (enable_a && m_alt_enable_background) | |
| 397 | 394 | { |
| 398 | startx = state->m_v3_regs[0x1c/4]; | |
| 399 | incyy = state->m_v3_regs[0x30/4]&0x7ffff; | |
| 395 | startx = m_v3_regs[0x1c/4]; | |
| 396 | incyy = m_v3_regs[0x30/4]&0x7ffff; | |
| 400 | 397 | if (incyy&0x40000) incyy = incyy-0x80000; // level 3 boss in sengekis |
| 401 | incyx = state->m_v3_regs[0x2c/4]; | |
| 402 | starty = state->m_v3_regs[0x20/4]; | |
| 403 | incxy = state->m_v3_regs[0x28/4]; | |
| 404 | incxx = state->m_v3_regs[0x24/4]&0x7ffff; | |
| 398 | incyx = m_v3_regs[0x2c/4]; | |
| 399 | starty = m_v3_regs[0x20/4]; | |
| 400 | incxy = m_v3_regs[0x28/4]; | |
| 401 | incxx = m_v3_regs[0x24/4]&0x7ffff; | |
| 405 | 402 | if (incxx&0x40000) incxx = incxx-0x80000; |
| 406 | 403 | |
| 407 | columnscroll = ( | |
| 404 | columnscroll = (m_v3_regs[0x0c/4] >> 1) & 0x0001; | |
| 408 | 405 | |
| 409 | suprnova_draw_roz(bitmap,bitmap_flags,cliprect, state->m_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_a, columnscroll, &state->m_v3slc_ram[0]); | |
| 410 | //tilemap_copy_bitmap(bitmap, state->m_tilemap_bitmap_lower, state->m_tilemap_bitmapflags_lower); | |
| 406 | suprnova_draw_roz(bitmap,bitmap_flags,cliprect, m_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_a, columnscroll, &m_v3slc_ram[0]); | |
| 407 | //tilemap_copy_bitmap(bitmap, m_tilemap_bitmap_lower, m_tilemap_bitmapflags_lower); | |
| 411 | 408 | } |
| 412 | 409 | } |
| 413 | 410 | |
| 414 | ||
| 411 | void skns_state::supernova_draw_b( bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_flags, const rectangle &cliprect, int tran ) | |
| 415 | 412 | { |
| 416 | skns_state *state = machine.driver_data<skns_state>(); | |
| 417 | int enable_b = (state->m_v3_regs[0x34/4] >> 0) & 0x0001; | |
| 418 | int nowrap_b = (state->m_v3_regs[0x34/4] >> 0) & 0x0004; | |
| 413 | int enable_b = (m_v3_regs[0x34/4] >> 0) & 0x0001; | |
| 414 | int nowrap_b = (m_v3_regs[0x34/4] >> 0) & 0x0004; | |
| 419 | 415 | |
| 420 | 416 | |
| 421 | 417 | UINT32 startx,starty; |
| r20977 | r20978 | |
| 424 | 420 | |
| 425 | 421 | //if(nowrap_b) printf("b\n"); |
| 426 | 422 | |
| 427 | if (enable_b && | |
| 423 | if (enable_b && m_alt_enable_background) | |
| 428 | 424 | { |
| 429 | startx = state->m_v3_regs[0x40/4]; | |
| 430 | incyy = state->m_v3_regs[0x54/4]&0x7ffff; | |
| 425 | startx = m_v3_regs[0x40/4]; | |
| 426 | incyy = m_v3_regs[0x54/4]&0x7ffff; | |
| 431 | 427 | if (incyy&0x40000) incyy = incyy-0x80000; |
| 432 | incyx = state->m_v3_regs[0x50/4]; | |
| 433 | starty = state->m_v3_regs[0x44/4]; | |
| 434 | incxy = state->m_v3_regs[0x4c/4]; | |
| 435 | incxx = state->m_v3_regs[0x48/4]&0x7ffff; | |
| 428 | incyx = m_v3_regs[0x50/4]; | |
| 429 | starty = m_v3_regs[0x44/4]; | |
| 430 | incxy = m_v3_regs[0x4c/4]; | |
| 431 | incxx = m_v3_regs[0x48/4]&0x7ffff; | |
| 436 | 432 | if (incxx&0x40000) incxx = incxx-0x80000; |
| 437 | columnscroll = (state->m_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll | |
| 438 | suprnova_draw_roz(bitmap,bitmap_flags, cliprect, state->m_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_b, columnscroll, &state->m_v3slc_ram[0x1000/4]); | |
| 433 | columnscroll = (m_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll | |
| 434 | suprnova_draw_roz(bitmap,bitmap_flags, cliprect, m_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_b, columnscroll, &m_v3slc_ram[0x1000/4]); | |
| 439 | 435 | |
| 440 | 436 | //popmessage("%08x %08x %08x %08x %08x %08x", startx, starty, incxx, incyy, incxy, incyx); |
| 441 | 437 | |
| r20977 | r20978 | |
| 444 | 440 | |
| 445 | 441 | UINT32 skns_state::screen_update_skns(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 446 | 442 | { |
| 447 | palette_update( | |
| 443 | palette_update(); | |
| 448 | 444 | |
| 449 | 445 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 450 | 446 | m_tilemap_bitmap_lower.fill(0); |
| r20977 | r20978 | |
| 463 | 459 | //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); |
| 464 | 460 | |
| 465 | 461 | /*if (!supernova_pri_b) { */ |
| 466 | supernova_draw_b(machine(), m_tilemap_bitmap_lower, m_tilemap_bitmapflags_lower, cliprect,tran);// tran = 1; | |
| 467 | supernova_draw_a(machine(), m_tilemap_bitmap_higher,m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; | |
| 462 | supernova_draw_b(m_tilemap_bitmap_lower, m_tilemap_bitmapflags_lower, cliprect,tran);// tran = 1; | |
| 463 | supernova_draw_a(m_tilemap_bitmap_higher,m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; | |
| 468 | 464 | |
| 469 | 465 | { |
| 470 | 466 | int x,y; |
| r20977 | r20978 | |
|---|---|---|
| 84 | 84 | m_foreground->set_transparent_pen(0 ); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | ||
| 87 | void shootout_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ) | |
| 88 | 88 | { |
| 89 | shootout_state *state = machine.driver_data<shootout_state>(); | |
| 90 | UINT8 *spriteram = state->m_spriteram; | |
| 91 | gfx_element *gfx = machine.gfx[1]; | |
| 89 | UINT8 *spriteram = m_spriteram; | |
| 90 | gfx_element *gfx = machine().gfx[1]; | |
| 92 | 91 | const UINT8 *source = spriteram+127*4; |
| 93 | 92 | int count; |
| 94 | 93 | |
| 95 | | |
| 94 | m_bFlicker = !m_bFlicker; | |
| 96 | 95 | |
| 97 | 96 | for( count=0; count<128; count++ ) |
| 98 | 97 | { |
| r20977 | r20978 | |
| 107 | 106 | -------x enable |
| 108 | 107 | */ |
| 109 | 108 | if ( attributes & 0x01 ){ /* visible */ |
| 110 | if( | |
| 109 | if( m_bFlicker || (attributes&0x02)==0 ){ | |
| 111 | 110 | int priority_mask = (attributes&0x08)?0x2:0; |
| 112 | 111 | int sx = (240 - source[2])&0xff; |
| 113 | 112 | int sy = (240 - source[0])&0xff; |
| r20977 | r20978 | |
| 116 | 115 | int flipx = (attributes & 0x04); |
| 117 | 116 | int flipy = 0; |
| 118 | 117 | |
| 119 | if ( | |
| 118 | if (flip_screen()) { | |
| 120 | 119 | flipx = !flipx; |
| 121 | 120 | flipy = !flipy; |
| 122 | 121 | } |
| r20977 | r20978 | |
| 127 | 126 | |
| 128 | 127 | vx = sx; |
| 129 | 128 | vy = sy; |
| 130 | if ( | |
| 129 | if (flip_screen()) { | |
| 131 | 130 | vx = 240 - vx; |
| 132 | 131 | vy = 240 - vy; |
| 133 | 132 | } |
| r20977 | r20978 | |
| 137 | 136 | 0 /*color*/, |
| 138 | 137 | flipx,flipy, |
| 139 | 138 | vx,vy, |
| 140 | machine.priority_bitmap, | |
| 139 | machine().priority_bitmap, | |
| 141 | 140 | priority_mask,0); |
| 142 | 141 | |
| 143 | 142 | number++; |
| r20977 | r20978 | |
| 146 | 145 | |
| 147 | 146 | vx = sx; |
| 148 | 147 | vy = sy; |
| 149 | if ( | |
| 148 | if (flip_screen()) { | |
| 150 | 149 | vx = 240 - vx; |
| 151 | 150 | vy = 240 - vy; |
| 152 | 151 | } |
| r20977 | r20978 | |
| 156 | 155 | 0 /*color*/, |
| 157 | 156 | flipx,flipy, |
| 158 | 157 | vx,vy, |
| 159 | machine.priority_bitmap, | |
| 158 | machine().priority_bitmap, | |
| 160 | 159 | priority_mask,0); |
| 161 | 160 | } |
| 162 | 161 | } |
| r20977 | r20978 | |
| 170 | 169 | |
| 171 | 170 | m_background->draw(bitmap, cliprect, 0,0); |
| 172 | 171 | m_foreground->draw(bitmap, cliprect, 0,1); |
| 173 | draw_sprites( | |
| 172 | draw_sprites(bitmap,cliprect,3/*bank bits */); | |
| 174 | 173 | return 0; |
| 175 | 174 | } |
| 176 | 175 | |
| r20977 | r20978 | |
| 180 | 179 | |
| 181 | 180 | m_background->draw(bitmap, cliprect, 0,0); |
| 182 | 181 | m_foreground->draw(bitmap, cliprect, 0,1); |
| 183 | draw_sprites( | |
| 182 | draw_sprites(bitmap,cliprect,2/*bank bits*/); | |
| 184 | 183 | return 0; |
| 185 | 184 | } |
| r20977 | r20978 | |
|---|---|---|
| 218 | 218 | |
| 219 | 219 | ***************************************************************************/ |
| 220 | 220 | |
| 221 | ||
| 221 | void suna8_state::draw_normal_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int which) | |
| 222 | 222 | { |
| 223 | suna8_state *state = machine.driver_data<suna8_state>(); | |
| 224 | 223 | |
| 225 | UINT8 *spriteram = | |
| 224 | UINT8 *spriteram = m_spriteram + which * 0x2000 * 2; | |
| 226 | 225 | |
| 227 | 226 | int i; |
| 228 | 227 | int mx = 0; // multisprite x counter |
| 229 | 228 | |
| 230 | int max_x = machine.primary_screen->width() - 8; | |
| 231 | int max_y = machine.primary_screen->height() - 8; | |
| 229 | int max_x = machine().primary_screen->width() - 8; | |
| 230 | int max_y = machine().primary_screen->height() - 8; | |
| 232 | 231 | |
| 233 | 232 | for (i = 0x1d00; i < 0x2000; i += 4) |
| 234 | 233 | { |
| r20977 | r20978 | |
| 240 | 239 | int x = spriteram[i + 2]; |
| 241 | 240 | int bank = spriteram[i + 3]; |
| 242 | 241 | |
| 243 | if ( | |
| 242 | if (m_text_dim) | |
| 244 | 243 | { |
| 245 | 244 | // Older, simpler hardware: hardhead, rranger |
| 246 | 245 | flipx = 0; |
| r20977 | r20978 | |
| 292 | 291 | srcy = (((bank & 0x80)>>4) + (bank & 0x04) + ((~bank >> 4)&2)) * 2; |
| 293 | 292 | srcpg = ((code >> 4) & 3) + 4; |
| 294 | 293 | gfxbank = (bank & 0x3); |
| 295 | switch ( | |
| 294 | switch (m_gfxbank_type) | |
| 296 | 295 | { |
| 297 | 296 | case suna8_state::GFXBANK_TYPE_SPARKMAN: |
| 298 | 297 | break; |
| r20977 | r20978 | |
| 314 | 313 | // 70 56/8/a/c 0e 01 (gfxhi=1) |
| 315 | 314 | // 6f 78/a/c/e 0f 04 "" |
| 316 | 315 | if (gfxbank == 3) |
| 317 | gfxbank += | |
| 316 | gfxbank += m_gfxbank; | |
| 318 | 317 | break; |
| 319 | 318 | } |
| 320 | 319 | colorbank = (bank & 8) >> 3; |
| r20977 | r20978 | |
| 328 | 327 | srcy = (((bank & 0x80)>>4) + (bank & 0x04) + ((~bank >> 4)&3)) * 2; |
| 329 | 328 | srcpg = (code >> 4) & 3; |
| 330 | 329 | gfxbank = bank & 0x03; |
| 331 | switch ( | |
| 330 | switch (m_gfxbank_type) | |
| 332 | 331 | { |
| 333 | 332 | case suna8_state::GFXBANK_TYPE_STARFIGH: |
| 334 | 333 | // starfigh: boss 2 tail, p2 g7: |
| 335 | 334 | // 61 20 1b 27 |
| 336 | 335 | if (gfxbank == 3) |
| 337 | gfxbank += | |
| 336 | gfxbank += m_gfxbank; | |
| 338 | 337 | break; |
| 339 | 338 | |
| 340 | 339 | default: |
| r20977 | r20978 | |
| 374 | 373 | if (flipx) tile_flipx = !tile_flipx; |
| 375 | 374 | if (flipy) tile_flipy = !tile_flipy; |
| 376 | 375 | |
| 377 | if ( | |
| 376 | if (flip_screen()) | |
| 378 | 377 | { |
| 379 | 378 | sx = max_x - sx; tile_flipx = !tile_flipx; |
| 380 | 379 | sy = max_y - sy; tile_flipy = !tile_flipy; |
| 381 | 380 | } |
| 382 | 381 | |
| 383 | drawgfx_transpen( bitmap, cliprect, machine.gfx[which], | |
| 382 | drawgfx_transpen( bitmap, cliprect, machine().gfx[which], | |
| 384 | 383 | tile + (attr & 0x3)*0x100 + gfxbank, |
| 385 | (((attr >> 2) & 0xf) | colorbank) + 0x10 * | |
| 384 | (((attr >> 2) & 0xf) | colorbank) + 0x10 * m_palettebank, // hardhea2 player2 | |
| 386 | 385 | tile_flipx, tile_flipy, |
| 387 | 386 | sx, sy, 0xf); |
| 388 | 387 | } |
| r20977 | r20978 | |
| 391 | 390 | } |
| 392 | 391 | } |
| 393 | 392 | |
| 394 | ||
| 393 | void suna8_state::draw_text_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 395 | 394 | { |
| 396 | suna8_state *state = machine.driver_data<suna8_state>(); | |
| 397 | UINT8 *spriteram = state->m_spriteram; | |
| 395 | UINT8 *spriteram = m_spriteram; | |
| 398 | 396 | int i; |
| 399 | 397 | |
| 400 | int max_x = machine.primary_screen->width() - 8; | |
| 401 | int max_y = machine.primary_screen->height() - 8; | |
| 398 | int max_x = machine().primary_screen->width() - 8; | |
| 399 | int max_y = machine().primary_screen->height() - 8; | |
| 402 | 400 | |
| 403 | 401 | for (i = 0x1900; i < 0x19ff; i += 4) |
| 404 | 402 | { |
| r20977 | r20978 | |
| 411 | 409 | |
| 412 | 410 | if (~code & 0x80) continue; |
| 413 | 411 | |
| 414 | dimx = 2; dimy = | |
| 412 | dimx = 2; dimy = m_text_dim; | |
| 415 | 413 | srcx = (code & 0xf) * 2; srcy = (y & 0xf0) / 8; |
| 416 | 414 | srcpg = (code >> 4) & 3; |
| 417 | 415 | |
| r20977 | r20978 | |
| 439 | 437 | int sx = x + tx * 8; |
| 440 | 438 | int sy = (y + real_ty * 8) & 0xff; |
| 441 | 439 | |
| 442 | if ( | |
| 440 | if (flip_screen()) | |
| 443 | 441 | { |
| 444 | 442 | sx = max_x - sx; flipx = !flipx; |
| 445 | 443 | sy = max_y - sy; flipy = !flipy; |
| 446 | 444 | } |
| 447 | 445 | |
| 448 | drawgfx_transpen( bitmap,cliprect,machine.gfx[0], | |
| 446 | drawgfx_transpen( bitmap,cliprect,machine().gfx[0], | |
| 449 | 447 | tile + (attr & 0x3)*0x100 + bank, |
| 450 | 448 | (attr >> 2) & 0xf, |
| 451 | 449 | flipx, flipy, |
| r20977 | r20978 | |
| 501 | 499 | #endif |
| 502 | 500 | { |
| 503 | 501 | // Normal sprites |
| 504 | draw_normal_sprites( | |
| 502 | draw_normal_sprites(bitmap,cliprect, 0); | |
| 505 | 503 | |
| 506 | 504 | // More normal sprites (second sprite "chip" in sparkman) |
| 507 | 505 | if (machine().gfx[1]) |
| 508 | draw_normal_sprites( | |
| 506 | draw_normal_sprites(bitmap,cliprect, 1); | |
| 509 | 507 | |
| 510 | 508 | // Text sprites (earlier games only) |
| 511 | 509 | if (m_text_dim) |
| 512 | draw_text_sprites( | |
| 510 | draw_text_sprites(bitmap,cliprect); | |
| 513 | 511 | } |
| 514 | 512 | return 0; |
| 515 | 513 | } |
| r20977 | r20978 | |
|---|---|---|
| 99 | 99 | #define NUM_STARFIELD_PENS (0x40) |
| 100 | 100 | |
| 101 | 101 | |
| 102 | ||
| 102 | inline void spacefb_state::shift_star_generator(spacefb_state *state) | |
| 103 | 103 | { |
| 104 | | |
| 104 | m_star_shift_reg = ((m_star_shift_reg << 1) | (((~m_star_shift_reg >> 16) & 0x01) ^ ((m_star_shift_reg >> 4) & 0x01))) & 0x1ffff; | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | ||
| 108 | void spacefb_state::get_starfield_pens(spacefb_state *state, pen_t *pens) | |
| 109 | 109 | { |
| 110 | 110 | /* generate the pens based on the various enable bits */ |
| 111 | 111 | int i; |
| 112 | 112 | |
| 113 | int color_contrast_r = state->m_port_2 & 0x01; | |
| 114 | int color_contrast_g = state->m_port_2 & 0x02; | |
| 115 | int color_contrast_b = state->m_port_2 & 0x04; | |
| 116 | int background_red = state->m_port_2 & 0x08; | |
| 117 | int background_blue = state->m_port_2 & 0x10; | |
| 118 | int disable_star_field = state->m_port_2 & 0x80; | |
| 113 | int color_contrast_r = m_port_2 & 0x01; | |
| 114 | int color_contrast_g = m_port_2 & 0x02; | |
| 115 | int color_contrast_b = m_port_2 & 0x04; | |
| 116 | int background_red = m_port_2 & 0x08; | |
| 117 | int background_blue = m_port_2 & 0x10; | |
| 118 | int disable_star_field = m_port_2 & 0x80; | |
| 119 | 119 | |
| 120 | 120 | for (i = 0; i < NUM_STARFIELD_PENS; i++) |
| 121 | 121 | { |
| r20977 | r20978 | |
| 126 | 126 | UINT8 ra = (((i >> 4) & 0x01) || background_red) && !disable_star_field; |
| 127 | 127 | UINT8 rb = ((i >> 5) & 0x01) && color_contrast_r && !disable_star_field; |
| 128 | 128 | |
| 129 | UINT8 r = combine_3_weights(state->m_color_weights_rg, 0, rb, ra); | |
| 130 | UINT8 g = combine_3_weights(state->m_color_weights_rg, 0, gb, ga); | |
| 131 | UINT8 b = combine_2_weights(state->m_color_weights_b, bb, ba); | |
| 129 | UINT8 r = combine_3_weights(m_color_weights_rg, 0, rb, ra); | |
| 130 | UINT8 g = combine_3_weights(m_color_weights_rg, 0, gb, ga); | |
| 131 | UINT8 b = combine_2_weights(m_color_weights_b, bb, ba); | |
| 132 | 132 | |
| 133 | 133 | pens[i] = MAKE_RGB(r, g, b); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | ||
| 138 | void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) | |
| 139 | 139 | { |
| 140 | 140 | spacefb_state *state = screen.machine().driver_data<spacefb_state>(); |
| 141 | 141 | int y; |
| r20977 | r20978 | |
| 162 | 162 | |
| 163 | 163 | for (x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) |
| 164 | 164 | { |
| 165 | if ( | |
| 165 | if (m_object_present_map[(y * bitmap.width()) + x] == 0) | |
| 166 | 166 | { |
| 167 | 167 | /* draw the star - the 4 possible values come from the effect of the two XOR gates */ |
| 168 | if (((state->m_star_shift_reg & 0x1c0ff) == 0x0c0b7) || | |
| 169 | ((state->m_star_shift_reg & 0x1c0ff) == 0x0c0d7) || | |
| 170 | ((state->m_star_shift_reg & 0x1c0ff) == 0x0c0bb) || | |
| 171 | ((state->m_star_shift_reg & 0x1c0ff) == 0x0c0db)) | |
| 172 | bitmap.pix32(y, x) = pens[(state->m_star_shift_reg >> 8) & 0x3f]; | |
| 168 | if (((m_star_shift_reg & 0x1c0ff) == 0x0c0b7) || | |
| 169 | ((m_star_shift_reg & 0x1c0ff) == 0x0c0d7) || | |
| 170 | ((m_star_shift_reg & 0x1c0ff) == 0x0c0bb) || | |
| 171 | ((m_star_shift_reg & 0x1c0ff) == 0x0c0db)) | |
| 172 | bitmap.pix32(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; | |
| 173 | 173 | else |
| 174 | 174 | bitmap.pix32(y, x) = pens[0]; |
| 175 | 175 | } |
| r20977 | r20978 | |
| 204 | 204 | #define NUM_SPRITE_PENS (0x40) |
| 205 | 205 | |
| 206 | 206 | |
| 207 | ||
| 207 | void spacefb_state::get_sprite_pens(pen_t *pens) | |
| 208 | 208 | { |
| 209 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 210 | 209 | static const double fade_weights[] = { 1.0, 1.5, 2.5, 4.0 }; |
| 211 | const UINT8 *prom = machine.root_device().memregion("proms")->base(); | |
| 210 | const UINT8 *prom = machine().root_device().memregion("proms")->base(); | |
| 212 | 211 | int i; |
| 213 | 212 | |
| 214 | 213 | for (i = 0; i < NUM_SPRITE_PENS; i++) |
| 215 | 214 | { |
| 216 | UINT8 data = prom[(( | |
| 215 | UINT8 data = prom[((m_port_0 & 0x40) >> 2) | (i & 0x0f)]; | |
| 217 | 216 | |
| 218 | 217 | UINT8 r0 = (data >> 0) & 0x01; |
| 219 | 218 | UINT8 r1 = (data >> 1) & 0x01; |
| r20977 | r20978 | |
| 226 | 225 | UINT8 b1 = (data >> 6) & 0x01; |
| 227 | 226 | UINT8 b2 = (data >> 7) & 0x01; |
| 228 | 227 | |
| 229 | UINT8 r = combine_3_weights(state->m_color_weights_rg, r0, r1, r2); | |
| 230 | UINT8 g = combine_3_weights(state->m_color_weights_rg, g0, g1, g2); | |
| 231 | UINT8 b = combine_2_weights(state->m_color_weights_b, b1, b2); | |
| 228 | UINT8 r = combine_3_weights(m_color_weights_rg, r0, r1, r2); | |
| 229 | UINT8 g = combine_3_weights(m_color_weights_rg, g0, g1, g2); | |
| 230 | UINT8 b = combine_2_weights(m_color_weights_b, b1, b2); | |
| 232 | 231 | |
| 233 | 232 | if (i >> 4) |
| 234 | 233 | { |
| r20977 | r20978 | |
| 245 | 244 | } |
| 246 | 245 | |
| 247 | 246 | |
| 248 | ||
| 247 | void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) | |
| 249 | 248 | { |
| 250 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 251 | 249 | UINT8 sy; |
| 252 | 250 | |
| 253 | UINT8 *gfx = | |
| 251 | UINT8 *gfx = memregion("gfx2")->base(); | |
| 254 | 252 | |
| 255 | UINT8 code = state->m_videoram[offs + 0x0200] & 0x3f; | |
| 256 | UINT8 y = ~state->m_videoram[offs + 0x0100] - 2; | |
| 253 | UINT8 code = m_videoram[offs + 0x0200] & 0x3f; | |
| 254 | UINT8 y = ~m_videoram[offs + 0x0100] - 2; | |
| 257 | 255 | |
| 258 | 256 | for (sy = 0; sy < 4; sy++) |
| 259 | 257 | { |
| 260 | 258 | UINT8 sx, dy; |
| 261 | 259 | |
| 262 | 260 | UINT8 data = gfx[(code << 2) | sy]; |
| 263 | UINT8 x = | |
| 261 | UINT8 x = m_videoram[offs + 0x0000]; | |
| 264 | 262 | |
| 265 | 263 | if (flip) |
| 266 | 264 | dy = ~y; |
| r20977 | r20978 | |
| 283 | 281 | bitmap.pix32(dy, dx + 0) = pen; |
| 284 | 282 | bitmap.pix32(dy, dx + 1) = pen; |
| 285 | 283 | |
| 286 | state->m_object_present_map[(dy * bitmap.width()) + dx + 0] = 1; | |
| 287 | state->m_object_present_map[(dy * bitmap.width()) + dx + 1] = 1; | |
| 284 | m_object_present_map[(dy * bitmap.width()) + dx + 0] = 1; | |
| 285 | m_object_present_map[(dy * bitmap.width()) + dx + 1] = 1; | |
| 288 | 286 | } |
| 289 | 287 | |
| 290 | 288 | x = x + 1; |
| r20977 | r20978 | |
| 297 | 295 | } |
| 298 | 296 | |
| 299 | 297 | |
| 300 | ||
| 298 | void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) | |
| 301 | 299 | { |
| 302 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 303 | 300 | UINT8 sy; |
| 304 | 301 | |
| 305 | UINT8 *gfx = | |
| 302 | UINT8 *gfx = memregion("gfx1")->base(); | |
| 306 | 303 | |
| 307 | UINT8 code = ~state->m_videoram[offs + 0x0200]; | |
| 308 | UINT8 color_base = (~state->m_videoram[offs + 0x0300] & 0x0f) << 2; | |
| 309 | UINT8 y = ~state->m_videoram[offs + 0x0100] - 2; | |
| 304 | UINT8 code = ~m_videoram[offs + 0x0200]; | |
| 305 | UINT8 color_base = (~m_videoram[offs + 0x0300] & 0x0f) << 2; | |
| 306 | UINT8 y = ~m_videoram[offs + 0x0100] - 2; | |
| 310 | 307 | |
| 311 | 308 | for (sy = 0; sy < 8; sy++) |
| 312 | 309 | { |
| r20977 | r20978 | |
| 315 | 312 | UINT8 data1 = gfx[0x0000 | (code << 3) | (sy ^ 0x07)]; |
| 316 | 313 | UINT8 data2 = gfx[0x0800 | (code << 3) | (sy ^ 0x07)]; |
| 317 | 314 | |
| 318 | UINT8 x = | |
| 315 | UINT8 x = m_videoram[offs + 0x0000] - 3; | |
| 319 | 316 | |
| 320 | 317 | if (flip) |
| 321 | 318 | dy = ~y; |
| r20977 | r20978 | |
| 341 | 338 | bitmap.pix32(dy, dx + 0) = pen; |
| 342 | 339 | bitmap.pix32(dy, dx + 1) = pen; |
| 343 | 340 | |
| 344 | state->m_object_present_map[(dy * bitmap.width()) + dx + 0] = (data != 0); | |
| 345 | state->m_object_present_map[(dy * bitmap.width()) + dx + 1] = (data != 0); | |
| 341 | m_object_present_map[(dy * bitmap.width()) + dx + 0] = (data != 0); | |
| 342 | m_object_present_map[(dy * bitmap.width()) + dx + 1] = (data != 0); | |
| 346 | 343 | |
| 347 | 344 | x = x + 1; |
| 348 | 345 | data1 = data1 >> 1; |
| r20977 | r20978 | |
| 355 | 352 | } |
| 356 | 353 | |
| 357 | 354 | |
| 358 | ||
| 355 | void spacefb_state::draw_objects(bitmap_rgb32 &bitmap, const rectangle &cliprect) | |
| 359 | 356 | { |
| 360 | spacefb_state *state = machine.driver_data<spacefb_state>(); | |
| 361 | 357 | pen_t sprite_pens[NUM_SPRITE_PENS]; |
| 362 | 358 | |
| 363 | offs_t offs = (state->m_port_0 & 0x20) ? 0x80 : 0x00; | |
| 364 | int flip = state->m_port_0 & 0x01; | |
| 359 | offs_t offs = (m_port_0 & 0x20) ? 0x80 : 0x00; | |
| 360 | int flip = m_port_0 & 0x01; | |
| 365 | 361 | |
| 366 | 362 | /* since the way the schematics show the bullet color |
| 367 | 363 | connected is impossible, just use pure red for now */ |
| 368 | 364 | pen_t bullet_pen = MAKE_RGB(0xff, 0x00, 0x00); |
| 369 | 365 | |
| 370 | get_sprite_pens( | |
| 366 | get_sprite_pens(sprite_pens); | |
| 371 | 367 | |
| 372 | memset( | |
| 368 | memset(m_object_present_map, 0, bitmap.width() * bitmap.height()); | |
| 373 | 369 | |
| 374 | 370 | while (1) |
| 375 | 371 | { |
| 376 | if (state->m_videoram[offs + 0x0300] & 0x20) | |
| 377 | draw_bullet(machine, offs, bullet_pen, bitmap, cliprect, flip); | |
| 378 | else if (state->m_videoram[offs + 0x0300] & 0x40) | |
| 379 | draw_sprite(machine, offs, sprite_pens, bitmap, cliprect, flip); | |
| 372 | if (m_videoram[offs + 0x0300] & 0x20) | |
| 373 | draw_bullet(offs, bullet_pen, bitmap, cliprect, flip); | |
| 374 | else if (m_videoram[offs + 0x0300] & 0x40) | |
| 375 | draw_sprite(offs, sprite_pens, bitmap, cliprect, flip); | |
| 380 | 376 | |
| 381 | 377 | /* next object */ |
| 382 | 378 | offs = offs + 1; |
| r20977 | r20978 | |
| 396 | 392 | |
| 397 | 393 | UINT32 spacefb_state::screen_update_spacefb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 398 | 394 | { |
| 399 | draw_objects( | |
| 395 | draw_objects(bitmap, cliprect); | |
| 400 | 396 | draw_starfield(screen, bitmap, cliprect); |
| 401 | 397 | |
| 402 | 398 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 57 | 57 | m_background->mark_tile_dirty(offset&0x7ff ); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | ||
| 60 | void shangkid_state::draw_sprite(const UINT8 *source, bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 61 | 61 | { |
| 62 | shangkid_state *state = machine.driver_data<shangkid_state>(); | |
| 63 | 62 | gfx_element *gfx; |
| 64 | 63 | int transparent_pen; |
| 65 | 64 | int bank_index; |
| r20977 | r20978 | |
| 83 | 82 | if( xsize==0 && xflip ) xpos -= 16; |
| 84 | 83 | if( ysize==0 && yflip==0 ) ypos += 16; |
| 85 | 84 | |
| 86 | if( | |
| 85 | if( m_gfx_type == 1 ) | |
| 87 | 86 | { |
| 88 | 87 | /* Shanghai Kid */ |
| 89 | 88 | switch( bank&0x30 ) |
| r20977 | r20978 | |
| 129 | 128 | transparent_pen = 7; |
| 130 | 129 | } |
| 131 | 130 | |
| 132 | gfx = machine.gfx[1+bank_index]; | |
| 131 | gfx = machine().gfx[1+bank_index]; | |
| 133 | 132 | |
| 134 | 133 | width = (xscale+1)*2; |
| 135 | 134 | height = (yscale+1)*2; |
| r20977 | r20978 | |
| 168 | 167 | } |
| 169 | 168 | } |
| 170 | 169 | |
| 171 | ||
| 170 | void shangkid_state::shangkid_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 172 | 171 | { |
| 173 | shangkid_state *state = machine.driver_data<shangkid_state>(); | |
| 174 | 172 | const UINT8 *source, *finish; |
| 175 | 173 | |
| 176 | finish = state->m_spriteram; | |
| 177 | source = state->m_spriteram+0x200; | |
| 174 | finish = m_spriteram; | |
| 175 | source = m_spriteram+0x200; | |
| 178 | 176 | while( source>finish ){ |
| 179 | 177 | source -= 8; |
| 180 | draw_sprite( | |
| 178 | draw_sprite(source, bitmap,cliprect ); | |
| 181 | 179 | } |
| 182 | 180 | } |
| 183 | 181 | |
| r20977 | r20978 | |
| 189 | 187 | m_background->set_scrolly(0,m_videoreg[2]+0x10 ); |
| 190 | 188 | |
| 191 | 189 | m_background->draw(bitmap, cliprect, 0,0 ); |
| 192 | shangkid_draw_sprites( | |
| 190 | shangkid_draw_sprites(bitmap,cliprect ); | |
| 193 | 191 | m_background->draw(bitmap, cliprect, 1,0 ); /* high priority tiles */ |
| 194 | 192 | return 0; |
| 195 | 193 | } |
| r20977 | r20978 | |
| 231 | 229 | } |
| 232 | 230 | |
| 233 | 231 | |
| 234 | ||
| 232 | void shangkid_state::dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) | |
| 235 | 233 | { |
| 236 | shangkid_state *state = machine.driver_data<shangkid_state>(); | |
| 237 | UINT8 *videoram = state->m_videoram; | |
| 234 | UINT8 *videoram = m_videoram; | |
| 238 | 235 | int i; |
| 239 | 236 | int sx,sy; |
| 240 | 237 | int tile; |
| r20977 | r20978 | |
| 275 | 272 | drawgfx_transpen( |
| 276 | 273 | bitmap, |
| 277 | 274 | cliprect, |
| 278 | machine.gfx[0], | |
| 275 | machine().gfx[0], | |
| 279 | 276 | tile, |
| 280 | 277 | attr & 0x0f, |
| 281 | 278 | 0,0,//xflip,yflip, |
| r20977 | r20978 | |
| 285 | 282 | } |
| 286 | 283 | } |
| 287 | 284 | |
| 288 | ||
| 285 | void shangkid_state::dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 289 | 286 | { |
| 290 | shangkid_state *state = machine.driver_data<shangkid_state>(); | |
| 291 | UINT8 *videoram = state->m_videoram; | |
| 287 | UINT8 *videoram = m_videoram; | |
| 292 | 288 | int i; |
| 293 | 289 | int sx,sy; |
| 294 | 290 | int tile; |
| r20977 | r20978 | |
| 309 | 305 | drawgfx_transpen( |
| 310 | 306 | bitmap, |
| 311 | 307 | cliprect, |
| 312 | machine.gfx[1], | |
| 308 | machine().gfx[1], | |
| 313 | 309 | bank*0x40 + (tile&0x3f), |
| 314 | 310 | color, |
| 315 | 311 | tile&0x80,tile&0x40, /* flipx,flipy */ |
| r20977 | r20978 | |
| 319 | 315 | |
| 320 | 316 | UINT32 shangkid_state::screen_update_dynamski(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 321 | 317 | { |
| 322 | dynamski_draw_background(machine(), bitmap,cliprect, 0 ); | |
| 323 | dynamski_draw_sprites(machine(), bitmap,cliprect ); | |
| 324 | dynamski_draw_background(machine(), bitmap,cliprect, 1 ); | |
| 318 | dynamski_draw_background(bitmap,cliprect, 0 ); | |
| 319 | dynamski_draw_sprites(bitmap,cliprect ); | |
| 320 | dynamski_draw_background(bitmap,cliprect, 1 ); | |
| 325 | 321 | return 0; |
| 326 | 322 | } |
| r20977 | r20978 | |
|---|---|---|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | ||
| 59 | void sderby_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int codeshift) | |
| 60 | 60 | { |
| 61 | sderby_state *state = machine.driver_data<sderby_state>(); | |
| 62 | UINT16 *spriteram16 = state->m_spriteram; | |
| 61 | UINT16 *spriteram16 = m_spriteram; | |
| 63 | 62 | int offs; |
| 64 | int height = machine.gfx[0]->height(); | |
| 65 | int colordiv = machine.gfx[0]->granularity() / 16; | |
| 63 | int height = machine().gfx[0]->height(); | |
| 64 | int colordiv = machine().gfx[0]->granularity() / 16; | |
| 66 | 65 | |
| 67 | for (offs = 4;offs < | |
| 66 | for (offs = 4;offs < m_spriteram.bytes()/2;offs += 4) | |
| 68 | 67 | { |
| 69 | 68 | int sx,sy,code,color,flipx; |
| 70 | 69 | |
| r20977 | r20978 | |
| 77 | 76 | code = spriteram16[offs+2] >> codeshift; |
| 78 | 77 | color = (spriteram16[offs+1] & 0x3e00) >> 9; |
| 79 | 78 | |
| 80 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 79 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 81 | 80 | code, |
| 82 | 81 | color/colordiv+48, |
| 83 | 82 | flipx,0, |
| r20977 | r20978 | |
| 100 | 99 | UINT32 sderby_state::screen_update_sderby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 101 | 100 | { |
| 102 | 101 | m_tilemap->draw(bitmap, cliprect, 0,0); |
| 103 | draw_sprites( | |
| 102 | draw_sprites(bitmap,cliprect,0); | |
| 104 | 103 | m_md_tilemap->draw(bitmap, cliprect, 0,0); |
| 105 | 104 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 106 | 105 | return 0; |
| r20977 | r20978 | |
| 110 | 109 | { |
| 111 | 110 | m_tilemap->draw(bitmap, cliprect, 0,0); |
| 112 | 111 | m_md_tilemap->draw(bitmap, cliprect, 0,0); |
| 113 | draw_sprites( | |
| 112 | draw_sprites(bitmap,cliprect,0); | |
| 114 | 113 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 115 | 114 | return 0; |
| 116 | 115 | } |
| r20977 | r20978 | |
|---|---|---|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | ||
| 55 | void speedspn_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 56 | 56 | { |
| 57 | speedspn_state *state = machine.driver_data<speedspn_state>(); | |
| 58 | gfx_element *gfx = machine.gfx[1]; | |
| 59 | UINT8 *source = state->m_vidram+ 0x1000; | |
| 57 | gfx_element *gfx = machine().gfx[1]; | |
| 58 | UINT8 *source = m_vidram+ 0x1000; | |
| 60 | 59 | UINT8 *finish = source + 0x1000; |
| 61 | 60 | |
| 62 | 61 | while( source<finish ) |
| r20977 | r20978 | |
| 104 | 103 | #endif |
| 105 | 104 | m_tilemap->set_scrollx(0, 0x100); // verify |
| 106 | 105 | m_tilemap->draw(bitmap, cliprect, 0,0); |
| 107 | draw_sprites( | |
| 106 | draw_sprites(bitmap,cliprect); | |
| 108 | 107 | return 0; |
| 109 | 108 | } |
| r20977 | r20978 | |
|---|---|---|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| 227 | ||
| 227 | void ssrj_state::draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 228 | 228 | { |
| 229 | ssrj_state *state = machine.driver_data<ssrj_state>(); | |
| 230 | 229 | int i,j,k,x,y; |
| 231 | 230 | |
| 232 | 231 | for(i=0;i<6;i++) |
| 233 | 232 | { |
| 234 | y = state->m_buffer_spriteram[0x80+20*i]; | |
| 235 | x = state->m_buffer_spriteram[0x80+20*i+2]; | |
| 236 | if (!state->m_buffer_spriteram[0x80+20*i+3]) | |
| 233 | y = m_buffer_spriteram[0x80+20*i]; | |
| 234 | x = m_buffer_spriteram[0x80+20*i+2]; | |
| 235 | if (!m_buffer_spriteram[0x80+20*i+3]) | |
| 237 | 236 | { |
| 238 | 237 | for(k=0;k<5;k++,x+=8) |
| 239 | 238 | { |
| r20977 | r20978 | |
| 242 | 241 | int code; |
| 243 | 242 | int offs = (i * 5 + k) * 64 + (31 - j) * 2; |
| 244 | 243 | |
| 245 | code = | |
| 244 | code = m_vram3[offs] + 256 * m_vram3[offs + 1]; | |
| 246 | 245 | drawgfx_transpen(bitmap, |
| 247 | cliprect,machine.gfx[0], | |
| 246 | cliprect,machine().gfx[0], | |
| 248 | 247 | code&1023, |
| 249 | 248 | ((code>>12)&0x3)+8, |
| 250 | 249 | code&0x4000, |
| r20977 | r20978 | |
| 272 | 271 | m_tilemap1->set_scrollx(0, 0xff-m_scrollram[2] ); |
| 273 | 272 | m_tilemap1->set_scrolly(0, m_scrollram[0] ); |
| 274 | 273 | m_tilemap1->draw(bitmap, cliprect, 0, 0); |
| 275 | draw_objects( | |
| 274 | draw_objects(bitmap, cliprect); | |
| 276 | 275 | m_tilemap2->draw(bitmap, cliprect, 0, 0); |
| 277 | 276 | |
| 278 | 277 | if (m_scrollram[0x101] == 0xb) m_tilemap4->draw(bitmap, cliprect, 0, 0);/* hack to display 4th tilemap */ |
| r20977 | r20978 | |
|---|---|---|
| 92 | 92 | m_bg_tilemap->set_scroll_cols(32); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | ||
| 95 | void seicross_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 96 | 96 | { |
| 97 | seicross_state *state = machine.driver_data<seicross_state>(); | |
| 98 | UINT8 *spriteram = state->m_spriteram; | |
| 99 | UINT8 *spriteram_2 = state->m_spriteram2; | |
| 97 | UINT8 *spriteram = m_spriteram; | |
| 98 | UINT8 *spriteram_2 = m_spriteram2; | |
| 100 | 99 | int offs; |
| 101 | 100 | |
| 102 | for (offs = | |
| 101 | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) | |
| 103 | 102 | { |
| 104 | 103 | int x = spriteram[offs + 3]; |
| 105 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 104 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 106 | 105 | (spriteram[offs] & 0x3f) + ((spriteram[offs + 1] & 0x10) << 2) + 128, |
| 107 | 106 | spriteram[offs + 1] & 0x0f, |
| 108 | 107 | spriteram[offs] & 0x40,spriteram[offs] & 0x80, |
| 109 | 108 | x,240-spriteram[offs + 2],0); |
| 110 | 109 | if(x>0xf0) |
| 111 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 110 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 112 | 111 | (spriteram[offs] & 0x3f) + ((spriteram[offs + 1] & 0x10) << 2) + 128, |
| 113 | 112 | spriteram[offs + 1] & 0x0f, |
| 114 | 113 | spriteram[offs] & 0x40,spriteram[offs] & 0x80, |
| 115 | 114 | x-256,240-spriteram[offs + 2],0); |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | for (offs = | |
| 117 | for (offs = m_spriteram2.bytes() - 4; offs >= 0; offs -= 4) | |
| 119 | 118 | { |
| 120 | 119 | int x = spriteram_2[offs + 3]; |
| 121 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 120 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 122 | 121 | (spriteram_2[offs] & 0x3f) + ((spriteram_2[offs + 1] & 0x10) << 2), |
| 123 | 122 | spriteram_2[offs + 1] & 0x0f, |
| 124 | 123 | spriteram_2[offs] & 0x40,spriteram_2[offs] & 0x80, |
| 125 | 124 | x,240-spriteram_2[offs + 2],0); |
| 126 | 125 | if(x>0xf0) |
| 127 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 126 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 128 | 127 | (spriteram_2[offs] & 0x3f) + ((spriteram_2[offs + 1] & 0x10) << 2), |
| 129 | 128 | spriteram_2[offs + 1] & 0x0f, |
| 130 | 129 | spriteram_2[offs] & 0x40,spriteram_2[offs] & 0x80, |
| r20977 | r20978 | |
| 140 | 139 | m_bg_tilemap->set_scrolly(col, m_row_scroll[col]); |
| 141 | 140 | |
| 142 | 141 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 143 | draw_sprites( | |
| 142 | draw_sprites(bitmap, cliprect); | |
| 144 | 143 | return 0; |
| 145 | 144 | } |
| r20977 | r20978 | |
|---|---|---|
| 30 | 30 | #include "video/segaic16.h" |
| 31 | 31 | |
| 32 | 32 | |
| 33 | ||
| 33 | void segas1x_bootleg_state::setup_system16_bootleg_spritebanking( ) | |
| 34 | 34 | { |
| 35 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 36 | 35 | |
| 37 | if ( | |
| 36 | if (m_spritebank_type == 1) | |
| 38 | 37 | { |
| 39 | 38 | static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
| 40 | 39 | int i; |
| 41 | 40 | for (i = 0; i < 16; i++) |
| 42 | | |
| 41 | m_sprites->set_bank(i, default_banklist[i]); | |
| 43 | 42 | } |
| 44 | 43 | else |
| 45 | 44 | { |
| 46 | 45 | static const UINT8 alternate_banklist[] = { 0,255,255,255, 255,255,255,3, 255,255,255,2, 255,1,0,255 }; |
| 47 | 46 | int i; |
| 48 | 47 | for (i = 0; i < 16; i++) |
| 49 | | |
| 48 | m_sprites->set_bank(i, alternate_banklist[i]); | |
| 50 | 49 | |
| 51 | 50 | } |
| 52 | 51 | |
| r20977 | r20978 | |
| 159 | 158 | } |
| 160 | 159 | #endif |
| 161 | 160 | |
| 162 | ||
| 161 | void segas1x_bootleg_state::update_page( ) | |
| 163 | 162 | { |
| 164 | segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>(); | |
| 165 | 163 | int all_dirty = 0; |
| 166 | 164 | int i, offset; |
| 167 | 165 | |
| 168 | if ( | |
| 166 | if (m_old_tile_bank1 != m_tile_bank1) | |
| 169 | 167 | { |
| 170 | 168 | all_dirty = 1; |
| 171 | | |
| 169 | m_old_tile_bank1 = m_tile_bank1; | |
| 172 | 170 | } |
| 173 | 171 | |
| 174 | if ( | |
| 172 | if (m_old_tile_bank0 != m_tile_bank0) | |
| 175 | 173 | { |
| 176 | 174 | all_dirty = 1; |
| 177 | state->m_old_tile_bank0 = state->m_tile_bank0; | |
| 178 | state->m_text_layer->mark_all_dirty(); | |
| 175 | m_old_tile_bank0 = m_tile_bank0; | |
| 176 | m_text_layer->mark_all_dirty(); | |
| 179 | 177 | } |
| 180 | 178 | |
| 181 | 179 | if (all_dirty) |
| 182 | 180 | { |
| 183 | state->m_background->mark_all_dirty(); | |
| 184 | state->m_foreground->mark_all_dirty(); | |
| 181 | m_background->mark_all_dirty(); | |
| 182 | m_foreground->mark_all_dirty(); | |
| 185 | 183 | |
| 186 | if ( | |
| 184 | if (m_system18) | |
| 187 | 185 | { |
| 188 | state->m_background2->mark_all_dirty(); | |
| 189 | state->m_foreground2->mark_all_dirty(); | |
| 186 | m_background2->mark_all_dirty(); | |
| 187 | m_foreground2->mark_all_dirty(); | |
| 190 | 188 | } |
| 191 | 189 | } |
| 192 | 190 | else { |
| 193 | 191 | for (i = 0; i < 4; i++) |
| 194 | 192 | { |
| 195 | 193 | int page0 = 64 * 32 * i; |
| 196 | if ( | |
| 194 | if (m_old_bg_page[i] != m_bg_page[i]) | |
| 197 | 195 | { |
| 198 | | |
| 196 | m_old_bg_page[i] = m_bg_page[i]; | |
| 199 | 197 | for (offset = page0; offset < page0 + 64 * 32; offset++) |
| 200 | 198 | { |
| 201 | | |
| 199 | m_background->mark_tile_dirty(offset); | |
| 202 | 200 | } |
| 203 | 201 | } |
| 204 | 202 | |
| 205 | if ( | |
| 203 | if (m_old_fg_page[i] != m_fg_page[i]) | |
| 206 | 204 | { |
| 207 | | |
| 205 | m_old_fg_page[i] = m_fg_page[i]; | |
| 208 | 206 | for (offset = page0; offset < page0 + 64 * 32; offset++) |
| 209 | 207 | { |
| 210 | | |
| 208 | m_foreground->mark_tile_dirty(offset); | |
| 211 | 209 | } |
| 212 | 210 | } |
| 213 | 211 | |
| 214 | if ( | |
| 212 | if (m_system18) | |
| 215 | 213 | { |
| 216 | if ( | |
| 214 | if (m_old_bg2_page[i] != m_bg2_page[i]) | |
| 217 | 215 | { |
| 218 | | |
| 216 | m_old_bg2_page[i] = m_bg2_page[i]; | |
| 219 | 217 | for (offset = page0; offset < page0 + 64 * 32; offset++) |
| 220 | 218 | { |
| 221 | | |
| 219 | m_background2->mark_tile_dirty(offset); | |
| 222 | 220 | } |
| 223 | 221 | } |
| 224 | 222 | |
| 225 | if ( | |
| 223 | if (m_old_fg2_page[i] != m_fg2_page[i]) | |
| 226 | 224 | { |
| 227 | | |
| 225 | m_old_fg2_page[i] = m_fg2_page[i]; | |
| 228 | 226 | for (offset = page0; offset < page0 + 64 * 32; offset++) |
| 229 | 227 | { |
| 230 | | |
| 228 | m_foreground2->mark_tile_dirty(offset); | |
| 231 | 229 | } |
| 232 | 230 | } |
| 233 | 231 | } |
| r20977 | r20978 | |
| 423 | 421 | m_system18 = 0; |
| 424 | 422 | } |
| 425 | 423 | |
| 426 | setup_system16_bootleg_spritebanking( | |
| 424 | setup_system16_bootleg_spritebanking(); | |
| 427 | 425 | } |
| 428 | 426 | |
| 429 | 427 | VIDEO_START_MEMBER(segas1x_bootleg_state,system18old) |
| r20977 | r20978 | |
| 583 | 581 | VIDEO_START_MEMBER(segas1x_bootleg_state,s16a_bootleg_wb3bl) |
| 584 | 582 | { |
| 585 | 583 | VIDEO_START_CALL_MEMBER(s16a_bootleg); |
| 586 | setup_system16_bootleg_spritebanking( | |
| 584 | setup_system16_bootleg_spritebanking(); | |
| 587 | 585 | } |
| 588 | 586 | |
| 589 | 587 | VIDEO_START_MEMBER(segas1x_bootleg_state,s16a_bootleg_shinobi) |
| 590 | 588 | { |
| 591 | 589 | VIDEO_START_CALL_MEMBER(s16a_bootleg); |
| 592 | setup_system16_bootleg_spritebanking( | |
| 590 | setup_system16_bootleg_spritebanking(); | |
| 593 | 591 | } |
| 594 | 592 | |
| 595 | 593 | VIDEO_START_MEMBER(segas1x_bootleg_state,s16a_bootleg_passsht) |
| 596 | 594 | { |
| 597 | 595 | VIDEO_START_CALL_MEMBER(s16a_bootleg); |
| 598 | setup_system16_bootleg_spritebanking( | |
| 596 | setup_system16_bootleg_spritebanking(); | |
| 599 | 597 | } |
| 600 | 598 | |
| 601 | 599 | // Passing Shot (2 player), Shinobi (Datsu), Wonderboy 3 |
| r20977 | r20978 | |
| 769 | 767 | // start the sprites drawing |
| 770 | 768 | m_sprites->draw_async(cliprect); |
| 771 | 769 | |
| 772 | update_page( | |
| 770 | update_page(); | |
| 773 | 771 | |
| 774 | 772 | machine().priority_bitmap.fill(0, cliprect); |
| 775 | 773 | |
| r20977 | r20978 | |
| 845 | 843 | // start the sprites drawing |
| 846 | 844 | m_sprites->draw_async(cliprect); |
| 847 | 845 | |
| 848 | update_page( | |
| 846 | update_page(); | |
| 849 | 847 | |
| 850 | 848 | machine().priority_bitmap.fill(0); |
| 851 | 849 |
| r20977 | r20978 | |
|---|---|---|
| 90 | 90 | else m_xtraram[offset - 0x1000] = data; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | void simpsons_video_banking( | |
| 93 | void simpsons_state::simpsons_video_banking( int bank ) | |
| 94 | 94 | { |
| 95 | simpsons_state *state = machine.driver_data<simpsons_state>(); | |
| 96 | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); | |
| 95 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 97 | 96 | |
| 98 | 97 | if (bank & 1) |
| 99 | 98 | { |
| 100 | 99 | space.install_read_bank(0x0000, 0x0fff, "bank5"); |
| 101 | space.install_write_handler(0x0000, 0x0fff, write8_delegate(FUNC(simpsons_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state)); | |
| 102 | state->membank("bank5")->set_base(state->m_generic_paletteram_8); | |
| 100 | space.install_write_handler(0x0000, 0x0fff, write8_delegate(FUNC(simpsons_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), this)); | |
| 101 | membank("bank5")->set_base(m_generic_paletteram_8); | |
| 103 | 102 | } |
| 104 | 103 | else |
| 105 | space.install_legacy_readwrite_handler(* | |
| 104 | space.install_legacy_readwrite_handler(*m_k052109, 0x0000, 0x0fff, FUNC(k052109_r), FUNC(k052109_w)); | |
| 106 | 105 | |
| 107 | 106 | if (bank & 2) |
| 108 | space.install_readwrite_handler(0x2000, 0x3fff, read8_delegate(FUNC(simpsons_state::simpsons_k053247_r), | |
| 107 | space.install_readwrite_handler(0x2000, 0x3fff, read8_delegate(FUNC(simpsons_state::simpsons_k053247_r),this), write8_delegate(FUNC(simpsons_state::simpsons_k053247_w),this)); | |
| 109 | 108 | else |
| 110 | space.install_readwrite_handler(0x2000, 0x3fff, read8_delegate(FUNC(simpsons_state::simpsons_k052109_r), | |
| 109 | space.install_readwrite_handler(0x2000, 0x3fff, read8_delegate(FUNC(simpsons_state::simpsons_k052109_r),this), write8_delegate(FUNC(simpsons_state::simpsons_k052109_w),this)); | |
| 111 | 110 | } |
| 112 | 111 | |
| 113 | 112 |
| r20977 | r20978 | |
|---|---|---|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | sta | |
| 160 | int starcrus_state::collision_check_s1s2() | |
| 161 | 161 | { |
| 162 | starcrus_state *state = machine.driver_data<starcrus_state>(); | |
| 163 | 162 | int org_x, org_y; |
| 164 | 163 | int sx, sy; |
| 165 | 164 | rectangle clip(0, 15, 0, 15); |
| 166 | 165 | |
| 167 | state->m_ship1_vid->fill(0, clip); | |
| 168 | state->m_ship2_vid->fill(0, clip); | |
| 166 | m_ship1_vid->fill(0, clip); | |
| 167 | m_ship2_vid->fill(0, clip); | |
| 169 | 168 | |
| 170 | 169 | /* origin is with respect to ship1 */ |
| 171 | 170 | |
| 172 | org_x = state->m_s1_x; | |
| 173 | org_y = state->m_s1_y; | |
| 171 | org_x = m_s1_x; | |
| 172 | org_y = m_s1_y; | |
| 174 | 173 | |
| 175 | 174 | /* Draw ship 1 */ |
| 176 | drawgfx_opaque(* | |
| 175 | drawgfx_opaque(*m_ship1_vid, | |
| 177 | 176 | clip, |
| 178 | machine.gfx[8+((state->m_s1_sprite&0x04)>>2)], | |
| 179 | (state->m_s1_sprite&0x03)^0x03, | |
| 177 | machine().gfx[8+((m_s1_sprite&0x04)>>2)], | |
| 178 | (m_s1_sprite&0x03)^0x03, | |
| 180 | 179 | 0, |
| 181 | (state->m_s1_sprite&0x08)>>3, (state->m_s1_sprite&0x10)>>4, | |
| 182 | state->m_s1_x-org_x, state->m_s1_y-org_y); | |
| 180 | (m_s1_sprite&0x08)>>3, (m_s1_sprite&0x10)>>4, | |
| 181 | m_s1_x-org_x, m_s1_y-org_y); | |
| 183 | 182 | |
| 184 | 183 | /* Draw ship 2 */ |
| 185 | drawgfx_opaque(* | |
| 184 | drawgfx_opaque(*m_ship2_vid, | |
| 186 | 185 | clip, |
| 187 | machine.gfx[10+((state->m_s2_sprite&0x04)>>2)], | |
| 188 | (state->m_s2_sprite&0x03)^0x03, | |
| 186 | machine().gfx[10+((m_s2_sprite&0x04)>>2)], | |
| 187 | (m_s2_sprite&0x03)^0x03, | |
| 189 | 188 | 0, |
| 190 | (state->m_s2_sprite&0x08)>>3, (state->m_s2_sprite&0x10)>>4, | |
| 191 | state->m_s2_x-org_x, state->m_s2_y-org_y); | |
| 189 | (m_s2_sprite&0x08)>>3, (m_s2_sprite&0x10)>>4, | |
| 190 | m_s2_x-org_x, m_s2_y-org_y); | |
| 192 | 191 | |
| 193 | 192 | /* Now check for collisions */ |
| 194 | 193 | for (sy=0;sy<16;sy++) |
| 195 | 194 | for (sx=0;sx<16;sx++) |
| 196 | 195 | /* Condition 1 - ship 1 = ship 2 */ |
| 197 | if (( | |
| 196 | if ((m_ship1_vid->pix16(sy, sx) == 1) && (m_ship2_vid->pix16(sy, sx) == 1)) | |
| 198 | 197 | return 1; |
| 199 | 198 | |
| 200 | 199 | return 0; |
| 201 | 200 | } |
| 202 | 201 | |
| 203 | sta | |
| 202 | int starcrus_state::collision_check_p1p2() | |
| 204 | 203 | { |
| 205 | starcrus_state *state = machine.driver_data<starcrus_state>(); | |
| 206 | 204 | int org_x, org_y; |
| 207 | 205 | int sx, sy; |
| 208 | 206 | rectangle clip(0, 15, 0, 15); |
| 209 | 207 | |
| 210 | 208 | /* if both are scores, return */ |
| 211 | if ( ((state->m_p1_sprite & 0x08) == 0) && | |
| 212 | ((state->m_p2_sprite & 0x08) == 0) ) | |
| 209 | if ( ((m_p1_sprite & 0x08) == 0) && | |
| 210 | ((m_p2_sprite & 0x08) == 0) ) | |
| 213 | 211 | { |
| 214 | 212 | return 0; |
| 215 | 213 | } |
| 216 | 214 | |
| 217 | state->m_proj1_vid->fill(0, clip); | |
| 218 | state->m_proj2_vid->fill(0, clip); | |
| 215 | m_proj1_vid->fill(0, clip); | |
| 216 | m_proj2_vid->fill(0, clip); | |
| 219 | 217 | |
| 220 | 218 | /* origin is with respect to proj1 */ |
| 221 | 219 | |
| 222 | org_x = state->m_p1_x; | |
| 223 | org_y = state->m_p1_y; | |
| 220 | org_x = m_p1_x; | |
| 221 | org_y = m_p1_y; | |
| 224 | 222 | |
| 225 | if ( | |
| 223 | if (m_p1_sprite & 0x08) /* if p1 is a projectile */ | |
| 226 | 224 | { |
| 227 | 225 | /* Draw score/projectile 1 */ |
| 228 | drawgfx_opaque(* | |
| 226 | drawgfx_opaque(*m_proj1_vid, | |
| 229 | 227 | clip, |
| 230 | machine.gfx[(state->m_p1_sprite&0x0c)>>2], | |
| 231 | (state->m_p1_sprite&0x03)^0x03, | |
| 228 | machine().gfx[(m_p1_sprite&0x0c)>>2], | |
| 229 | (m_p1_sprite&0x03)^0x03, | |
| 232 | 230 | 0, |
| 233 | 231 | 0,0, |
| 234 | | |
| 232 | m_p1_x-org_x, m_p1_y-org_y); | |
| 235 | 233 | } |
| 236 | 234 | |
| 237 | if ( | |
| 235 | if (m_p2_sprite & 0x08) /* if p2 is a projectile */ | |
| 238 | 236 | { |
| 239 | 237 | /* Draw score/projectile 2 */ |
| 240 | drawgfx_opaque(* | |
| 238 | drawgfx_opaque(*m_proj2_vid, | |
| 241 | 239 | clip, |
| 242 | machine.gfx[4+((state->m_p2_sprite&0x0c)>>2)], | |
| 243 | (state->m_p2_sprite&0x03)^0x03, | |
| 240 | machine().gfx[4+((m_p2_sprite&0x0c)>>2)], | |
| 241 | (m_p2_sprite&0x03)^0x03, | |
| 244 | 242 | 0, |
| 245 | 243 | 0,0, |
| 246 | | |
| 244 | m_p2_x-org_x, m_p2_y-org_y); | |
| 247 | 245 | } |
| 248 | 246 | |
| 249 | 247 | /* Now check for collisions */ |
| 250 | 248 | for (sy=0;sy<16;sy++) |
| 251 | 249 | for (sx=0;sx<16;sx++) |
| 252 | 250 | /* Condition 1 - proj 1 = proj 2 */ |
| 253 | if (( | |
| 251 | if ((m_proj1_vid->pix16(sy, sx) == 1) && (m_proj2_vid->pix16(sy, sx) == 1)) | |
| 254 | 252 | return 1; |
| 255 | 253 | |
| 256 | 254 | return 0; |
| 257 | 255 | } |
| 258 | 256 | |
| 259 | sta | |
| 257 | int starcrus_state::collision_check_s1p1p2() | |
| 260 | 258 | { |
| 261 | starcrus_state *state = machine.driver_data<starcrus_state>(); | |
| 262 | 259 | int org_x, org_y; |
| 263 | 260 | int sx, sy; |
| 264 | 261 | rectangle clip(0, 15, 0, 15); |
| 265 | 262 | |
| 266 | 263 | /* if both are scores, return */ |
| 267 | if ( ((state->m_p1_sprite & 0x08) == 0) && | |
| 268 | ((state->m_p2_sprite & 0x08) == 0) ) | |
| 264 | if ( ((m_p1_sprite & 0x08) == 0) && | |
| 265 | ((m_p2_sprite & 0x08) == 0) ) | |
| 269 | 266 | { |
| 270 | 267 | return 0; |
| 271 | 268 | } |
| 272 | 269 | |
| 273 | state->m_ship1_vid->fill(0, clip); | |
| 274 | state->m_proj1_vid->fill(0, clip); | |
| 275 | state->m_proj2_vid->fill(0, clip); | |
| 270 | m_ship1_vid->fill(0, clip); | |
| 271 | m_proj1_vid->fill(0, clip); | |
| 272 | m_proj2_vid->fill(0, clip); | |
| 276 | 273 | |
| 277 | 274 | /* origin is with respect to ship1 */ |
| 278 | 275 | |
| 279 | org_x = state->m_s1_x; | |
| 280 | org_y = state->m_s1_y; | |
| 276 | org_x = m_s1_x; | |
| 277 | org_y = m_s1_y; | |
| 281 | 278 | |
| 282 | 279 | /* Draw ship 1 */ |
| 283 | drawgfx_opaque(* | |
| 280 | drawgfx_opaque(*m_ship1_vid, | |
| 284 | 281 | clip, |
| 285 | machine.gfx[8+((state->m_s1_sprite&0x04)>>2)], | |
| 286 | (state->m_s1_sprite&0x03)^0x03, | |
| 282 | machine().gfx[8+((m_s1_sprite&0x04)>>2)], | |
| 283 | (m_s1_sprite&0x03)^0x03, | |
| 287 | 284 | 0, |
| 288 | (state->m_s1_sprite&0x08)>>3, (state->m_s1_sprite&0x10)>>4, | |
| 289 | state->m_s1_x-org_x, state->m_s1_y-org_y); | |
| 285 | (m_s1_sprite&0x08)>>3, (m_s1_sprite&0x10)>>4, | |
| 286 | m_s1_x-org_x, m_s1_y-org_y); | |
| 290 | 287 | |
| 291 | if ( | |
| 288 | if (m_p1_sprite & 0x08) /* if p1 is a projectile */ | |
| 292 | 289 | { |
| 293 | 290 | /* Draw projectile 1 */ |
| 294 | drawgfx_opaque(* | |
| 291 | drawgfx_opaque(*m_proj1_vid, | |
| 295 | 292 | clip, |
| 296 | machine.gfx[(state->m_p1_sprite&0x0c)>>2], | |
| 297 | (state->m_p1_sprite&0x03)^0x03, | |
| 293 | machine().gfx[(m_p1_sprite&0x0c)>>2], | |
| 294 | (m_p1_sprite&0x03)^0x03, | |
| 298 | 295 | 0, |
| 299 | 296 | 0,0, |
| 300 | | |
| 297 | m_p1_x-org_x, m_p1_y-org_y); | |
| 301 | 298 | } |
| 302 | 299 | |
| 303 | if ( | |
| 300 | if (m_p2_sprite & 0x08) /* if p2 is a projectile */ | |
| 304 | 301 | { |
| 305 | 302 | /* Draw projectile 2 */ |
| 306 | drawgfx_opaque(* | |
| 303 | drawgfx_opaque(*m_proj2_vid, | |
| 307 | 304 | clip, |
| 308 | machine.gfx[4+((state->m_p2_sprite&0x0c)>>2)], | |
| 309 | (state->m_p2_sprite&0x03)^0x03, | |
| 305 | machine().gfx[4+((m_p2_sprite&0x0c)>>2)], | |
| 306 | (m_p2_sprite&0x03)^0x03, | |
| 310 | 307 | 0, |
| 311 | 308 | 0,0, |
| 312 | | |
| 309 | m_p2_x-org_x, m_p2_y-org_y); | |
| 313 | 310 | } |
| 314 | 311 | |
| 315 | 312 | /* Now check for collisions */ |
| 316 | 313 | for (sy=0;sy<16;sy++) |
| 317 | 314 | for (sx=0;sx<16;sx++) |
| 318 | if ( | |
| 315 | if (m_ship1_vid->pix16(sy, sx) == 1) | |
| 319 | 316 | { |
| 320 | 317 | /* Condition 1 - ship 1 = proj 1 */ |
| 321 | if ( | |
| 318 | if (m_proj1_vid->pix16(sy, sx) == 1) | |
| 322 | 319 | return 1; |
| 323 | 320 | /* Condition 2 - ship 1 = proj 2 */ |
| 324 | if ( | |
| 321 | if (m_proj2_vid->pix16(sy, sx) == 1) | |
| 325 | 322 | return 1; |
| 326 | 323 | } |
| 327 | 324 | |
| 328 | 325 | return 0; |
| 329 | 326 | } |
| 330 | 327 | |
| 331 | sta | |
| 328 | int starcrus_state::collision_check_s2p1p2() | |
| 332 | 329 | { |
| 333 | starcrus_state *state = machine.driver_data<starcrus_state>(); | |
| 334 | 330 | int org_x, org_y; |
| 335 | 331 | int sx, sy; |
| 336 | 332 | rectangle clip(0, 15, 0, 15); |
| 337 | 333 | |
| 338 | 334 | /* if both are scores, return */ |
| 339 | if ( ((state->m_p1_sprite & 0x08) == 0) && | |
| 340 | ((state->m_p2_sprite & 0x08) == 0) ) | |
| 335 | if ( ((m_p1_sprite & 0x08) == 0) && | |
| 336 | ((m_p2_sprite & 0x08) == 0) ) | |
| 341 | 337 | { |
| 342 | 338 | return 0; |
| 343 | 339 | } |
| 344 | 340 | |
| 345 | state->m_ship2_vid->fill(0, clip); | |
| 346 | state->m_proj1_vid->fill(0, clip); | |
| 347 | state->m_proj2_vid->fill(0, clip); | |
| 341 | m_ship2_vid->fill(0, clip); | |
| 342 | m_proj1_vid->fill(0, clip); | |
| 343 | m_proj2_vid->fill(0, clip); | |
| 348 | 344 | |
| 349 | 345 | /* origin is with respect to ship2 */ |
| 350 | 346 | |
| 351 | org_x = state->m_s2_x; | |
| 352 | org_y = state->m_s2_y; | |
| 347 | org_x = m_s2_x; | |
| 348 | org_y = m_s2_y; | |
| 353 | 349 | |
| 354 | 350 | /* Draw ship 2 */ |
| 355 | drawgfx_opaque(* | |
| 351 | drawgfx_opaque(*m_ship2_vid, | |
| 356 | 352 | clip, |
| 357 | machine.gfx[10+((state->m_s2_sprite&0x04)>>2)], | |
| 358 | (state->m_s2_sprite&0x03)^0x03, | |
| 353 | machine().gfx[10+((m_s2_sprite&0x04)>>2)], | |
| 354 | (m_s2_sprite&0x03)^0x03, | |
| 359 | 355 | 0, |
| 360 | (state->m_s2_sprite&0x08)>>3, (state->m_s2_sprite&0x10)>>4, | |
| 361 | state->m_s2_x-org_x, state->m_s2_y-org_y); | |
| 356 | (m_s2_sprite&0x08)>>3, (m_s2_sprite&0x10)>>4, | |
| 357 | m_s2_x-org_x, m_s2_y-org_y); | |
| 362 | 358 | |
| 363 | if ( | |
| 359 | if (m_p1_sprite & 0x08) /* if p1 is a projectile */ | |
| 364 | 360 | { |
| 365 | 361 | /* Draw projectile 1 */ |
| 366 | drawgfx_opaque(* | |
| 362 | drawgfx_opaque(*m_proj1_vid, | |
| 367 | 363 | clip, |
| 368 | machine.gfx[(state->m_p1_sprite&0x0c)>>2], | |
| 369 | (state->m_p1_sprite&0x03)^0x03, | |
| 364 | machine().gfx[(m_p1_sprite&0x0c)>>2], | |
| 365 | (m_p1_sprite&0x03)^0x03, | |
| 370 | 366 | 0, |
| 371 | 367 | 0,0, |
| 372 | | |
| 368 | m_p1_x-org_x, m_p1_y-org_y); | |
| 373 | 369 | } |
| 374 | 370 | |
| 375 | if ( | |
| 371 | if (m_p2_sprite & 0x08) /* if p2 is a projectile */ | |
| 376 | 372 | { |
| 377 | 373 | /* Draw projectile 2 */ |
| 378 | drawgfx_opaque(* | |
| 374 | drawgfx_opaque(*m_proj2_vid, | |
| 379 | 375 | clip, |
| 380 | machine.gfx[4+((state->m_p2_sprite&0x0c)>>2)], | |
| 381 | (state->m_p2_sprite&0x03)^0x03, | |
| 376 | machine().gfx[4+((m_p2_sprite&0x0c)>>2)], | |
| 377 | (m_p2_sprite&0x03)^0x03, | |
| 382 | 378 | 0, |
| 383 | 379 | 0,0, |
| 384 | | |
| 380 | m_p2_x-org_x, m_p2_y-org_y); | |
| 385 | 381 | } |
| 386 | 382 | |
| 387 | 383 | /* Now check for collisions */ |
| 388 | 384 | for (sy=0;sy<16;sy++) |
| 389 | 385 | for (sx=0;sx<16;sx++) |
| 390 | if ( | |
| 386 | if (m_ship2_vid->pix16(sy, sx) == 1) | |
| 391 | 387 | { |
| 392 | 388 | /* Condition 1 - ship 2 = proj 1 */ |
| 393 | if ( | |
| 389 | if (m_proj1_vid->pix16(sy, sx) == 1) | |
| 394 | 390 | return 1; |
| 395 | 391 | /* Condition 2 - ship 2 = proj 2 */ |
| 396 | if ( | |
| 392 | if (m_proj2_vid->pix16(sy, sx) == 1) | |
| 397 | 393 | return 1; |
| 398 | 394 | } |
| 399 | 395 | |
| r20977 | r20978 | |
| 450 | 446 | m_collision_reg = 0x00; |
| 451 | 447 | |
| 452 | 448 | /* Check for collisions between ship1 and ship2 */ |
| 453 | if (collision_check_s1s2( | |
| 449 | if (collision_check_s1s2()) | |
| 454 | 450 | { |
| 455 | 451 | m_collision_reg |= 0x08; |
| 456 | 452 | } |
| 457 | 453 | /* Check for collisions between ship1 and projectiles */ |
| 458 | if (collision_check_s1p1p2( | |
| 454 | if (collision_check_s1p1p2()) | |
| 459 | 455 | { |
| 460 | 456 | m_collision_reg |= 0x02; |
| 461 | 457 | } |
| 462 | 458 | /* Check for collisions between ship1 and projectiles */ |
| 463 | if (collision_check_s2p1p2( | |
| 459 | if (collision_check_s2p1p2()) | |
| 464 | 460 | { |
| 465 | 461 | m_collision_reg |= 0x01; |
| 466 | 462 | } |
| 467 | 463 | /* Check for collisions between ship1 and projectiles */ |
| 468 | 464 | /* Note: I don't think this is used by the game */ |
| 469 | if (collision_check_p1p2( | |
| 465 | if (collision_check_p1p2()) | |
| 470 | 466 | { |
| 471 | 467 | m_collision_reg |= 0x04; |
| 472 | 468 | } |
| r20977 | r20978 | |
|---|---|---|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | ||
| 176 | void stactics_state::update_beam() | |
| 177 | 177 | { |
| 178 | 178 | /* first, update the firebeam state */ |
| 179 | state->m_old_beam_state = state->m_beam_state; | |
| 180 | if (state->m_shot_standby == 0) | |
| 181 | state->m_beam_state = state->m_beam_state + state->m_beam_states_per_frame; | |
| 179 | m_old_beam_state = m_beam_state; | |
| 180 | if (m_shot_standby == 0) | |
| 181 | m_beam_state = m_beam_state + m_beam_states_per_frame; | |
| 182 | 182 | |
| 183 | 183 | /* These are thresholds for the two shots from the LED fire ROM */ |
| 184 | 184 | /* (Note: There are two more for sound triggers, */ |
| 185 | 185 | /* whenever that gets implemented) */ |
| 186 | if ((state->m_old_beam_state < 0x8b) & (state->m_beam_state >= 0x8b)) | |
| 187 | state->m_shot_arrive = 1; | |
| 186 | if ((m_old_beam_state < 0x8b) & (m_beam_state >= 0x8b)) | |
| 187 | m_shot_arrive = 1; | |
| 188 | 188 | |
| 189 | if ((state->m_old_beam_state < 0xca) & (state->m_beam_state >= 0xca)) | |
| 190 | state->m_shot_arrive = 1; | |
| 189 | if ((m_old_beam_state < 0xca) & (m_beam_state >= 0xca)) | |
| 190 | m_shot_arrive = 1; | |
| 191 | 191 | |
| 192 | if ( | |
| 192 | if (m_beam_state >= 0x100) | |
| 193 | 193 | { |
| 194 | state->m_beam_state = 0; | |
| 195 | state->m_shot_standby = 1; | |
| 194 | m_beam_state = 0; | |
| 195 | m_shot_standby = 1; | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| r20977 | r20978 | |
| 204 | 204 | * |
| 205 | 205 | *************************************/ |
| 206 | 206 | |
| 207 | ||
| 207 | inline int stactics_state::get_pixel_on_plane(UINT8 *videoram, UINT8 y, UINT8 x, UINT8 y_scroll) | |
| 208 | 208 | { |
| 209 | 209 | UINT8 code; |
| 210 | 210 | UINT8 gfx; |
| r20977 | r20978 | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
| 226 | static | |
| 226 | void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 227 | 227 | { |
| 228 | 228 | int y; |
| 229 | 229 | |
| r20977 | r20978 | |
| 238 | 238 | for (x = 0; x < 0x100; x++) |
| 239 | 239 | { |
| 240 | 240 | /* get the pixels for the four planes */ |
| 241 | int pixel_b = get_pixel_on_plane(state->m_videoram_b, y, x, 0); | |
| 242 | int pixel_d = get_pixel_on_plane(state->m_videoram_d, y, x, state->m_y_scroll_d); | |
| 243 | int pixel_e = get_pixel_on_plane(state->m_videoram_e, y, x, state->m_y_scroll_e); | |
| 244 | int pixel_f = get_pixel_on_plane(state->m_videoram_f, y, x, state->m_y_scroll_f); | |
| 241 | int pixel_b = get_pixel_on_plane(m_videoram_b, y, x, 0); | |
| 242 | int pixel_d = get_pixel_on_plane(m_videoram_d, y, x, m_y_scroll_d); | |
| 243 | int pixel_e = get_pixel_on_plane(m_videoram_e, y, x, m_y_scroll_e); | |
| 244 | int pixel_f = get_pixel_on_plane(m_videoram_f, y, x, m_y_scroll_f); | |
| 245 | 245 | |
| 246 | 246 | /* get the color for this pixel */ |
| 247 | UINT8 color = | |
| 247 | UINT8 color = m_videoram_b[((y >> 3) << 5) | (x >> 3)] >> 4; | |
| 248 | 248 | |
| 249 | 249 | /* assemble the pen index */ |
| 250 | 250 | int pen = color | |
| r20977 | r20978 | |
| 252 | 252 | (pixel_f << 5) | |
| 253 | 253 | (pixel_e << 6) | |
| 254 | 254 | (pixel_d << 7) | |
| 255 | ((state->m_palette[0] & 0x01) << 8) | | |
| 256 | ((state->m_palette[1] & 0x01) << 9); | |
| 255 | ((m_palette[0] & 0x01) << 8) | | |
| 256 | ((m_palette[1] & 0x01) << 9); | |
| 257 | 257 | |
| 258 | 258 | /* compute the effective pixel coordinate after adjusting for the |
| 259 | 259 | mirror movement - this is mechanical on the real machine */ |
| 260 | int sy = y + state->m_vert_pos; | |
| 261 | int sx = x - state->m_horiz_pos; | |
| 260 | int sy = y + m_vert_pos; | |
| 261 | int sx = x - m_horiz_pos; | |
| 262 | 262 | |
| 263 | 263 | /* plot if visible */ |
| 264 | 264 | if ((sy >= 0) && (sy < 0x100) && (sx >= 0) && (sx < 0x100)) |
| r20977 | r20978 | |
| 283 | 283 | }; |
| 284 | 284 | |
| 285 | 285 | |
| 286 | static | |
| 286 | void stactics_state::set_indicator_leds(int data, const char *output_name, int base_index) | |
| 287 | 287 | { |
| 288 | 288 | /* decode the data */ |
| 289 | 289 | data = to_7seg[~data & 0x0f]; |
| r20977 | r20978 | |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
| 299 | ||
| 299 | void stactics_state::update_artwork() | |
| 300 | 300 | { |
| 301 | 301 | int i; |
| 302 | UINT8 *beam_region = machine.root_device().memregion("user1")->base(); | |
| 302 | UINT8 *beam_region = machine().root_device().memregion("user1")->base(); | |
| 303 | 303 | |
| 304 | 304 | /* set the lamps first */ |
| 305 | output_set_indexed_value("base_lamp", 4, state->m_lamps[0] & 0x01); | |
| 306 | output_set_indexed_value("base_lamp", 3, state->m_lamps[1] & 0x01); | |
| 307 | output_set_indexed_value("base_lamp", 2, state->m_lamps[2] & 0x01); | |
| 308 | output_set_indexed_value("base_lamp", 1, state->m_lamps[3] & 0x01); | |
| 309 | output_set_indexed_value("base_lamp", 0, state->m_lamps[4] & 0x01); | |
| 310 | output_set_value("start_lamp", state->m_lamps[5] & 0x01); | |
| 311 | output_set_value("barrier_lamp", state->m_lamps[6] & 0x01); /* this needs to flash on/off, not implemented */ | |
| 305 | output_set_indexed_value("base_lamp", 4, m_lamps[0] & 0x01); | |
| 306 | output_set_indexed_value("base_lamp", 3, m_lamps[1] & 0x01); | |
| 307 | output_set_indexed_value("base_lamp", 2, m_lamps[2] & 0x01); | |
| 308 | output_set_indexed_value("base_lamp", 1, m_lamps[3] & 0x01); | |
| 309 | output_set_indexed_value("base_lamp", 0, m_lamps[4] & 0x01); | |
| 310 | output_set_value("start_lamp", m_lamps[5] & 0x01); | |
| 311 | output_set_value("barrier_lamp", m_lamps[6] & 0x01); /* this needs to flash on/off, not implemented */ | |
| 312 | 312 | |
| 313 | 313 | /* laser beam - loop for each LED */ |
| 314 | 314 | for (i = 0; i < 0x40; i++) |
| 315 | 315 | { |
| 316 | offs_t beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | | |
| 316 | offs_t beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | m_beam_state; | |
| 317 | 317 | UINT8 beam_data = beam_region[beam_data_offs]; |
| 318 | 318 | int on = (beam_data >> (i & 0x07)) & 0x01; |
| 319 | 319 | |
| r20977 | r20978 | |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /* sight LED */ |
| 325 | output_set_value("sight_led", * | |
| 325 | output_set_value("sight_led", *m_motor_on & 0x01); | |
| 326 | 326 | |
| 327 | 327 | /* score display */ |
| 328 | 328 | for (i = 0x01; i < 0x07; i++) |
| 329 | output_set_digit_value(i - 1, to_7seg[~ | |
| 329 | output_set_digit_value(i - 1, to_7seg[~m_display_buffer[i] & 0x0f]); | |
| 330 | 330 | |
| 331 | 331 | /* credits indicator */ |
| 332 | set_indicator_leds(state->m_display_buffer[0x07], "credit_led", 0x00); | |
| 333 | set_indicator_leds(state->m_display_buffer[0x08], "credit_led", 0x04); | |
| 332 | set_indicator_leds(m_display_buffer[0x07], "credit_led", 0x00); | |
| 333 | set_indicator_leds(m_display_buffer[0x08], "credit_led", 0x04); | |
| 334 | 334 | |
| 335 | 335 | /* barriers indicator */ |
| 336 | set_indicator_leds(state->m_display_buffer[0x09], "barrier_led", 0x00); | |
| 337 | set_indicator_leds(state->m_display_buffer[0x0a], "barrier_led", 0x04); | |
| 338 | set_indicator_leds(state->m_display_buffer[0x0b], "barrier_led", 0x08); | |
| 336 | set_indicator_leds(m_display_buffer[0x09], "barrier_led", 0x00); | |
| 337 | set_indicator_leds(m_display_buffer[0x0a], "barrier_led", 0x04); | |
| 338 | set_indicator_leds(m_display_buffer[0x0b], "barrier_led", 0x08); | |
| 339 | 339 | |
| 340 | 340 | /* rounds indicator */ |
| 341 | set_indicator_leds(state->m_display_buffer[0x0c], "round_led", 0x00); | |
| 342 | set_indicator_leds(state->m_display_buffer[0x0d], "round_led", 0x04); | |
| 343 | set_indicator_leds(state->m_display_buffer[0x0e], "round_led", 0x08); | |
| 344 | set_indicator_leds(state->m_display_buffer[0x0f], "round_led", 0x0c); | |
| 341 | set_indicator_leds(m_display_buffer[0x0c], "round_led", 0x00); | |
| 342 | set_indicator_leds(m_display_buffer[0x0d], "round_led", 0x04); | |
| 343 | set_indicator_leds(m_display_buffer[0x0e], "round_led", 0x08); | |
| 344 | set_indicator_leds(m_display_buffer[0x0f], "round_led", 0x0c); | |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | |
| r20977 | r20978 | |
| 375 | 375 | |
| 376 | 376 | UINT32 stactics_state::screen_update_stactics(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 377 | 377 | { |
| 378 | update_beam(this); | |
| 379 | draw_background(this, bitmap, cliprect); | |
| 380 | update_artwork(machine(), this); | |
| 378 | update_beam(); | |
| 379 | draw_background(bitmap, cliprect); | |
| 380 | update_artwork(); | |
| 381 | 381 | |
| 382 | 382 | m_frame_count = (m_frame_count + 1) & 0x0f; |
| 383 | 383 |
| r20977 | r20978 | |
|---|---|---|
| 157 | 157 | |
| 158 | 158 | ***************************************************************************/ |
| 159 | 159 | |
| 160 | ||
| 160 | void skyfox_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 161 | 161 | { |
| 162 | skyfox_state *state = machine.driver_data<skyfox_state>(); | |
| 163 | 162 | int offs; |
| 164 | 163 | |
| 165 | int width = machine.primary_screen->width(); | |
| 166 | int height = machine.primary_screen->height(); | |
| 164 | int width = machine().primary_screen->width(); | |
| 165 | int height = machine().primary_screen->height(); | |
| 167 | 166 | |
| 168 | 167 | /* The 32x32 tiles in the 80-ff range are bankswitched */ |
| 169 | int shift =( | |
| 168 | int shift =(m_bg_ctrl & 0x80) ? (4 - 1) : 4; | |
| 170 | 169 | |
| 171 | for (offs = 0; offs < | |
| 170 | for (offs = 0; offs < m_spriteram.bytes(); offs += 4) | |
| 172 | 171 | { |
| 173 | 172 | int xstart, ystart, xend, yend; |
| 174 | 173 | int xinc, yinc, dx, dy; |
| 175 | 174 | int low_code, high_code, n; |
| 176 | 175 | |
| 177 | int y = state->m_spriteram[offs + 0]; | |
| 178 | int x = state->m_spriteram[offs + 1]; | |
| 179 | int code = state->m_spriteram[offs + 2] + state->m_spriteram[offs + 3] * 256; | |
| 176 | int y = m_spriteram[offs + 0]; | |
| 177 | int x = m_spriteram[offs + 1]; | |
| 178 | int code = m_spriteram[offs + 2] + m_spriteram[offs + 3] * 256; | |
| 180 | 179 | int flipx = code & 0x2; |
| 181 | 180 | int flipy = code & 0x4; |
| 182 | 181 | |
| r20977 | r20978 | |
| 193 | 192 | |
| 194 | 193 | #define DRAW_SPRITE(DX,DY,CODE) \ |
| 195 | 194 | drawgfx_transpen(bitmap,\ |
| 196 | cliprect,machine.gfx[0], \ | |
| 195 | cliprect,machine().gfx[0], \ | |
| 197 | 196 | (CODE), \ |
| 198 | 197 | 0, \ |
| 199 | 198 | flipx,flipy, \ |
| 200 | 199 | x + (DX),y + (DY), 0xff); |
| 201 | if ( | |
| 200 | if (m_bg_ctrl & 1) // flipscreen | |
| 202 | 201 | { |
| 203 | 202 | x = width - x - (n - 1) * 8; |
| 204 | 203 | y = height - y - (n - 1) * 8; |
| r20977 | r20978 | |
| 235 | 234 | |
| 236 | 235 | ***************************************************************************/ |
| 237 | 236 | |
| 238 | ||
| 237 | void skyfox_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 239 | 238 | { |
| 240 | skyfox_state *state = machine.driver_data<skyfox_state>(); | |
| 241 | UINT8 *RAM = state->memregion("gfx2")->base(); | |
| 239 | UINT8 *RAM = memregion("gfx2")->base(); | |
| 242 | 240 | int x, y, i; |
| 243 | 241 | |
| 244 | 242 | /* The foreground stars (sprites) move at twice this speed when |
| 245 | 243 | the bg scroll rate [e.g. (skyfox_bg_reg >> 1) & 7] is 4 */ |
| 246 | int pos = ( | |
| 244 | int pos = (m_bg_pos >> 4) & (512 * 2 - 1); | |
| 247 | 245 | |
| 248 | 246 | for (i = 0 ; i < 0x1000; i++) |
| 249 | 247 | { |
| 250 | 248 | int pen, offs, j; |
| 251 | 249 | |
| 252 | offs = (i * 2 + (( | |
| 250 | offs = (i * 2 + ((m_bg_ctrl >> 4) & 0x3) * 0x2000) % 0x8000; | |
| 253 | 251 | |
| 254 | 252 | pen = RAM[offs]; |
| 255 | 253 | x = RAM[offs + 1] * 2 + (i & 1) + pos + ((i & 8) ? 512 : 0); |
| 256 | 254 | y = ((i / 8) / 2) * 8 + (i % 8); |
| 257 | 255 | |
| 258 | if ( | |
| 256 | if (m_bg_ctrl & 1) // flipscreen | |
| 259 | 257 | { |
| 260 | 258 | x = 512 * 2 - (x % (512 * 2)); |
| 261 | 259 | y = 256 - (y % 256); |
| r20977 | r20978 | |
| 281 | 279 | UINT32 skyfox_state::screen_update_skyfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 282 | 280 | { |
| 283 | 281 | bitmap.fill(255, cliprect); // the bg is black |
| 284 | draw_background(machine(), bitmap, cliprect); | |
| 285 | draw_sprites(machine(), bitmap, cliprect); | |
| 282 | draw_background(bitmap, cliprect); | |
| 283 | draw_sprites(bitmap, cliprect); | |
| 286 | 284 | return 0; |
| 287 | 285 | } |
| r20977 | r20978 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | ***************************************************************************/ |
| 158 | 158 | |
| 159 | ||
| 159 | void senjyo_state::draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 160 | 160 | { |
| 161 | senjyo_state *state = machine.driver_data<senjyo_state>(); | |
| 162 | 161 | int x,y,pen,strwid,count; |
| 163 | 162 | |
| 164 | 163 | |
| 165 | if ( | |
| 164 | if (m_bgstripes == 0xff) /* off */ | |
| 166 | 165 | bitmap.fill(0, cliprect); |
| 167 | 166 | else |
| 168 | 167 | { |
| 169 | int flip = | |
| 168 | int flip = flip_screen(); | |
| 170 | 169 | |
| 171 | 170 | pen = 0; |
| 172 | 171 | count = 0; |
| 173 | strwid = | |
| 172 | strwid = m_bgstripes; | |
| 174 | 173 | if (strwid == 0) strwid = 0x100; |
| 175 | 174 | if (flip) strwid ^= 0xff; |
| 176 | 175 | |
| r20977 | r20978 | |
| 193 | 192 | } |
| 194 | 193 | } |
| 195 | 194 | |
| 196 | ||
| 195 | void senjyo_state::draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 197 | 196 | { |
| 198 | senjyo_state *state = machine.driver_data<senjyo_state>(); | |
| 199 | 197 | int offs,x; |
| 200 | 198 | |
| 201 | 199 | for (offs = 0;offs < 0x400;offs++) |
| 202 | 200 | for (x = 0;x < 8;x++) |
| 203 | if ( | |
| 201 | if (m_radarram[offs] & (1 << x)) | |
| 204 | 202 | { |
| 205 | 203 | int sx, sy; |
| 206 | 204 | |
| 207 | 205 | sx = (8 * (offs % 8) + x) + 256-64; |
| 208 | 206 | sy = ((offs & 0x1ff) / 8) + 96; |
| 209 | 207 | |
| 210 | if ( | |
| 208 | if (flip_screen()) | |
| 211 | 209 | { |
| 212 | 210 | sx = 255 - sx; |
| 213 | 211 | sy = 255 - sy; |
| r20977 | r20978 | |
| 218 | 216 | } |
| 219 | 217 | } |
| 220 | 218 | |
| 221 | ||
| 219 | void senjyo_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority) | |
| 222 | 220 | { |
| 223 | senjyo_state *state = machine.driver_data<senjyo_state>(); | |
| 224 | UINT8 *spriteram = state->m_spriteram; | |
| 221 | UINT8 *spriteram = m_spriteram; | |
| 225 | 222 | int offs; |
| 226 | 223 | |
| 227 | for (offs = | |
| 224 | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) | |
| 228 | 225 | { |
| 229 | 226 | int big,sx,sy,flipx,flipy; |
| 230 | 227 | |
| 231 | 228 | if (((spriteram[offs+1] & 0x30) >> 4) == priority) |
| 232 | 229 | { |
| 233 | if ( | |
| 230 | if (m_is_senjyo) /* Senjyo */ | |
| 234 | 231 | big = (spriteram[offs] & 0x80); |
| 235 | 232 | else /* Star Force */ |
| 236 | 233 | big = ((spriteram[offs] & 0xc0) == 0xc0); |
| r20977 | r20978 | |
| 242 | 239 | flipx = spriteram[offs+1] & 0x40; |
| 243 | 240 | flipy = spriteram[offs+1] & 0x80; |
| 244 | 241 | |
| 245 | if ( | |
| 242 | if (flip_screen()) | |
| 246 | 243 | { |
| 247 | 244 | flipx = !flipx; |
| 248 | 245 | flipy = !flipy; |
| r20977 | r20978 | |
| 260 | 257 | } |
| 261 | 258 | |
| 262 | 259 | |
| 263 | drawgfx_transpen(bitmap,cliprect,machine.gfx[big ? 5 : 4], | |
| 260 | drawgfx_transpen(bitmap,cliprect,machine().gfx[big ? 5 : 4], | |
| 264 | 261 | spriteram[offs], |
| 265 | 262 | spriteram[offs + 1] & 0x07, |
| 266 | 263 | flipx,flipy, |
| r20977 | r20978 | |
| 312 | 309 | m_bg3_tilemap->set_scrolly(0, scrolly); |
| 313 | 310 | } |
| 314 | 311 | |
| 315 | draw_bgbitmap(machine(), bitmap, cliprect); | |
| 316 | draw_sprites(machine(), bitmap, cliprect, 0); | |
| 312 | draw_bgbitmap(bitmap, cliprect); | |
| 313 | draw_sprites(bitmap, cliprect, 0); | |
| 317 | 314 | m_bg3_tilemap->draw(bitmap, cliprect, 0, 0); |
| 318 | draw_sprites( | |
| 315 | draw_sprites(bitmap, cliprect, 1); | |
| 319 | 316 | m_bg2_tilemap->draw(bitmap, cliprect, 0, 0); |
| 320 | draw_sprites( | |
| 317 | draw_sprites(bitmap, cliprect, 2); | |
| 321 | 318 | m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); |
| 322 | draw_sprites( | |
| 319 | draw_sprites(bitmap, cliprect, 3); | |
| 323 | 320 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 324 | draw_radar( | |
| 321 | draw_radar(bitmap, cliprect); | |
| 325 | 322 | |
| 326 | 323 | #if 0 |
| 327 | 324 | { |
| r20977 | r20978 | |
|---|---|---|
| 78 | 78 | m_bg_tilemap->set_scroll_rows(32); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | ||
| 81 | void strnskil_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 82 | 82 | { |
| 83 | strnskil_state *state = machine.driver_data<strnskil_state>(); | |
| 84 | UINT8 *spriteram = state->m_spriteram; | |
| 83 | UINT8 *spriteram = m_spriteram; | |
| 85 | 84 | int offs; |
| 86 | 85 | |
| 87 | 86 | for (offs = 0x60; offs < 0x100; offs += 4) |
| 88 | 87 | { |
| 89 | 88 | int code = spriteram[offs + 1]; |
| 90 | 89 | int color = spriteram[offs + 2] & 0x3f; |
| 91 | int flipx = state->flip_screen_x(); | |
| 92 | int flipy = state->flip_screen_y(); | |
| 90 | int flipx = flip_screen_x(); | |
| 91 | int flipy = flip_screen_y(); | |
| 93 | 92 | |
| 94 | 93 | int sx = spriteram[offs + 3]; |
| 95 | 94 | int sy = spriteram[offs]; |
| 96 | 95 | int px, py; |
| 97 | 96 | |
| 98 | if ( | |
| 97 | if (flip_screen()) | |
| 99 | 98 | { |
| 100 | 99 | px = 240 - sx + 0; /* +2 or +0 ? */ |
| 101 | 100 | py = sy; |
| r20977 | r20978 | |
| 112 | 111 | sx = sx - 256; |
| 113 | 112 | |
| 114 | 113 | drawgfx_transmask(bitmap, cliprect, |
| 115 | machine.gfx[1], | |
| 114 | machine().gfx[1], | |
| 116 | 115 | code, color, |
| 117 | 116 | flipx, flipy, |
| 118 | 117 | px, py, |
| 119 | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); | |
| 118 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); | |
| 120 | 119 | } |
| 121 | 120 | } |
| 122 | 121 | |
| r20977 | r20978 | |
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 145 | draw_sprites( | |
| 144 | draw_sprites(bitmap, cliprect); | |
| 146 | 145 | return 0; |
| 147 | 146 | } |
| r20977 | r20978 | |
|---|---|---|
| 135 | 135 | m_bg_tilemap->set_scroll_rows(32); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | ||
| 138 | void sonson_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 139 | 139 | { |
| 140 | sonson_state *state = machine.driver_data<sonson_state>(); | |
| 141 | UINT8 *spriteram = state->m_spriteram; | |
| 140 | UINT8 *spriteram = m_spriteram; | |
| 142 | 141 | int offs; |
| 143 | 142 | |
| 144 | for (offs = | |
| 143 | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) | |
| 145 | 144 | { |
| 146 | 145 | int code = spriteram[offs + 2] + ((spriteram[offs + 1] & 0x20) << 3); |
| 147 | 146 | int color = spriteram[offs + 1] & 0x1f; |
| r20977 | r20978 | |
| 150 | 149 | int sx = spriteram[offs + 3]; |
| 151 | 150 | int sy = spriteram[offs + 0]; |
| 152 | 151 | |
| 153 | if ( | |
| 152 | if (flip_screen()) | |
| 154 | 153 | { |
| 155 | 154 | sx = 240 - sx; |
| 156 | 155 | sy = 240 - sy; |
| r20977 | r20978 | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | drawgfx_transpen(bitmap, cliprect, |
| 162 | machine.gfx[1], | |
| 161 | machine().gfx[1], | |
| 163 | 162 | code, color, |
| 164 | 163 | flipx, flipy, |
| 165 | 164 | sx, sy, 0); |
| 166 | 165 | |
| 167 | 166 | /* wrap-around */ |
| 168 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx - 256, sy, 0); | |
| 169 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy - 256, 0); | |
| 167 | drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx - 256, sy, 0); | |
| 168 | drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy - 256, 0); | |
| 170 | 169 | } |
| 171 | 170 | } |
| 172 | 171 | |
| 173 | 172 | UINT32 sonson_state::screen_update_sonson(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 174 | 173 | { |
| 175 | 174 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 176 | draw_sprites( | |
| 175 | draw_sprites(bitmap, cliprect); | |
| 177 | 176 | return 0; |
| 178 | 177 | } |
| r20977 | r20978 | |
|---|---|---|
| 147 | 147 | m_bg_tilemap->set_scroll_cols(32); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | ||
| 150 | void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 151 | 151 | { |
| 152 | shaolins_state *state = machine.driver_data<shaolins_state>(); | |
| 153 | UINT8 *spriteram = state->m_spriteram; | |
| 152 | UINT8 *spriteram = m_spriteram; | |
| 154 | 153 | int offs; |
| 155 | 154 | |
| 156 | for (offs = | |
| 155 | for (offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32 ) /* max 24 sprites */ | |
| 157 | 156 | { |
| 158 | 157 | if (spriteram[offs] && spriteram[offs + 6]) /* stop rogue sprites on high score screen */ |
| 159 | 158 | { |
| 160 | 159 | int code = spriteram[offs + 8]; |
| 161 | int color = (spriteram[offs + 9] & 0x0f) | ( | |
| 160 | int color = (spriteram[offs + 9] & 0x0f) | (m_palettebank << 4); | |
| 162 | 161 | int flipx = !(spriteram[offs + 9] & 0x40); |
| 163 | 162 | int flipy = spriteram[offs + 9] & 0x80; |
| 164 | 163 | int sx = 240 - spriteram[offs + 6]; |
| 165 | 164 | int sy = 248 - spriteram[offs + 4]; |
| 166 | 165 | |
| 167 | if ( | |
| 166 | if (flip_screen()) | |
| 168 | 167 | { |
| 169 | 168 | sx = 240 - sx; |
| 170 | 169 | sy = 248 - sy; |
| r20977 | r20978 | |
| 172 | 171 | flipy = !flipy; |
| 173 | 172 | } |
| 174 | 173 | |
| 175 | drawgfx_transmask(bitmap, cliprect,machine.gfx[1], | |
| 174 | drawgfx_transmask(bitmap, cliprect,machine().gfx[1], | |
| 176 | 175 | code, color, |
| 177 | 176 | flipx, flipy, |
| 178 | 177 | sx, sy, |
| 179 | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, | |
| 178 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, m_palettebank << 5)); | |
| 180 | 179 | } |
| 181 | 180 | } |
| 182 | 181 | } |
| r20977 | r20978 | |
| 184 | 183 | UINT32 shaolins_state::screen_update_shaolins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 185 | 184 | { |
| 186 | 185 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 187 | draw_sprites( | |
| 186 | draw_sprites(bitmap, cliprect); | |
| 188 | 187 | return 0; |
| 189 | 188 | } |
| r20977 | r20978 | |
|---|---|---|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | ||
| 28 | void segag80r_state::vblank_latch_set() | |
| 29 | 29 | { |
| 30 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 31 | 30 | /* set a timer to mimic the 555 timer that drives the EDGINT signal */ |
| 32 | 31 | /* the 555 is run in monostable mode with R=56000 and C=1000pF */ |
| 33 | state->m_vblank_latch = 1; | |
| 34 | machine.scheduler().timer_set(PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), timer_expired_delegate(FUNC(segag80r_state::vblank_latch_clear),state)); | |
| 32 | m_vblank_latch = 1; | |
| 33 | machine().scheduler().timer_set(PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), timer_expired_delegate(FUNC(segag80r_state::vblank_latch_clear),this)); | |
| 35 | 34 | |
| 36 | 35 | /* latch the current flip state at the same time */ |
| 37 | | |
| 36 | m_video_flip = m_video_control & 1; | |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | |
| 41 | 40 | INTERRUPT_GEN_MEMBER(segag80r_state::segag80r_vblank_start) |
| 42 | 41 | { |
| 43 | vblank_latch_set( | |
| 42 | vblank_latch_set(); | |
| 44 | 43 | |
| 45 | 44 | /* if interrupts are enabled, clock one */ |
| 46 | 45 | if (m_video_control & 0x04) |
| r20977 | r20978 | |
| 50 | 49 | |
| 51 | 50 | INTERRUPT_GEN_MEMBER(segag80r_state::sindbadm_vblank_start) |
| 52 | 51 | { |
| 53 | vblank_latch_set( | |
| 52 | vblank_latch_set(); | |
| 54 | 53 | |
| 55 | 54 | /* interrupts appear to always be enabled, but they have a manual */ |
| 56 | 55 | /* acknowledge rather than an automatic ack; they are also not masked */ |
| r20977 | r20978 | |
| 66 | 65 | * |
| 67 | 66 | *************************************/ |
| 68 | 67 | |
| 69 | ||
| 68 | void segag80r_state::g80_set_palette_entry(int entry, UINT8 data) | |
| 70 | 69 | { |
| 71 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 72 | 70 | int bit0, bit1, bit2; |
| 73 | 71 | int r, g, b; |
| 74 | 72 | |
| r20977 | r20978 | |
| 81 | 79 | bit0 = (r >> 0) & 0x01; |
| 82 | 80 | bit1 = (r >> 1) & 0x01; |
| 83 | 81 | bit2 = (r >> 2) & 0x01; |
| 84 | r = combine_3_weights( | |
| 82 | r = combine_3_weights(m_rweights, bit0, bit1, bit2); | |
| 85 | 83 | |
| 86 | 84 | /* green component */ |
| 87 | 85 | bit0 = (g >> 0) & 0x01; |
| 88 | 86 | bit1 = (g >> 1) & 0x01; |
| 89 | 87 | bit2 = (g >> 2) & 0x01; |
| 90 | g = combine_3_weights( | |
| 88 | g = combine_3_weights(m_gweights, bit0, bit1, bit2); | |
| 91 | 89 | |
| 92 | 90 | /* blue component */ |
| 93 | 91 | bit0 = (b >> 0) & 0x01; |
| 94 | 92 | bit1 = (b >> 1) & 0x01; |
| 95 | b = combine_2_weights( | |
| 93 | b = combine_2_weights(m_bweights, bit0, bit1); | |
| 96 | 94 | |
| 97 | palette_set_color(machine, entry, MAKE_RGB(r, g, b)); | |
| 95 | palette_set_color(machine(), entry, MAKE_RGB(r, g, b)); | |
| 98 | 96 | } |
| 99 | 97 | |
| 100 | 98 | |
| 101 | ||
| 99 | void segag80r_state::spaceod_bg_init_palette() | |
| 102 | 100 | { |
| 103 | 101 | static const int resistances[2] = { 1800, 1200 }; |
| 104 | 102 | double trweights[2], tgweights[2], tbweights[2]; |
| r20977 | r20978 | |
| 136 | 134 | bit1 = (b >> 1) & 0x01; |
| 137 | 135 | b = combine_2_weights(tbweights, bit0, bit1); |
| 138 | 136 | |
| 139 | palette_set_color(machine, 64 + i, MAKE_RGB(r, g, b)); | |
| 137 | palette_set_color(machine(), 64 + i, MAKE_RGB(r, g, b)); | |
| 140 | 138 | } |
| 141 | 139 | } |
| 142 | 140 | |
| r20977 | r20978 | |
| 204 | 202 | /* create a fixed background palette and two tilemaps, one horizontally scrolling */ |
| 205 | 203 | /* and one vertically scrolling */ |
| 206 | 204 | case G80_BACKGROUND_SPACEOD: |
| 207 | spaceod_bg_init_palette( | |
| 205 | spaceod_bg_init_palette(); | |
| 208 | 206 | m_spaceod_bg_htilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::spaceod_get_tile_info),this), tilemap_mapper_delegate(FUNC(segag80r_state::spaceod_scan_rows),this), 8,8, 128,32); |
| 209 | 207 | m_spaceod_bg_vtilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::spaceod_get_tile_info),this), tilemap_mapper_delegate(FUNC(segag80r_state::spaceod_scan_rows),this), 8,8, 32,128); |
| 210 | 208 | break; |
| r20977 | r20978 | |
| 256 | 254 | { |
| 257 | 255 | offset &= 0x3f; |
| 258 | 256 | m_generic_paletteram_8[offset] = data; |
| 259 | g80_set_palette_entry( | |
| 257 | g80_set_palette_entry(offset, data); | |
| 260 | 258 | return; |
| 261 | 259 | } |
| 262 | 260 | |
| r20977 | r20978 | |
| 420 | 418 | { |
| 421 | 419 | offs_t paloffs = offset & 0x3f; |
| 422 | 420 | m_generic_paletteram_8[paloffs | 0x40] = data; |
| 423 | g80_set_palette_entry( | |
| 421 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 424 | 422 | /* note that since the background board is not integrated with the main board */ |
| 425 | 423 | /* writes here also write through to regular videoram */ |
| 426 | 424 | } |
| r20977 | r20978 | |
| 490 | 488 | { |
| 491 | 489 | offs_t paloffs = offset & 0x3f; |
| 492 | 490 | m_generic_paletteram_8[paloffs | 0x40] = data; |
| 493 | g80_set_palette_entry( | |
| 491 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 494 | 492 | return; |
| 495 | 493 | } |
| 496 | 494 | |
| r20977 | r20978 | |
| 573 | 571 | { |
| 574 | 572 | offs_t paloffs = offset & 0x3f; |
| 575 | 573 | m_generic_paletteram_8[paloffs | 0x40] = data; |
| 576 | g80_set_palette_entry( | |
| 574 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 577 | 575 | return; |
| 578 | 576 | } |
| 579 | 577 | |
| r20977 | r20978 | |
| 621 | 619 | * |
| 622 | 620 | *************************************/ |
| 623 | 621 | |
| 624 | ||
| 622 | void segag80r_state::draw_videoram(bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *transparent_pens) | |
| 625 | 623 | { |
| 626 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 627 | UINT8 *videoram = state->m_videoram; | |
| 628 | int flipmask = state->m_video_flip ? 0x1f : 0x00; | |
| 624 | UINT8 *videoram = m_videoram; | |
| 625 | int flipmask = m_video_flip ? 0x1f : 0x00; | |
| 629 | 626 | int x, y; |
| 630 | 627 | |
| 631 | 628 | /* iterate over the screen and draw visible tiles */ |
| 632 | 629 | for (y = cliprect.min_y / 8; y <= cliprect.max_y / 8; y++) |
| 633 | 630 | { |
| 634 | int effy = | |
| 631 | int effy = m_video_flip ? 27 - y : y; | |
| 635 | 632 | for (x = cliprect.min_x / 8; x <= cliprect.max_x / 8; x++) |
| 636 | 633 | { |
| 637 | 634 | int offs = effy * 32 + (x ^ flipmask); |
| 638 | 635 | UINT8 tile = videoram[offs]; |
| 639 | 636 | |
| 640 | 637 | /* draw the tile */ |
| 641 | drawgfx_transmask(bitmap, cliprect, machine.gfx[0], tile, tile >> 4, | |
| 638 | drawgfx_transmask(bitmap, cliprect, machine().gfx[0], tile, tile >> 4, m_video_flip, m_video_flip, x*8, y*8, transparent_pens[tile >> 4]); | |
| 642 | 639 | } |
| 643 | 640 | } |
| 644 | 641 | } |
| r20977 | r20978 | |
| 651 | 648 | * |
| 652 | 649 | *************************************/ |
| 653 | 650 | |
| 654 | ||
| 651 | void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 655 | 652 | { |
| 656 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 657 | bitmap_ind16 &pixmap = (!(state->m_spaceod_bg_control & 0x02) ? state->m_spaceod_bg_htilemap : state->m_spaceod_bg_vtilemap)->pixmap(); | |
| 658 | int flipmask = (state->m_spaceod_bg_control & 0x01) ? 0xff : 0x00; | |
| 659 | int xoffset = (state->m_spaceod_bg_control & 0x02) ? 0x10 : 0x00; | |
| 653 | bitmap_ind16 &pixmap = (!(m_spaceod_bg_control & 0x02) ? m_spaceod_bg_htilemap : m_spaceod_bg_vtilemap)->pixmap(); | |
| 654 | int flipmask = (m_spaceod_bg_control & 0x01) ? 0xff : 0x00; | |
| 655 | int xoffset = (m_spaceod_bg_control & 0x02) ? 0x10 : 0x00; | |
| 660 | 656 | int xmask = pixmap.width() - 1; |
| 661 | 657 | int ymask = pixmap.height() - 1; |
| 662 | 658 | int x, y; |
| r20977 | r20978 | |
| 670 | 666 | /* now fill in the background wherever there are black pixels */ |
| 671 | 667 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 672 | 668 | { |
| 673 | int effy = (y + | |
| 669 | int effy = (y + m_spaceod_vcounter + 22) ^ flipmask; | |
| 674 | 670 | UINT16 *src = &pixmap.pix16(effy & ymask); |
| 675 | 671 | UINT16 *dst = &bitmap.pix16(y); |
| 676 | 672 | |
| 677 | 673 | /* loop over horizontal pixels */ |
| 678 | 674 | for (x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 679 | 675 | { |
| 680 | int effx = ((x + state->m_spaceod_hcounter) ^ flipmask) + xoffset; | |
| 681 | UINT8 fgpix = state->m_generic_paletteram_8[dst[x]]; | |
| 676 | int effx = ((x + m_spaceod_hcounter) ^ flipmask) + xoffset; | |
| 677 | UINT8 fgpix = m_generic_paletteram_8[dst[x]]; | |
| 682 | 678 | UINT8 bgpix = src[effx & xmask] & 0x3f; |
| 683 | 679 | |
| 684 | 680 | /* the background detect flag is set if: |
| r20977 | r20978 | |
| 687 | 683 | - the original tile color == DIP switches |
| 688 | 684 | */ |
| 689 | 685 | if (bgpix != 0 && fgpix != 0 && (dst[x] >> 2) == spaceod_bg_detect_tile_color) |
| 690 | | |
| 686 | m_spaceod_bg_detect = 1; | |
| 691 | 687 | |
| 692 | 688 | /* the background graphics are only displayed if: |
| 693 | 689 | - fgpix == 0 AND |
| 694 | 690 | - !EXTBLK (not blanked) AND |
| 695 | - | |
| 691 | - m_bg_enable == 0 | |
| 696 | 692 | */ |
| 697 | if (fgpix == 0 && state->m_bg_enable == 0) | |
| 698 | dst[x] = bgpix | state->m_spaceod_fixed_color | 0x40; | |
| 693 | if (fgpix == 0 && m_bg_enable == 0) | |
| 694 | dst[x] = bgpix | m_spaceod_fixed_color | 0x40; | |
| 699 | 695 | } |
| 700 | 696 | } |
| 701 | 697 | } |
| r20977 | r20978 | |
| 709 | 705 | * |
| 710 | 706 | *************************************/ |
| 711 | 707 | |
| 712 | ||
| 708 | void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 713 | 709 | { |
| 714 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 715 | bitmap_ind16 &pixmap = state->m_bg_tilemap->pixmap(); | |
| 716 | int flipmask = (state->m_video_control & 0x08) ? 0xff : 0x00; | |
| 710 | bitmap_ind16 &pixmap = m_bg_tilemap->pixmap(); | |
| 711 | int flipmask = (m_video_control & 0x08) ? 0xff : 0x00; | |
| 717 | 712 | int xmask = pixmap.width() - 1; |
| 718 | 713 | int ymask = pixmap.height() - 1; |
| 719 | 714 | int x, y; |
| 720 | 715 | |
| 721 | 716 | /* if disabled, draw nothing */ |
| 722 | if (! | |
| 717 | if (!m_bg_enable) | |
| 723 | 718 | { |
| 724 | 719 | bitmap.fill(0, cliprect); |
| 725 | 720 | return; |
| r20977 | r20978 | |
| 728 | 723 | /* now fill in the background wherever there are black pixels */ |
| 729 | 724 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 730 | 725 | { |
| 731 | int effy = | |
| 726 | int effy = m_bg_scrolly + (((y ^ flipmask) + (flipmask & 0xe0)) & 0xff); | |
| 732 | 727 | UINT16 *src = &pixmap.pix16(effy & ymask); |
| 733 | 728 | UINT16 *dst = &bitmap.pix16(y); |
| 734 | 729 | |
| 735 | 730 | /* loop over horizontal pixels */ |
| 736 | 731 | for (x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 737 | 732 | { |
| 738 | int effx = | |
| 733 | int effx = m_bg_scrollx + (x ^ flipmask); | |
| 739 | 734 | dst[x] = src[effx & xmask]; |
| 740 | 735 | } |
| 741 | 736 | } |
| r20977 | r20978 | |
| 750 | 745 | * |
| 751 | 746 | *************************************/ |
| 752 | 747 | |
| 753 | ||
| 748 | void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 754 | 749 | { |
| 755 | segag80r_state *state = machine.driver_data<segag80r_state>(); | |
| 756 | bitmap_ind16 &pixmap = state->m_bg_tilemap->pixmap(); | |
| 757 | int flipmask = (state->m_video_control & 0x08) ? 0x3ff : 0x000; | |
| 750 | bitmap_ind16 &pixmap = m_bg_tilemap->pixmap(); | |
| 751 | int flipmask = (m_video_control & 0x08) ? 0x3ff : 0x000; | |
| 758 | 752 | int xmask = pixmap.width() - 1; |
| 759 | 753 | int ymask = pixmap.height() - 1; |
| 760 | 754 | int x, y; |
| 761 | 755 | |
| 762 | 756 | /* if disabled, draw nothing */ |
| 763 | if (! | |
| 757 | if (!m_bg_enable) | |
| 764 | 758 | { |
| 765 | 759 | bitmap.fill(0, cliprect); |
| 766 | 760 | return; |
| r20977 | r20978 | |
| 769 | 763 | /* now fill in the background wherever there are black pixels */ |
| 770 | 764 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 771 | 765 | { |
| 772 | int effy = (y + | |
| 766 | int effy = (y + m_bg_scrolly) ^ flipmask; | |
| 773 | 767 | UINT16 *src = &pixmap.pix16(effy & ymask); |
| 774 | 768 | UINT16 *dst = &bitmap.pix16(y); |
| 775 | 769 | |
| 776 | 770 | /* loop over horizontal pixels */ |
| 777 | 771 | for (x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 778 | 772 | { |
| 779 | int effx = (x + | |
| 773 | int effx = (x + m_bg_scrollx) ^ flipmask; | |
| 780 | 774 | dst[x] = src[effx & xmask]; |
| 781 | 775 | } |
| 782 | 776 | } |
| r20977 | r20978 | |
| 800 | 794 | /* background: none */ |
| 801 | 795 | case G80_BACKGROUND_NONE: |
| 802 | 796 | memset(transparent_pens, 0, 16); |
| 803 | draw_videoram( | |
| 797 | draw_videoram(bitmap, cliprect, transparent_pens); | |
| 804 | 798 | break; |
| 805 | 799 | |
| 806 | 800 | /* foreground: visible except where black */ |
| r20977 | r20978 | |
| 808 | 802 | /* we draw the foreground first, then the background to do collision detection */ |
| 809 | 803 | case G80_BACKGROUND_SPACEOD: |
| 810 | 804 | memset(transparent_pens, 0, 16); |
| 811 | draw_videoram(machine(), bitmap, cliprect, transparent_pens); | |
| 812 | draw_background_spaceod(machine(), bitmap, cliprect); | |
| 805 | draw_videoram(bitmap, cliprect, transparent_pens); | |
| 806 | draw_background_spaceod(bitmap, cliprect); | |
| 813 | 807 | break; |
| 814 | 808 | |
| 815 | 809 | /* foreground: visible except for pen 0 (this disagrees with schematics) */ |
| 816 | 810 | /* background: page-granular scrolling */ |
| 817 | 811 | case G80_BACKGROUND_MONSTERB: |
| 818 | 812 | memset(transparent_pens, 1, 16); |
| 819 | draw_background_page_scroll(machine(), bitmap, cliprect); | |
| 820 | draw_videoram(machine(), bitmap, cliprect, transparent_pens); | |
| 813 | draw_background_page_scroll(bitmap, cliprect); | |
| 814 | draw_videoram(bitmap, cliprect, transparent_pens); | |
| 821 | 815 | break; |
| 822 | 816 | |
| 823 | 817 | /* foreground: visible except for pen 0 */ |
| 824 | 818 | /* background: full scrolling */ |
| 825 | 819 | case G80_BACKGROUND_PIGNEWT: |
| 826 | 820 | memset(transparent_pens, 1, 16); |
| 827 | draw_background_full_scroll(machine(), bitmap, cliprect); | |
| 828 | draw_videoram(machine(), bitmap, cliprect, transparent_pens); | |
| 821 | draw_background_full_scroll(bitmap, cliprect); | |
| 822 | draw_videoram(bitmap, cliprect, transparent_pens); | |
| 829 | 823 | break; |
| 830 | 824 | |
| 831 | 825 | /* foreground: visible except for pen 0 */ |
| 832 | 826 | /* background: page-granular scrolling */ |
| 833 | 827 | case G80_BACKGROUND_SINDBADM: |
| 834 | 828 | memset(transparent_pens, 1, 16); |
| 835 | draw_background_page_scroll(machine(), bitmap, cliprect); | |
| 836 | draw_videoram(machine(), bitmap, cliprect, transparent_pens); | |
| 829 | draw_background_page_scroll(bitmap, cliprect); | |
| 830 | draw_videoram(bitmap, cliprect, transparent_pens); | |
| 837 | 831 | break; |
| 838 | 832 | } |
| 839 | 833 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | int suprridr_is_screen_flipped( | |
| 124 | int suprridr_state::suprridr_is_screen_flipped() | |
| 125 | 125 | { |
| 126 | suprridr_state *state = machine.driver_data<suprridr_state>(); | |
| 127 | return state->m_flipx; /* or is it flipy? */ | |
| 126 | return m_flipx; /* or is it flipy? */ | |
| 128 | 127 | } |
| 129 | 128 | |
| 130 | 129 |
| r20977 | r20978 | |
|---|---|---|
| 131 | 131 | m_bg_tilemap->set_scroll_cols(32); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | ||
| 134 | void sbasketb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 135 | 135 | { |
| 136 | sbasketb_state *state = machine.driver_data<sbasketb_state>(); | |
| 137 | UINT8 *spriteram = state->m_spriteram; | |
| 138 | int offs = (*state->m_spriteram_select & 0x01) * 0x100; | |
| 136 | UINT8 *spriteram = m_spriteram; | |
| 137 | int offs = (*m_spriteram_select & 0x01) * 0x100; | |
| 139 | 138 | int i; |
| 140 | 139 | |
| 141 | 140 | for (i = 0; i < 64; i++, offs += 4) |
| r20977 | r20978 | |
| 146 | 145 | if (sx || sy) |
| 147 | 146 | { |
| 148 | 147 | int code = spriteram[offs + 0] | ((spriteram[offs + 1] & 0x20) << 3); |
| 149 | int color = (spriteram[offs + 1] & 0x0f) + 16 * * | |
| 148 | int color = (spriteram[offs + 1] & 0x0f) + 16 * *m_palettebank; | |
| 150 | 149 | int flipx = spriteram[offs + 1] & 0x40; |
| 151 | 150 | int flipy = spriteram[offs + 1] & 0x80; |
| 152 | 151 | |
| 153 | if ( | |
| 152 | if (flip_screen()) | |
| 154 | 153 | { |
| 155 | 154 | sx = 240 - sx; |
| 156 | 155 | sy = 240 - sy; |
| r20977 | r20978 | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | drawgfx_transpen(bitmap,cliprect, |
| 162 | machine.gfx[1], | |
| 161 | machine().gfx[1], | |
| 163 | 162 | code, color, |
| 164 | 163 | flipx, flipy, |
| 165 | 164 | sx, sy, 0); |
| r20977 | r20978 | |
| 175 | 174 | m_bg_tilemap->set_scrolly(col, *m_scroll); |
| 176 | 175 | |
| 177 | 176 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 178 | draw_sprites( | |
| 177 | draw_sprites(bitmap, cliprect); | |
| 179 | 178 | return 0; |
| 180 | 179 | } |
| r20977 | r20978 | |
|---|---|---|
| 187 | 187 | * |
| 188 | 188 | *************************************/ |
| 189 | 189 | |
| 190 | void skullxbo_scanline_update( | |
| 190 | void skullxbo_state::skullxbo_scanline_update(int scanline) | |
| 191 | 191 | { |
| 192 | skullxbo_state *state = machine.driver_data<skullxbo_state>(); | |
| 193 | UINT16 *base = &state->m_alpha[(scanline / 8) * 64 + 42]; | |
| 192 | UINT16 *base = &m_alpha[(scanline / 8) * 64 + 42]; | |
| 194 | 193 | int x; |
| 195 | 194 | |
| 196 | 195 | /* keep in range */ |
| 197 | if (base >= & | |
| 196 | if (base >= &m_alpha[0x7c0]) | |
| 198 | 197 | return; |
| 199 | 198 | |
| 200 | 199 | /* special case: scanline 0 should re-latch the previous raw scroll */ |
| 201 | 200 | if (scanline == 0) |
| 202 | 201 | { |
| 203 | int newscroll = (*state->m_yscroll >> 7) & 0x1ff; | |
| 204 | state->m_playfield_tilemap->set_scrolly(0, newscroll); | |
| 202 | int newscroll = (*m_yscroll >> 7) & 0x1ff; | |
| 203 | m_playfield_tilemap->set_scrolly(0, newscroll); | |
| 205 | 204 | atarimo_set_yscroll(0, newscroll); |
| 206 | 205 | } |
| 207 | 206 | |
| r20977 | r20978 | |
| 219 | 218 | |
| 220 | 219 | /* force a partial update with the previous scroll */ |
| 221 | 220 | if (scanline > 0) |
| 222 | machine.primary_screen->update_partial(scanline - 1); | |
| 221 | machine().primary_screen->update_partial(scanline - 1); | |
| 223 | 222 | |
| 224 | 223 | /* update the new scroll */ |
| 225 | | |
| 224 | m_playfield_tilemap->set_scrolly(0, newscroll); | |
| 226 | 225 | atarimo_set_yscroll(0, newscroll); |
| 227 | 226 | |
| 228 | 227 | /* make sure we change this value so that writes to the scroll register */ |
| 229 | 228 | /* know whether or not they are a different scroll */ |
| 230 | * | |
| 229 | *m_yscroll = data; | |
| 231 | 230 | } |
| 232 | 231 | } |
| 233 | 232 | } |
| r20977 | r20978 | |
|---|---|---|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | |
| 706 | ||
| 706 | void snk_state::tnk3_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int xscroll, const int yscroll) | |
| 707 | 707 | { |
| 708 | snk_state *state = machine.driver_data<snk_state>(); | |
| 709 | UINT8 *spriteram = state->m_spriteram; | |
| 710 | gfx_element *gfx = machine.gfx[2]; | |
| 708 | UINT8 *spriteram = m_spriteram; | |
| 709 | gfx_element *gfx = machine().gfx[2]; | |
| 711 | 710 | const int size = gfx->width(); |
| 712 | 711 | int tile_number, attributes, color, sx, sy; |
| 713 | 712 | int xflip,yflip; |
| r20977 | r20978 | |
| 719 | 718 | /* sgladiat and tnk3 have 512 tiles, bit 6 is bank and bit 5 is y-flip */ |
| 720 | 719 | /* athena has 1024 tiles, bit 6 and bit 5 are bank */ |
| 721 | 720 | |
| 722 | for (offs = 0; offs < | |
| 721 | for (offs = 0; offs < m_num_sprites*4; offs += 4) | |
| 723 | 722 | { |
| 724 | 723 | tile_number = spriteram[offs+1]; |
| 725 | 724 | attributes = spriteram[offs+3]; |
| r20977 | r20978 | |
| 745 | 744 | yflip = attributes & 0x20; |
| 746 | 745 | } |
| 747 | 746 | |
| 748 | if ( | |
| 747 | if (flip_screen()) | |
| 749 | 748 | { |
| 750 | 749 | sx = 89 - size - sx; // this causes slight misalignment in tnk3 but is correct for athena and fitegolf |
| 751 | 750 | sy = 262 - size - sy; |
| r20977 | r20978 | |
| 754 | 753 | } |
| 755 | 754 | |
| 756 | 755 | sx &= 0x1ff; |
| 757 | sy &= | |
| 756 | sy &= m_yscroll_mask; // sgladiat apparently has only 256 pixels of vertical scrolling range | |
| 758 | 757 | if (sx > 512-size) sx -= 512; |
| 759 | if (sy > ( | |
| 758 | if (sy > (m_yscroll_mask+1)-size) sy -= (m_yscroll_mask+1); | |
| 760 | 759 | |
| 761 | 760 | drawgfx_transtable(bitmap,cliprect,gfx, |
| 762 | 761 | tile_number, |
| 763 | 762 | color, |
| 764 | 763 | xflip,yflip, |
| 765 | 764 | sx,sy, |
| 766 | | |
| 765 | m_drawmode_table, machine().shadow_table); | |
| 767 | 766 | } |
| 768 | 767 | } |
| 769 | 768 | |
| r20977 | r20978 | |
| 927 | 926 | m_bg_tilemap->set_scrolly(0, m_bg_scrolly); |
| 928 | 927 | |
| 929 | 928 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 930 | tnk3_draw_sprites( | |
| 929 | tnk3_draw_sprites(bitmap, cliprect, m_sp16_scrollx, m_sp16_scrolly); | |
| 931 | 930 | m_tx_tilemap->draw(bitmap, cliprect, 0, 0); |
| 932 | 931 | |
| 933 | 932 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 198 | 198 | * |
| 199 | 199 | *************************************/ |
| 200 | 200 | |
| 201 | struct extents_list | |
| 202 | { | |
| 203 | UINT8 scan_extent[256]; | |
| 204 | UINT16 extent[32][16]; | |
| 205 | }; | |
| 206 | 201 | |
| 207 | ||
| 208 | struct cache_entry | |
| 209 | { | |
| 210 | struct cache_entry * next; | |
| 211 | tilemap_t * tmap; | |
| 212 | UINT8 page; | |
| 213 | UINT8 bank; | |
| 214 | }; | |
| 215 | ||
| 216 | ||
| 217 | ||
| 218 | 202 | /************************************* |
| 219 | 203 | * |
| 220 | * Prototypes | |
| 221 | * | |
| 222 | *************************************/ | |
| 223 | ||
| 224 | ||
| 225 | static void sprite_erase_buffer(segas32_state *state); | |
| 226 | static void sprite_swap_buffers(segas32_state *state); | |
| 227 | static void sprite_render_list(running_machine &machine); | |
| 228 | ||
| 229 | ||
| 230 | ||
| 231 | ||
| 232 | /************************************* | |
| 233 | * | |
| 234 | 204 | * Video start |
| 235 | 205 | * |
| 236 | 206 | *************************************/ |
| 237 | 207 | |
| 238 | ||
| 208 | void segas32_state::common_start(int multi32) | |
| 239 | 209 | { |
| 240 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 241 | 210 | int tmap; |
| 242 | 211 | |
| 243 | 212 | /* remember whether or not we are multi32 */ |
| 244 | | |
| 213 | m_is_multi32 = multi32; | |
| 245 | 214 | |
| 246 | 215 | /* allocate a copy of spriteram in 32-bit format */ |
| 247 | | |
| 216 | m_spriteram_32bit = auto_alloc_array(machine(), UINT32, 0x20000/4); | |
| 248 | 217 | |
| 249 | 218 | /* allocate the tilemap cache */ |
| 250 | | |
| 219 | m_cache_head = NULL; | |
| 251 | 220 | for (tmap = 0; tmap < TILEMAP_CACHE_SIZE; tmap++) |
| 252 | 221 | { |
| 253 | struct cache_entry *entry = auto_alloc(machine, struct cache_entry); | |
| 222 | struct cache_entry *entry = auto_alloc(machine(), struct cache_entry); | |
| 254 | 223 | |
| 255 | entry->tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(segas32_state::get_tile_info), | |
| 224 | entry->tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segas32_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,16); | |
| 256 | 225 | entry->page = 0xff; |
| 257 | 226 | entry->bank = 0; |
| 258 | entry->next = | |
| 227 | entry->next = m_cache_head; | |
| 259 | 228 | entry->tmap->set_user_data(entry); |
| 260 | 229 | |
| 261 | | |
| 230 | m_cache_head = entry; | |
| 262 | 231 | } |
| 263 | 232 | |
| 264 | 233 | /* allocate the bitmaps (a few extra for multi32) */ |
| 265 | 234 | for (tmap = 0; tmap < 9 + 2 * multi32; tmap++) |
| 266 | 235 | { |
| 267 | state->m_layer_data[tmap].bitmap = auto_bitmap_ind16_alloc(machine, 416, 224); | |
| 268 | state->m_layer_data[tmap].transparent = auto_alloc_array_clear(machine, UINT8, 256); | |
| 236 | m_layer_data[tmap].bitmap = auto_bitmap_ind16_alloc(machine(), 416, 224); | |
| 237 | m_layer_data[tmap].transparent = auto_alloc_array_clear(machine(), UINT8, 256); | |
| 269 | 238 | } |
| 270 | 239 | |
| 271 | 240 | /* allocate pre-rendered solid lines of 0's and ffff's */ |
| 272 | state->m_solid_0000 = auto_alloc_array(machine, UINT16, 512); | |
| 273 | memset(state->m_solid_0000, 0x00, sizeof(state->m_solid_0000[0]) * 512); | |
| 274 | state->m_solid_ffff = auto_alloc_array(machine, UINT16, 512); | |
| 275 | memset(state->m_solid_ffff, 0xff, sizeof(state->m_solid_ffff[0]) * 512); | |
| 241 | m_solid_0000 = auto_alloc_array(machine(), UINT16, 512); | |
| 242 | memset(m_solid_0000, 0x00, sizeof(m_solid_0000[0]) * 512); | |
| 243 | m_solid_ffff = auto_alloc_array(machine(), UINT16, 512); | |
| 244 | memset(m_solid_ffff, 0xff, sizeof(m_solid_ffff[0]) * 512); | |
| 276 | 245 | |
| 277 | 246 | /* initialize videoram */ |
| 278 | | |
| 247 | m_system32_videoram[0x1ff00/2] = 0x8000; | |
| 279 | 248 | } |
| 280 | 249 | |
| 281 | 250 | |
| 282 | 251 | VIDEO_START_MEMBER(segas32_state,system32) |
| 283 | 252 | { |
| 284 | common_start( | |
| 253 | common_start(0); | |
| 285 | 254 | } |
| 286 | 255 | |
| 287 | 256 | |
| 288 | 257 | VIDEO_START_MEMBER(segas32_state,multi32) |
| 289 | 258 | { |
| 290 | common_start( | |
| 259 | common_start(1); | |
| 291 | 260 | } |
| 292 | 261 | |
| 293 | 262 | |
| r20977 | r20978 | |
| 313 | 282 | |
| 314 | 283 | /* look for pending commands */ |
| 315 | 284 | if (m_sprite_control[0] & 2) |
| 316 | sprite_erase_buffer( | |
| 285 | sprite_erase_buffer(); | |
| 317 | 286 | if (m_sprite_control[0] & 1) |
| 318 | 287 | { |
| 319 | sprite_swap_buffers(this); | |
| 320 | sprite_render_list(machine()); | |
| 288 | sprite_swap_buffers(); | |
| 289 | sprite_render_list(); | |
| 321 | 290 | } |
| 322 | 291 | m_sprite_control[0] = 0; |
| 323 | 292 | } |
| 324 | 293 | |
| 325 | 294 | |
| 326 | void system32_set_vblank( | |
| 295 | void segas32_state::system32_set_vblank(int state) | |
| 327 | 296 | { |
| 328 | segas32_state *drvstate = machine.driver_data<segas32_state>(); | |
| 329 | 297 | /* at the end of VBLANK is when automatic sprite rendering happens */ |
| 330 | 298 | if (!state) |
| 331 | machine.scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(segas32_state::update_sprites), | |
| 299 | machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(segas32_state::update_sprites),this), 1); | |
| 332 | 300 | } |
| 333 | 301 | |
| 334 | 302 | |
| r20977 | r20978 | |
| 339 | 307 | * |
| 340 | 308 | *************************************/ |
| 341 | 309 | |
| 342 | ||
| 310 | inline UINT16 segas32_state::xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(UINT16 value) | |
| 343 | 311 | { |
| 344 | 312 | int r = (value >> 0) & 0x1f; |
| 345 | 313 | int g = (value >> 5) & 0x1f; |
| r20977 | r20978 | |
| 350 | 318 | } |
| 351 | 319 | |
| 352 | 320 | |
| 353 | ||
| 321 | inline UINT16 segas32_state::xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(UINT16 value) | |
| 354 | 322 | { |
| 355 | 323 | int r = ((value >> 12) & 0x01) | ((value << 1) & 0x1e); |
| 356 | 324 | int g = ((value >> 13) & 0x01) | ((value >> 3) & 0x1e); |
| r20977 | r20978 | |
| 359 | 327 | } |
| 360 | 328 | |
| 361 | 329 | |
| 362 | ||
| 330 | inline void segas32_state::update_color(int offset, UINT16 data) | |
| 363 | 331 | { |
| 364 | 332 | /* note that since we use this RAM directly, we don't technically need */ |
| 365 | 333 | /* to call palette_set_color() at all; however, it does give us that */ |
| 366 | 334 | /* nice display when you hit F4, which is useful for debugging */ |
| 367 | 335 | |
| 368 | 336 | /* set the color */ |
| 369 | palette_set_color_rgb(machine, offset, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); | |
| 337 | palette_set_color_rgb(machine(), offset, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); | |
| 370 | 338 | } |
| 371 | 339 | |
| 372 | 340 | |
| 373 | ||
| 341 | inline UINT16 segas32_state::common_paletteram_r(address_space &space, int which, offs_t offset) | |
| 374 | 342 | { |
| 375 | segas32_state *state = space.machine().driver_data<segas32_state>(); | |
| 376 | 343 | int convert; |
| 377 | 344 | |
| 378 | 345 | /* the lower half of palette RAM is formatted xBBBBBGGGGGRRRRR */ |
| r20977 | r20978 | |
| 383 | 350 | offset &= 0x3fff; |
| 384 | 351 | |
| 385 | 352 | if (!convert) |
| 386 | return | |
| 353 | return m_system32_paletteram[which][offset]; | |
| 387 | 354 | else |
| 388 | return xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR( | |
| 355 | return xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(m_system32_paletteram[which][offset]); | |
| 389 | 356 | } |
| 390 | 357 | |
| 391 | 358 | |
| 392 | ||
| 359 | void segas32_state::common_paletteram_w(address_space &space, int which, offs_t offset, UINT16 data, UINT16 mem_mask) | |
| 393 | 360 | { |
| 394 | segas32_state *state = space.machine().driver_data<segas32_state>(); | |
| 395 | 361 | UINT16 value; |
| 396 | 362 | int convert; |
| 397 | 363 | |
| r20977 | r20978 | |
| 403 | 369 | offset &= 0x3fff; |
| 404 | 370 | |
| 405 | 371 | /* read, modify, and write the new value, updating the palette */ |
| 406 | value = | |
| 372 | value = m_system32_paletteram[which][offset]; | |
| 407 | 373 | if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); |
| 408 | 374 | COMBINE_DATA(&value); |
| 409 | 375 | if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); |
| 410 | state->m_system32_paletteram[which][offset] = value; | |
| 411 | update_color(space.machine(), 0x4000*which + offset, value); | |
| 376 | m_system32_paletteram[which][offset] = value; | |
| 377 | update_color(0x4000*which + offset, value); | |
| 412 | 378 | |
| 413 | 379 | /* if blending is enabled, writes go to both halves of palette RAM */ |
| 414 | if ( | |
| 380 | if (m_mixer_control[which][0x4e/2] & 0x0880) | |
| 415 | 381 | { |
| 416 | 382 | offset ^= 0x2000; |
| 417 | 383 | |
| 418 | 384 | /* read, modify, and write the new value, updating the palette */ |
| 419 | value = | |
| 385 | value = m_system32_paletteram[which][offset]; | |
| 420 | 386 | if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); |
| 421 | 387 | COMBINE_DATA(&value); |
| 422 | 388 | if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); |
| 423 | state->m_system32_paletteram[which][offset] = value; | |
| 424 | update_color(space.machine(), 0x4000*which + offset, value); | |
| 389 | m_system32_paletteram[which][offset] = value; | |
| 390 | update_color(0x4000*which + offset, value); | |
| 425 | 391 | } |
| 426 | 392 | } |
| 427 | 393 | |
| r20977 | r20978 | |
| 698 | 664 | * |
| 699 | 665 | *************************************/ |
| 700 | 666 | |
| 701 | ||
| 667 | tilemap_t *segas32_state::find_cache_entry(int page, int bank) | |
| 702 | 668 | { |
| 703 | struct cache_entry *entry, *prev; | |
| 669 | struct segas32_state::cache_entry *entry, *prev; | |
| 704 | 670 | |
| 705 | 671 | /* scan the list for a matching entry */ |
| 706 | 672 | prev = NULL; |
| 707 | entry = | |
| 673 | entry = m_cache_head; | |
| 708 | 674 | while (1) |
| 709 | 675 | { |
| 710 | 676 | if (entry->page == page && entry->bank == bank) |
| r20977 | r20978 | |
| 713 | 679 | if (prev) |
| 714 | 680 | { |
| 715 | 681 | prev->next = entry->next; |
| 716 | entry->next = state->m_cache_head; | |
| 717 | state->m_cache_head = entry; | |
| 682 | entry->next = m_cache_head; | |
| 683 | m_cache_head = entry; | |
| 718 | 684 | } |
| 719 | 685 | return entry->tmap; |
| 720 | 686 | } |
| r20977 | r20978 | |
| 733 | 699 | |
| 734 | 700 | /* move it to the head */ |
| 735 | 701 | prev->next = entry->next; |
| 736 | entry->next = state->m_cache_head; | |
| 737 | state->m_cache_head = entry; | |
| 702 | entry->next = m_cache_head; | |
| 703 | m_cache_head = entry; | |
| 738 | 704 | |
| 739 | 705 | return entry->tmap; |
| 740 | 706 | } |
| r20977 | r20978 | |
| 749 | 715 | |
| 750 | 716 | TILE_GET_INFO_MEMBER(segas32_state::get_tile_info) |
| 751 | 717 | { |
| 752 | struct cache_entry *entry = (struct cache_entry *)param; | |
| 718 | struct segas32_state::cache_entry *entry = (struct segas32_state::cache_entry *)param; | |
| 753 | 719 | UINT16 data = m_system32_videoram[(entry->page & 0x7f) * 0x200 + tile_index]; |
| 754 | 720 | SET_TILE_INFO_MEMBER(0, (entry->bank << 13) + (data & 0x1fff), (data >> 4) & 0x1ff, (data >> 14) & 3); |
| 755 | 721 | } |
| r20977 | r20978 | |
| 762 | 728 | * |
| 763 | 729 | *************************************/ |
| 764 | 730 | |
| 765 | ||
| 731 | int segas32_state::compute_clipping_extents(screen_device &screen, int enable, int clipout, int clipmask, const rectangle &cliprect, struct extents_list *list) | |
| 766 | 732 | { |
| 767 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 768 | int flip = (state->m_system32_videoram[0x1ff00/2] >> 9) & 1; | |
| 733 | int flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; | |
| 769 | 734 | rectangle tempclip; |
| 770 | 735 | rectangle clips[5]; |
| 771 | 736 | int sorted[5]; |
| r20977 | r20978 | |
| 792 | 757 | { |
| 793 | 758 | if (!flip) |
| 794 | 759 | { |
| 795 | clips[i].min_x = state->m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; | |
| 796 | clips[i].min_y = state->m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; | |
| 797 | clips[i].max_x = (state->m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; | |
| 798 | clips[i].max_y = (state->m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; | |
| 760 | clips[i].min_x = m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; | |
| 761 | clips[i].min_y = m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; | |
| 762 | clips[i].max_x = (m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; | |
| 763 | clips[i].max_y = (m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; | |
| 799 | 764 | } |
| 800 | 765 | else |
| 801 | 766 | { |
| 802 | 767 | const rectangle &visarea = screen.visible_area(); |
| 803 | 768 | |
| 804 | clips[i].max_x = (visarea.max_x + 1) - (state->m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); | |
| 805 | clips[i].max_y = (visarea.max_y + 1) - (state->m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); | |
| 806 | clips[i].min_x = (visarea.max_x + 1) - ((state->m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); | |
| 807 | clips[i].min_y = (visarea.max_y + 1) - ((state->m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); | |
| 769 | clips[i].max_x = (visarea.max_x + 1) - (m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); | |
| 770 | clips[i].max_y = (visarea.max_y + 1) - (m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); | |
| 771 | clips[i].min_x = (visarea.max_x + 1) - ((m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); | |
| 772 | clips[i].min_y = (visarea.max_y + 1) - ((m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); | |
| 808 | 773 | } |
| 809 | 774 | clips[i] &= tempclip; |
| 810 | 775 | sorted[i] = i; |
| r20977 | r20978 | |
| 872 | 837 | * |
| 873 | 838 | *************************************/ |
| 874 | 839 | |
| 875 | ||
| 840 | inline void segas32_state::get_tilemaps(int bgnum, tilemap_t **tilemaps) | |
| 876 | 841 | { |
| 877 | 842 | int tilebank, page; |
| 878 | 843 | |
| 879 | 844 | /* determine the current tilebank */ |
| 880 | if (state->m_is_multi32) | |
| 881 | tilebank = (state->m_system32_tilebank_external >> (2*bgnum)) & 3; | |
| 845 | if (m_is_multi32) | |
| 846 | tilebank = (m_system32_tilebank_external >> (2*bgnum)) & 3; | |
| 882 | 847 | else |
| 883 | tilebank = (( | |
| 848 | tilebank = ((m_system32_tilebank_external & 1) << 1) | ((m_system32_videoram[0x1ff00/2] & 0x400) >> 10); | |
| 884 | 849 | |
| 885 | 850 | /* find the cache entries */ |
| 886 | page = (state->m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 0) & 0x7f; | |
| 887 | tilemaps[0] = find_cache_entry(state, page, tilebank); | |
| 888 | page = (state->m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 8) & 0x7f; | |
| 889 | tilemaps[1] = find_cache_entry(state, page, tilebank); | |
| 890 | page = (state->m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 0) & 0x7f; | |
| 891 | tilemaps[2] = find_cache_entry(state, page, tilebank); | |
| 892 | page = (state->m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 8) & 0x7f; | |
| 893 | tilemaps[3] = find_cache_entry(state, page, tilebank); | |
| 851 | page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 0) & 0x7f; | |
| 852 | tilemaps[0] = find_cache_entry(page, tilebank); | |
| 853 | page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 8) & 0x7f; | |
| 854 | tilemaps[1] = find_cache_entry(page, tilebank); | |
| 855 | page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 0) & 0x7f; | |
| 856 | tilemaps[2] = find_cache_entry(page, tilebank); | |
| 857 | page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 8) & 0x7f; | |
| 858 | tilemaps[3] = find_cache_entry(page, tilebank); | |
| 894 | 859 | } |
| 895 | 860 | |
| 896 | 861 | |
| 897 | ||
| 862 | void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_state::layer_info *layer, const rectangle &cliprect, int bgnum) | |
| 898 | 863 | { |
| 899 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 900 | 864 | int clipenable, clipout, clips, clipdraw_start; |
| 901 | 865 | bitmap_ind16 &bitmap = *layer->bitmap; |
| 902 | 866 | struct extents_list clip_extents; |
| r20977 | r20978 | |
| 908 | 872 | int x, y; |
| 909 | 873 | |
| 910 | 874 | /* get the tilemaps */ |
| 911 | get_tilemaps( | |
| 875 | get_tilemaps(bgnum, tilemaps); | |
| 912 | 876 | |
| 913 | 877 | /* configure the layer */ |
| 914 | 878 | opaque = 0; |
| r20977 | r20978 | |
| 917 | 881 | //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; |
| 918 | 882 | |
| 919 | 883 | /* determine if we're flipped */ |
| 920 | flip = (( | |
| 884 | flip = ((m_system32_videoram[0x1ff00/2] >> 9) ^ (m_system32_videoram[0x1ff00/2] >> bgnum)) & 1; | |
| 921 | 885 | |
| 922 | 886 | /* determine the clipping */ |
| 923 | clipenable = (state->m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; | |
| 924 | clipout = (state->m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; | |
| 925 | clips = (state->m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; | |
| 887 | clipenable = (m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; | |
| 888 | clipout = (m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; | |
| 889 | clips = (m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; | |
| 926 | 890 | clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); |
| 927 | 891 | |
| 928 | 892 | /* extract the X/Y step values (these are in destination space!) */ |
| 929 | dstxstep = state->m_system32_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; | |
| 930 | if (state->m_system32_videoram[0x1ff00/2] & 0x4000) | |
| 931 | dstystep = state->m_system32_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; | |
| 893 | dstxstep = m_system32_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; | |
| 894 | if (m_system32_videoram[0x1ff00/2] & 0x4000) | |
| 895 | dstystep = m_system32_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; | |
| 932 | 896 | else |
| 933 | 897 | dstystep = dstxstep; |
| 934 | 898 | |
| r20977 | r20978 | |
| 943 | 907 | srcystep = (0x200 << 20) / dstystep; |
| 944 | 908 | |
| 945 | 909 | /* start with the fractional scroll offsets, in source coordinates */ |
| 946 | srcx_start = (state->m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; | |
| 947 | srcx_start += (state->m_system32_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; | |
| 948 | srcy = (state->m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; | |
| 949 | srcy += (state->m_system32_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; | |
| 910 | srcx_start = (m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; | |
| 911 | srcx_start += (m_system32_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; | |
| 912 | srcy = (m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; | |
| 913 | srcy += (m_system32_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; | |
| 950 | 914 | |
| 951 | 915 | /* then account for the destination center coordinates */ |
| 952 | srcx_start -= ((INT16)(state->m_system32_videoram[0x1ff30/2 + 2 * bgnum] << 6) >> 6) * srcxstep; | |
| 953 | srcy -= ((INT16)(state->m_system32_videoram[0x1ff32/2 + 2 * bgnum] << 7) >> 7) * srcystep; | |
| 916 | srcx_start -= ((INT16)(m_system32_videoram[0x1ff30/2 + 2 * bgnum] << 6) >> 6) * srcxstep; | |
| 917 | srcy -= ((INT16)(m_system32_videoram[0x1ff32/2 + 2 * bgnum] << 7) >> 7) * srcystep; | |
| 954 | 918 | |
| 955 | 919 | /* finally, account for destination top,left coordinates */ |
| 956 | 920 | srcx_start += cliprect.min_x * srcxstep; |
| r20977 | r20978 | |
| 1034 | 998 | #if 0 |
| 1035 | 999 | if (dstxstep != 0x200 || dstystep != 0x200) |
| 1036 | 1000 | popmessage("Zoom=%03X,%03X Cent=%03X,%03X", dstxstep, dstystep, |
| 1037 | state->m_system32_videoram[0x1ff30/2 + 2 * bgnum], | |
| 1038 | state->m_system32_videoram[0x1ff32/2 + 2 * bgnum]); | |
| 1001 | m_system32_videoram[0x1ff30/2 + 2 * bgnum], | |
| 1002 | m_system32_videoram[0x1ff32/2 + 2 * bgnum]); | |
| 1039 | 1003 | #endif |
| 1040 | 1004 | } |
| 1041 | 1005 | |
| r20977 | r20978 | |
| 1047 | 1011 | * |
| 1048 | 1012 | *************************************/ |
| 1049 | 1013 | |
| 1050 | ||
| 1014 | void segas32_state::update_tilemap_rowscroll(screen_device &screen, struct segas32_state::layer_info *layer, const rectangle &cliprect, int bgnum) | |
| 1051 | 1015 | { |
| 1052 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 1053 | 1016 | int clipenable, clipout, clips, clipdraw_start; |
| 1054 | 1017 | bitmap_ind16 &bitmap = *layer->bitmap; |
| 1055 | 1018 | struct extents_list clip_extents; |
| r20977 | r20978 | |
| 1062 | 1025 | int x, y; |
| 1063 | 1026 | |
| 1064 | 1027 | /* get the tilemaps */ |
| 1065 | get_tilemaps( | |
| 1028 | get_tilemaps(bgnum, tilemaps); | |
| 1066 | 1029 | |
| 1067 | 1030 | /* configure the layer */ |
| 1068 | 1031 | opaque = 0; |
| 1069 | //opaque = ( | |
| 1032 | //opaque = (m_system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; | |
| 1070 | 1033 | //if (screen.machine().input().code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1; |
| 1071 | 1034 | //if (screen.machine().input().code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1; |
| 1072 | 1035 | |
| 1073 | 1036 | /* determine if we're flipped */ |
| 1074 | flip = (( | |
| 1037 | flip = ((m_system32_videoram[0x1ff00/2] >> 9) ^ (m_system32_videoram[0x1ff00/2] >> bgnum)) & 1; | |
| 1075 | 1038 | |
| 1076 | 1039 | /* determine the clipping */ |
| 1077 | clipenable = (state->m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; | |
| 1078 | clipout = (state->m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; | |
| 1079 | clips = (state->m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; | |
| 1040 | clipenable = (m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; | |
| 1041 | clipout = (m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; | |
| 1042 | clips = (m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; | |
| 1080 | 1043 | clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); |
| 1081 | 1044 | |
| 1082 | 1045 | /* determine if row scroll and/or row select is enabled */ |
| 1083 | rowscroll = (state->m_system32_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; | |
| 1084 | rowselect = (state->m_system32_videoram[0x1ff04/2] >> bgnum) & 1; | |
| 1085 | if ((state->m_system32_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) | |
| 1046 | rowscroll = (m_system32_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; | |
| 1047 | rowselect = (m_system32_videoram[0x1ff04/2] >> bgnum) & 1; | |
| 1048 | if ((m_system32_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) | |
| 1086 | 1049 | rowscroll = rowselect = 0; |
| 1087 | 1050 | |
| 1088 | 1051 | /* get a pointer to the table */ |
| 1089 | table = & | |
| 1052 | table = &m_system32_videoram[(m_system32_videoram[0x1ff04/2] >> 10) * 0x400]; | |
| 1090 | 1053 | |
| 1091 | 1054 | /* start with screen-wide X and Y scrolls */ |
| 1092 | xscroll = (state->m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (state->m_system32_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); | |
| 1093 | yscroll = (state->m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); | |
| 1055 | xscroll = (m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_system32_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); | |
| 1056 | yscroll = (m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); | |
| 1094 | 1057 | |
| 1095 | 1058 | /* render the tilemap into its bitmap */ |
| 1096 | 1059 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| r20977 | r20978 | |
| 1187 | 1150 | #if 0 |
| 1188 | 1151 | if (rowscroll || rowselect) |
| 1189 | 1152 | popmessage("Scroll=%d Select=%d Table@%06X", |
| 1190 | rowscroll, rowselect, ( | |
| 1153 | rowscroll, rowselect, (m_system32_videoram[0x1ff04/2] >> 10) * 0x800); | |
| 1191 | 1154 | #endif |
| 1192 | 1155 | } |
| 1193 | 1156 | |
| r20977 | r20978 | |
| 1199 | 1162 | * |
| 1200 | 1163 | *************************************/ |
| 1201 | 1164 | |
| 1202 | ||
| 1165 | void segas32_state::update_tilemap_text(screen_device &screen, struct segas32_state::layer_info *layer, const rectangle &cliprect) | |
| 1203 | 1166 | { |
| 1204 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 1205 | 1167 | bitmap_ind16 &bitmap = *layer->bitmap; |
| 1206 | 1168 | UINT16 *tilebase; |
| 1207 | 1169 | UINT16 *gfxbase; |
| r20977 | r20978 | |
| 1211 | 1173 | int flip; |
| 1212 | 1174 | |
| 1213 | 1175 | /* determine if we're flipped */ |
| 1214 | flip = ( | |
| 1176 | flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; | |
| 1215 | 1177 | |
| 1216 | 1178 | /* determine the base of the tilemap and graphics data */ |
| 1217 | tilebase = &state->m_system32_videoram[((state->m_system32_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; | |
| 1218 | gfxbase = &state->m_system32_videoram[(state->m_system32_videoram[0x1ff5c/2] & 7) * 0x2000]; | |
| 1179 | tilebase = &m_system32_videoram[((m_system32_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; | |
| 1180 | gfxbase = &m_system32_videoram[(m_system32_videoram[0x1ff5c/2] & 7) * 0x2000]; | |
| 1219 | 1181 | |
| 1220 | 1182 | /* compute start/end tile numbers */ |
| 1221 | 1183 | startx = cliprect.min_x / 8; |
| r20977 | r20978 | |
| 1359 | 1321 | * |
| 1360 | 1322 | *************************************/ |
| 1361 | 1323 | |
| 1362 | ||
| 1324 | void segas32_state::update_bitmap(screen_device &screen, struct segas32_state::layer_info *layer, const rectangle &cliprect) | |
| 1363 | 1325 | { |
| 1364 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 1365 | 1326 | int clipenable, clipout, clips, clipdraw_start; |
| 1366 | 1327 | bitmap_ind16 &bitmap = *layer->bitmap; |
| 1367 | 1328 | struct extents_list clip_extents; |
| r20977 | r20978 | |
| 1371 | 1332 | int bpp; |
| 1372 | 1333 | |
| 1373 | 1334 | /* configure the layer */ |
| 1374 | bpp = ( | |
| 1335 | bpp = (m_system32_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; | |
| 1375 | 1336 | |
| 1376 | 1337 | /* determine the clipping */ |
| 1377 | clipenable = (state->m_system32_videoram[0x1ff02/2] >> 15) & 1; | |
| 1378 | clipout = (state->m_system32_videoram[0x1ff02/2] >> 10) & 1; | |
| 1338 | clipenable = (m_system32_videoram[0x1ff02/2] >> 15) & 1; | |
| 1339 | clipout = (m_system32_videoram[0x1ff02/2] >> 10) & 1; | |
| 1379 | 1340 | clips = 0x10; |
| 1380 | 1341 | clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); |
| 1381 | 1342 | |
| 1382 | 1343 | /* determine x/y scroll */ |
| 1383 | xscroll = state->m_system32_videoram[0x1ff88/2] & 0x1ff; | |
| 1384 | yscroll = state->m_system32_videoram[0x1ff8a/2] & 0x1ff; | |
| 1385 | color = (state->m_system32_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); | |
| 1344 | xscroll = m_system32_videoram[0x1ff88/2] & 0x1ff; | |
| 1345 | yscroll = m_system32_videoram[0x1ff8a/2] & 0x1ff; | |
| 1346 | color = (m_system32_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); | |
| 1386 | 1347 | |
| 1387 | 1348 | /* loop over target rows */ |
| 1388 | 1349 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| r20977 | r20978 | |
| 1405 | 1366 | /* 8bpp mode case */ |
| 1406 | 1367 | if (bpp == 8) |
| 1407 | 1368 | { |
| 1408 | UINT8 *src = (UINT8 *)& | |
| 1369 | UINT8 *src = (UINT8 *)&m_system32_videoram[512/2 * ((y + yscroll) & 0xff)]; | |
| 1409 | 1370 | for (x = extents[0]; x < extents[1]; x++) |
| 1410 | 1371 | { |
| 1411 | 1372 | int effx = (x + xscroll) & 0x1ff; |
| r20977 | r20978 | |
| 1419 | 1380 | /* 4bpp mode case */ |
| 1420 | 1381 | else |
| 1421 | 1382 | { |
| 1422 | UINT16 *src = & | |
| 1383 | UINT16 *src = &m_system32_videoram[512/4 * ((y + yscroll) & 0x1ff)]; | |
| 1423 | 1384 | for (x = extents[0]; x < extents[1]; x++) |
| 1424 | 1385 | { |
| 1425 | 1386 | int effx = (x + xscroll) & 0x1ff; |
| r20977 | r20978 | |
| 1463 | 1424 | * |
| 1464 | 1425 | *************************************/ |
| 1465 | 1426 | |
| 1466 | ||
| 1427 | void segas32_state::update_background(struct segas32_state::layer_info *layer, const rectangle &cliprect) | |
| 1467 | 1428 | { |
| 1468 | 1429 | bitmap_ind16 &bitmap = *layer->bitmap; |
| 1469 | 1430 | int x, y; |
| r20977 | r20978 | |
| 1474 | 1435 | int color; |
| 1475 | 1436 | |
| 1476 | 1437 | /* determine the color */ |
| 1477 | if (state->m_system32_videoram[0x1ff5e/2] & 0x8000) | |
| 1478 | color = (state->m_system32_videoram[0x1ff5e/2] & 0x1fff) + y; | |
| 1438 | if (m_system32_videoram[0x1ff5e/2] & 0x8000) | |
| 1439 | color = (m_system32_videoram[0x1ff5e/2] & 0x1fff) + y; | |
| 1479 | 1440 | else |
| 1480 | color = | |
| 1441 | color = m_system32_videoram[0x1ff5e/2] & 0x1e00; | |
| 1481 | 1442 | |
| 1482 | 1443 | /* if the color doesn't match, fill */ |
| 1483 | 1444 | if (dst[cliprect.min_x] != color) |
| r20977 | r20978 | |
| 1487 | 1448 | } |
| 1488 | 1449 | |
| 1489 | 1450 | |
| 1490 | ||
| 1451 | UINT8 segas32_state::update_tilemaps(screen_device &screen, const rectangle &cliprect) | |
| 1491 | 1452 | { |
| 1492 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 1493 | int enable0 = !(state->m_system32_videoram[0x1ff02/2] & 0x0001) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0002); | |
| 1494 | int enable1 = !(state->m_system32_videoram[0x1ff02/2] & 0x0002) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0004); | |
| 1495 | int enable2 = !(state->m_system32_videoram[0x1ff02/2] & 0x0004) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0008) && !(state->m_system32_videoram[0x1ff00/2] & 0x1000); | |
| 1496 | int enable3 = !(state->m_system32_videoram[0x1ff02/2] & 0x0008) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0010) && !(state->m_system32_videoram[0x1ff00/2] & 0x2000); | |
| 1497 | int enablet = !(state->m_system32_videoram[0x1ff02/2] & 0x0010) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0001); | |
| 1498 | int enableb = !(state->m_system32_videoram[0x1ff02/2] & 0x0020) && !(state->m_system32_videoram[0x1ff8e/2] & 0x0020); | |
| 1453 | int enable0 = !(m_system32_videoram[0x1ff02/2] & 0x0001) && !(m_system32_videoram[0x1ff8e/2] & 0x0002); | |
| 1454 | int enable1 = !(m_system32_videoram[0x1ff02/2] & 0x0002) && !(m_system32_videoram[0x1ff8e/2] & 0x0004); | |
| 1455 | int enable2 = !(m_system32_videoram[0x1ff02/2] & 0x0004) && !(m_system32_videoram[0x1ff8e/2] & 0x0008) && !(m_system32_videoram[0x1ff00/2] & 0x1000); | |
| 1456 | int enable3 = !(m_system32_videoram[0x1ff02/2] & 0x0008) && !(m_system32_videoram[0x1ff8e/2] & 0x0010) && !(m_system32_videoram[0x1ff00/2] & 0x2000); | |
| 1457 | int enablet = !(m_system32_videoram[0x1ff02/2] & 0x0010) && !(m_system32_videoram[0x1ff8e/2] & 0x0001); | |
| 1458 | int enableb = !(m_system32_videoram[0x1ff02/2] & 0x0020) && !(m_system32_videoram[0x1ff8e/2] & 0x0020); | |
| 1499 | 1459 | |
| 1500 | 1460 | /* update any tilemaps */ |
| 1501 | 1461 | if (enable0) |
| 1502 | update_tilemap_zoom(screen, & | |
| 1462 | update_tilemap_zoom(screen, &m_layer_data[MIXER_LAYER_NBG0], cliprect, 0); | |
| 1503 | 1463 | if (enable1) |
| 1504 | update_tilemap_zoom(screen, & | |
| 1464 | update_tilemap_zoom(screen, &m_layer_data[MIXER_LAYER_NBG1], cliprect, 1); | |
| 1505 | 1465 | if (enable2) |
| 1506 | update_tilemap_rowscroll(screen, & | |
| 1466 | update_tilemap_rowscroll(screen, &m_layer_data[MIXER_LAYER_NBG2], cliprect, 2); | |
| 1507 | 1467 | if (enable3) |
| 1508 | update_tilemap_rowscroll(screen, & | |
| 1468 | update_tilemap_rowscroll(screen, &m_layer_data[MIXER_LAYER_NBG3], cliprect, 3); | |
| 1509 | 1469 | if (enablet) |
| 1510 | update_tilemap_text(screen, & | |
| 1470 | update_tilemap_text(screen, &m_layer_data[MIXER_LAYER_TEXT], cliprect); | |
| 1511 | 1471 | if (enableb) |
| 1512 | update_bitmap(screen, &state->m_layer_data[MIXER_LAYER_BITMAP], cliprect); | |
| 1513 | update_background(state, &state->m_layer_data[MIXER_LAYER_BACKGROUND], cliprect); | |
| 1472 | update_bitmap(screen, &m_layer_data[MIXER_LAYER_BITMAP], cliprect); | |
| 1473 | update_background(&m_layer_data[MIXER_LAYER_BACKGROUND], cliprect); | |
| 1514 | 1474 | |
| 1515 | 1475 | return (enablet << 0) | (enable0 << 1) | (enable1 << 2) | (enable2 << 3) | (enable3 << 4) | (enableb << 5); |
| 1516 | 1476 | } |
| r20977 | r20978 | |
| 1523 | 1483 | * |
| 1524 | 1484 | *************************************/ |
| 1525 | 1485 | |
| 1526 | ||
| 1486 | void segas32_state::sprite_erase_buffer() | |
| 1527 | 1487 | { |
| 1528 | 1488 | /* erase the visible sprite buffer and clear the checksums */ |
| 1529 | | |
| 1489 | m_layer_data[MIXER_LAYER_SPRITES].bitmap->fill(0xffff); | |
| 1530 | 1490 | |
| 1531 | 1491 | /* for multi32, erase the other buffer as well */ |
| 1532 | if (state->m_is_multi32) | |
| 1533 | state->m_layer_data[MIXER_LAYER_MULTISPR].bitmap->fill(0xffff); | |
| 1492 | if (m_is_multi32) | |
| 1493 | m_layer_data[MIXER_LAYER_MULTISPR].bitmap->fill(0xffff); | |
| 1534 | 1494 | } |
| 1535 | 1495 | |
| 1536 | 1496 | |
| 1537 | ||
| 1497 | void segas32_state::sprite_swap_buffers() | |
| 1538 | 1498 | { |
| 1539 | 1499 | /* swap between the two sprite buffers */ |
| 1540 | struct layer_info temp; | |
| 1541 | temp = state->m_layer_data[MIXER_LAYER_SPRITES]; | |
| 1542 | state->m_layer_data[MIXER_LAYER_SPRITES] = state->m_layer_data[MIXER_LAYER_SPRITES_2]; | |
| 1543 | state->m_layer_data[MIXER_LAYER_SPRITES_2] = temp; | |
| 1500 | struct segas32_state::layer_info temp; | |
| 1501 | temp = m_layer_data[MIXER_LAYER_SPRITES]; | |
| 1502 | m_layer_data[MIXER_LAYER_SPRITES] = m_layer_data[MIXER_LAYER_SPRITES_2]; | |
| 1503 | m_layer_data[MIXER_LAYER_SPRITES_2] = temp; | |
| 1544 | 1504 | |
| 1545 | 1505 | /* for multi32, swap the other buffer as well */ |
| 1546 | if ( | |
| 1506 | if (m_is_multi32) | |
| 1547 | 1507 | { |
| 1548 | temp = state->m_layer_data[MIXER_LAYER_MULTISPR]; | |
| 1549 | state->m_layer_data[MIXER_LAYER_MULTISPR] = state->m_layer_data[MIXER_LAYER_MULTISPR_2]; | |
| 1550 | state->m_layer_data[MIXER_LAYER_MULTISPR_2] = temp; | |
| 1508 | temp = m_layer_data[MIXER_LAYER_MULTISPR]; | |
| 1509 | m_layer_data[MIXER_LAYER_MULTISPR] = m_layer_data[MIXER_LAYER_MULTISPR_2]; | |
| 1510 | m_layer_data[MIXER_LAYER_MULTISPR_2] = temp; | |
| 1551 | 1511 | } |
| 1552 | 1512 | |
| 1553 | 1513 | /* latch any pending info */ |
| 1554 | memcpy( | |
| 1514 | memcpy(m_sprite_control_latched, m_sprite_control, sizeof(m_sprite_control_latched)); | |
| 1555 | 1515 | } |
| 1556 | 1516 | |
| 1557 | 1517 | |
| r20977 | r20978 | |
| 1652 | 1612 | } \ |
| 1653 | 1613 | } |
| 1654 | 1614 | |
| 1655 | ||
| 1615 | int segas32_state::draw_one_sprite(UINT16 *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) | |
| 1656 | 1616 | { |
| 1657 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 1658 | 1617 | static const int transparency_masks[4][4] = |
| 1659 | 1618 | { |
| 1660 | 1619 | { 0x7fff, 0x3fff, 0x1fff, 0x0fff }, |
| r20977 | r20978 | |
| 1663 | 1622 | { 0x1fff, 0x0fff, 0x07ff, 0x03ff } |
| 1664 | 1623 | }; |
| 1665 | 1624 | |
| 1666 | bitmap_ind16 &bitmap = *state->m_layer_data[(!state->m_is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap; | |
| 1667 | UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x400000; | |
| 1668 | const UINT32 *spritebase = (const UINT32 *)machine.root_device().memregion("gfx2")->base(); | |
| 1625 | bitmap_ind16 &bitmap = *m_layer_data[(!m_is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap; | |
| 1626 | UINT8 numbanks = machine().root_device().memregion("gfx2")->bytes() / 0x400000; | |
| 1627 | const UINT32 *spritebase = (const UINT32 *)machine().root_device().memregion("gfx2")->base(); | |
| 1669 | 1628 | |
| 1670 | 1629 | int indirect = data[0] & 0x2000; |
| 1671 | 1630 | int indlocal = data[0] & 0x1000; |
| 1672 | int shadow = (data[0] & 0x0800) && ( | |
| 1631 | int shadow = (data[0] & 0x0800) && (m_sprite_control_latched[0x0a/2] & 1); | |
| 1673 | 1632 | int fromram = data[0] & 0x0400; |
| 1674 | 1633 | int bpp8 = data[0] & 0x0200; |
| 1675 | 1634 | int transp = (data[0] & 0x0100) ? 0 : (bpp8 ? 0xff : 0x0f); |
| r20977 | r20978 | |
| 1681 | 1640 | int adjustx = (data[0] >> 0) & 3; |
| 1682 | 1641 | int srch = (data[1] >> 8); |
| 1683 | 1642 | int srcw = bpp8 ? (data[1] & 0x3f) : ((data[1] >> 1) & 0x3f); |
| 1684 | int bank = | |
| 1643 | int bank = m_is_multi32 ? | |
| 1685 | 1644 | ((data[3] & 0x2000) >> 13) | ((data[3] & 0x8000) >> 14) : |
| 1686 | 1645 | ((data[3] & 0x0800) >> 11) | ((data[3] & 0x4000) >> 13); |
| 1687 | 1646 | int dsth = data[2] & 0x3ff; |
| r20977 | r20978 | |
| 1702 | 1661 | goto bail; |
| 1703 | 1662 | |
| 1704 | 1663 | /* determine the transparency mask for pixels */ |
| 1705 | transmask = transparency_masks[ | |
| 1664 | transmask = transparency_masks[m_sprite_control_latched[0x08/2] & 3][m_sprite_control_latched[0x0a/2] & 3]; | |
| 1706 | 1665 | if (bpp8) |
| 1707 | 1666 | transmask &= 0xfff0; |
| 1708 | 1667 | |
| 1709 | 1668 | /* create the local palette for the indirect case */ |
| 1710 | 1669 | if (indirect) |
| 1711 | 1670 | { |
| 1712 | UINT16 *src = indlocal ? &data[8] : & | |
| 1671 | UINT16 *src = indlocal ? &data[8] : &m_system32_spriteram[8 * (data[7] & 0x1fff)]; | |
| 1713 | 1672 | for (x = 0; x < 16; x++) |
| 1714 | indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | (( | |
| 1673 | indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | ((m_sprite_control_latched[0x0a/2] & 1) ? 0x8000 : 0x0000); | |
| 1715 | 1674 | } |
| 1716 | 1675 | |
| 1717 | 1676 | /* clamp to within the memory region size */ |
| 1718 | 1677 | if (fromram) |
| 1719 | 1678 | { |
| 1720 | spritedata = | |
| 1679 | spritedata = m_spriteram_32bit; | |
| 1721 | 1680 | addrmask = (0x20000 / 4) - 1; |
| 1722 | 1681 | } |
| 1723 | 1682 | else |
| r20977 | r20978 | |
| 1854 | 1813 | |
| 1855 | 1814 | |
| 1856 | 1815 | |
| 1857 | ||
| 1816 | void segas32_state::sprite_render_list() | |
| 1858 | 1817 | { |
| 1859 | segas32_state *state = machine.driver_data<segas32_state>(); | |
| 1860 | 1818 | rectangle outerclip, clipin, clipout; |
| 1861 | 1819 | int xoffs = 0, yoffs = 0; |
| 1862 | 1820 | int numentries = 0; |
| r20977 | r20978 | |
| 1869 | 1827 | |
| 1870 | 1828 | /* compute the outer clip */ |
| 1871 | 1829 | outerclip.min_x = outerclip.min_y = 0; |
| 1872 | outerclip.max_x = ( | |
| 1830 | outerclip.max_x = (m_sprite_control_latched[0x0c/2] & 1) ? 415 : 319; | |
| 1873 | 1831 | outerclip.max_y = 223; |
| 1874 | 1832 | |
| 1875 | 1833 | /* initialize the cliprects */ |
| r20977 | r20978 | |
| 1881 | 1839 | while (numentries++ < 0x20000/16) |
| 1882 | 1840 | { |
| 1883 | 1841 | /* top two bits are a command */ |
| 1884 | sprite = & | |
| 1842 | sprite = &m_system32_spriteram[8 * (spritenum & 0x1fff)]; | |
| 1885 | 1843 | switch (sprite[0] >> 14) |
| 1886 | 1844 | { |
| 1887 | 1845 | /* command 0 = draw sprite */ |
| 1888 | 1846 | case 0: |
| 1889 | spritenum += 1 + draw_one_sprite( | |
| 1847 | spritenum += 1 + draw_one_sprite(sprite, xoffs, yoffs, clipin, clipout); | |
| 1890 | 1848 | break; |
| 1891 | 1849 | |
| 1892 | 1850 | /* command 1 = set clipping */ |
| r20977 | r20978 | |
| 1945 | 1903 | * |
| 1946 | 1904 | *************************************/ |
| 1947 | 1905 | |
| 1948 | ||
| 1906 | inline UINT8 segas32_state::compute_color_offsets(int which, int layerbit, int layerflag) | |
| 1949 | 1907 | { |
| 1950 | int mode = (( | |
| 1908 | int mode = ((m_mixer_control[which][0x3e/2] & 0x8000) >> 14) | (layerbit & 1); | |
| 1951 | 1909 | |
| 1952 | 1910 | switch (mode) |
| 1953 | 1911 | { |
| r20977 | r20978 | |
| 1965 | 1923 | } |
| 1966 | 1924 | } |
| 1967 | 1925 | |
| 1968 | ||
| 1926 | inline UINT16 segas32_state::compute_sprite_blend(UINT8 encoding) | |
| 1969 | 1927 | { |
| 1970 | 1928 | int value = encoding & 0xf; |
| 1971 | 1929 | |
| r20977 | r20978 | |
| 1986 | 1944 | } |
| 1987 | 1945 | } |
| 1988 | 1946 | |
| 1989 | ||
| 1947 | inline UINT16 *segas32_state::get_layer_scanline(int layer, int scanline) | |
| 1990 | 1948 | { |
| 1991 | if (state->m_layer_data[layer].transparent[scanline]) | |
| 1992 | return (layer == MIXER_LAYER_SPRITES) ? state->m_solid_ffff : state->m_solid_0000; | |
| 1993 | return &state->m_layer_data[layer].bitmap->pix16(scanline); | |
| 1949 | if (m_layer_data[layer].transparent[scanline]) | |
| 1950 | return (layer == MIXER_LAYER_SPRITES) ? m_solid_ffff : m_solid_0000; | |
| 1951 | return &m_layer_data[layer].bitmap->pix16(scanline); | |
| 1994 | 1952 | } |
| 1995 | 1953 | |
| 1996 | ||
| 1954 | void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 enablemask) | |
| 1997 | 1955 | { |
| 1998 | int blendenable = state->m_mixer_control[which][0x4e/2] & 0x0800; | |
| 1999 | int blendfactor = (state->m_mixer_control[which][0x4e/2] >> 8) & 7; | |
| 1956 | int blendenable = m_mixer_control[which][0x4e/2] & 0x0800; | |
| 1957 | int blendfactor = (m_mixer_control[which][0x4e/2] >> 8) & 7; | |
| 2000 | 1958 | struct mixer_layer_info |
| 2001 | 1959 | { |
| 2002 | 1960 | UINT16 palbase; /* palette base from control reg */ |
| r20977 | r20978 | |
| 2020 | 1978 | /* if we are the second monitor on multi32, swap in the proper sprite bank */ |
| 2021 | 1979 | if (which == 1) |
| 2022 | 1980 | { |
| 2023 | temp_sprite_save = state->m_layer_data[MIXER_LAYER_SPRITES]; | |
| 2024 | state->m_layer_data[MIXER_LAYER_SPRITES] = state->m_layer_data[MIXER_LAYER_MULTISPR]; | |
| 1981 | temp_sprite_save = m_layer_data[MIXER_LAYER_SPRITES]; | |
| 1982 | m_layer_data[MIXER_LAYER_SPRITES] = m_layer_data[MIXER_LAYER_MULTISPR]; | |
| 2025 | 1983 | } |
| 2026 | 1984 | |
| 2027 | 1985 | /* extract the RGB offsets */ |
| 2028 | rgboffs[0][0] = (INT8)(state->m_mixer_control[which][0x40/2] << 2) >> 2; | |
| 2029 | rgboffs[0][1] = (INT8)(state->m_mixer_control[which][0x42/2] << 2) >> 2; | |
| 2030 | rgboffs[0][2] = (INT8)(state->m_mixer_control[which][0x44/2] << 2) >> 2; | |
| 2031 | rgboffs[1][0] = (INT8)(state->m_mixer_control[which][0x46/2] << 2) >> 2; | |
| 2032 | rgboffs[1][1] = (INT8)(state->m_mixer_control[which][0x48/2] << 2) >> 2; | |
| 2033 | rgboffs[1][2] = (INT8)(state->m_mixer_control[which][0x4a/2] << 2) >> 2; | |
| 1986 | rgboffs[0][0] = (INT8)(m_mixer_control[which][0x40/2] << 2) >> 2; | |
| 1987 | rgboffs[0][1] = (INT8)(m_mixer_control[which][0x42/2] << 2) >> 2; | |
| 1988 | rgboffs[0][2] = (INT8)(m_mixer_control[which][0x44/2] << 2) >> 2; | |
| 1989 | rgboffs[1][0] = (INT8)(m_mixer_control[which][0x46/2] << 2) >> 2; | |
| 1990 | rgboffs[1][1] = (INT8)(m_mixer_control[which][0x48/2] << 2) >> 2; | |
| 1991 | rgboffs[1][2] = (INT8)(m_mixer_control[which][0x4a/2] << 2) >> 2; | |
| 2034 | 1992 | rgboffs[2][0] = 0; |
| 2035 | 1993 | rgboffs[2][1] = 0; |
| 2036 | 1994 | rgboffs[2][2] = 0; |
| 2037 | 1995 | |
| 2038 | 1996 | /* determine the sprite grouping parameters first */ |
| 2039 | switch ( | |
| 1997 | switch (m_mixer_control[which][0x4c/2] & 0x0f) | |
| 2040 | 1998 | { |
| 2041 | 1999 | default: |
| 2042 | 2000 | case 0x0: sprgroup_shift = 14; sprgroup_mask = 0x00; sprgroup_or = 0x01; break; |
| r20977 | r20978 | |
| 2059 | 2017 | case 0xe: sprgroup_shift = 11; sprgroup_mask = 0x07; sprgroup_or = 0x00; break; |
| 2060 | 2018 | case 0xf: sprgroup_shift = 10; sprgroup_mask = 0x0f; sprgroup_or = 0x00; break; |
| 2061 | 2019 | } |
| 2062 | sprshadowmask = ( | |
| 2020 | sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; | |
| 2063 | 2021 | sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; |
| 2064 | 2022 | sprshadow = 0x7ffe & sprpixmask; |
| 2065 | 2023 | |
| r20977 | r20978 | |
| 2067 | 2025 | numlayers = 0; |
| 2068 | 2026 | for (laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) |
| 2069 | 2027 | { |
| 2070 | int priority = | |
| 2028 | int priority = m_mixer_control[which][0x20/2 + laynum] & 0x0f; | |
| 2071 | 2029 | if ((enablemask & (1 << laynum)) && priority != 0) |
| 2072 | 2030 | { |
| 2073 | 2031 | layersort[numlayers].index = laynum; |
| 2074 | 2032 | layersort[numlayers].effpri = (priority << 3) | (6 - laynum); |
| 2075 | layersort[numlayers].palbase = (state->m_mixer_control[which][0x20/2 + laynum] & 0x00f0) << 6; | |
| 2076 | layersort[numlayers].mixshift = (state->m_mixer_control[which][0x20/2 + laynum] >> 8) & 3; | |
| 2077 | layersort[numlayers].blendmask = blendenable ? ((state->m_mixer_control[which][0x30/2 + laynum] >> 6) & 0xff) : 0; | |
| 2078 | layersort[numlayers].sprblendmask = compute_sprite_blend(state->m_mixer_control[which][0x30/2 + laynum] & 0x3f); | |
| 2079 | layersort[numlayers].coloroffs = compute_color_offsets(state, which, (state->m_mixer_control[which][0x3e/2] >> laynum) & 1, (state->m_mixer_control[which][0x30/2 + laynum] >> 14) & 1); | |
| 2033 | layersort[numlayers].palbase = (m_mixer_control[which][0x20/2 + laynum] & 0x00f0) << 6; | |
| 2034 | layersort[numlayers].mixshift = (m_mixer_control[which][0x20/2 + laynum] >> 8) & 3; | |
| 2035 | layersort[numlayers].blendmask = blendenable ? ((m_mixer_control[which][0x30/2 + laynum] >> 6) & 0xff) : 0; | |
| 2036 | layersort[numlayers].sprblendmask = compute_sprite_blend(m_mixer_control[which][0x30/2 + laynum] & 0x3f); | |
| 2037 | layersort[numlayers].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> laynum) & 1, (m_mixer_control[which][0x30/2 + laynum] >> 14) & 1); | |
| 2080 | 2038 | numlayers++; |
| 2081 | 2039 | } |
| 2082 | 2040 | } |
| r20977 | r20978 | |
| 2084 | 2042 | /* extract info about the BACKGROUND layer */ |
| 2085 | 2043 | layersort[numlayers].index = MIXER_LAYER_BACKGROUND; |
| 2086 | 2044 | layersort[numlayers].effpri = (1 << 3) | 0; |
| 2087 | layersort[numlayers].palbase = (state->m_mixer_control[which][0x2c/2] & 0x00f0) << 6; | |
| 2088 | layersort[numlayers].mixshift = (state->m_mixer_control[which][0x2c/2] >> 8) & 3; | |
| 2045 | layersort[numlayers].palbase = (m_mixer_control[which][0x2c/2] & 0x00f0) << 6; | |
| 2046 | layersort[numlayers].mixshift = (m_mixer_control[which][0x2c/2] >> 8) & 3; | |
| 2089 | 2047 | layersort[numlayers].blendmask = 0; |
| 2090 | 2048 | layersort[numlayers].sprblendmask = 0; |
| 2091 | layersort[numlayers].coloroffs = compute_color_offsets( | |
| 2049 | layersort[numlayers].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> 8) & 1, (m_mixer_control[which][0x3e/2] >> 14) & 1); | |
| 2092 | 2050 | numlayers++; |
| 2093 | 2051 | |
| 2094 | 2052 | /* now bubble sort the list by effective priority */ |
| r20977 | r20978 | |
| 2105 | 2063 | for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) |
| 2106 | 2064 | { |
| 2107 | 2065 | int effgroup = sprgroup_or | groupnum; |
| 2108 | int priority = | |
| 2066 | int priority = m_mixer_control[which][0x00/2 + effgroup] & 0x0f; | |
| 2109 | 2067 | int effpri = (priority << 3) | 7; |
| 2110 | 2068 | int sprindex = numlayers; |
| 2111 | 2069 | int dstnum = 0; |
| r20977 | r20978 | |
| 2121 | 2079 | /* build the sprite entry */ |
| 2122 | 2080 | layerorder[groupnum][sprindex].index = MIXER_LAYER_SPRITES; |
| 2123 | 2081 | layerorder[groupnum][sprindex].effpri = effpri; |
| 2124 | if ((state->m_mixer_control[which][0x4c/2] & 3) != 3) | |
| 2125 | layerorder[groupnum][sprindex].palbase = (state->m_mixer_control[which][0x00/2 + effgroup] & 0x00f0) << 6; | |
| 2082 | if ((m_mixer_control[which][0x4c/2] & 3) != 3) | |
| 2083 | layerorder[groupnum][sprindex].palbase = (m_mixer_control[which][0x00/2 + effgroup] & 0x00f0) << 6; | |
| 2126 | 2084 | else |
| 2127 | layerorder[groupnum][sprindex].palbase = (state->m_mixer_control[which][0x4c/2] & 0x00f0) << 6; | |
| 2128 | layerorder[groupnum][sprindex].mixshift = (state->m_mixer_control[which][0x00/2 + effgroup] >> 8) & 3; | |
| 2085 | layerorder[groupnum][sprindex].palbase = (m_mixer_control[which][0x4c/2] & 0x00f0) << 6; | |
| 2086 | layerorder[groupnum][sprindex].mixshift = (m_mixer_control[which][0x00/2 + effgroup] >> 8) & 3; | |
| 2129 | 2087 | layerorder[groupnum][sprindex].blendmask = 0; |
| 2130 | 2088 | layerorder[groupnum][sprindex].sprblendmask = 0; |
| 2131 | layerorder[groupnum][sprindex].coloroffs = compute_color_offsets( | |
| 2089 | layerorder[groupnum][sprindex].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> 6) & 1, (m_mixer_control[which][0x4c/2] >> 15) & 1); | |
| 2132 | 2090 | } |
| 2133 | 2091 | /* |
| 2134 | 2092 | { |
| r20977 | r20978 | |
| 2144 | 2102 | |
| 2145 | 2103 | /* based on the sprite controller flip bits, the data is scanned to us in different */ |
| 2146 | 2104 | /* directions; account for this */ |
| 2147 | if ( | |
| 2105 | if (m_sprite_control_latched[0x04/2] & 1) | |
| 2148 | 2106 | { |
| 2149 | 2107 | sprx_start = cliprect.max_x; |
| 2150 | 2108 | sprdx = -1; |
| r20977 | r20978 | |
| 2155 | 2113 | sprdx = 1; |
| 2156 | 2114 | } |
| 2157 | 2115 | |
| 2158 | if ( | |
| 2116 | if (m_sprite_control_latched[0x04/2] & 2) | |
| 2159 | 2117 | { |
| 2160 | 2118 | spry = cliprect.max_y; |
| 2161 | 2119 | sprdy = -1; |
| r20977 | r20978 | |
| 2173 | 2131 | UINT16 *layerbase[8]; |
| 2174 | 2132 | |
| 2175 | 2133 | /* get the starting address for each layer */ |
| 2176 | layerbase[MIXER_LAYER_TEXT] = get_layer_scanline(state, MIXER_LAYER_TEXT, y); | |
| 2177 | layerbase[MIXER_LAYER_NBG0] = get_layer_scanline(state, MIXER_LAYER_NBG0, y); | |
| 2178 | layerbase[MIXER_LAYER_NBG1] = get_layer_scanline(state, MIXER_LAYER_NBG1, y); | |
| 2179 | layerbase[MIXER_LAYER_NBG2] = get_layer_scanline(state, MIXER_LAYER_NBG2, y); | |
| 2180 | layerbase[MIXER_LAYER_NBG3] = get_layer_scanline(state, MIXER_LAYER_NBG3, y); | |
| 2181 | layerbase[MIXER_LAYER_BITMAP] = get_layer_scanline(state, MIXER_LAYER_BITMAP, y); | |
| 2182 | layerbase[MIXER_LAYER_SPRITES] = get_layer_scanline(state, MIXER_LAYER_SPRITES, spry); | |
| 2183 | layerbase[MIXER_LAYER_BACKGROUND] = get_layer_scanline(state, MIXER_LAYER_BACKGROUND, y); | |
| 2134 | layerbase[MIXER_LAYER_TEXT] = get_layer_scanline(MIXER_LAYER_TEXT, y); | |
| 2135 | layerbase[MIXER_LAYER_NBG0] = get_layer_scanline(MIXER_LAYER_NBG0, y); | |
| 2136 | layerbase[MIXER_LAYER_NBG1] = get_layer_scanline(MIXER_LAYER_NBG1, y); | |
| 2137 | layerbase[MIXER_LAYER_NBG2] = get_layer_scanline(MIXER_LAYER_NBG2, y); | |
| 2138 | layerbase[MIXER_LAYER_NBG3] = get_layer_scanline(MIXER_LAYER_NBG3, y); | |
| 2139 | layerbase[MIXER_LAYER_BITMAP] = get_layer_scanline(MIXER_LAYER_BITMAP, y); | |
| 2140 | layerbase[MIXER_LAYER_SPRITES] = get_layer_scanline(MIXER_LAYER_SPRITES, spry); | |
| 2141 | layerbase[MIXER_LAYER_BACKGROUND] = get_layer_scanline(MIXER_LAYER_BACKGROUND, y); | |
| 2184 | 2142 | |
| 2185 | 2143 | /* loop over columns */ |
| 2186 | 2144 | for (x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) |
| r20977 | r20978 | |
| 2225 | 2183 | } |
| 2226 | 2184 | |
| 2227 | 2185 | /* adjust the first pixel */ |
| 2228 | firstpix = | |
| 2186 | firstpix = m_system32_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; | |
| 2229 | 2187 | |
| 2230 | 2188 | /* compute R, G, B */ |
| 2231 | 2189 | rgbdelta = &rgboffs[first->coloroffs][0]; |
| r20977 | r20978 | |
| 2272 | 2230 | (laynum != MIXER_LAYER_SPRITES || (first->sprblendmask & (1 << sprgroup)))) |
| 2273 | 2231 | { |
| 2274 | 2232 | /* adjust the second pixel */ |
| 2275 | secondpix = | |
| 2233 | secondpix = m_system32_paletteram[which][(second->palbase + ((secondpix >> second->mixshift) & 0xfff0) + (secondpix & 0x0f)) & 0x3fff]; | |
| 2276 | 2234 | |
| 2277 | 2235 | /* compute first RGB */ |
| 2278 | 2236 | r *= 7 - blendfactor; |
| r20977 | r20978 | |
| 2323 | 2281 | |
| 2324 | 2282 | /* if we are the second monitor on multi32, swap back the sprite layer */ |
| 2325 | 2283 | if (which == 1) |
| 2326 | | |
| 2284 | m_layer_data[MIXER_LAYER_SPRITES] = temp_sprite_save; | |
| 2327 | 2285 | } |
| 2328 | 2286 | |
| 2329 | 2287 | |
| r20977 | r20978 | |
| 2334 | 2292 | * |
| 2335 | 2293 | *************************************/ |
| 2336 | 2294 | |
| 2337 | ||
| 2295 | void segas32_state::print_mixer_data(int which) | |
| 2338 | 2296 | { |
| 2339 | if (++ | |
| 2297 | if (++m_print_count > 60 * 5) | |
| 2340 | 2298 | { |
| 2341 | 2299 | mame_printf_debug("\n"); |
| 2342 | mame_printf_debug("OP: %04X\n", | |
| 2300 | mame_printf_debug("OP: %04X\n", m_system32_videoram[0x1ff8e/2]); | |
| 2343 | 2301 | mame_printf_debug("SC: %04X %04X %04X %04X - %04X %04X %04X %04X\n", |
| 2344 | state->m_sprite_control_latched[0x00], | |
| 2345 | state->m_sprite_control_latched[0x01], | |
| 2346 | state->m_sprite_control_latched[0x02], | |
| 2347 | state->m_sprite_control_latched[0x03], | |
| 2348 | state->m_sprite_control_latched[0x04], | |
| 2349 | state->m_sprite_control_latched[0x05], | |
| 2350 | state->m_sprite_control_latched[0x06], | |
| 2351 | state->m_sprite_control_latched[0x07]); | |
| 2302 | m_sprite_control_latched[0x00], | |
| 2303 | m_sprite_control_latched[0x01], | |
| 2304 | m_sprite_control_latched[0x02], | |
| 2305 | m_sprite_control_latched[0x03], | |
| 2306 | m_sprite_control_latched[0x04], | |
| 2307 | m_sprite_control_latched[0x05], | |
| 2308 | m_sprite_control_latched[0x06], | |
| 2309 | m_sprite_control_latched[0x07]); | |
| 2352 | 2310 | mame_printf_debug("00: %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n", |
| 2353 | state->m_mixer_control[which][0x00], | |
| 2354 | state->m_mixer_control[which][0x01], | |
| 2355 | state->m_mixer_control[which][0x02], | |
| 2356 | state->m_mixer_control[which][0x03], | |
| 2357 | state->m_mixer_control[which][0x04], | |
| 2358 | state->m_mixer_control[which][0x05], | |
| 2359 | state->m_mixer_control[which][0x06], | |
| 2360 | state->m_mixer_control[which][0x07], | |
| 2361 | state->m_mixer_control[which][0x08], | |
| 2362 | state->m_mixer_control[which][0x09], | |
| 2363 | state->m_mixer_control[which][0x0a], | |
| 2364 | state->m_mixer_control[which][0x0b], | |
| 2365 | state->m_mixer_control[which][0x0c], | |
| 2366 | state->m_mixer_control[which][0x0d], | |
| 2367 | state->m_mixer_control[which][0x0e], | |
| 2368 | state->m_mixer_control[which][0x0f]); | |
| 2311 | m_mixer_control[which][0x00], | |
| 2312 | m_mixer_control[which][0x01], | |
| 2313 | m_mixer_control[which][0x02], | |
| 2314 | m_mixer_control[which][0x03], | |
| 2315 | m_mixer_control[which][0x04], | |
| 2316 | m_mixer_control[which][0x05], | |
| 2317 | m_mixer_control[which][0x06], | |
| 2318 | m_mixer_control[which][0x07], | |
| 2319 | m_mixer_control[which][0x08], | |
| 2320 | m_mixer_control[which][0x09], | |
| 2321 | m_mixer_control[which][0x0a], | |
| 2322 | m_mixer_control[which][0x0b], | |
| 2323 | m_mixer_control[which][0x0c], | |
| 2324 | m_mixer_control[which][0x0d], | |
| 2325 | m_mixer_control[which][0x0e], | |
| 2326 | m_mixer_control[which][0x0f]); | |
| 2369 | 2327 | mame_printf_debug("20: %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n", |
| 2370 | state->m_mixer_control[which][0x10], | |
| 2371 | state->m_mixer_control[which][0x11], | |
| 2372 | state->m_mixer_control[which][0x12], | |
| 2373 | state->m_mixer_control[which][0x13], | |
| 2374 | state->m_mixer_control[which][0x14], | |
| 2375 | state->m_mixer_control[which][0x15], | |
| 2376 | state->m_mixer_control[which][0x16], | |
| 2377 | state->m_mixer_control[which][0x17], | |
| 2378 | state->m_mixer_control[which][0x18], | |
| 2379 | state->m_mixer_control[which][0x19], | |
| 2380 | state->m_mixer_control[which][0x1a], | |
| 2381 | state->m_mixer_control[which][0x1b], | |
| 2382 | state->m_mixer_control[which][0x1c], | |
| 2383 | state->m_mixer_control[which][0x1d], | |
| 2384 | state->m_mixer_control[which][0x1e], | |
| 2385 | state->m_mixer_control[which][0x1f]); | |
| 2328 | m_mixer_control[which][0x10], | |
| 2329 | m_mixer_control[which][0x11], | |
| 2330 | m_mixer_control[which][0x12], | |
| 2331 | m_mixer_control[which][0x13], | |
| 2332 | m_mixer_control[which][0x14], | |
| 2333 | m_mixer_control[which][0x15], | |
| 2334 | m_mixer_control[which][0x16], | |
| 2335 | m_mixer_control[which][0x17], | |
| 2336 | m_mixer_control[which][0x18], | |
| 2337 | m_mixer_control[which][0x19], | |
| 2338 | m_mixer_control[which][0x1a], | |
| 2339 | m_mixer_control[which][0x1b], | |
| 2340 | m_mixer_control[which][0x1c], | |
| 2341 | m_mixer_control[which][0x1d], | |
| 2342 | m_mixer_control[which][0x1e], | |
| 2343 | m_mixer_control[which][0x1f]); | |
| 2386 | 2344 | mame_printf_debug("40: %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n", |
| 2387 | state->m_mixer_control[which][0x20], | |
| 2388 | state->m_mixer_control[which][0x21], | |
| 2389 | state->m_mixer_control[which][0x22], | |
| 2390 | state->m_mixer_control[which][0x23], | |
| 2391 | state->m_mixer_control[which][0x24], | |
| 2392 | state->m_mixer_control[which][0x25], | |
| 2393 | state->m_mixer_control[which][0x26], | |
| 2394 | state->m_mixer_control[which][0x27], | |
| 2395 | state->m_mixer_control[which][0x28], | |
| 2396 | state->m_mixer_control[which][0x29], | |
| 2397 | state->m_mixer_control[which][0x2a], | |
| 2398 | state->m_mixer_control[which][0x2b], | |
| 2399 | state->m_mixer_control[which][0x2c], | |
| 2400 | state->m_mixer_control[which][0x2d], | |
| 2401 | state->m_mixer_control[which][0x2e], | |
| 2402 | state->m_mixer_control[which][0x2f]); | |
| 2403 | state->m_print_count = 0; | |
| 2345 | m_mixer_control[which][0x20], | |
| 2346 | m_mixer_control[which][0x21], | |
| 2347 | m_mixer_control[which][0x22], | |
| 2348 | m_mixer_control[which][0x23], | |
| 2349 | m_mixer_control[which][0x24], | |
| 2350 | m_mixer_control[which][0x25], | |
| 2351 | m_mixer_control[which][0x26], | |
| 2352 | m_mixer_control[which][0x27], | |
| 2353 | m_mixer_control[which][0x28], | |
| 2354 | m_mixer_control[which][0x29], | |
| 2355 | m_mixer_control[which][0x2a], | |
| 2356 | m_mixer_control[which][0x2b], | |
| 2357 | m_mixer_control[which][0x2c], | |
| 2358 | m_mixer_control[which][0x2d], | |
| 2359 | m_mixer_control[which][0x2e], | |
| 2360 | m_mixer_control[which][0x2f]); | |
| 2361 | m_print_count = 0; | |
| 2404 | 2362 | } |
| 2405 | 2363 | } |
| 2406 | 2364 | |
| r20977 | r20978 | |
| 2438 | 2396 | |
| 2439 | 2397 | /* do the mixing */ |
| 2440 | 2398 | g_profiler.start(PROFILER_USER3); |
| 2441 | mix_all_layers( | |
| 2399 | mix_all_layers(0, 0, bitmap, cliprect, enablemask); | |
| 2442 | 2400 | g_profiler.stop(); |
| 2443 | 2401 | |
| 2444 | 2402 | if (LOG_SPRITES && machine().input().code_pressed(KEYCODE_L)) |
| r20977 | r20978 | |
| 2449 | 2407 | |
| 2450 | 2408 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2451 | 2409 | { |
| 2452 | UINT16 *src = get_layer_scanline( | |
| 2410 | UINT16 *src = get_layer_scanline(MIXER_LAYER_SPRITES, y); | |
| 2453 | 2411 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2454 | 2412 | fprintf(f, "%04X ", *src++); |
| 2455 | 2413 | fprintf(f, "\n"); |
| r20977 | r20978 | |
| 2459 | 2417 | f = fopen("nbg0.txt", "w"); |
| 2460 | 2418 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2461 | 2419 | { |
| 2462 | UINT16 *src = get_layer_scanline( | |
| 2420 | UINT16 *src = get_layer_scanline(MIXER_LAYER_NBG0, y); | |
| 2463 | 2421 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2464 | 2422 | fprintf(f, "%04X ", *src++); |
| 2465 | 2423 | fprintf(f, "\n"); |
| r20977 | r20978 | |
| 2469 | 2427 | f = fopen("nbg1.txt", "w"); |
| 2470 | 2428 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2471 | 2429 | { |
| 2472 | UINT16 *src = get_layer_scanline( | |
| 2430 | UINT16 *src = get_layer_scanline(MIXER_LAYER_NBG1, y); | |
| 2473 | 2431 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2474 | 2432 | fprintf(f, "%04X ", *src++); |
| 2475 | 2433 | fprintf(f, "\n"); |
| r20977 | r20978 | |
| 2479 | 2437 | f = fopen("nbg2.txt", "w"); |
| 2480 | 2438 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2481 | 2439 | { |
| 2482 | UINT16 *src = get_layer_scanline( | |
| 2440 | UINT16 *src = get_layer_scanline(MIXER_LAYER_NBG2, y); | |
| 2483 | 2441 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2484 | 2442 | fprintf(f, "%04X ", *src++); |
| 2485 | 2443 | fprintf(f, "\n"); |
| r20977 | r20978 | |
| 2489 | 2447 | f = fopen("nbg3.txt", "w"); |
| 2490 | 2448 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2491 | 2449 | { |
| 2492 | UINT16 *src = get_layer_scanline( | |
| 2450 | UINT16 *src = get_layer_scanline(MIXER_LAYER_NBG3, y); | |
| 2493 | 2451 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2494 | 2452 | fprintf(f, "%04X ", *src++); |
| 2495 | 2453 | fprintf(f, "\n"); |
| r20977 | r20978 | |
| 2530 | 2488 | // if (showclip != -1) |
| 2531 | 2489 | for (showclip = 0; showclip < 4; showclip++) |
| 2532 | 2490 | { |
| 2533 | int flip = (state->m_system32_videoram[0x1ff00/2] >> 9) & 1; | |
| 2534 | int clips = (state->m_system32_videoram[0x1ff06/2] >> (4 * showclip)) & 0x0f; | |
| 2535 | if (((state->m_system32_videoram[0x1ff02/2] >> (11 + showclip)) & 1) && clips) | |
| 2491 | int flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; | |
| 2492 | int clips = (m_system32_videoram[0x1ff06/2] >> (4 * showclip)) & 0x0f; | |
| 2493 | if (((m_system32_videoram[0x1ff02/2] >> (11 + showclip)) & 1) && clips) | |
| 2536 | 2494 | { |
| 2537 | 2495 | int i, x, y; |
| 2538 | 2496 | for (i = 0; i < 4; i++) |
| r20977 | r20978 | |
| 2544 | 2502 | pen_t white = get_white_pen(screen.machine()); |
| 2545 | 2503 | if (!flip) |
| 2546 | 2504 | { |
| 2547 | rect.min_x = state->m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; | |
| 2548 | rect.min_y = state->m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; | |
| 2549 | rect.max_x = (state->m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; | |
| 2550 | rect.max_y = (state->m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; | |
| 2505 | rect.min_x = m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; | |
| 2506 | rect.min_y = m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; | |
| 2507 | rect.max_x = (m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; | |
| 2508 | rect.max_y = (m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; | |
| 2551 | 2509 | } |
| 2552 | 2510 | else |
| 2553 | 2511 | { |
| 2554 | rect.max_x = (visarea.max_x + 1) - (state->m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); | |
| 2555 | rect.max_y = (visarea.max_y + 1) - (state->m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); | |
| 2556 | rect.min_x = (visarea.max_x + 1) - ((state->m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); | |
| 2557 | rect.min_y = (visarea.max_y + 1) - ((state->m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); | |
| 2512 | rect.max_x = (visarea.max_x + 1) - (m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); | |
| 2513 | rect.max_y = (visarea.max_y + 1) - (m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); | |
| 2514 | rect.min_x = (visarea.max_x + 1) - ((m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); | |
| 2515 | rect.min_y = (visarea.max_y + 1) - ((m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); | |
| 2558 | 2516 | } |
| 2559 | 2517 | sect_rect(&rect, &screen.visible_area()); |
| 2560 | 2518 | |
| r20977 | r20978 | |
| 2577 | 2535 | } |
| 2578 | 2536 | #endif |
| 2579 | 2537 | |
| 2580 | if (PRINTF_MIXER_DATA) print_mixer_data( | |
| 2538 | if (PRINTF_MIXER_DATA) print_mixer_data(0); | |
| 2581 | 2539 | return 0; |
| 2582 | 2540 | } |
| 2583 | 2541 | |
| 2584 | 2542 | |
| 2585 | ||
| 2543 | UINT32 segas32_state::multi32_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int index) | |
| 2586 | 2544 | { |
| 2587 | segas32_state *state = screen.machine().driver_data<segas32_state>(); | |
| 2588 | 2545 | UINT8 enablemask; |
| 2589 | 2546 | |
| 2590 | 2547 | /* update the visible area */ |
| 2591 | if ( | |
| 2548 | if (m_system32_videoram[0x1ff00/2] & 0x8000) | |
| 2592 | 2549 | screen.set_visible_area(0, 52*8-1, 0, 28*8-1); |
| 2593 | 2550 | else |
| 2594 | 2551 | screen.set_visible_area(0, 40*8-1, 0, 28*8-1); |
| 2595 | 2552 | |
| 2596 | 2553 | /* if the display is off, punt */ |
| 2597 | if (! | |
| 2554 | if (!m_system32_displayenable[index]) | |
| 2598 | 2555 | { |
| 2599 | 2556 | bitmap.fill(get_black_pen(screen.machine()), cliprect); |
| 2600 | 2557 | return 0; |
| r20977 | r20978 | |
| 2617 | 2574 | |
| 2618 | 2575 | /* do the mixing */ |
| 2619 | 2576 | g_profiler.start(PROFILER_USER3); |
| 2620 | mix_all_layers( | |
| 2577 | mix_all_layers(index, 0, bitmap, cliprect, enablemask); | |
| 2621 | 2578 | g_profiler.stop(); |
| 2622 | 2579 | |
| 2623 | 2580 | if (PRINTF_MIXER_DATA) |
| 2624 | 2581 | { |
| 2625 | if (!screen.machine().input().code_pressed(KEYCODE_M)) print_mixer_data(state, 0); | |
| 2626 | else print_mixer_data(state, 1); | |
| 2582 | if (!screen.machine().input().code_pressed(KEYCODE_M)) print_mixer_data(0); | |
| 2583 | else print_mixer_data(1); | |
| 2627 | 2584 | } |
| 2628 | 2585 | if (LOG_SPRITES && screen.machine().input().code_pressed(KEYCODE_L)) |
| 2629 | 2586 | { |
| r20977 | r20978 | |
| 2633 | 2590 | |
| 2634 | 2591 | for (y = visarea.min_y; y <= visarea.max_y; y++) |
| 2635 | 2592 | { |
| 2636 | UINT16 *src = get_layer_scanline( | |
| 2593 | UINT16 *src = get_layer_scanline(MIXER_LAYER_SPRITES, y); | |
| 2637 | 2594 | for (x = visarea.min_x; x <= visarea.max_x; x++) |
| 2638 | 2595 | fprintf(f, "%04X ", *src++); |
| 2639 | 2596 | fprintf(f, "\n"); |
| r20977 | r20978 | |
|---|---|---|
| 213 | 213 | * |
| 214 | 214 | *************************************/ |
| 215 | 215 | |
| 216 | ||
| 216 | void starfire_state::get_pens(pen_t *pens) | |
| 217 | 217 | { |
| 218 | 218 | offs_t offs; |
| 219 | starfire_state *state = machine.driver_data<starfire_state>(); | |
| 220 | 219 | |
| 221 | 220 | for (offs = 0; offs < STARFIRE_NUM_PENS; offs++) |
| 222 | 221 | { |
| 223 | UINT16 color = | |
| 222 | UINT16 color = m_starfire_colors[offs]; | |
| 224 | 223 | |
| 225 | 224 | pens[offs] = MAKE_RGB(pal3bit(color >> 6), pal3bit(color >> 3), pal3bit(color >> 0)); |
| 226 | 225 | } |
| r20977 | r20978 | |
| 231 | 230 | pen_t pens[STARFIRE_NUM_PENS]; |
| 232 | 231 | int y = param; |
| 233 | 232 | |
| 234 | get_pens( | |
| 233 | get_pens(pens); | |
| 235 | 234 | |
| 236 | 235 | UINT8 *pix = &m_starfire_videoram[y]; |
| 237 | 236 | UINT8 *col = &m_starfire_colorram[y]; |
| r20977 | r20978 | |
|---|---|---|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | ||
| 71 | void stfight_state::set_pens() | |
| 72 | 72 | { |
| 73 | stfight_state *state = machine.driver_data<stfight_state>(); | |
| 74 | 73 | int i; |
| 75 | 74 | |
| 76 | 75 | for (i = 0; i < 0x100; i++) |
| 77 | 76 | { |
| 78 | UINT16 data = | |
| 77 | UINT16 data = m_generic_paletteram_8[i] | (m_generic_paletteram2_8[i] << 8); | |
| 79 | 78 | rgb_t color = MAKE_RGB(pal4bit(data >> 4), pal4bit(data >> 0), pal4bit(data >> 8)); |
| 80 | 79 | |
| 81 | colortable_palette_set_color(machine.colortable, i, color); | |
| 80 | colortable_palette_set_color(machine().colortable, i, color); | |
| 82 | 81 | } |
| 83 | 82 | } |
| 84 | 83 | |
| r20977 | r20978 | |
| 240 | 239 | |
| 241 | 240 | ***************************************************************************/ |
| 242 | 241 | |
| 243 | ||
| 242 | void stfight_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 244 | 243 | { |
| 245 | stfight_state *state = machine.driver_data<stfight_state>(); | |
| 246 | 244 | int offs,sx,sy; |
| 247 | 245 | |
| 248 | 246 | for (offs = 0;offs < 4096;offs += 32) |
| 249 | 247 | { |
| 250 | 248 | int code; |
| 251 | int attr = | |
| 249 | int attr = m_sprite_ram[offs+1]; | |
| 252 | 250 | int flipx = attr & 0x10; |
| 253 | 251 | int color = attr & 0x0f; |
| 254 | 252 | int pri = (attr & 0x20) >> 5; |
| 255 | 253 | |
| 256 | sy = state->m_sprite_ram[offs+2]; | |
| 257 | sx = state->m_sprite_ram[offs+3]; | |
| 254 | sy = m_sprite_ram[offs+2]; | |
| 255 | sx = m_sprite_ram[offs+3]; | |
| 258 | 256 | |
| 259 | 257 | // non-active sprites have zero y coordinate value |
| 260 | 258 | if( sy > 0 ) |
| r20977 | r20978 | |
| 267 | 265 | sx -= 0x100; |
| 268 | 266 | } |
| 269 | 267 | |
| 270 | if ( | |
| 268 | if (flip_screen()) | |
| 271 | 269 | { |
| 272 | 270 | sx = 240 - sx; |
| 273 | 271 | sy = 240 - sy; |
| 274 | 272 | flipx = !flipx; |
| 275 | 273 | } |
| 276 | 274 | |
| 277 | code = | |
| 275 | code = m_sprite_base + m_sprite_ram[offs]; | |
| 278 | 276 | |
| 279 | pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4], | |
| 277 | pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4], | |
| 280 | 278 | code, |
| 281 | 279 | color, |
| 282 | flipx, | |
| 280 | flipx,flip_screen(), | |
| 283 | 281 | sx,sy, |
| 284 | machine.priority_bitmap, | |
| 282 | machine().priority_bitmap, | |
| 285 | 283 | pri ? 0x02 : 0,0x0f); |
| 286 | 284 | } |
| 287 | 285 | } |
| r20977 | r20978 | |
| 290 | 288 | |
| 291 | 289 | UINT32 stfight_state::screen_update_stfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 292 | 290 | { |
| 293 | set_pens( | |
| 291 | set_pens(); | |
| 294 | 292 | |
| 295 | 293 | machine().priority_bitmap.fill(0, cliprect); |
| 296 | 294 | |
| r20977 | r20978 | |
| 300 | 298 | |
| 301 | 299 | /* Draw sprites (may be obscured by foreground layer) */ |
| 302 | 300 | if (m_vh_latch_ram[0x07] & 0x40) |
| 303 | draw_sprites( | |
| 301 | draw_sprites(bitmap,cliprect); | |
| 304 | 302 | |
| 305 | 303 | m_tx_tilemap->draw(bitmap, cliprect, 0,0); |
| 306 | 304 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | |
| 95 | ||
| 95 | void shadfrce_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 96 | 96 | { |
| 97 | 97 | /* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt | |
| 98 | 98 | | ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */ |
| r20977 | r20978 | |
| 108 | 108 | P = priority |
| 109 | 109 | */ |
| 110 | 110 | |
| 111 | shadfrce_state *state = machine.driver_data<shadfrce_state>(); | |
| 112 | gfx_element *gfx = machine.gfx[1]; | |
| 113 | UINT16 *finish = state->m_spvideoram_old; | |
| 111 | gfx_element *gfx = machine().gfx[1]; | |
| 112 | UINT16 *finish = m_spvideoram_old; | |
| 114 | 113 | UINT16 *source = finish + 0x2000/2 - 8; |
| 115 | 114 | int hcount; |
| 116 | 115 | while( source>=finish ) |
| r20977 | r20978 | |
| 130 | 129 | height++; |
| 131 | 130 | if (enable) { |
| 132 | 131 | for (hcount=0;hcount<height;hcount++) { |
| 133 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16,machine.priority_bitmap,pri_mask,0); | |
| 134 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16,machine.priority_bitmap,pri_mask,0); | |
| 135 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16+0x200,machine.priority_bitmap,pri_mask,0); | |
| 136 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16+0x200,machine.priority_bitmap,pri_mask,0); | |
| 132 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16,machine().priority_bitmap,pri_mask,0); | |
| 133 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16,machine().priority_bitmap,pri_mask,0); | |
| 134 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16+0x200,machine().priority_bitmap,pri_mask,0); | |
| 135 | pdrawgfx_transpen(bitmap,cliprect,gfx,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16+0x200,machine().priority_bitmap,pri_mask,0); | |
| 137 | 136 | } |
| 138 | 137 | } |
| 139 | 138 | source-=8; |
| r20977 | r20978 | |
| 148 | 147 | { |
| 149 | 148 | m_bg1tilemap->draw(bitmap, cliprect, 0,0); |
| 150 | 149 | m_bg0tilemap->draw(bitmap, cliprect, 0,1); |
| 151 | draw_sprites( | |
| 150 | draw_sprites(bitmap,cliprect); | |
| 152 | 151 | m_fgtilemap->draw(bitmap, cliprect, 0,0); |
| 153 | 152 | } |
| 154 | 153 | else |
| r20977 | r20978 | |
|---|---|---|
| 79 | 79 | * * |
| 80 | 80 | *************************************/ |
| 81 | 81 | |
| 82 | ||
| 82 | void speedbal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 83 | 83 | { |
| 84 | speedbal_state *state = machine.driver_data<speedbal_state>(); | |
| 85 | UINT8 *spriteram = state->m_spriteram; | |
| 84 | UINT8 *spriteram = m_spriteram; | |
| 86 | 85 | int x,y,code,color,offset,flipx,flipy; |
| 87 | 86 | |
| 88 | 87 | /* Drawing sprites: 64 in total */ |
| 89 | 88 | |
| 90 | for (offset = 0;offset < | |
| 89 | for (offset = 0;offset < m_spriteram.bytes();offset += 4) | |
| 91 | 90 | { |
| 92 | 91 | if(!(spriteram[offset + 2] & 0x80)) |
| 93 | 92 | continue; |
| r20977 | r20978 | |
| 101 | 100 | |
| 102 | 101 | flipx = flipy = 0; |
| 103 | 102 | |
| 104 | if( | |
| 103 | if(flip_screen()) | |
| 105 | 104 | { |
| 106 | 105 | x = 246 - x; |
| 107 | 106 | y = 238 - y; |
| 108 | 107 | flipx = flipy = 1; |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | drawgfx_transpen (bitmap,cliprect,machine.gfx[2], | |
| 110 | drawgfx_transpen (bitmap,cliprect,machine().gfx[2], | |
| 112 | 111 | code, |
| 113 | 112 | color, |
| 114 | 113 | flipx,flipy, |
| r20977 | r20978 | |
| 126 | 125 | { |
| 127 | 126 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 128 | 127 | m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 129 | draw_sprites( | |
| 128 | draw_sprites(bitmap, cliprect); | |
| 130 | 129 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); |
| 131 | 130 | m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); |
| 132 | 131 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 64 | 64 | m_fg_tilemap->set_transparent_pen(0); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | ||
| 67 | void solomon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 68 | 68 | { |
| 69 | solomon_state *state = machine.driver_data<solomon_state>(); | |
| 70 | UINT8 *spriteram = state->m_spriteram; | |
| 69 | UINT8 *spriteram = m_spriteram; | |
| 71 | 70 | int offs; |
| 72 | 71 | |
| 73 | for (offs = | |
| 72 | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) | |
| 74 | 73 | { |
| 75 | 74 | int code = spriteram[offs] + 16 * (spriteram[offs + 1] & 0x10); |
| 76 | 75 | int color = (spriteram[offs + 1] & 0x0e) >> 1; |
| r20977 | r20978 | |
| 79 | 78 | int sx = spriteram[offs + 3]; |
| 80 | 79 | int sy = 241 - spriteram[offs + 2]; |
| 81 | 80 | |
| 82 | if ( | |
| 81 | if (flip_screen()) | |
| 83 | 82 | { |
| 84 | 83 | sx = 240 - sx; |
| 85 | 84 | sy = 242 - sy; |
| r20977 | r20978 | |
| 88 | 87 | } |
| 89 | 88 | |
| 90 | 89 | drawgfx_transpen(bitmap, cliprect, |
| 91 | machine.gfx[2], | |
| 90 | machine().gfx[2], | |
| 92 | 91 | code, color, |
| 93 | 92 | flipx, flipy, |
| 94 | 93 | sx, sy, 0); |
| r20977 | r20978 | |
| 99 | 98 | { |
| 100 | 99 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 101 | 100 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 102 | draw_sprites( | |
| 101 | draw_sprites(bitmap, cliprect); | |
| 103 | 102 | return 0; |
| 104 | 103 | } |
| r20977 | r20978 | |
|---|---|---|
| 162 | 162 | * |
| 163 | 163 | *************************************/ |
| 164 | 164 | |
| 165 | ||
| 165 | void skydiver_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 166 | 166 | { |
| 167 | skydiver_state *state = machine.driver_data<skydiver_state>(); | |
| 168 | 167 | int pic; |
| 169 | 168 | |
| 170 | 169 | |
| r20977 | r20978 | |
| 178 | 177 | int color; |
| 179 | 178 | int wide; |
| 180 | 179 | |
| 181 | sx = 29*8 - state->m_videoram[pic + 0x0390]; | |
| 182 | sy = 30*8 - state->m_videoram[pic*2 + 0x0398]; | |
| 183 | charcode = state->m_videoram[pic*2 + 0x0399]; | |
| 180 | sx = 29*8 - m_videoram[pic + 0x0390]; | |
| 181 | sy = 30*8 - m_videoram[pic*2 + 0x0398]; | |
| 182 | charcode = m_videoram[pic*2 + 0x0399]; | |
| 184 | 183 | xflip = charcode & 0x10; |
| 185 | 184 | yflip = charcode & 0x08; |
| 186 | wide = (~pic & 0x02) && | |
| 185 | wide = (~pic & 0x02) && m_width; | |
| 187 | 186 | charcode = (charcode & 0x07) | ((charcode & 0x60) >> 2); |
| 188 | 187 | color = pic & 0x01; |
| 189 | 188 | |
| r20977 | r20978 | |
| 192 | 191 | sx -= 8; |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1], | |
| 194 | drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[1], | |
| 196 | 195 | charcode, color, |
| 197 | 196 | xflip,yflip,sx,sy, |
| 198 | 197 | wide ? 0x20000 : 0x10000, 0x10000,0); |
| r20977 | r20978 | |
| 204 | 203 | { |
| 205 | 204 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 206 | 205 | |
| 207 | draw_sprites( | |
| 206 | draw_sprites(bitmap, cliprect); | |
| 208 | 207 | return 0; |
| 209 | 208 | } |
| r20977 | r20978 | |
|---|---|---|
| 143 | 143 | |
| 144 | 144 | #define DRAW_SPRITE( order, sx, sy ) drawgfx_transpen( bitmap, \ |
| 145 | 145 | cliprect,gfx, \ |
| 146 | (which+order),color+ 8 * | |
| 146 | (which+order),color+ 8 * m_sprite_palbank,flipx,flipy,sx,sy,0); | |
| 147 | 147 | |
| 148 | ||
| 148 | void spdodgeb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 149 | 149 | { |
| 150 | spdodgeb_state *state = machine.driver_data<spdodgeb_state>(); | |
| 151 | UINT8 *spriteram = state->m_spriteram; | |
| 152 | gfx_element *gfx = machine.gfx[1]; | |
| 150 | UINT8 *spriteram = m_spriteram; | |
| 151 | gfx_element *gfx = machine().gfx[1]; | |
| 153 | 152 | UINT8 *src; |
| 154 | 153 | int i; |
| 155 | 154 | |
| r20977 | r20978 | |
| 158 | 157 | /* 240-SY Z|F|CLR|WCH WHICH SX |
| 159 | 158 | xxxxxxxx x|x|xxx|xxx xxxxxxxx xxxxxxxx |
| 160 | 159 | */ |
| 161 | for (i = 0;i < | |
| 160 | for (i = 0;i < m_spriteram.bytes();i += 4) | |
| 162 | 161 | { |
| 163 | 162 | int attr = src[i+1]; |
| 164 | 163 | int which = src[i+2]+((attr & 0x07)<<8); |
| r20977 | r20978 | |
| 171 | 170 | int dy = -16; |
| 172 | 171 | int cy; |
| 173 | 172 | |
| 174 | if ( | |
| 173 | if (flip_screen()) | |
| 175 | 174 | { |
| 176 | 175 | sx = 240 - sx; |
| 177 | 176 | sy = 240 - sy; |
| r20977 | r20978 | |
| 190 | 189 | break; |
| 191 | 190 | |
| 192 | 191 | case 1: /* double y */ |
| 193 | if ( | |
| 192 | if (flip_screen()) { if (sy > 240) sy -= 256; } else { if (sy < 0) sy += 256; } | |
| 194 | 193 | cy = sy + dy; |
| 195 | 194 | which &= ~1; |
| 196 | 195 | DRAW_SPRITE(0,sx,cy); |
| r20977 | r20978 | |
| 207 | 206 | { |
| 208 | 207 | m_bg_tilemap->set_scrollx(0,m_lastscroll+5); |
| 209 | 208 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 210 | draw_sprites( | |
| 209 | draw_sprites(bitmap,cliprect); | |
| 211 | 210 | return 0; |
| 212 | 211 | } |
| r20977 | r20978 | |
|---|---|---|
| 136 | 136 | m_fg_tilemap->set_transparent_pen(0); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | ||
| 139 | void ssozumo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 140 | 140 | { |
| 141 | ssozumo_state *state = machine.driver_data<ssozumo_state>(); | |
| 142 | UINT8 *spriteram = state->m_spriteram; | |
| 141 | UINT8 *spriteram = m_spriteram; | |
| 143 | 142 | int offs; |
| 144 | 143 | |
| 145 | for (offs = 0; offs < | |
| 144 | for (offs = 0; offs < m_spriteram.bytes(); offs += 4) | |
| 146 | 145 | { |
| 147 | 146 | if (spriteram[offs] & 0x01) |
| 148 | 147 | { |
| r20977 | r20978 | |
| 153 | 152 | int sx = 239 - spriteram[offs + 3]; |
| 154 | 153 | int sy = (240 - spriteram[offs + 2]) & 0xff; |
| 155 | 154 | |
| 156 | if ( | |
| 155 | if (flip_screen()) | |
| 157 | 156 | { |
| 158 | 157 | sx = 240 - sx; |
| 159 | 158 | sy = 240 - sy; |
| r20977 | r20978 | |
| 162 | 161 | } |
| 163 | 162 | |
| 164 | 163 | drawgfx_transpen(bitmap, cliprect, |
| 165 | machine.gfx[2], | |
| 164 | machine().gfx[2], | |
| 166 | 165 | code, color, |
| 167 | 166 | flipx, flipy, |
| 168 | 167 | sx, sy, 0); |
| r20977 | r20978 | |
| 174 | 173 | { |
| 175 | 174 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 176 | 175 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 177 | draw_sprites( | |
| 176 | draw_sprites(bitmap, cliprect); | |
| 178 | 177 | return 0; |
| 179 | 178 | } |
| r20977 | r20978 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | ***************************************************************************/ |
| 50 | 50 | |
| 51 | ||
| 51 | void snk68_state::common_video_start() | |
| 52 | 52 | { |
| 53 | snk68_state *state = machine.driver_data<snk68_state>(); | |
| 54 | 53 | |
| 55 | | |
| 54 | m_fg_tilemap->set_transparent_pen(0); | |
| 56 | 55 | |
| 57 | state->m_fg_tilemap->set_scrolldx(0, machine.primary_screen->width() - 256); | |
| 58 | state->m_fg_tilemap->set_scrolldy(0, machine.primary_screen->height() - 256); | |
| 56 | m_fg_tilemap->set_scrolldx(0, machine().primary_screen->width() - 256); | |
| 57 | m_fg_tilemap->set_scrolldy(0, machine().primary_screen->height() - 256); | |
| 59 | 58 | } |
| 60 | 59 | |
| 61 | 60 | void snk68_state::video_start() |
| r20977 | r20978 | |
| 63 | 62 | m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(snk68_state::get_pow_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32); |
| 64 | 63 | m_fg_tile_offset = 0; |
| 65 | 64 | |
| 66 | common_video_start( | |
| 65 | common_video_start(); | |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | VIDEO_START_MEMBER(snk68_state,searchar) |
| 70 | 69 | { |
| 71 | 70 | m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(snk68_state::get_searchar_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32); |
| 72 | 71 | |
| 73 | common_video_start( | |
| 72 | common_video_start(); | |
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | /*************************************************************************** |
| r20977 | r20978 | |
| 180 | 179 | |
| 181 | 180 | ***************************************************************************/ |
| 182 | 181 | |
| 183 | ||
| 182 | void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int group) | |
| 184 | 183 | { |
| 185 | snk68_state *state = machine.driver_data<snk68_state>(); | |
| 186 | UINT16 *spriteram16 = state->m_spriteram; | |
| 187 | int flipscreen = state->m_flipscreen; | |
| 188 | int sprite_flip_axis = state->m_sprite_flip_axis; | |
| 184 | UINT16 *spriteram16 = m_spriteram; | |
| 185 | int flipscreen = m_flipscreen; | |
| 186 | int sprite_flip_axis = m_sprite_flip_axis; | |
| 189 | 187 | const UINT16* tiledata = &spriteram16[0x800*group]; |
| 190 | 188 | |
| 191 | 189 | // pow has 0x4000 tiles and independent x/y flipping |
| 192 | 190 | // the other games have > 0x4000 tiles and flipping in only one direction |
| 193 | 191 | // (globally selected) |
| 194 | int const is_pow = (machine.gfx[1]->elements() <= 0x4000); | |
| 192 | int const is_pow = (machine().gfx[1]->elements() <= 0x4000); | |
| 195 | 193 | int offs; |
| 196 | 194 | |
| 197 | 195 | for (offs = 0; offs < 0x800; offs += 0x40) |
| r20977 | r20978 | |
| 249 | 247 | fy = !fy; |
| 250 | 248 | } |
| 251 | 249 | |
| 252 | drawgfx_transpen(bitmap,cliprect, machine.gfx[1], | |
| 250 | drawgfx_transpen(bitmap,cliprect, machine().gfx[1], | |
| 253 | 251 | tile, |
| 254 | 252 | color, |
| 255 | 253 | fx, fy, |
| r20977 | r20978 | |
| 274 | 272 | bitmap.fill(0x7ff, cliprect); |
| 275 | 273 | |
| 276 | 274 | /* This appears to be the correct priority order */ |
| 277 | draw_sprites(machine(), bitmap, cliprect, 2); | |
| 278 | draw_sprites(machine(), bitmap, cliprect, 3); | |
| 279 | draw_sprites(machine(), bitmap, cliprect, 1); | |
| 275 | draw_sprites(bitmap, cliprect, 2); | |
| 276 | draw_sprites(bitmap, cliprect, 3); | |
| 277 | draw_sprites(bitmap, cliprect, 1); | |
| 280 | 278 | |
| 281 | 279 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 282 | 280 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 592 | 592 | |
| 593 | 593 | /* Draw a tilemap sprite */ |
| 594 | 594 | |
| 595 | ||
| 595 | void ssv_state::draw_row(bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int sy, int scroll) | |
| 596 | 596 | { |
| 597 | ssv_state *state = machine.driver_data<ssv_state>(); | |
| 598 | UINT16 *spriteram16 = state->m_spriteram; | |
| 599 | UINT16 *ssv_scroll = state->m_scroll; | |
| 597 | UINT16 *spriteram16 = m_spriteram; | |
| 598 | UINT16 *ssv_scroll = m_scroll; | |
| 600 | 599 | rectangle clip; |
| 601 | 600 | int attr, code, color, mode, size, page, shadow; |
| 602 | 601 | int x, x1, sx1, flipx, xnum, xstart, xend, xinc; |
| r20977 | r20978 | |
| 678 | 677 | attr = s3[1]; // code low bits + color |
| 679 | 678 | |
| 680 | 679 | /* Code's high bits are scrambled */ |
| 681 | code += | |
| 680 | code += m_tile_code[(attr & 0x3c00)>>10]; | |
| 682 | 681 | flipy = (attr & 0x4000); |
| 683 | 682 | flipx = (attr & 0x8000); |
| 684 | 683 | |
| r20977 | r20978 | |
| 708 | 707 | { |
| 709 | 708 | for (ty = ystart; ty != yend; ty += yinc) |
| 710 | 709 | { |
| 711 | ssv_drawgfx( bitmap, clip, machine.gfx[gfx], | |
| 710 | ssv_drawgfx( bitmap, clip, machine().gfx[gfx], | |
| 712 | 711 | code++, |
| 713 | 712 | color, |
| 714 | 713 | flipx, flipy, |
| r20977 | r20978 | |
| 724 | 723 | |
| 725 | 724 | /* Draw the "background layer" using multiple tilemap sprites */ |
| 726 | 725 | |
| 727 | ||
| 726 | void ssv_state::draw_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int nr) | |
| 728 | 727 | { |
| 729 | 728 | int sy; |
| 730 | for ( sy = 0; sy <= machine.primary_screen->visible_area().max_y; sy += 0x40 ) | |
| 731 | draw_row(machine, bitmap, cliprect, 0, sy, nr); | |
| 729 | for ( sy = 0; sy <= machine().primary_screen->visible_area().max_y; sy += 0x40 ) | |
| 730 | draw_row(bitmap, cliprect, 0, sy, nr); | |
| 732 | 731 | } |
| 733 | 732 | |
| 734 | 733 | /* Draw sprites in the sprites list */ |
| 735 | 734 | |
| 736 | ||
| 735 | void ssv_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 737 | 736 | { |
| 738 | 737 | /* Sprites list */ |
| 739 | ssv_state *state = machine.driver_data<ssv_state>(); | |
| 740 | UINT16 *ssv_scroll = state->m_scroll; | |
| 741 | UINT16 *spriteram16 = state->m_spriteram; | |
| 738 | UINT16 *ssv_scroll = m_scroll; | |
| 739 | UINT16 *spriteram16 = m_spriteram; | |
| 742 | 740 | |
| 743 | 741 | UINT16 *s1 = spriteram16; |
| 744 | 742 | UINT16 *end1 = spriteram16 + 0x02000/2; |
| r20977 | r20978 | |
| 823 | 821 | } |
| 824 | 822 | |
| 825 | 823 | if ((mode & 0x001f) != 0) |
| 826 | draw_row( | |
| 824 | draw_row(bitmap, cliprect, sx, sy, scroll); | |
| 827 | 825 | } |
| 828 | 826 | else |
| 829 | 827 | { |
| r20977 | r20978 | |
| 844 | 842 | attr = s2[1]; // code low bits + color |
| 845 | 843 | |
| 846 | 844 | /* Code's high bits are scrambled */ |
| 847 | code += | |
| 845 | code += m_tile_code[(attr & 0x3c00)>>10]; | |
| 848 | 846 | flipy = (attr & 0x4000); |
| 849 | 847 | flipx = (attr & 0x8000); |
| 850 | 848 | |
| r20977 | r20978 | |
| 934 | 932 | { |
| 935 | 933 | for (y = ystart; y != yend; y += yinc) |
| 936 | 934 | { |
| 937 | ssv_drawgfx( bitmap, cliprect, machine.gfx[gfx], | |
| 935 | ssv_drawgfx( bitmap, cliprect, machine().gfx[gfx], | |
| 938 | 936 | code++, |
| 939 | 937 | color, |
| 940 | 938 | flipx, flipy, |
| r20977 | r20978 | |
| 944 | 942 | } |
| 945 | 943 | |
| 946 | 944 | #ifdef MAME_DEBUG |
| 947 | if (machine.input().code_pressed(KEYCODE_Z)) /* Display some info on each sprite */ | |
| 945 | if (machine().input().code_pressed(KEYCODE_Z)) /* Display some info on each sprite */ | |
| 948 | 946 | { char buf[30]; |
| 949 | 947 | sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8); |
| 950 | ui_draw_text(&machine.render().ui_container(), buf, sx, sy); | |
| 948 | ui_draw_text(&machine().render().ui_container(), buf, sx, sy); | |
| 951 | 949 | } |
| 952 | 950 | #endif |
| 953 | 951 | |
| r20977 | r20978 | |
| 986 | 984 | return 0; |
| 987 | 985 | } |
| 988 | 986 | |
| 989 | void ssv_enable_video( | |
| 987 | void ssv_state::ssv_enable_video(int enable) | |
| 990 | 988 | { |
| 991 | ssv_state *state = machine.driver_data<ssv_state>(); | |
| 992 | 989 | |
| 993 | | |
| 990 | m_enable_video = enable; | |
| 994 | 991 | } |
| 995 | 992 | |
| 996 | 993 | UINT32 ssv_state::screen_update_ssv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| r20977 | r20978 | |
| 1035 | 1032 | if (!m_enable_video) |
| 1036 | 1033 | return 0; |
| 1037 | 1034 | |
| 1038 | draw_layer( | |
| 1035 | draw_layer(bitmap, clip, 0); // "background layer" | |
| 1039 | 1036 | |
| 1040 | draw_sprites( | |
| 1037 | draw_sprites(bitmap, clip); // sprites list | |
| 1041 | 1038 | |
| 1042 | 1039 | |
| 1043 | 1040 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 76 | 76 | */ |
| 77 | 77 | |
| 78 | 78 | |
| 79 | ||
| 79 | inline int segag80v_state::adjust_xy(int rawx, int rawy, int *outx, int *outy) | |
| 80 | 80 | { |
| 81 | 81 | int clipped = FALSE; |
| 82 | 82 | |
| r20977 | r20978 | |
| 101 | 101 | *outy &= 0x3ff; |
| 102 | 102 | |
| 103 | 103 | /* convert into .16 values */ |
| 104 | *outx = (*outx - (state->m_min_x - 512)) << 16; | |
| 105 | *outy = (*outy - (state->m_min_y - 512)) << 16; | |
| 104 | *outx = (*outx - (m_min_x - 512)) << 16; | |
| 105 | *outy = (*outy - (m_min_y - 512)) << 16; | |
| 106 | 106 | return clipped; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
| 110 | ||
| 110 | void segag80v_state::sega_generate_vector_list() | |
| 111 | 111 | { |
| 112 | segag80v_state *state = machine.driver_data<segag80v_state>(); | |
| 113 | UINT8 *sintable = state->memregion("proms")->base(); | |
| 112 | UINT8 *sintable = memregion("proms")->base(); | |
| 114 | 113 | double total_time = 1.0 / (double)IRQ_CLOCK; |
| 115 | 114 | UINT16 symaddr = 0; |
| 116 | UINT8 *vectorram = | |
| 115 | UINT8 *vectorram = m_vectorram; | |
| 117 | 116 | |
| 118 | 117 | vector_clear_list(); |
| 119 | 118 | |
| r20977 | r20978 | |
| 176 | 175 | int adjx, adjy, clipped; |
| 177 | 176 | |
| 178 | 177 | /* Add a starting point to the vector list. */ |
| 179 | clipped = adjust_xy( | |
| 178 | clipped = adjust_xy(curx, cury, &adjx, &adjy); | |
| 180 | 179 | if (!clipped) |
| 181 | vector_add_point(machine, adjx, adjy, 0, 0); | |
| 180 | vector_add_point(machine(), adjx, adjy, 0, 0); | |
| 182 | 181 | |
| 183 | 182 | /* Loop until we run out of time. */ |
| 184 | 183 | while (total_time > 0) |
| r20977 | r20978 | |
| 242 | 241 | intensity = 0; |
| 243 | 242 | |
| 244 | 243 | /* Loop over the length of the vector. */ |
| 245 | clipped = adjust_xy( | |
| 244 | clipped = adjust_xy(curx, cury, &adjx, &adjy); | |
| 246 | 245 | xaccum = yaccum = 0; |
| 247 | 246 | while (length-- != 0 && total_time > 0) |
| 248 | 247 | { |
| r20977 | r20978 | |
| 281 | 280 | /* Apply the clipping from the DAC circuit. If the values clip */ |
| 282 | 281 | /* the beam is turned off, but the computations continue right */ |
| 283 | 282 | /* on going. */ |
| 284 | newclip = adjust_xy( | |
| 283 | newclip = adjust_xy(curx, cury, &adjx, &adjy); | |
| 285 | 284 | if (newclip != clipped) |
| 286 | 285 | { |
| 287 | 286 | /* if we're just becoming unclipped, add an empty point */ |
| 288 | 287 | if (!newclip) |
| 289 | vector_add_point(machine, adjx, adjy, 0, 0); | |
| 288 | vector_add_point(machine(), adjx, adjy, 0, 0); | |
| 290 | 289 | |
| 291 | 290 | /* otherwise, add a colored point */ |
| 292 | 291 | else |
| 293 | vector_add_point(machine, adjx, adjy, color, intensity); | |
| 292 | vector_add_point(machine(), adjx, adjy, color, intensity); | |
| 294 | 293 | } |
| 295 | 294 | clipped = newclip; |
| 296 | 295 | |
| r20977 | r20978 | |
| 300 | 299 | |
| 301 | 300 | /* We're done; if we are not clipped, add a final point. */ |
| 302 | 301 | if (!clipped) |
| 303 | vector_add_point(machine, adjx, adjy, color, intensity); | |
| 302 | vector_add_point(machine(), adjx, adjy, color, intensity); | |
| 304 | 303 | |
| 305 | 304 | /* if the high bit of the attribute is set, we break out of */ |
| 306 | 305 | /* this loop and fetch another symbol */ |
| r20977 | r20978 | |
| 336 | 335 | |
| 337 | 336 | UINT32 segag80v_state::screen_update_segag80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 338 | 337 | { |
| 339 | sega_generate_vector_list( | |
| 338 | sega_generate_vector_list(); | |
| 340 | 339 | SCREEN_UPDATE32_CALL(vector); |
| 341 | 340 | return 0; |
| 342 | 341 | } |
| r20977 | r20978 | |
|---|---|---|
| 53 | 53 | |
| 54 | 54 | ********************************************************/ |
| 55 | 55 | |
| 56 | ||
| 56 | void superchs_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs) | |
| 57 | 57 | { |
| 58 | superchs_state *state = machine.driver_data<superchs_state>(); | |
| 59 | UINT32 *spriteram32 = state->m_spriteram; | |
| 60 | UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base(); | |
| 58 | UINT32 *spriteram32 = m_spriteram; | |
| 59 | UINT16 *spritemap = (UINT16 *)memregion("user1")->base(); | |
| 61 | 60 | int offs, data, tilenum, color, flipx, flipy; |
| 62 | 61 | int x, y, priority, dblsize, curx, cury; |
| 63 | 62 | int sprites_flipscreen = 0; |
| r20977 | r20978 | |
| 67 | 66 | |
| 68 | 67 | /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list |
| 69 | 68 | while processing sprite ram and then draw them all at the end */ |
| 70 | struct tempsprite *sprite_ptr = | |
| 69 | struct tempsprite *sprite_ptr = m_spritelist; | |
| 71 | 70 | |
| 72 | for (offs = ( | |
| 71 | for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) | |
| 73 | 72 | { |
| 74 | 73 | data = spriteram32[offs+0]; |
| 75 | 74 | flipx = (data & 0x00800000) >> 23; |
| r20977 | r20978 | |
| 164 | 163 | } |
| 165 | 164 | else |
| 166 | 165 | { |
| 167 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], | |
| 166 | drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx], | |
| 168 | 167 | sprite_ptr->code, |
| 169 | 168 | sprite_ptr->color, |
| 170 | 169 | sprite_ptr->flipx,sprite_ptr->flipy, |
| r20977 | r20978 | |
| 179 | 178 | } |
| 180 | 179 | |
| 181 | 180 | /* this happens only if primsks != NULL */ |
| 182 | while (sprite_ptr != | |
| 181 | while (sprite_ptr != m_spritelist) | |
| 183 | 182 | { |
| 184 | 183 | sprite_ptr--; |
| 185 | 184 | |
| 186 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], | |
| 185 | pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx], | |
| 187 | 186 | sprite_ptr->code, |
| 188 | 187 | sprite_ptr->color, |
| 189 | 188 | sprite_ptr->flipx,sprite_ptr->flipy, |
| 190 | 189 | sprite_ptr->x,sprite_ptr->y, |
| 191 | 190 | sprite_ptr->zoomx,sprite_ptr->zoomy, |
| 192 | machine.priority_bitmap,sprite_ptr->primask,0); | |
| 191 | machine().priority_bitmap,sprite_ptr->primask,0); | |
| 193 | 192 | } |
| 194 | 193 | } |
| 195 | 194 | |
| r20977 | r20978 | |
| 225 | 224 | if (!machine().input().code_pressed (KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2); |
| 226 | 225 | if (!machine().input().code_pressed (KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4); |
| 227 | 226 | if (!machine().input().code_pressed (KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8); |
| 228 | if (!machine().input().code_pressed (KEYCODE_N)) draw_sprites( | |
| 227 | if (!machine().input().code_pressed (KEYCODE_N)) draw_sprites(bitmap, cliprect, primasks, 48, -116); | |
| 229 | 228 | #else |
| 230 | 229 | tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); |
| 231 | 230 | tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 1); |
| 232 | 231 | tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2); |
| 233 | 232 | tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4); |
| 234 | 233 | tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8); /* text layer */ |
| 235 | draw_sprites( | |
| 234 | draw_sprites(bitmap, cliprect, primasks, 48, -116); | |
| 236 | 235 | #endif |
| 237 | 236 | return 0; |
| 238 | 237 | } |
| r20977 | r20978 | |
|---|---|---|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | ||
| 214 | void st0016_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 215 | 215 | { |
| 216 | 216 | /* |
| 217 | 217 | object ram : |
| r20977 | r20978 | |
| 256 | 256 | |
| 257 | 257 | */ |
| 258 | 258 | |
| 259 | gfx_element *gfx = machine.gfx[st0016_ramgfx]; | |
| 259 | gfx_element *gfx = machine().gfx[st0016_ramgfx]; | |
| 260 | 260 | int i,j,lx,ly,x,y,code,offset,length,sx,sy,color,flipx,flipy,scrollx,scrolly/*,plx,ply*/; |
| 261 | 261 | |
| 262 | 262 | |
| r20977 | r20978 | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | |
| 421 | ||
| 421 | void st0016_state::st0016_save_init() | |
| 422 | 422 | { |
| 423 | state_save_register_global(machine, st0016_spr_bank); | |
| 424 | state_save_register_global(machine, st0016_spr2_bank); | |
| 425 | state_save_register_global(machine, st0016_pal_bank); | |
| 426 | state_save_register_global(machine, st0016_char_bank); | |
| 427 | //state_save_register_global(machine, st0016_rom_bank); | |
| 428 | state_save_register_global_array(machine, st0016_vregs); | |
| 429 | state_save_register_global_pointer(machine, st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); | |
| 430 | state_save_register_global_pointer(machine, st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); | |
| 431 | state_save_register_global_pointer(machine, st0016_spriteram, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); | |
| 423 | state_save_register_global(machine(), st0016_spr_bank); | |
| 424 | state_save_register_global(machine(), st0016_spr2_bank); | |
| 425 | state_save_register_global(machine(), st0016_pal_bank); | |
| 426 | state_save_register_global(machine(), st0016_char_bank); | |
| 427 | //state_save_register_global(machine(), st0016_rom_bank); | |
| 428 | state_save_register_global_array(machine(), st0016_vregs); | |
| 429 | state_save_register_global_pointer(machine(), st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); | |
| 430 | state_save_register_global_pointer(machine(), st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); | |
| 431 | state_save_register_global_pointer(machine(), st0016_spriteram, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); | |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | |
| r20977 | r20978 | |
| 483 | 483 | |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | st0016_save_init( | |
| 486 | st0016_save_init(); | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | |
| 490 | ||
| 490 | void st0016_state::draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority) | |
| 491 | 491 | { |
| 492 | gfx_element *gfx = machine.gfx[st0016_ramgfx]; | |
| 492 | gfx_element *gfx = machine().gfx[st0016_ramgfx]; | |
| 493 | 493 | int j; |
| 494 | 494 | //for(j=0x40-8;j>=0;j-=8) |
| 495 | 495 | for(j=0;j<0x40;j+=8) |
| r20977 | r20978 | |
| 583 | 583 | |
| 584 | 584 | void st0016_state::st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 585 | 585 | { |
| 586 | draw_bgmap(machine(), bitmap,cliprect,0); | |
| 587 | draw_sprites(machine(), bitmap,cliprect); | |
| 588 | draw_bgmap(machine(), bitmap,cliprect,1); | |
| 586 | draw_bgmap(bitmap,cliprect,0); | |
| 587 | draw_sprites(bitmap,cliprect); | |
| 588 | draw_bgmap(bitmap,cliprect,1); | |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | UINT32 st0016_state::screen_update_st0016(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| r20977 | r20978 | |
|---|---|---|
| 33 | 33 | SPRITE DRAW ROUTINES |
| 34 | 34 | ************************************************************/ |
| 35 | 35 | |
| 36 | ||
| 36 | void slapshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks, int y_offset ) | |
| 37 | 37 | { |
| 38 | 38 | /* |
| 39 | 39 | Sprite format: |
| r20977 | r20978 | |
| 88 | 88 | 000b - 000f : unused |
| 89 | 89 | |
| 90 | 90 | */ |
| 91 | slapshot_state *state = machine.driver_data<slapshot_state>(); | |
| 92 | 91 | int x, y, off, extoffs; |
| 93 | 92 | int code, color, spritedata, spritecont, flipx, flipy; |
| 94 | 93 | int xcurrent, ycurrent, big_sprite = 0; |
| r20977 | r20978 | |
| 101 | 100 | |
| 102 | 101 | /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list |
| 103 | 102 | while processing sprite ram and then draw them all at the end */ |
| 104 | struct slapshot_tempsprite *sprite_ptr = | |
| 103 | struct slapshot_tempsprite *sprite_ptr = m_spritelist; | |
| 105 | 104 | |
| 106 | 105 | /* must remember enable status from last frame because driftout fails to |
| 107 | 106 | reactivate them from a certain point onwards. */ |
| 108 | int disabled = | |
| 107 | int disabled = m_sprites_disabled; | |
| 109 | 108 | |
| 110 | 109 | /* must remember master scroll from previous frame because driftout |
| 111 | 110 | sometimes doesn't set it. */ |
| 112 | int master_scrollx = state->m_sprites_master_scrollx; | |
| 113 | int master_scrolly = state->m_sprites_master_scrolly; | |
| 111 | int master_scrollx = m_sprites_master_scrollx; | |
| 112 | int master_scrolly = m_sprites_master_scrolly; | |
| 114 | 113 | |
| 115 | 114 | /* must also remember the sprite bank from previous frame. */ |
| 116 | int area = | |
| 115 | int area = m_sprites_active_area; | |
| 117 | 116 | |
| 118 | 117 | scroll1x = 0; |
| 119 | 118 | scroll1y = 0; |
| r20977 | r20978 | |
| 122 | 121 | color = 0; |
| 123 | 122 | |
| 124 | 123 | x_offset = 3; /* Get rid of 0-3 unwanted pixels on edge of screen. */ |
| 125 | if ( | |
| 124 | if (m_sprites_flipscreen) x_offset = -x_offset; | |
| 126 | 125 | |
| 127 | 126 | /* safety check to avoid getting stuck in bank 2 for games using only one bank */ |
| 128 | 127 | if (area == 0x8000 && |
| 129 | state->m_spriteram_buffered[(0x8000 + 6) / 2] == 0 && | |
| 130 | state->m_spriteram_buffered[(0x8000 + 10) / 2] == 0) | |
| 128 | m_spriteram_buffered[(0x8000 + 6) / 2] == 0 && | |
| 129 | m_spriteram_buffered[(0x8000 + 10) / 2] == 0) | |
| 131 | 130 | area = 0; |
| 132 | 131 | |
| 133 | 132 | |
| r20977 | r20978 | |
| 136 | 135 | /* sprites_active_area may change during processing */ |
| 137 | 136 | int offs = off + area; |
| 138 | 137 | |
| 139 | if ( | |
| 138 | if (m_spriteram_buffered[(offs + 6) / 2] & 0x8000) | |
| 140 | 139 | { |
| 141 | disabled = state->m_spriteram_buffered[(offs + 10) / 2] & 0x1000; | |
| 142 | state->m_sprites_flipscreen = state->m_spriteram_buffered[(offs + 10) / 2] & 0x2000; | |
| 140 | disabled = m_spriteram_buffered[(offs + 10) / 2] & 0x1000; | |
| 141 | m_sprites_flipscreen = m_spriteram_buffered[(offs + 10) / 2] & 0x2000; | |
| 143 | 142 | x_offset = 3; /* Get rid of 0-3 unwanted pixels on edge of screen. */ |
| 144 | if (state->m_sprites_flipscreen) x_offset = -x_offset; | |
| 145 | area = 0x8000 * (state->m_spriteram_buffered[(offs + 10) / 2] & 0x0001); | |
| 143 | if (m_sprites_flipscreen) x_offset = -x_offset; | |
| 144 | area = 0x8000 * (m_spriteram_buffered[(offs + 10) / 2] & 0x0001); | |
| 146 | 145 | continue; |
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 | //popmessage("%04x",area); |
| 150 | 149 | |
| 151 | 150 | /* check for extra scroll offset */ |
| 152 | if (( | |
| 151 | if ((m_spriteram_buffered[(offs + 4) / 2] & 0xf000) == 0xa000) | |
| 153 | 152 | { |
| 154 | master_scrollx = | |
| 153 | master_scrollx = m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 155 | 154 | if (master_scrollx >= 0x800) |
| 156 | 155 | master_scrollx -= 0x1000; /* signed value */ |
| 157 | 156 | |
| 158 | master_scrolly = | |
| 157 | master_scrolly = m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 159 | 158 | if (master_scrolly >= 0x800) |
| 160 | 159 | master_scrolly -= 0x1000; /* signed value */ |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | if (( | |
| 162 | if ((m_spriteram_buffered[(offs + 4) / 2] & 0xf000) == 0x5000) | |
| 164 | 163 | { |
| 165 | scroll1x = | |
| 164 | scroll1x = m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 166 | 165 | if (scroll1x >= 0x800) |
| 167 | 166 | scroll1x -= 0x1000; /* signed value */ |
| 168 | 167 | |
| 169 | scroll1y = | |
| 168 | scroll1y = m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 170 | 169 | if (scroll1y >= 0x800) |
| 171 | 170 | scroll1y -= 0x1000; /* signed value */ |
| 172 | 171 | } |
| r20977 | r20978 | |
| 174 | 173 | if (disabled) |
| 175 | 174 | continue; |
| 176 | 175 | |
| 177 | spritedata = | |
| 176 | spritedata = m_spriteram_buffered[(offs + 8) / 2]; | |
| 178 | 177 | |
| 179 | 178 | spritecont = (spritedata & 0xff00) >> 8; |
| 180 | 179 | |
| r20977 | r20978 | |
| 182 | 181 | { |
| 183 | 182 | if (big_sprite == 0) /* are we starting a big sprite ? */ |
| 184 | 183 | { |
| 185 | xlatch = state->m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 186 | ylatch = state->m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 184 | xlatch = m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 185 | ylatch = m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 187 | 186 | x_no = 0; |
| 188 | 187 | y_no = 0; |
| 189 | zoomword = | |
| 188 | zoomword = m_spriteram_buffered[(offs + 2) / 2]; | |
| 190 | 189 | zoomylatch = (zoomword >> 8) & 0xff; |
| 191 | 190 | zoomxlatch = (zoomword >> 0) & 0xff; |
| 192 | 191 | big_sprite = 1; /* we have started a new big sprite */ |
| r20977 | r20978 | |
| 207 | 206 | // of anything. |
| 208 | 207 | if (big_sprite == 0 || (spritecont & 0xf0) == 0) |
| 209 | 208 | { |
| 210 | x = | |
| 209 | x = m_spriteram_buffered[(offs + 4) / 2]; | |
| 211 | 210 | |
| 212 | 211 | // DG: some absolute x values deduced here are 1 too high (scenes when you get |
| 213 | 212 | // home run in Koshien, and may also relate to BG layer woods and stuff as you |
| r20977 | r20978 | |
| 230 | 229 | scrolly = scroll1y + master_scrolly; |
| 231 | 230 | } |
| 232 | 231 | x &= 0xfff; |
| 233 | y = | |
| 232 | y = m_spriteram_buffered[(offs+6)/2] & 0xfff; | |
| 234 | 233 | |
| 235 | 234 | xcurrent = x; |
| 236 | 235 | ycurrent = y; |
| r20977 | r20978 | |
| 278 | 277 | } |
| 279 | 278 | else |
| 280 | 279 | { |
| 281 | zoomword = | |
| 280 | zoomword = m_spriteram_buffered[(offs+2)/2]; | |
| 282 | 281 | zoomy = (zoomword >> 8) & 0xff; |
| 283 | 282 | zoomx = (zoomword >> 0) & 0xff; |
| 284 | 283 | zx = (0x100 - zoomx) / 16; |
| r20977 | r20978 | |
| 298 | 297 | { |
| 299 | 298 | int i; |
| 300 | 299 | |
| 301 | code = state->m_spriteram_buffered[(offs)/2] & 0xff; | |
| 302 | i = (state->m_spriteext[(extoffs >> 4)] & 0xff00 ); | |
| 300 | code = m_spriteram_buffered[(offs)/2] & 0xff; | |
| 301 | i = (m_spriteext[(extoffs >> 4)] & 0xff00 ); | |
| 303 | 302 | code = (i | code); |
| 304 | 303 | } |
| 305 | 304 | |
| r20977 | r20978 | |
| 315 | 314 | cury = (y + scrolly) & 0xfff; |
| 316 | 315 | if (cury >= 0x800) cury -= 0x1000; /* treat it as signed */ |
| 317 | 316 | |
| 318 | if ( | |
| 317 | if (m_sprites_flipscreen) | |
| 319 | 318 | { |
| 320 | 319 | /* -zx/y is there to fix zoomed sprite coords in screenflip. |
| 321 | 320 | drawgfxzoom does not know to draw from flip-side of sprites when |
| r20977 | r20978 | |
| 332 | 331 | { |
| 333 | 332 | sprite_ptr->code = code; |
| 334 | 333 | sprite_ptr->color = color; |
| 335 | if (machine.gfx[0]->granularity() == 64) /* Final Blow, Slapshot are 6bpp */ | |
| 334 | if (machine().gfx[0]->granularity() == 64) /* Final Blow, Slapshot are 6bpp */ | |
| 336 | 335 | sprite_ptr->color /= 4; |
| 337 | 336 | sprite_ptr->flipx = flipx; |
| 338 | 337 | sprite_ptr->flipy = flipy; |
| r20977 | r20978 | |
| 349 | 348 | } |
| 350 | 349 | else |
| 351 | 350 | { |
| 352 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0], | |
| 351 | drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0], | |
| 353 | 352 | sprite_ptr->code, |
| 354 | 353 | sprite_ptr->color, |
| 355 | 354 | sprite_ptr->flipx,sprite_ptr->flipy, |
| r20977 | r20978 | |
| 361 | 360 | |
| 362 | 361 | |
| 363 | 362 | /* this happens only if primsks != NULL */ |
| 364 | while (sprite_ptr != | |
| 363 | while (sprite_ptr != m_spritelist) | |
| 365 | 364 | { |
| 366 | 365 | sprite_ptr--; |
| 367 | 366 | |
| 368 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0], | |
| 367 | pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0], | |
| 369 | 368 | sprite_ptr->code, |
| 370 | 369 | sprite_ptr->color, |
| 371 | 370 | sprite_ptr->flipx,sprite_ptr->flipy, |
| 372 | 371 | sprite_ptr->x,sprite_ptr->y, |
| 373 | 372 | sprite_ptr->zoomx,sprite_ptr->zoomy, |
| 374 | machine.priority_bitmap,sprite_ptr->primask,0); | |
| 373 | machine().priority_bitmap,sprite_ptr->primask,0); | |
| 375 | 374 | } |
| 376 | 375 | } |
| 377 | 376 | |
| 378 | 377 | |
| 379 | ||
| 378 | void slapshot_state::taito_handle_sprite_buffering( ) | |
| 380 | 379 | { |
| 381 | slapshot_state *state = machine.driver_data<slapshot_state>(); | |
| 382 | 380 | |
| 383 | if ( | |
| 381 | if (m_prepare_sprites) /* no buffering */ | |
| 384 | 382 | { |
| 385 | memcpy(state->m_spriteram_buffered, state->m_spriteram, state->m_spriteram.bytes()); | |
| 386 | state->m_prepare_sprites = 0; | |
| 383 | memcpy(m_spriteram_buffered, m_spriteram, m_spriteram.bytes()); | |
| 384 | m_prepare_sprites = 0; | |
| 387 | 385 | } |
| 388 | 386 | } |
| 389 | 387 | |
| 390 | ||
| 388 | void slapshot_state::taito_update_sprites_active_area( ) | |
| 391 | 389 | { |
| 392 | slapshot_state *state = machine.driver_data<slapshot_state>(); | |
| 393 | 390 | int off; |
| 394 | 391 | |
| 395 | 392 | /* if the frame was skipped, we'll have to do the buffering now */ |
| 396 | taito_handle_sprite_buffering( | |
| 393 | taito_handle_sprite_buffering(); | |
| 397 | 394 | |
| 398 | 395 | /* safety check to avoid getting stuck in bank 2 for games using only one bank */ |
| 399 | if (state->m_sprites_active_area == 0x8000 && | |
| 400 | state->m_spriteram_buffered[(0x8000 + 6) / 2] == 0 && | |
| 401 | state->m_spriteram_buffered[(0x8000 + 10) / 2] == 0) | |
| 402 | state->m_sprites_active_area = 0; | |
| 396 | if (m_sprites_active_area == 0x8000 && | |
| 397 | m_spriteram_buffered[(0x8000 + 6) / 2] == 0 && | |
| 398 | m_spriteram_buffered[(0x8000 + 10) / 2] == 0) | |
| 399 | m_sprites_active_area = 0; | |
| 403 | 400 | |
| 404 | 401 | for (off = 0; off < 0x4000; off += 16) |
| 405 | 402 | { |
| 406 | 403 | /* sprites_active_area may change during processing */ |
| 407 | int offs = off + | |
| 404 | int offs = off + m_sprites_active_area; | |
| 408 | 405 | |
| 409 | if ( | |
| 406 | if (m_spriteram_buffered[(offs + 6) / 2] & 0x8000) | |
| 410 | 407 | { |
| 411 | state->m_sprites_disabled = state->m_spriteram_buffered[(offs + 10) / 2] & 0x1000; | |
| 412 | state->m_sprites_active_area = 0x8000 * (state->m_spriteram_buffered[(offs + 10) / 2] & 0x0001); | |
| 408 | m_sprites_disabled = m_spriteram_buffered[(offs + 10) / 2] & 0x1000; | |
| 409 | m_sprites_active_area = 0x8000 * (m_spriteram_buffered[(offs + 10) / 2] & 0x0001); | |
| 413 | 410 | continue; |
| 414 | 411 | } |
| 415 | 412 | |
| 416 | 413 | /* check for extra scroll offset */ |
| 417 | if (( | |
| 414 | if ((m_spriteram_buffered[(offs+4)/2] & 0xf000) == 0xa000) | |
| 418 | 415 | { |
| 419 | state->m_sprites_master_scrollx = state->m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 420 | if (state->m_sprites_master_scrollx >= 0x800) | |
| 421 | state->m_sprites_master_scrollx -= 0x1000; /* signed value */ | |
| 416 | m_sprites_master_scrollx = m_spriteram_buffered[(offs + 4) / 2] & 0xfff; | |
| 417 | if (m_sprites_master_scrollx >= 0x800) | |
| 418 | m_sprites_master_scrollx -= 0x1000; /* signed value */ | |
| 422 | 419 | |
| 423 | state->m_sprites_master_scrolly = state->m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 424 | if (state->m_sprites_master_scrolly >= 0x800) | |
| 425 | state->m_sprites_master_scrolly -= 0x1000; /* signed value */ | |
| 420 | m_sprites_master_scrolly = m_spriteram_buffered[(offs + 6) / 2] & 0xfff; | |
| 421 | if (m_sprites_master_scrolly >= 0x800) | |
| 422 | m_sprites_master_scrolly -= 0x1000; /* signed value */ | |
| 426 | 423 | } |
| 427 | 424 | } |
| 428 | 425 | } |
| r20977 | r20978 | |
| 432 | 429 | // rising edge |
| 433 | 430 | if (state) |
| 434 | 431 | { |
| 435 | taito_update_sprites_active_area( | |
| 432 | taito_update_sprites_active_area(); | |
| 436 | 433 | |
| 437 | 434 | m_prepare_sprites = 1; |
| 438 | 435 | } |
| r20977 | r20978 | |
| 495 | 492 | } |
| 496 | 493 | #endif |
| 497 | 494 | |
| 498 | taito_handle_sprite_buffering( | |
| 495 | taito_handle_sprite_buffering(); | |
| 499 | 496 | |
| 500 | 497 | tc0480scp_tilemap_update(m_tc0480scp); |
| 501 | 498 | |
| r20977 | r20978 | |
| 555 | 552 | if (spritepri[i] < tilepri[(layer[3])]) primasks[i] |= 0xff00; |
| 556 | 553 | } |
| 557 | 554 | |
| 558 | draw_sprites( | |
| 555 | draw_sprites(bitmap,cliprect,primasks,0); | |
| 559 | 556 | } |
| 560 | 557 | |
| 561 | 558 | /* |
| r20977 | r20978 | |
|---|---|---|
| 161 | 161 | m_flipon = m_charon = m_staron = m_objon = m_bgon = 0; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | ||
| 164 | void sidearms_state::draw_sprites_region(bitmap_ind16 &bitmap, const rectangle &cliprect, int start_offset, int end_offset ) | |
| 165 | 165 | { |
| 166 | sidearms_state *state = machine.driver_data<sidearms_state>(); | |
| 167 | UINT8 *buffered_spriteram = state->m_spriteram->buffer(); | |
| 168 | gfx_element *gfx = machine.gfx[2]; | |
| 166 | UINT8 *buffered_spriteram = m_spriteram->buffer(); | |
| 167 | gfx_element *gfx = machine().gfx[2]; | |
| 169 | 168 | int offs, attr, color, code, x, y, flipx, flipy; |
| 170 | 169 | |
| 171 | flipy = flipx = | |
| 170 | flipy = flipx = m_flipon; | |
| 172 | 171 | |
| 173 | 172 | for (offs = end_offset - 32; offs >= start_offset; offs -= 32) |
| 174 | 173 | { |
| r20977 | r20978 | |
| 180 | 179 | code = buffered_spriteram[offs] + ((attr << 3) & 0x700); |
| 181 | 180 | x = buffered_spriteram[offs + 3] + ((attr << 4) & 0x100); |
| 182 | 181 | |
| 183 | if ( | |
| 182 | if (m_flipon) | |
| 184 | 183 | { |
| 185 | 184 | x = (62 * 8) - x; |
| 186 | 185 | y = (30 * 8) - y; |
| r20977 | r20978 | |
| 194 | 193 | } |
| 195 | 194 | } |
| 196 | 195 | |
| 197 | ||
| 196 | void sidearms_state::sidearms_draw_starfield( bitmap_ind16 &bitmap ) | |
| 198 | 197 | { |
| 199 | 198 | int x, y, i; |
| 200 | 199 | UINT32 hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191; |
| 201 | 200 | UINT8 *sf_rom; |
| 202 | 201 | UINT16 *lineptr; |
| 203 | 202 | int pixadv, lineadv; |
| 204 | sidearms_state *state = machine.driver_data<sidearms_state>(); | |
| 205 | 203 | |
| 206 | 204 | // clear starfield background |
| 207 | 205 | lineptr = &bitmap.pix16(16, 64); |
| r20977 | r20978 | |
| 210 | 208 | for (i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } |
| 211 | 209 | |
| 212 | 210 | // bail if not Side Arms or the starfield has been disabled |
| 213 | if ( | |
| 211 | if (m_gameid || !m_staron) return; | |
| 214 | 212 | |
| 215 | 213 | // init and cache some global vars in stack frame |
| 216 | 214 | hadd_283 = 0; |
| 217 | 215 | |
| 218 | _hflop_74a_n = state->m_hflop_74a_n; | |
| 219 | _vcount_191 = state->m_vcount_191; | |
| 220 | _hcount_191 = state->m_hcount_191 & 0xff; | |
| 216 | _hflop_74a_n = m_hflop_74a_n; | |
| 217 | _vcount_191 = m_vcount_191; | |
| 218 | _hcount_191 = m_hcount_191 & 0xff; | |
| 221 | 219 | |
| 222 | sf_rom = machine.root_device().memregion("user1")->base(); | |
| 220 | sf_rom = machine().root_device().memregion("user1")->base(); | |
| 223 | 221 | |
| 224 | 222 | #if 0 // old loop (for reference; easier to read) |
| 225 | 223 | if (!flipon) |
| r20977 | r20978 | |
| 265 | 263 | lineptr += lineadv; |
| 266 | 264 | } |
| 267 | 265 | #else // optimized loop |
| 268 | if (! | |
| 266 | if (!m_flipon) | |
| 269 | 267 | { |
| 270 | 268 | lineptr = &bitmap.pix16(16, 64); |
| 271 | 269 | pixadv = 1; |
| r20977 | r20978 | |
| 287 | 285 | i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) |
| 288 | 286 | i |= (_hflop_74a_n^(hadd_283>>8)) << 3; // to starfield EPROM A03 (1 bit) |
| 289 | 287 | i |= hadd_283>>5 & 7; // to starfield EPROM A00-A02 (3 bits) |
| 290 | | |
| 288 | m_latch_374 = sf_rom[i + 0x3000]; // lines A12-A13 are always high | |
| 291 | 289 | |
| 292 | 290 | hadd_283 = _hcount_191 + 63; |
| 293 | 291 | |
| r20977 | r20978 | |
| 306 | 304 | i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) |
| 307 | 305 | i |= (_hflop_74a_n^(hadd_283>>8)) << 3; // to starfield EPROM A03 (1 bit) |
| 308 | 306 | i |= hadd_283>>5 & 7; // to starfield EPROM A00-A02 (3 bits) |
| 309 | | |
| 307 | m_latch_374 = sf_rom[i + 0x3000]; // lines A12-A13 are always high | |
| 310 | 308 | } |
| 311 | 309 | |
| 312 | if ((~(( | |
| 310 | if ((~((m_latch_374^hadd_283)^1) & 0x1f)) continue; // logic rejection 3 | |
| 313 | 311 | |
| 314 | *lineptr = (UINT16)( | |
| 312 | *lineptr = (UINT16)(m_latch_374>>5 | 0x378); // to color mixer | |
| 315 | 313 | } |
| 316 | 314 | lineptr += lineadv; |
| 317 | 315 | } |
| 318 | 316 | #endif |
| 319 | 317 | } |
| 320 | 318 | |
| 321 | ||
| 319 | void sidearms_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 322 | 320 | { |
| 323 | sidearms_state *state = machine.driver_data<sidearms_state>(); | |
| 324 | 321 | |
| 325 | if (state->m_gameid == 2 || state->m_gameid == 3) // Dyger and Whizz have simple front-to-back sprite priority | |
| 326 | draw_sprites_region(machine, bitmap, cliprect, 0x0000, 0x1000); | |
| 322 | if (m_gameid == 2 || m_gameid == 3) // Dyger and Whizz have simple front-to-back sprite priority | |
| 323 | draw_sprites_region(bitmap, cliprect, 0x0000, 0x1000); | |
| 327 | 324 | else |
| 328 | 325 | { |
| 329 | draw_sprites_region(machine, bitmap, cliprect, 0x0700, 0x0800); | |
| 330 | draw_sprites_region(machine, bitmap, cliprect, 0x0e00, 0x1000); | |
| 331 | draw_sprites_region(machine, bitmap, cliprect, 0x0800, 0x0f00); | |
| 332 | draw_sprites_region(machine, bitmap, cliprect, 0x0000, 0x0700); | |
| 326 | draw_sprites_region(bitmap, cliprect, 0x0700, 0x0800); | |
| 327 | draw_sprites_region(bitmap, cliprect, 0x0e00, 0x1000); | |
| 328 | draw_sprites_region(bitmap, cliprect, 0x0800, 0x0f00); | |
| 329 | draw_sprites_region(bitmap, cliprect, 0x0000, 0x0700); | |
| 333 | 330 | } |
| 334 | 331 | } |
| 335 | 332 | |
| 336 | 333 | UINT32 sidearms_state::screen_update_sidearms(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 337 | 334 | { |
| 338 | sidearms_draw_starfield( | |
| 335 | sidearms_draw_starfield(bitmap); | |
| 339 | 336 | |
| 340 | 337 | m_bg_tilemap->set_scrollx(0, m_bg_scrollx[0] + (m_bg_scrollx[1] << 8 & 0xf00)); |
| 341 | 338 | m_bg_tilemap->set_scrolly(0, m_bg_scrolly[0] + (m_bg_scrolly[1] << 8 & 0xf00)); |
| r20977 | r20978 | |
| 344 | 341 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 345 | 342 | |
| 346 | 343 | if (m_objon) |
| 347 | draw_sprites( | |
| 344 | draw_sprites(bitmap, cliprect); | |
| 348 | 345 | |
| 349 | 346 | if (m_charon) |
| 350 | 347 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| r20977 | r20978 | |
|---|---|---|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | ||
| 80 | UINT8 sprint2_state::collision_check(colortable_t *colortable, rectangle& rect) | |
| 81 | 81 | { |
| 82 | 82 | UINT8 data = 0; |
| 83 | 83 | |
| r20977 | r20978 | |
| 87 | 87 | for (y = rect.min_y; y <= rect.max_y; y++) |
| 88 | 88 | for (x = rect.min_x; x <= rect.max_x; x++) |
| 89 | 89 | { |
| 90 | UINT16 a = colortable_entry_get_value(colortable, | |
| 90 | UINT16 a = colortable_entry_get_value(colortable, m_helper.pix16(y, x)); | |
| 91 | 91 | |
| 92 | 92 | if (a == 0) |
| 93 | 93 | data |= 0x40; |
| r20977 | r20978 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | ||
| 103 | inline int sprint2_state::get_sprite_code(UINT8 *video_ram, int n) | |
| 104 | 104 | { |
| 105 | 105 | return video_ram[0x398 + 2 * n + 1] >> 3; |
| 106 | 106 | } |
| 107 | ||
| 107 | inline int sprint2_state::get_sprite_x(UINT8 *video_ram, int n) | |
| 108 | 108 | { |
| 109 | 109 | return 2 * (248 - video_ram[0x390 + 1 * n]); |
| 110 | 110 | } |
| 111 | ||
| 111 | inline int sprint2_state::get_sprite_y(UINT8 *video_ram, int n) | |
| 112 | 112 | { |
| 113 | 113 | return 1 * (248 - video_ram[0x398 + 2 * n]); |
| 114 | 114 | } |
| r20977 | r20978 | |
| 176 | 176 | get_sprite_x(video_ram, i), |
| 177 | 177 | get_sprite_y(video_ram, i), 1); |
| 178 | 178 | |
| 179 | m_collision[i] |= collision_check( | |
| 179 | m_collision[i] |= collision_check(machine().colortable, rect); | |
| 180 | 180 | |
| 181 | 181 | /* check for sprite-sprite collisions */ |
| 182 | 182 | |
| r20977 | r20978 | |
| 198 | 198 | get_sprite_x(video_ram, i), |
| 199 | 199 | get_sprite_y(video_ram, i), 1); |
| 200 | 200 | |
| 201 | m_collision[i] |= collision_check( | |
| 201 | m_collision[i] |= collision_check(machine().colortable, rect); | |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
| r20977 | r20978 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | ***************************************************************************/ |
| 118 | 118 | |
| 119 | ||
| 119 | inline int sf_state::sf_invert( int nb ) | |
| 120 | 120 | { |
| 121 | 121 | static const int delta[4] = {0x00, 0x18, 0x18, 0x00}; |
| 122 | 122 | return nb ^ delta[(nb >> 3) & 3]; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | ||
| 125 | void sf_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ) | |
| 126 | 126 | { |
| 127 | sf_state *state = machine.driver_data<sf_state>(); | |
| 128 | 127 | int offs; |
| 129 | 128 | |
| 130 | 129 | for (offs = 0x1000 - 0x20; offs >= 0; offs -= 0x20) |
| 131 | 130 | { |
| 132 | int c = state->m_objectram[offs]; | |
| 133 | int attr = state->m_objectram[offs + 1]; | |
| 134 | int sy = state->m_objectram[offs + 2]; | |
| 135 | int sx = state->m_objectram[offs + 3]; | |
| 131 | int c = m_objectram[offs]; | |
| 132 | int attr = m_objectram[offs + 1]; | |
| 133 | int sy = m_objectram[offs + 2]; | |
| 134 | int sx = m_objectram[offs + 3]; | |
| 136 | 135 | int color = attr & 0x000f; |
| 137 | 136 | int flipx = attr & 0x0100; |
| 138 | 137 | int flipy = attr & 0x0200; |
| r20977 | r20978 | |
| 141 | 140 | { |
| 142 | 141 | int c1, c2, c3, c4, t; |
| 143 | 142 | |
| 144 | if ( | |
| 143 | if (flip_screen()) | |
| 145 | 144 | { |
| 146 | 145 | sx = 480 - sx; |
| 147 | 146 | sy = 224 - sy; |
| r20977 | r20978 | |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | 167 | drawgfx_transpen(bitmap, |
| 169 | cliprect, machine.gfx[2], | |
| 168 | cliprect, machine().gfx[2], | |
| 170 | 169 | sf_invert(c1), |
| 171 | 170 | color, |
| 172 | 171 | flipx,flipy, |
| 173 | 172 | sx,sy, 15); |
| 174 | 173 | drawgfx_transpen(bitmap, |
| 175 | cliprect, machine.gfx[2], | |
| 174 | cliprect, machine().gfx[2], | |
| 176 | 175 | sf_invert(c2), |
| 177 | 176 | color, |
| 178 | 177 | flipx,flipy, |
| 179 | 178 | sx+16,sy, 15); |
| 180 | 179 | drawgfx_transpen(bitmap, |
| 181 | cliprect, machine.gfx[2], | |
| 180 | cliprect, machine().gfx[2], | |
| 182 | 181 | sf_invert(c3), |
| 183 | 182 | color, |
| 184 | 183 | flipx,flipy, |
| 185 | 184 | sx,sy+16, 15); |
| 186 | 185 | drawgfx_transpen(bitmap, |
| 187 | cliprect, machine.gfx[2], | |
| 186 | cliprect, machine().gfx[2], | |
| 188 | 187 | sf_invert(c4), |
| 189 | 188 | color, |
| 190 | 189 | flipx,flipy, |
| r20977 | r20978 | |
| 192 | 191 | } |
| 193 | 192 | else |
| 194 | 193 | { |
| 195 | if ( | |
| 194 | if (flip_screen()) | |
| 196 | 195 | { |
| 197 | 196 | sx = 496 - sx; |
| 198 | 197 | sy = 240 - sy; |
| r20977 | r20978 | |
| 201 | 200 | } |
| 202 | 201 | |
| 203 | 202 | drawgfx_transpen(bitmap, |
| 204 | cliprect, machine.gfx[2], | |
| 203 | cliprect, machine().gfx[2], | |
| 205 | 204 | sf_invert(c), |
| 206 | 205 | color, |
| 207 | 206 | flipx,flipy, |
| r20977 | r20978 | |
| 221 | 220 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 222 | 221 | |
| 223 | 222 | if (m_sf_active & 0x80) |
| 224 | draw_sprites( | |
| 223 | draw_sprites(bitmap, cliprect); | |
| 225 | 224 | |
| 226 | 225 | m_tx_tilemap->draw(bitmap, cliprect, 0, 0); |
| 227 | 226 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | /* sprites - quite a bit still needs doing .. */ |
| 89 | 89 | |
| 90 | ||
| 90 | void stlforce_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 91 | 91 | { |
| 92 | stlforce_state *state = machine.driver_data<stlforce_state>(); | |
| 93 | const UINT16 *source = state->m_spriteram+0x0; | |
| 94 | const UINT16 *finish = state->m_spriteram+0x800; | |
| 95 | gfx_element *gfx = machine.gfx[2]; | |
| 92 | const UINT16 *source = m_spriteram+0x0; | |
| 93 | const UINT16 *finish = m_spriteram+0x800; | |
| 94 | gfx_element *gfx = machine().gfx[2]; | |
| 96 | 95 | int ypos, xpos, attr, num; |
| 97 | 96 | |
| 98 | 97 | while (source<finish) |
| r20977 | r20978 | |
| 112 | 111 | num, |
| 113 | 112 | 64+attr, |
| 114 | 113 | 0,0, |
| 115 | xpos+ | |
| 114 | xpos+m_sprxoffs,ypos,0 ); | |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | 117 | source += 0x4; |
| r20977 | r20978 | |
| 166 | 165 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 167 | 166 | m_mlow_tilemap->draw(bitmap, cliprect, 0,0); |
| 168 | 167 | m_mhigh_tilemap->draw(bitmap, cliprect, 0,0); |
| 169 | draw_sprites( | |
| 168 | draw_sprites(bitmap,cliprect); | |
| 170 | 169 | m_tx_tilemap->draw(bitmap, cliprect, 0,0); |
| 171 | 170 | return 0; |
| 172 | 171 | } |
| r20977 | r20978 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | ***************************************************************************/ |
| 108 | 108 | |
| 109 | ||
| 109 | void srumbler_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 110 | 110 | { |
| 111 | srumbler_state *state = machine.driver_data<srumbler_state>(); | |
| 112 | UINT8 *buffered_spriteram = state->m_spriteram->buffer(); | |
| 111 | UINT8 *buffered_spriteram = m_spriteram->buffer(); | |
| 113 | 112 | int offs; |
| 114 | 113 | |
| 115 | 114 | /* Draw the sprites. */ |
| 116 | for (offs = | |
| 115 | for (offs = m_spriteram->bytes()-4; offs>=0;offs -= 4) | |
| 117 | 116 | { |
| 118 | 117 | /* SPRITES |
| 119 | 118 | ===== |
| r20977 | r20978 | |
| 138 | 137 | sx = buffered_spriteram[offs + 3] + 0x100 * ( attr & 0x01); |
| 139 | 138 | flipy = attr & 0x02; |
| 140 | 139 | |
| 141 | if ( | |
| 140 | if (flip_screen()) | |
| 142 | 141 | { |
| 143 | 142 | sx = 496 - sx; |
| 144 | 143 | sy = 240 - sy; |
| 145 | 144 | flipy = !flipy; |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], | |
| 147 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], | |
| 149 | 148 | code, |
| 150 | 149 | colour, |
| 151 | | |
| 150 | flip_screen(),flipy, | |
| 152 | 151 | sx, sy,15); |
| 153 | 152 | } |
| 154 | 153 | } |
| r20977 | r20978 | |
| 157 | 156 | UINT32 srumbler_state::screen_update_srumbler(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 158 | 157 | { |
| 159 | 158 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
| 160 | draw_sprites( | |
| 159 | draw_sprites(bitmap,cliprect); | |
| 161 | 160 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
| 162 | 161 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 163 | 162 | return 0; |
| r20977 | r20978 | |
|---|---|---|
| 114 | 114 | * |
| 115 | 115 | *************************************/ |
| 116 | 116 | |
| 117 | ||
| 117 | void system1_state::video_start_common(int pagecount) | |
| 118 | 118 | { |
| 119 | system1_state *state = machine.driver_data<system1_state>(); | |
| 120 | 119 | int pagenum; |
| 121 | 120 | |
| 122 | 121 | /* allocate memory for the collision arrays */ |
| 123 | state->m_mix_collide = auto_alloc_array_clear(machine, UINT8, 64); | |
| 124 | state->m_sprite_collide = auto_alloc_array_clear(machine, UINT8, 1024); | |
| 122 | m_mix_collide = auto_alloc_array_clear(machine(), UINT8, 64); | |
| 123 | m_sprite_collide = auto_alloc_array_clear(machine(), UINT8, 1024); | |
| 125 | 124 | |
| 126 | 125 | /* allocate memory for videoram */ |
| 127 | state->m_tilemap_pages = pagecount; | |
| 128 | state->m_videoram = auto_alloc_array_clear(machine, UINT8, 0x800 * pagecount); | |
| 126 | m_tilemap_pages = pagecount; | |
| 127 | m_videoram = auto_alloc_array_clear(machine(), UINT8, 0x800 * pagecount); | |
| 129 | 128 | |
| 130 | 129 | /* create the tilemap pages */ |
| 131 | 130 | for (pagenum = 0; pagenum < pagecount; pagenum++) |
| 132 | 131 | { |
| 133 | state->m_tilemap_page[pagenum] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(system1_state::tile_get_info),state), TILEMAP_SCAN_ROWS, 8,8, 32,32); | |
| 134 | state->m_tilemap_page[pagenum]->set_transparent_pen(0); | |
| 135 | state->m_tilemap_page[pagenum]->set_user_data(state->m_videoram + 0x800 * pagenum); | |
| 132 | m_tilemap_page[pagenum] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(system1_state::tile_get_info),this), TILEMAP_SCAN_ROWS, 8,8, 32,32); | |
| 133 | m_tilemap_page[pagenum]->set_transparent_pen(0); | |
| 134 | m_tilemap_page[pagenum]->set_user_data(m_videoram + 0x800 * pagenum); | |
| 136 | 135 | } |
| 137 | 136 | |
| 138 | 137 | /* allocate a temporary bitmap for sprite rendering */ |
| 139 | | |
| 138 | m_sprite_bitmap = auto_bitmap_ind16_alloc(machine(), 512, 256); | |
| 140 | 139 | |
| 141 | 140 | /* register for save stats */ |
| 142 | state_save_register_global(machine, state->m_video_mode); | |
| 143 | state_save_register_global(machine, state->m_mix_collide_summary); | |
| 144 | state_save_register_global(machine, state->m_sprite_collide_summary); | |
| 145 | state->save_pointer(NAME(state->m_videoram), 0x800 * pagecount); | |
| 146 | state_save_register_global_pointer(machine, state->m_mix_collide, 64); | |
| 147 | state_save_register_global_pointer(machine, state->m_sprite_collide, 1024); | |
| 141 | state_save_register_global(machine(), m_video_mode); | |
| 142 | state_save_register_global(machine(), m_mix_collide_summary); | |
| 143 | state_save_register_global(machine(), m_sprite_collide_summary); | |
| 144 | save_pointer(NAME(m_videoram), 0x800 * pagecount); | |
| 145 | state_save_register_global_pointer(machine(), m_mix_collide, 64); | |
| 146 | state_save_register_global_pointer(machine(), m_sprite_collide, 1024); | |
| 148 | 147 | } |
| 149 | 148 | |
| 150 | 149 | |
| 151 | 150 | void system1_state::video_start() |
| 152 | 151 | { |
| 153 | video_start_common( | |
| 152 | video_start_common(2); | |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | |
| 157 | 156 | VIDEO_START_MEMBER(system1_state,system2) |
| 158 | 157 | { |
| 159 | video_start_common( | |
| 158 | video_start_common(8); | |
| 160 | 159 | } |
| 161 | 160 | |
| 162 | 161 | |
| r20977 | r20978 | |
| 238 | 237 | * |
| 239 | 238 | *************************************/ |
| 240 | 239 | |
| 241 | ||
| 240 | inline void system1_state::videoram_wait_states(cpu_device *cpu) | |
| 242 | 241 | { |
| 243 | 242 | /* The main Z80's CPU clock is halted whenever an access to VRAM happens, |
| 244 | 243 | and is only restarted by the FIXST signal, which occurs once every |
| r20977 | r20978 | |
| 359 | 358 | * |
| 360 | 359 | *************************************/ |
| 361 | 360 | |
| 362 | ||
| 361 | void system1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset) | |
| 363 | 362 | { |
| 364 | system1_state *state = machine.driver_data<system1_state>(); | |
| 365 | UINT32 gfxbanks = state->memregion("sprites")->bytes() / 0x8000; | |
| 366 | const UINT8 *gfxbase = state->memregion("sprites")->base(); | |
| 367 | UINT8 *spriteram = state->m_spriteram; | |
| 368 | int flipscreen = state->flip_screen(); | |
| 363 | UINT32 gfxbanks = memregion("sprites")->bytes() / 0x8000; | |
| 364 | const UINT8 *gfxbase = memregion("sprites")->base(); | |
| 365 | UINT8 *spriteram = m_spriteram; | |
| 366 | int flipscreen = flip_screen(); | |
| 369 | 367 | int spritenum; |
| 370 | 368 | |
| 371 | 369 | /* up to 32 sprites total */ |
| r20977 | r20978 | |
| 450 | 448 | int prevpix = destbase[effx]; |
| 451 | 449 | |
| 452 | 450 | if ((prevpix & 0x0f) != 0) |
| 453 | | |
| 451 | m_sprite_collide[((prevpix >> 4) & 0x1f) + 32 * spritenum] = m_sprite_collide_summary = 1; | |
| 454 | 452 | destbase[effx] = color1 | palettebase; |
| 455 | 453 | } |
| 456 | 454 | } |
| r20977 | r20978 | |
| 471 | 469 | int prevpix = destbase[effx]; |
| 472 | 470 | |
| 473 | 471 | if ((prevpix & 0x0f) != 0) |
| 474 | | |
| 472 | m_sprite_collide[((prevpix >> 4) & 0x1f) + 32 * spritenum] = m_sprite_collide_summary = 1; | |
| 475 | 473 | destbase[effx] = color2 | palettebase; |
| 476 | 474 | } |
| 477 | 475 | } |
| r20977 | r20978 | |
| 489 | 487 | * |
| 490 | 488 | *************************************/ |
| 491 | 489 | |
| 492 | ||
| 490 | void system1_state::video_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind16 &fgpixmap, bitmap_ind16 **bgpixmaps, const int *bgrowscroll, int bgyscroll, int spritexoffs) | |
| 493 | 491 | { |
| 494 | system1_state *state = screen.machine().driver_data<system1_state>(); | |
| 495 | const UINT8 *lookup = state->memregion("proms")->base(); | |
| 492 | const UINT8 *lookup = memregion("proms")->base(); | |
| 496 | 493 | int x, y; |
| 497 | 494 | |
| 498 | 495 | /* first clear the sprite bitmap and draw sprites within this area */ |
| 499 | state->m_sprite_bitmap->fill(0, cliprect); | |
| 500 | draw_sprites(screen.machine(), *state->m_sprite_bitmap, cliprect, spritexoffs); | |
| 496 | m_sprite_bitmap->fill(0, cliprect); | |
| 497 | draw_sprites(*m_sprite_bitmap, cliprect, spritexoffs); | |
| 501 | 498 | |
| 502 | 499 | /* iterate over rows */ |
| 503 | 500 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 504 | 501 | { |
| 505 | 502 | UINT16 *fgbase = &fgpixmap.pix16(y & 0xff); |
| 506 | UINT16 *sprbase = & | |
| 503 | UINT16 *sprbase = &m_sprite_bitmap->pix16(y & 0xff); | |
| 507 | 504 | UINT16 *dstbase = &bitmap.pix16(y); |
| 508 | 505 | int bgy = (y + bgyscroll) & 0x1ff; |
| 509 | 506 | int bgxscroll = bgrowscroll[y >> 3 & 0x1f]; |
| r20977 | r20978 | |
| 533 | 530 | |
| 534 | 531 | /* compute collisions based on two of the PROM bits */ |
| 535 | 532 | if (!(lookup_value & 4)) |
| 536 | | |
| 533 | m_mix_collide[((lookup_value & 8) << 2) | ((sprpix >> 4) & 0x1f)] = m_mix_collide_summary = 1; | |
| 537 | 534 | |
| 538 | 535 | /* the lower 2 PROM bits select the palette and which pixels */ |
| 539 | 536 | lookup_value &= 3; |
| 540 | if ( | |
| 537 | if (m_video_mode & 0x10) | |
| 541 | 538 | dstbase[x] = 0; |
| 542 | 539 | else if (lookup_value == 0) |
| 543 | 540 | dstbase[x] = 0x000 | (sprpix & 0x1ff); |
| r20977 | r20978 | |
|---|---|---|
| 7 | 7 | /* Clean Up */ |
| 8 | 8 | /* is theres a bg colour register? */ |
| 9 | 9 | |
| 10 | ||
| 10 | void silkroad_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 11 | 11 | { |
| 12 | silkroad_state *state = machine.driver_data<silkroad_state>(); | |
| 13 | gfx_element *gfx = machine.gfx[0]; | |
| 14 | UINT32 *source = state->m_sprram; | |
| 12 | gfx_element *gfx = machine().gfx[0]; | |
| 13 | UINT32 *source = m_sprram; | |
| 15 | 14 | UINT32 *finish = source + 0x1000/4; |
| 16 | 15 | |
| 17 | 16 | while( source < finish ) |
| r20977 | r20978 | |
| 37 | 36 | { |
| 38 | 37 | for (wcount=0;wcount<width;wcount++) |
| 39 | 38 | { |
| 40 | pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+wcount,color,0,0,xpos+wcount*16+8,ypos,machine.priority_bitmap,pri_mask,0); | |
| 39 | pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+wcount,color,0,0,xpos+wcount*16+8,ypos,machine().priority_bitmap,pri_mask,0); | |
| 41 | 40 | } |
| 42 | 41 | } |
| 43 | 42 | else |
| 44 | 43 | { |
| 45 | 44 | for (wcount=width;wcount>0;wcount--) |
| 46 | 45 | { |
| 47 | pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+(width-wcount),color,1,0,xpos+wcount*16-16+8,ypos,machine.priority_bitmap,pri_mask,0); | |
| 46 | pdrawgfx_transpen(bitmap,cliprect,gfx,tileno+(width-wcount),color,1,0,xpos+wcount*16-16+8,ypos,machine().priority_bitmap,pri_mask,0); | |
| 48 | 47 | } |
| 49 | 48 | } |
| 50 | 49 | |
| r20977 | r20978 | |
| 146 | 145 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 147 | 146 | m_fg2_tilemap->draw(bitmap, cliprect, 0,1); |
| 148 | 147 | m_fg3_tilemap->draw(bitmap, cliprect, 0,2); |
| 149 | draw_sprites( | |
| 148 | draw_sprites(bitmap,cliprect); | |
| 150 | 149 | |
| 151 | 150 | if (0) |
| 152 | 151 | { |
| r20977 | r20978 | |
|---|---|---|
| 115 | 115 | |
| 116 | 116 | ***************************************************************************/ |
| 117 | 117 | |
| 118 | ||
| 118 | void suna16_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 *sprites, int gfx) | |
| 119 | 119 | { |
| 120 | suna16_state *state = machine.driver_data<suna16_state>(); | |
| 121 | 120 | int offs; |
| 122 | int max_x = machine.primary_screen->width() - 8; | |
| 123 | int max_y = machine.primary_screen->height() - 8; | |
| 121 | int max_x = machine().primary_screen->width() - 8; | |
| 122 | int max_y = machine().primary_screen->height() - 8; | |
| 124 | 123 | |
| 125 | 124 | for ( offs = 0xfc00/2; offs < 0x10000/2 ; offs += 4/2 ) |
| 126 | 125 | { |
| r20977 | r20978 | |
| 181 | 180 | |
| 182 | 181 | if (flipx) tile_flipx = !tile_flipx; |
| 183 | 182 | |
| 184 | if ( | |
| 183 | if (flip_screen()) | |
| 185 | 184 | { |
| 186 | 185 | sx = max_x - sx; |
| 187 | 186 | sy = max_y - sy; |
| r20977 | r20978 | |
| 189 | 188 | tile_flipy = !tile_flipy; |
| 190 | 189 | } |
| 191 | 190 | |
| 192 | drawgfx_transpen( bitmap, cliprect,machine.gfx[gfx], | |
| 191 | drawgfx_transpen( bitmap, cliprect,machine().gfx[gfx], | |
| 193 | 192 | (tile & 0x3fff) + bank*0x4000, |
| 194 | attr + ( | |
| 193 | attr + (m_color_bank << 4), | |
| 195 | 194 | tile_flipx, tile_flipy, |
| 196 | 195 | sx, sy,15 ); |
| 197 | 196 | |
| r20977 | r20978 | |
| 218 | 217 | { |
| 219 | 218 | /* Suna Quiz indicates the background is the last pen */ |
| 220 | 219 | bitmap.fill(0xff, cliprect); |
| 221 | draw_sprites( | |
| 220 | draw_sprites(bitmap, cliprect, m_spriteram, 0); | |
| 222 | 221 | return 0; |
| 223 | 222 | } |
| 224 | 223 | |
| r20977 | r20978 | |
| 237 | 236 | |
| 238 | 237 | /* Suna Quiz indicates the background is the last pen */ |
| 239 | 238 | bitmap.fill(0xff, cliprect); |
| 240 | if (layers_ctrl & 1) draw_sprites(machine(), bitmap, cliprect, m_spriteram, 0); | |
| 241 | if (layers_ctrl & 2) draw_sprites(machine(), bitmap, cliprect, m_spriteram2, 1); | |
| 239 | if (layers_ctrl & 1) draw_sprites(bitmap, cliprect, m_spriteram, 0); | |
| 240 | if (layers_ctrl & 2) draw_sprites(bitmap, cliprect, m_spriteram2, 1); | |
| 242 | 241 | return 0; |
| 243 | 242 | } |
| r20977 | r20978 | |
|---|---|---|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | ||
| 83 | void sspeedr_state::draw_track(bitmap_ind16 &bitmap) | |
| 84 | 84 | { |
| 85 | sspeedr_state *state = machine.driver_data<sspeedr_state>(); | |
| 86 | const UINT8* p = state->memregion("gfx3")->base(); | |
| 85 | const UINT8* p = memregion("gfx3")->base(); | |
| 87 | 86 | |
| 88 | 87 | int x; |
| 89 | 88 | int y; |
| 90 | 89 | |
| 91 | 90 | for (x = 0; x < 376; x++) |
| 92 | 91 | { |
| 93 | unsigned counter_x = x + | |
| 92 | unsigned counter_x = x + m_track_horz + 0x50; | |
| 94 | 93 | |
| 95 | 94 | int flag = 0; |
| 96 | 95 | |
| 97 | if ( | |
| 96 | if (m_track_ice & 2) | |
| 98 | 97 | { |
| 99 | 98 | flag = 1; |
| 100 | 99 | } |
| 101 | else if ( | |
| 100 | else if (m_track_ice & 4) | |
| 102 | 101 | { |
| 103 | if ( | |
| 102 | if (m_track_ice & 1) | |
| 104 | 103 | { |
| 105 | 104 | flag = (counter_x <= 0x1ff); |
| 106 | 105 | } |
| r20977 | r20978 | |
| 119 | 118 | |
| 120 | 119 | /* upper landscape */ |
| 121 | 120 | |
| 122 | for (; y < | |
| 121 | for (; y < m_track_vert[0]; y++) | |
| 123 | 122 | { |
| 124 | unsigned counter_y = y - | |
| 123 | unsigned counter_y = y - m_track_vert[0]; | |
| 125 | 124 | |
| 126 | 125 | int offset = |
| 127 | 126 | ((counter_y & 0x1f) << 3) | |
| r20977 | r20978 | |
| 140 | 139 | |
| 141 | 140 | /* street */ |
| 142 | 141 | |
| 143 | for (; y < 128 + | |
| 142 | for (; y < 128 + m_track_vert[1]; y++) | |
| 144 | 143 | { |
| 145 | 144 | bitmap.pix16(y, x) = flag ? 15 : 0; |
| 146 | 145 | } |
| r20977 | r20978 | |
| 149 | 148 | |
| 150 | 149 | for (; y < 248; y++) |
| 151 | 150 | { |
| 152 | unsigned counter_y = y - | |
| 151 | unsigned counter_y = y - m_track_vert[1]; | |
| 153 | 152 | |
| 154 | 153 | int offset = |
| 155 | 154 | ((counter_y & 0x1f) << 3) | |
| r20977 | r20978 | |
| 169 | 168 | } |
| 170 | 169 | |
| 171 | 170 | |
| 172 | ||
| 171 | void sspeedr_state::draw_drones(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 173 | 172 | { |
| 174 | sspeedr_state *state = machine.driver_data<sspeedr_state>(); | |
| 175 | 173 | static const UINT8 code[6] = |
| 176 | 174 | { |
| 177 | 175 | 0xf, 0x4, 0x3, 0x9, 0x7, 0xc |
| r20977 | r20978 | |
| 184 | 182 | int x; |
| 185 | 183 | int y; |
| 186 | 184 | |
| 187 | if (( | |
| 185 | if ((m_drones_mask >> i) & 1) | |
| 188 | 186 | { |
| 189 | 187 | continue; |
| 190 | 188 | } |
| 191 | 189 | |
| 192 | x = (code[i] << 5) - | |
| 190 | x = (code[i] << 5) - m_drones_horz - 0x50; | |
| 193 | 191 | |
| 194 | 192 | if (x <= -32) |
| 195 | 193 | { |
| 196 | 194 | x += 0x1c8; |
| 197 | 195 | } |
| 198 | 196 | |
| 199 | y = 0xf0 - | |
| 197 | y = 0xf0 - m_drones_vert[i >> 1]; | |
| 200 | 198 | |
| 201 | 199 | drawgfx_transpen(bitmap, cliprect, |
| 202 | machine.gfx[1], | |
| 203 | code[i] ^ state->m_toggle, | |
| 200 | machine().gfx[1], | |
| 201 | code[i] ^ m_toggle, | |
| 204 | 202 | 0, |
| 205 | 203 | 0, 0, |
| 206 | 204 | x, |
| r20977 | r20978 | |
| 209 | 207 | } |
| 210 | 208 | |
| 211 | 209 | |
| 212 | ||
| 210 | void sspeedr_state::draw_driver(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 213 | 211 | { |
| 214 | sspeedr_state *state = machine.driver_data<sspeedr_state>(); | |
| 215 | 212 | int x; |
| 216 | 213 | int y; |
| 217 | 214 | |
| 218 | if (!( | |
| 215 | if (!(m_driver_pic & 0x10)) | |
| 219 | 216 | { |
| 220 | 217 | return; |
| 221 | 218 | } |
| 222 | 219 | |
| 223 | x = 0x1e0 - | |
| 220 | x = 0x1e0 - m_driver_horz - 0x50; | |
| 224 | 221 | |
| 225 | 222 | if (x <= -32) |
| 226 | 223 | { |
| 227 | 224 | x += 0x1c8; |
| 228 | 225 | } |
| 229 | 226 | |
| 230 | y = 0xf0 - | |
| 227 | y = 0xf0 - m_driver_vert; | |
| 231 | 228 | |
| 232 | 229 | drawgfx_transpen(bitmap, cliprect, |
| 233 | machine.gfx[0], | |
| 234 | state->m_driver_pic, | |
| 230 | machine().gfx[0], | |
| 231 | m_driver_pic, | |
| 235 | 232 | 0, |
| 236 | 233 | 0, 0, |
| 237 | 234 | x, |
| r20977 | r20978 | |
| 247 | 244 | |
| 248 | 245 | UINT32 sspeedr_state::screen_update_sspeedr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 249 | 246 | { |
| 250 | draw_track(machine(), bitmap); | |
| 251 | draw_drones(machine(), bitmap, cliprect); | |
| 252 | draw_driver(machine(), bitmap, cliprect); | |
| 247 | draw_track(bitmap); | |
| 248 | draw_drones(bitmap, cliprect); | |
| 249 | draw_driver(bitmap, cliprect); | |
| 253 | 250 | return 0; |
| 254 | 251 | } |
| 255 | 252 |
| r20977 | r20978 | |
|---|---|---|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /* Same as Jailbreak + palette bank */ |
| 94 | ||
| 94 | void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 95 | 95 | { |
| 96 | scotrsht_state *state = machine.driver_data<scotrsht_state>(); | |
| 97 | UINT8 *spriteram = state->m_spriteram; | |
| 96 | UINT8 *spriteram = m_spriteram; | |
| 98 | 97 | int i; |
| 99 | 98 | |
| 100 | for (i = 0; i < | |
| 99 | for (i = 0; i < m_spriteram.bytes(); i += 4) | |
| 101 | 100 | { |
| 102 | 101 | int attr = spriteram[i + 1]; // attributes = ?tyxcccc |
| 103 | 102 | int code = spriteram[i] + ((attr & 0x40) << 2); |
| 104 | int color = (attr & 0x0f) + | |
| 103 | int color = (attr & 0x0f) + m_palette_bank * 16; | |
| 105 | 104 | int flipx = attr & 0x10; |
| 106 | 105 | int flipy = attr & 0x20; |
| 107 | 106 | int sx = spriteram[i + 2] - ((attr & 0x80) << 1); |
| 108 | 107 | int sy = spriteram[i + 3]; |
| 109 | 108 | |
| 110 | if ( | |
| 109 | if (flip_screen()) | |
| 111 | 110 | { |
| 112 | 111 | sx = 240 - sx; |
| 113 | 112 | sy = 240 - sy; |
| r20977 | r20978 | |
| 115 | 114 | flipy = !flipy; |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, | |
| 117 | drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, | |
| 119 | 118 | sx, sy, |
| 120 | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, | |
| 119 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, m_palette_bank * 16)); | |
| 121 | 120 | } |
| 122 | 121 | } |
| 123 | 122 | |
| r20977 | r20978 | |
| 136 | 135 | m_bg_tilemap->set_scrolly(col, m_scroll[col]); |
| 137 | 136 | |
| 138 | 137 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 139 | draw_sprites( | |
| 138 | draw_sprites(bitmap, cliprect); | |
| 140 | 139 | return 0; |
| 141 | 140 | } |
| r20977 | r20978 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | ***************************************************************************/ |
| 158 | 158 | |
| 159 | ||
| 159 | void superqix_state::pbillian_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 160 | 160 | { |
| 161 | superqix_state *state = machine.driver_data<superqix_state>(); | |
| 162 | UINT8 *spriteram = state->m_spriteram; | |
| 161 | UINT8 *spriteram = m_spriteram; | |
| 163 | 162 | int offs; |
| 164 | 163 | |
| 165 | for (offs = 0; offs < | |
| 164 | for (offs = 0; offs < m_spriteram.bytes(); offs += 4) | |
| 166 | 165 | { |
| 167 | 166 | int attr = spriteram[offs + 3]; |
| 168 | 167 | int code = ((spriteram[offs] & 0xfc) >> 2) + 64 * (attr & 0x0f); |
| r20977 | r20978 | |
| 170 | 169 | int sx = spriteram[offs + 1] + 256 * (spriteram[offs] & 0x01); |
| 171 | 170 | int sy = spriteram[offs + 2]; |
| 172 | 171 | |
| 173 | if ( | |
| 172 | if (flip_screen()) | |
| 174 | 173 | { |
| 175 | 174 | sx = 240 - sx; |
| 176 | 175 | sy = 240 - sy; |
| 177 | 176 | } |
| 178 | 177 | |
| 179 | drawgfx_transpen(bitmap,cliprect, machine.gfx[1], | |
| 178 | drawgfx_transpen(bitmap,cliprect, machine().gfx[1], | |
| 180 | 179 | code, |
| 181 | 180 | color, |
| 182 | | |
| 181 | flip_screen(), flip_screen(), | |
| 183 | 182 | sx, sy, 0); |
| 184 | 183 | } |
| 185 | 184 | } |
| 186 | 185 | |
| 187 | ||
| 186 | void superqix_state::superqix_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 188 | 187 | { |
| 189 | superqix_state *state = machine.driver_data<superqix_state>(); | |
| 190 | UINT8 *spriteram = state->m_spriteram; | |
| 188 | UINT8 *spriteram = m_spriteram; | |
| 191 | 189 | int offs; |
| 192 | 190 | |
| 193 | for (offs = 0; offs < | |
| 191 | for (offs = 0; offs < m_spriteram.bytes(); offs += 4) | |
| 194 | 192 | { |
| 195 | 193 | int attr = spriteram[offs + 3]; |
| 196 | 194 | int code = spriteram[offs] + 256 * (attr & 0x01); |
| r20977 | r20978 | |
| 200 | 198 | int sx = spriteram[offs + 1]; |
| 201 | 199 | int sy = spriteram[offs + 2]; |
| 202 | 200 | |
| 203 | if ( | |
| 201 | if (flip_screen()) | |
| 204 | 202 | { |
| 205 | 203 | sx = 240 - sx; |
| 206 | 204 | sy = 240 - sy; |
| r20977 | r20978 | |
| 208 | 206 | flipy = !flipy; |
| 209 | 207 | } |
| 210 | 208 | |
| 211 | drawgfx_transpen(bitmap,cliprect, machine.gfx[2], | |
| 209 | drawgfx_transpen(bitmap,cliprect, machine().gfx[2], | |
| 212 | 210 | code, |
| 213 | 211 | color, |
| 214 | 212 | flipx, flipy, |
| r20977 | r20978 | |
| 219 | 217 | UINT32 superqix_state::screen_update_pbillian(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 220 | 218 | { |
| 221 | 219 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 222 | pbillian_draw_sprites( | |
| 220 | pbillian_draw_sprites(bitmap,cliprect); | |
| 223 | 221 | |
| 224 | 222 | return 0; |
| 225 | 223 | } |
| r20977 | r20978 | |
| 228 | 226 | { |
| 229 | 227 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 230 | 228 | copybitmap_trans(bitmap,*m_fg_bitmap[m_show_bitmap],flip_screen(),flip_screen(),0,0,cliprect,0); |
| 231 | superqix_draw_sprites( | |
| 229 | superqix_draw_sprites(bitmap,cliprect); | |
| 232 | 230 | m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); |
| 233 | 231 | return 0; |
| 234 | 232 | } |
| r20977 | r20978 | |
|---|---|---|
| 122 | 122 | m_slapfight_palette_bank = offset; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | ||
| 125 | void slapfght_state::slapfght_log_vram() | |
| 126 | 126 | { |
| 127 | 127 | #ifdef MAME_DEBUG |
| 128 | slapfght_state *state = machine.driver_data<slapfght_state>(); | |
| 129 | if ( machine.input().code_pressed_once(KEYCODE_B) ) | |
| 128 | if ( machine().input().code_pressed_once(KEYCODE_B) ) | |
| 130 | 129 | { |
| 131 | 130 | int i; |
| 132 | 131 | for (i=0; i<0x800; i++) |
| 133 | 132 | { |
| 134 | logerror("Offset:%03x TileRAM:%02x AttribRAM:%02x SpriteRAM:%02x\n",i, | |
| 133 | logerror("Offset:%03x TileRAM:%02x AttribRAM:%02x SpriteRAM:%02x\n",i, m_slapfight_videoram[i],m_slapfight_colorram[i],m_spriteram->live()[i]); | |
| 135 | 134 | } |
| 136 | 135 | } |
| 137 | 136 | #endif |
| r20977 | r20978 | |
| 142 | 141 | Render the Sprites |
| 143 | 142 | |
| 144 | 143 | ***************************************************************************/ |
| 145 | ||
| 144 | void slapfght_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display ) | |
| 146 | 145 | { |
| 147 | slapfght_state *state = machine.driver_data<slapfght_state>(); | |
| 148 | UINT8 *buffered_spriteram = state->m_spriteram->buffer(); | |
| 146 | UINT8 *buffered_spriteram = m_spriteram->buffer(); | |
| 149 | 147 | int offs; |
| 150 | 148 | |
| 151 | for (offs = 0;offs < | |
| 149 | for (offs = 0;offs < m_spriteram->bytes();offs += 4) | |
| 152 | 150 | { |
| 153 | 151 | int sx, sy; |
| 154 | 152 | |
| 155 | 153 | if ((buffered_spriteram[offs+2] & 0x80) == priority_to_display) |
| 156 | 154 | { |
| 157 | if ( | |
| 155 | if (m_flipscreen) | |
| 158 | 156 | { |
| 159 | 157 | sx = 265 - buffered_spriteram[offs+1]; |
| 160 | 158 | sy = 239 - buffered_spriteram[offs+3]; |
| r20977 | r20978 | |
| 165 | 163 | sx = buffered_spriteram[offs+1] + 3; |
| 166 | 164 | sy = buffered_spriteram[offs+3] - 1; |
| 167 | 165 | } |
| 168 | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], | |
| 166 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], | |
| 169 | 167 | buffered_spriteram[offs], |
| 170 | 168 | ((buffered_spriteram[offs+2] >> 1) & 3) | |
| 171 | ((buffered_spriteram[offs+2] << 2) & 4) | (state->m_slapfight_palette_bank << 3), | |
| 172 | state->m_flipscreen, state->m_flipscreen, | |
| 169 | ((buffered_spriteram[offs+2] << 2) & 4) | (m_slapfight_palette_bank << 3), | |
| 170 | m_flipscreen, m_flipscreen, | |
| 173 | 171 | sx, sy,0); |
| 174 | 172 | } |
| 175 | 173 | } |
| r20977 | r20978 | |
| 188 | 186 | } |
| 189 | 187 | |
| 190 | 188 | m_pf1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); |
| 191 | draw_sprites( | |
| 189 | draw_sprites(bitmap,cliprect,0); | |
| 192 | 190 | m_pf1_tilemap->draw(bitmap, cliprect, 0,0); |
| 193 | draw_sprites( | |
| 191 | draw_sprites(bitmap,cliprect,0x80); | |
| 194 | 192 | |
| 195 | slapfght_log_vram( | |
| 193 | slapfght_log_vram(); | |
| 196 | 194 | return 0; |
| 197 | 195 | } |
| 198 | 196 | |
| r20977 | r20978 | |
| 237 | 235 | |
| 238 | 236 | m_fix_tilemap->draw(bitmap, cliprect, 0,0); |
| 239 | 237 | |
| 240 | slapfght_log_vram( | |
| 238 | slapfght_log_vram(); | |
| 241 | 239 | return 0; |
| 242 | 240 | } |
| r20977 | r20978 | |
|---|---|---|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | |
| 17 | ||
| 17 | void skyraid_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 18 | 18 | { |
| 19 | skyraid_state *state = machine.driver_data<skyraid_state>(); | |
| 20 | const UINT8* p = state->m_alpha_num_ram; | |
| 19 | const UINT8* p = m_alpha_num_ram; | |
| 21 | 20 | |
| 22 | 21 | int i; |
| 23 | 22 | |
| r20977 | r20978 | |
| 29 | 28 | y = 136 + 16 * (i ^ 1); |
| 30 | 29 | |
| 31 | 30 | for (x = 0; x < bitmap.width(); x += 16) |
| 32 | drawgfx_transpen(bitmap, cliprect, machine.gfx[0], *p++, 0, 0, 0, x, y, 0); | |
| 31 | drawgfx_transpen(bitmap, cliprect, machine().gfx[0], *p++, 0, 0, 0, x, y, 0); | |
| 33 | 32 | } |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | |
| 37 | ||
| 36 | void skyraid_state::draw_terrain(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 38 | 37 | { |
| 39 | skyraid_state *state = machine.driver_data<skyraid_state>(); | |
| 40 | const UINT8* p = state->memregion("user1")->base(); | |
| 38 | const UINT8* p = memregion("user1")->base(); | |
| 41 | 39 | |
| 42 | 40 | int x; |
| 43 | 41 | int y; |
| 44 | 42 | |
| 45 | 43 | for (y = 0; y < bitmap.height(); y++) |
| 46 | 44 | { |
| 47 | int offset = (16 * | |
| 45 | int offset = (16 * m_scroll + 16 * ((y + 1) / 2)) & 0x7FF; | |
| 48 | 46 | |
| 49 | 47 | x = 0; |
| 50 | 48 | |
| r20977 | r20978 | |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | |
| 68 | ||
| 66 | void skyraid_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 69 | 67 | { |
| 70 | skyraid_state *state = machine.driver_data<skyraid_state>(); | |
| 71 | 68 | int i; |
| 72 | 69 | |
| 73 | 70 | for (i = 0; i < 4; i++) |
| 74 | 71 | { |
| 75 | int code = state->m_obj_ram[8 + 2 * i + 0] & 15; | |
| 76 | int flag = state->m_obj_ram[8 + 2 * i + 1] & 15; | |
| 77 | int vert = state->m_pos_ram[8 + 2 * i + 0]; | |
| 78 | int horz = state->m_pos_ram[8 + 2 * i + 1]; | |
| 72 | int code = m_obj_ram[8 + 2 * i + 0] & 15; | |
| 73 | int flag = m_obj_ram[8 + 2 * i + 1] & 15; | |
| 74 | int vert = m_pos_ram[8 + 2 * i + 0]; | |
| 75 | int horz = m_pos_ram[8 + 2 * i + 1]; | |
| 79 | 76 | |
| 80 | 77 | vert -= 31; |
| 81 | 78 | |
| 82 | 79 | if (flag & 1) |
| 83 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], | |
| 80 | drawgfx_transpen(bitmap, cliprect, machine().gfx[1], | |
| 84 | 81 | code ^ 15, code >> 3, 0, 0, |
| 85 | 82 | horz / 2, vert, 2); |
| 86 | 83 | } |
| 87 | 84 | } |
| 88 | 85 | |
| 89 | 86 | |
| 90 | ||
| 87 | void skyraid_state::draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 91 | 88 | { |
| 92 | skyraid_state *state = machine.driver_data<skyraid_state>(); | |
| 93 | 89 | int i; |
| 94 | 90 | |
| 95 | 91 | /* hardware is restricted to one sprite per scanline */ |
| 96 | 92 | |
| 97 | 93 | for (i = 0; i < 4; i++) |
| 98 | 94 | { |
| 99 | int code = state->m_obj_ram[2 * i + 0] & 15; | |
| 100 | int vert = state->m_pos_ram[2 * i + 0]; | |
| 101 | int horz = state->m_pos_ram[2 * i + 1]; | |
| 95 | int code = m_obj_ram[2 * i + 0] & 15; | |
| 96 | int vert = m_pos_ram[2 * i + 0]; | |
| 97 | int horz = m_pos_ram[2 * i + 1]; | |
| 102 | 98 | |
| 103 | 99 | vert -= 15; |
| 104 | 100 | horz -= 31; |
| 105 | 101 | |
| 106 | drawgfx_transpen(bitmap, cliprect, machine.gfx[2], | |
| 102 | drawgfx_transpen(bitmap, cliprect, machine().gfx[2], | |
| 107 | 103 | code ^ 15, 0, 0, 0, |
| 108 | 104 | horz / 2, vert, 0); |
| 109 | 105 | } |
| 110 | 106 | } |
| 111 | 107 | |
| 112 | 108 | |
| 113 | ||
| 109 | void skyraid_state::draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src) | |
| 114 | 110 | { |
| 115 | const UINT8* p = machine.root_device().memregion("user2")->base(); | |
| 111 | const UINT8* p = machine().root_device().memregion("user2")->base(); | |
| 116 | 112 | |
| 117 | 113 | int x; |
| 118 | 114 | int y; |
| r20977 | r20978 | |
| 138 | 134 | rectangle helper_clip = cliprect; |
| 139 | 135 | helper_clip &= m_helper.cliprect(); |
| 140 | 136 | |
| 141 | draw_terrain(machine(), m_helper, helper_clip); | |
| 142 | draw_sprites(machine(), m_helper, helper_clip); | |
| 143 | draw_missiles(machine(), m_helper, helper_clip); | |
| 144 | draw_trapezoid(machine(), bitmap, m_helper); | |
| 145 | draw_text(machine(), bitmap, cliprect); | |
| 137 | draw_terrain(m_helper, helper_clip); | |
| 138 | draw_sprites(m_helper, helper_clip); | |
| 139 | draw_missiles(m_helper, helper_clip); | |
| 140 | draw_trapezoid(bitmap, m_helper); | |
| 141 | draw_text(bitmap, cliprect); | |
| 146 | 142 | return 0; |
| 147 | 143 | } |
| r20977 | r20978 | |
|---|---|---|
| 135 | 135 | colortable_configure_tilemap_groups(machine().colortable, m_fgtilemap, machine().gfx[2], 0); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | ||
| 138 | void sprcros2_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
| 139 | 139 | { |
| 140 | sprcros2_state *state = machine.driver_data<sprcros2_state>(); | |
| 141 | 140 | int offs,sx,sy,color,flipx,flipy; |
| 142 | 141 | |
| 143 | for (offs = | |
| 142 | for (offs = m_spriteram.bytes()-4; offs >= 0; offs -= 4) | |
| 144 | 143 | { |
| 145 | if ( | |
| 144 | if (m_spriteram[offs]) | |
| 146 | 145 | { |
| 147 | 146 | //offs |
| 148 | 147 | //76543210 |
| r20977 | r20978 | |
| 158 | 157 | //offs+2 y pos |
| 159 | 158 | //offs+3 x pos |
| 160 | 159 | |
| 161 | sx = ((state->m_spriteram[offs+3]+0x10)%0x100)-0x10; | |
| 162 | sy = 225-(((state->m_spriteram[offs+2]+0x10)%0x100)-0x10); | |
| 163 | color = (state->m_spriteram[offs+1]&0x38)>>3; | |
| 164 | flipx = state->m_spriteram[offs+1]&0x02; | |
| 160 | sx = ((m_spriteram[offs+3]+0x10)%0x100)-0x10; | |
| 161 | sy = 225-(((m_spriteram[offs+2]+0x10)%0x100)-0x10); | |
| 162 | color = (m_spriteram[offs+1]&0x38)>>3; | |
| 163 | flipx = m_spriteram[offs+1]&0x02; | |
| 165 | 164 | flipy = 0; |
| 166 | 165 | |
| 167 | if ( | |
| 166 | if (m_port7&0x02) | |
| 168 | 167 | { |
| 169 | 168 | sx = 224-sx; |
| 170 | 169 | sy = 224-sy; |
| r20977 | r20978 | |
| 172 | 171 | flipy = !flipy; |
| 173 | 172 | } |
| 174 | 173 | |
| 175 | drawgfx_transmask(bitmap,cliprect,machine.gfx[1], | |
| 176 | state->m_spriteram[offs], | |
| 174 | drawgfx_transmask(bitmap,cliprect,machine().gfx[1], | |
| 175 | m_spriteram[offs], | |
| 177 | 176 | color, |
| 178 | 177 | flipx,flipy, |
| 179 | 178 | sx,sy, |
| 180 | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); | |
| 179 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); | |
| 181 | 180 | } |
| 182 | 181 | } |
| 183 | 182 | } |
| r20977 | r20978 | |
| 185 | 184 | UINT32 sprcros2_state::screen_update_sprcros2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 186 | 185 | { |
| 187 | 186 | m_bgtilemap->draw(bitmap, cliprect, 0, 0); |
| 188 | draw_sprites( | |
| 187 | draw_sprites(bitmap, cliprect); | |
| 189 | 188 | m_fgtilemap->draw(bitmap, cliprect, 0, 0); |
| 190 | 189 | return 0; |
| 191 | 190 | } |
| r20977 | r20978 | |
|---|---|---|
| 8 | 8 | #include "includes/starshp1.h" |
| 9 | 9 | |
| 10 | 10 | |
| 11 | ||
| 11 | void starshp1_state::set_pens(colortable_t *colortable) | |
| 12 | 12 | { |
| 13 | colortable_palette_set_color(colortable, state->m_inverse ? 7 : 0, MAKE_RGB(0x00, 0x00, 0x00)); | |
| 14 | colortable_palette_set_color(colortable, state->m_inverse ? 6 : 1, MAKE_RGB(0x1e, 0x1e, 0x1e)); | |
| 15 | colortable_palette_set_color(colortable, state->m_inverse ? 5 : 2, MAKE_RGB(0x4e, 0x4e, 0x4e)); | |
| 16 | colortable_palette_set_color(colortable, state->m_inverse ? 4 : 3, MAKE_RGB(0x6c, 0x6c, 0x6c)); | |
| 17 | colortable_palette_set_color(colortable, state->m_inverse ? 3 : 4, MAKE_RGB(0x93, 0x93, 0x93)); | |
| 18 | colortable_palette_set_color(colortable, state->m_inverse ? 2 : 5, MAKE_RGB(0xb1, 0xb1, 0xb1)); | |
| 19 | colortable_palette_set_color(colortable, state->m_inverse ? 1 : 6, MAKE_RGB(0xe1, 0xe1, 0xe1)); | |
| 20 | colortable_palette_set_color(colortable, state->m_inverse ? 0 : 7, MAKE_RGB(0xff, 0xff, 0xff)); | |
| 13 | colortable_palette_set_color(colortable, m_inverse ? 7 : 0, MAKE_RGB(0x00, 0x00, 0x00)); | |
| 14 | colortable_palette_set_color(colortable, m_inverse ? 6 : 1, MAKE_RGB(0x1e, 0x1e, 0x1e)); | |
| 15 | colortable_palette_set_color(colortable, m_inverse ? 5 : 2, MAKE_RGB(0x4e, 0x4e, 0x4e)); | |
| 16 | colortable_palette_set_color(colortable, m_inverse ? 4 : 3, MAKE_RGB(0x6c, 0x6c, 0x6c)); | |
| 17 | colortable_palette_set_color(colortable, m_inverse ? 3 : 4, MAKE_RGB(0x93, 0x93, 0x93)); | |
| 18 | colortable_palette_set_color(colortable, m_inverse ? 2 : 5, MAKE_RGB(0xb1, 0xb1, 0xb1)); | |
| 19 | colortable_palette_set_color(colortable, m_inverse ? 1 : 6, MAKE_RGB(0xe1, 0xe1, 0xe1)); | |
| 20 | colortable_palette_set_color(colortable, m_inverse ? 0 : 7, MAKE_RGB(0xff, 0xff, 0xff)); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| r20977 | r20978 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | ||
| 144 | void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) | |
| 145 | 145 | { |
| 146 | 146 | /* |
| 147 | 147 | * The LSFR is reset once per frame at the position of |
| r20977 | r20978 | |
| 154 | 154 | |
| 155 | 155 | for (y = 0; y < bitmap.height(); y++) |
| 156 | 156 | { |
| 157 | const UINT16* p = | |
| 157 | const UINT16* p = m_LSFR + (UINT16) (512 * y); | |
| 158 | 158 | |
| 159 | 159 | UINT16* pLine = &bitmap.pix16(y); |
| 160 | 160 | |
| r20977 | r20978 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
| 168 | ||
| 168 | int starshp1_state::get_sprite_hpos(int i) | |
| 169 | 169 | { |
| 170 | return 2 * ( | |
| 170 | return 2 * (m_hpos_ram[i] ^ 0xff); | |
| 171 | 171 | } |
| 172 | ||
| 172 | int starshp1_state::get_sprite_vpos(int i) | |
| 173 | 173 | { |
| 174 | return 1 * ( | |
| 174 | return 1 * (m_vpos_ram[i] - 0x07); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | ||
| 178 | void starshp1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 179 | 179 | { |
| 180 | starshp1_state *state = machine.driver_data<starshp1_state>(); | |
| 181 | 180 | int i; |
| 182 | 181 | |
| 183 | 182 | for (i = 0; i < 14; i++) |
| 184 | 183 | { |
| 185 | int code = ( | |
| 184 | int code = (m_obj_ram[i] & 0xf) ^ 0xf; | |
| 186 | 185 | |
| 187 | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], | |
| 186 | drawgfx_transpen(bitmap, cliprect, machine().gfx[1], | |
| 188 | 187 | code % 8, |
| 189 | 188 | code / 8, |
| 190 | 189 | 0, 0, |
| 191 | get_sprite_hpos(state, i), | |
| 192 | get_sprite_vpos(state, i), 0); | |
| 190 | get_sprite_hpos(i), | |
| 191 | get_sprite_vpos(i), 0); | |
| 193 | 192 | } |
| 194 | 193 | } |
| 195 | 194 | |
| 196 | 195 | |
| 197 | ||
| 196 | void starshp1_state::draw_spaceship(bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 198 | 197 | { |
| 199 | starshp1_state *state = machine.driver_data<starshp1_state>(); | |
| 200 | double scaler = -5 * log(1 - state->m_ship_size / 256.0); /* ? */ | |
| 198 | double scaler = -5 * log(1 - m_ship_size / 256.0); /* ? */ | |
| 201 | 199 | |
| 202 | 200 | unsigned xzoom = 2 * 0x10000 * scaler; |
| 203 | 201 | unsigned yzoom = 1 * 0x10000 * scaler; |
| 204 | 202 | |
| 205 | int x = get_sprite_hpos(state, 14); | |
| 206 | int y = get_sprite_vpos(state, 14); | |
| 203 | int x = get_sprite_hpos(14); | |
| 204 | int y = get_sprite_vpos(14); | |
| 207 | 205 | |
| 208 | 206 | if (x <= 0) |
| 209 | x -= (xzoom * | |
| 207 | x -= (xzoom * m_ship_hoffset) >> 16; | |
| 210 | 208 | |
| 211 | 209 | if (y <= 0) |
| 212 | y -= (yzoom * | |
| 210 | y -= (yzoom * m_ship_voffset) >> 16; | |
| 213 | 211 | |
| 214 | drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[2], | |
| 215 | state->m_ship_picture & 0x03, | |
| 216 | state->m_ship_explode, | |
| 217 | state->m_ship_picture & 0x80, 0, | |
| 212 | drawgfxzoom_transpen(bitmap, cliprect, machine().gfx[2], | |
| 213 | m_ship_picture & 0x03, | |
| 214 | m_ship_explode, | |
| 215 | m_ship_picture & 0x80, 0, | |
| 218 | 216 | x, y, |
| 219 | 217 | xzoom, yzoom, 0); |
| 220 | 218 | } |
| 221 | 219 | |
| 222 | 220 | |
| 223 | ||
| 221 | void starshp1_state::draw_phasor(bitmap_ind16 &bitmap) | |
| 224 | 222 | { |
| 225 | 223 | int i; |
| 226 | 224 | |
| 227 | 225 | for (i = 128; i < 240; i++) |
| 228 | if (i >= get_sprite_vpos( | |
| 226 | if (i >= get_sprite_vpos(13)) | |
| 229 | 227 | { |
| 230 | 228 | bitmap.pix16(i, 2 * i + 0) = 0x10; |
| 231 | 229 | bitmap.pix16(i, 2 * i + 1) = 0x10; |
| r20977 | r20978 | |
| 235 | 233 | } |
| 236 | 234 | |
| 237 | 235 | |
| 238 | ||
| 236 | int starshp1_state::get_radius() | |
| 239 | 237 | { |
| 240 | return 6 * sqrt((double) | |
| 238 | return 6 * sqrt((double)m_circle_size); /* size calibrated by hand */ | |
| 241 | 239 | } |
| 242 | stat | |
| 240 | int starshp1_state::get_circle_hpos() | |
| 243 | 241 | { |
| 244 | return 2 * (3 * | |
| 242 | return 2 * (3 * m_circle_hpos / 2 - 64); | |
| 245 | 243 | } |
| 246 | stat | |
| 244 | int starshp1_state::get_circle_vpos() | |
| 247 | 245 | { |
| 248 | return 1 * (3 * | |
| 246 | return 1 * (3 * m_circle_vpos / 2 - 64); | |
| 249 | 247 | } |
| 250 | 248 | |
| 251 | 249 | |
| 252 | ||
| 250 | void starshp1_state::draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l) | |
| 253 | 251 | { |
| 254 | starshp1_state *state = machine.driver_data<starshp1_state>(); | |
| 255 | 252 | if (y >= 0 && y <= bitmap.height() - 1) |
| 256 | 253 | { |
| 257 | const UINT16* p = | |
| 254 | const UINT16* p = m_LSFR + (UINT16) (512 * y); | |
| 258 | 255 | |
| 259 | 256 | UINT16* pLine = &bitmap.pix16(y); |
| 260 | 257 | |
| r20977 | r20978 | |
| 267 | 264 | h2 = bitmap.width() - 1; |
| 268 | 265 | |
| 269 | 266 | for (x = h1; x <= h2; x++) |
| 270 | if ( | |
| 267 | if (m_circle_mod) | |
| 271 | 268 | { |
| 272 | 269 | if (p[x] & 1) |
| 273 | 270 | pLine[x] = 0x11; |
| r20977 | r20978 | |
| 278 | 275 | } |
| 279 | 276 | |
| 280 | 277 | |
| 281 | ||
| 278 | void starshp1_state::draw_circle(bitmap_ind16 &bitmap) | |
| 282 | 279 | { |
| 283 | starshp1_state *state = machine.driver_data<starshp1_state>(); | |
| 284 | int cx = get_circle_hpos(state); | |
| 285 | int cy = get_circle_vpos(state); | |
| 280 | int cx = get_circle_hpos(); | |
| 281 | int cy = get_circle_vpos(); | |
| 286 | 282 | |
| 287 | 283 | int x = 0; |
| 288 | int y = get_radius( | |
| 284 | int y = get_radius(); | |
| 289 | 285 | |
| 290 | 286 | /* Bresenham's circle algorithm */ |
| 291 | 287 | |
| 292 | int d = 3 - 2 * get_radius( | |
| 288 | int d = 3 - 2 * get_radius(); | |
| 293 | 289 | |
| 294 | 290 | while (x <= y) |
| 295 | 291 | { |
| 296 | draw_circle_line(machine, bitmap, cx, cy - x, y); | |
| 297 | draw_circle_line(machine, bitmap, cx, cy + x, y); | |
| 298 | draw_circle_line(machine, bitmap, cx, cy - y, x); | |
| 299 | draw_circle_line(machine, bitmap, cx, cy + y, x); | |
| 292 | draw_circle_line(bitmap, cx, cy - x, y); | |
| 293 | draw_circle_line(bitmap, cx, cy + x, y); | |
| 294 | draw_circle_line(bitmap, cx, cy - y, x); | |
| 295 | draw_circle_line(bitmap, cx, cy + y, x); | |
| 300 | 296 | |
| 301 | 297 | x++; |
| 302 | 298 | |
| r20977 | r20978 | |
| 308 | 304 | } |
| 309 | 305 | |
| 310 | 306 | |
| 311 | stat | |
| 307 | int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &rect) | |
| 312 | 308 | { |
| 313 | starshp1_state *state = machine.driver_data<starshp1_state>(); | |
| 314 | 309 | int x; |
| 315 | 310 | int y; |
| 316 | 311 | |
| 317 | 312 | for (y = rect.min_y; y <= rect.max_y; y++) |
| 318 | 313 | { |
| 319 | const UINT16* pLine = & | |
| 314 | const UINT16* pLine = &m_helper.pix16(y); | |
| 320 | 315 | |
| 321 | 316 | for (x = rect.min_x; x <= rect.max_x; x++) |
| 322 | 317 | if (pLine[x] != 0) |
| r20977 | r20978 | |
| 327 | 322 | } |
| 328 | 323 | |
| 329 | 324 | |
| 330 | stat | |
| 325 | int starshp1_state::point_in_circle(int x, int y, int center_x, int center_y, int r) | |
| 331 | 326 | { |
| 332 | 327 | int dx = abs(x - center_x) / 2; |
| 333 | 328 | int dy = abs(y - center_y) / 1; |
| r20977 | r20978 | |
| 336 | 331 | } |
| 337 | 332 | |
| 338 | 333 | |
| 339 | stat | |
| 334 | int starshp1_state::circle_collision(const rectangle &rect) | |
| 340 | 335 | { |
| 341 | int center_x = get_circle_hpos(state); | |
| 342 | int center_y = get_circle_vpos(state); | |
| 336 | int center_x = get_circle_hpos(); | |
| 337 | int center_y = get_circle_vpos(); | |
| 343 | 338 | |
| 344 | int r = get_radius( | |
| 339 | int r = get_radius(); | |
| 345 | 340 | |
| 346 | 341 | return point_in_circle(rect.min_x, rect.min_y, center_x, center_y, r) || |
| 347 | 342 | point_in_circle(rect.min_x, rect.max_y, center_x, center_y, r) || |
| r20977 | r20978 | |
| 352 | 347 | |
| 353 | 348 | UINT32 starshp1_state::screen_update_starshp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 354 | 349 | { |
| 355 | set_pens( | |
| 350 | set_pens(machine().colortable); | |
| 356 | 351 | |
| 357 | 352 | bitmap.fill(0, cliprect); |
| 358 | 353 | |
| 359 | 354 | if (m_starfield_kill == 0) |
| 360 | draw_starfield( | |
| 355 | draw_starfield(bitmap); | |
| 361 | 356 | |
| 362 | draw_sprites( | |
| 357 | draw_sprites(bitmap, cliprect); | |
| 363 | 358 | |
| 364 | 359 | if (m_circle_kill == 0 && m_circle_mod != 0) |
| 365 | draw_circle( | |
| 360 | draw_circle(bitmap); | |
| 366 | 361 | |
| 367 | 362 | if (m_attract == 0) |
| 368 | draw_spaceship( | |
| 363 | draw_spaceship(bitmap, cliprect); | |
| 369 | 364 | |
| 370 | 365 | if (m_circle_kill == 0 && m_circle_mod == 0) |
| 371 | draw_circle( | |
| 366 | draw_circle(bitmap); | |
| 372 | 367 | |
| 373 | 368 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 374 | 369 | |
| 375 | 370 | if (m_phasor != 0) |
| 376 | draw_phasor( | |
| 371 | draw_phasor(bitmap); | |
| 377 | 372 | |
| 378 | 373 | return 0; |
| 379 | 374 | } |
| r20977 | r20978 | |
| 387 | 382 | rectangle rect; |
| 388 | 383 | const rectangle &visarea = machine().primary_screen->visible_area(); |
| 389 | 384 | |
| 390 | rect.min_x = get_sprite_hpos(this, 13); | |
| 391 | rect.min_y = get_sprite_vpos(this, 13); | |
| 385 | rect.min_x = get_sprite_hpos(13); | |
| 386 | rect.min_y = get_sprite_vpos(13); | |
| 392 | 387 | rect.max_x = rect.min_x + machine().gfx[1]->width() - 1; |
| 393 | 388 | rect.max_y = rect.min_y + machine().gfx[1]->height() - 1; |
| 394 | 389 | |
| r20977 | r20978 | |
| 397 | 392 | m_helper.fill(0, visarea); |
| 398 | 393 | |
| 399 | 394 | if (m_attract == 0) |
| 400 | draw_spaceship(m | |
| 395 | draw_spaceship(m_helper, visarea); | |
| 401 | 396 | |
| 402 | if (circle_collision( | |
| 397 | if (circle_collision(visarea)) | |
| 403 | 398 | m_collision_latch |= 1; |
| 404 | 399 | |
| 405 | if (circle_collision( | |
| 400 | if (circle_collision(rect)) | |
| 406 | 401 | m_collision_latch |= 2; |
| 407 | 402 | |
| 408 | if (spaceship_collision(m | |
| 403 | if (spaceship_collision(m_helper, rect)) | |
| 409 | 404 | m_collision_latch |= 4; |
| 410 | 405 | |
| 411 | if (spaceship_collision(m | |
| 406 | if (spaceship_collision(m_helper, visarea)) | |
| 412 | 407 | m_collision_latch |= 8; |
| 413 | 408 | } |
| 414 | 409 | } |
| r20977 | r20978 | |
|---|---|---|
| 73 | 73 | DECLARE_WRITE8_MEMBER(scramble_protection_w); |
| 74 | 74 | DECLARE_READ8_MEMBER(scramble_protection_r); |
| 75 | 75 | DECLARE_WRITE_LINE_MEMBER(scramble_sh_7474_q_callback); |
| 76 | void cavelon_banksw(); | |
| 77 | inline int bit(int i,int n); | |
| 76 | 78 | }; |
| 77 | 79 | |
| 78 | 80 |
| r20977 | r20978 | |
|---|---|---|
| 43 | 43 | UINT32 screen_update_suprridr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 44 | 44 | INTERRUPT_GEN_MEMBER(main_nmi_gen); |
| 45 | 45 | TIMER_CALLBACK_MEMBER(delayed_sound_w); |
| 46 | int suprridr_is_screen_flipped(); | |
| 46 | 47 | }; |
| 47 | 48 | |
| 48 | 49 | /*----------- defined in video/suprridr.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 44 | 44 | virtual void palette_init(); |
| 45 | 45 | UINT32 screen_update_sbasketb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 46 | 46 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 47 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 47 | 48 | }; |
| r20977 | r20978 | |
|---|---|---|
| 24 | 24 | DECLARE_VIDEO_START(skullxbo); |
| 25 | 25 | UINT32 screen_update_skullxbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 26 | 26 | TIMER_CALLBACK_MEMBER(irq_gen); |
| 27 | void skullxbo_scanline_update(int scanline); | |
| 27 | 28 | }; |
| 28 | 29 | |
| 29 | 30 | /*----------- defined in video/skullxbo.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 51 | 51 | virtual void video_start(); |
| 52 | 52 | UINT32 screen_update_spacefb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 53 | 53 | TIMER_CALLBACK_MEMBER(interrupt_callback); |
| 54 | inline void shift_star_generator(spacefb_state *state); | |
| 55 | void get_starfield_pens(spacefb_state *state, pen_t *pens); | |
| 56 | void draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); | |
| 57 | void get_sprite_pens(pen_t *pens); | |
| 58 | void draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip); | |
| 59 | void draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip); | |
| 60 | void draw_objects(bitmap_rgb32 &bitmap, const rectangle &cliprect); | |
| 61 | void create_interrupt_timer(); | |
| 62 | void start_interrupt_timer(); | |
| 54 | 63 | }; |
| 55 | 64 | |
| 56 | 65 | /*----------- defined in audio/spacefb.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 65 | 65 | UINT32 screen_update_splash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 66 | 66 | UINT32 screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 67 | 67 | INTERRUPT_GEN_MEMBER(roldfrog_interrupt); |
| 68 | void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 69 | void splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 70 | void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 71 | void roldfrog_update_irq( ); | |
| 68 | 72 | }; |
| r20977 | r20978 | |
|---|---|---|
| 62 | 62 | UINT32 screen_update_starfire(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 63 | 63 | TIMER_CALLBACK_MEMBER(starfire_scanline_callback); |
| 64 | 64 | INTERRUPT_GEN_MEMBER(vblank_int); |
| 65 | void get_pens(pen_t *pens); | |
| 65 | 66 | }; |
| r20977 | r20978 | |
|---|---|---|
| 52 | 52 | DECLARE_WRITE8_MEMBER(subs_crash_w); |
| 53 | 53 | DECLARE_WRITE8_MEMBER(subs_explode_w); |
| 54 | 54 | DECLARE_WRITE8_MEMBER(subs_noise_reset_w); |
| 55 | int subs_steering_1(); | |
| 56 | int subs_steering_2(); | |
| 55 | 57 | }; |
| 56 | 58 | |
| 57 | 59 | /*----------- defined in audio/subs.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 45 | 45 | UINT32 screen_update_shadfrce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 46 | 46 | void screen_eof_shadfrce(screen_device &screen, bool state); |
| 47 | 47 | TIMER_DEVICE_CALLBACK_MEMBER(shadfrce_scanline); |
| 48 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 48 | 49 | }; |
| r20977 | r20978 | |
|---|---|---|
| 19 | 19 | TILE_GET_INFO_MEMBER(get_tile_info_fg); |
| 20 | 20 | virtual void video_start(); |
| 21 | 21 | UINT32 screen_update_speedbal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 22 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 22 | 23 | }; |
| r20977 | r20978 | |
|---|---|---|
| 52 | 52 | virtual void palette_init(); |
| 53 | 53 | UINT32 screen_update_skydiver(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 54 | 54 | INTERRUPT_GEN_MEMBER(skydiver_interrupt); |
| 55 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 55 | 56 | }; |
| 56 | 57 | |
| 57 | 58 | /*----------- defined in audio/skydiver.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 48 | 48 | virtual void palette_init(); |
| 49 | 49 | UINT32 screen_update_spdodgeb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 50 | 50 | TIMER_DEVICE_CALLBACK_MEMBER(spdodgeb_interrupt); |
| 51 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 52 | void mcu63705_update_inputs(); | |
| 51 | 53 | }; |
| r20977 | r20978 | |
|---|---|---|
| 64 | 64 | INTERRUPT_GEN_MEMBER(satansat_interrupt); |
| 65 | 65 | INTERRUPT_GEN_MEMBER(snk6502_interrupt); |
| 66 | 66 | TIMER_DEVICE_CALLBACK_MEMBER(sasuke_update_counter); |
| 67 | void sasuke_start_counter(); | |
| 67 | 68 | }; |
| 68 | 69 | |
| 69 | 70 |
| r20977 | r20978 | |
|---|---|---|
| 43 | 43 | UINT32 screen_update_skykid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 44 | 44 | INTERRUPT_GEN_MEMBER(main_vblank_irq); |
| 45 | 45 | INTERRUPT_GEN_MEMBER(mcu_vblank_irq); |
| 46 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 46 | 47 | }; |
| r20977 | r20978 | |
|---|---|---|
| 53 | 53 | virtual void machine_start(); |
| 54 | 54 | virtual void video_start(); |
| 55 | 55 | UINT32 screen_update_segag80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 56 | inline int adjust_xy(int rawx, int rawy, int *outx, int *outy); | |
| 57 | void sega_generate_vector_list(); | |
| 58 | offs_t decrypt_offset(address_space &space, offs_t offset); | |
| 59 | inline UINT8 demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0); | |
| 56 | 60 | }; |
| r20977 | r20978 | |
|---|---|---|
| 39 | 39 | DECLARE_DRIVER_INIT(superchs); |
| 40 | 40 | virtual void video_start(); |
| 41 | 41 | UINT32 screen_update_superchs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 42 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs); | |
| 42 | 43 | }; |
| r20977 | r20978 | |
|---|---|---|
| 69 | 69 | INTERRUPT_GEN_MEMBER(slapshot_interrupt); |
| 70 | 70 | TIMER_CALLBACK_MEMBER(slapshot_interrupt6); |
| 71 | 71 | void reset_sound_region(); |
| 72 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks, int y_offset ); | |
| 73 | void taito_handle_sprite_buffering( ); | |
| 74 | void taito_update_sprites_active_area( ); | |
| 72 | 75 | }; |
| r20977 | r20978 | |
|---|---|---|
| 53 | 53 | virtual void video_start(); |
| 54 | 54 | UINT32 screen_update_sidearms(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | 55 | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
| 56 | void draw_sprites_region(bitmap_ind16 &bitmap, const rectangle &cliprect, int start_offset, int end_offset ); | |
| 57 | void sidearms_draw_starfield( bitmap_ind16 &bitmap ); | |
| 58 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 56 | 59 | }; |
| r20977 | r20978 | |
|---|---|---|
| 35 | 35 | virtual void video_start(); |
| 36 | 36 | UINT32 screen_update_sderby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 37 | 37 | UINT32 screen_update_pmroulet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 38 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int codeshift); | |
| 38 | 39 | }; |
| r20977 | r20978 | |
|---|---|---|
| 172 | 172 | TIMER_CALLBACK_MEMBER(sgladiat_sndirq_update_callback); |
| 173 | 173 | TIMER_CALLBACK_MEMBER(sndirq_update_callback); |
| 174 | 174 | DECLARE_WRITE_LINE_MEMBER(ymirq_callback_2); |
| 175 | void tnk3_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int xscroll, const int yscroll); | |
| 176 | int hardflags_check(int num); | |
| 177 | int hardflags_check8(int num); | |
| 178 | int turbofront_check(int small, int num); | |
| 179 | int turbofront_check8(int small, int num); | |
| 175 | 180 | }; |
| r20977 | r20978 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | |
| 8 | typedef void (*sys32_output_callback)(int which, UINT16 data); | |
| 9 | struct layer_info | |
| 10 | { | |
| 11 | bitmap_ind16 *bitmap; | |
| 12 | UINT8 *transparent; | |
| 13 | }; | |
| 14 | 8 | |
| 15 | 9 | |
| 16 | 10 | class segas32_state : public driver_device |
| r20977 | r20978 | |
| 31 | 25 | required_shared_ptr<UINT16> m_system32_videoram; |
| 32 | 26 | required_shared_ptr<UINT16> m_system32_spriteram; |
| 33 | 27 | |
| 28 | typedef void (segas32_state::*sys32_output_callback)(int which, UINT16 data); | |
| 29 | ||
| 30 | struct layer_info | |
| 31 | { | |
| 32 | bitmap_ind16 *bitmap; | |
| 33 | UINT8 *transparent; | |
| 34 | }; | |
| 35 | ||
| 36 | struct extents_list | |
| 37 | { | |
| 38 | UINT8 scan_extent[256]; | |
| 39 | UINT16 extent[32][16]; | |
| 40 | }; | |
| 41 | ||
| 42 | ||
| 43 | struct cache_entry | |
| 44 | { | |
| 45 | struct cache_entry * next; | |
| 46 | tilemap_t * tmap; | |
| 47 | UINT8 page; | |
| 48 | UINT8 bank; | |
| 49 | }; | |
| 50 | ||
| 34 | 51 | UINT8 m_v60_irq_control[0x10]; |
| 35 | 52 | timer_device *m_v60_irq_timer[2]; |
| 36 | 53 | UINT8 m_sound_irq_control[4]; |
| r20977 | r20978 | |
| 181 | 198 | TIMER_CALLBACK_MEMBER(end_of_vblank_int); |
| 182 | 199 | TIMER_CALLBACK_MEMBER(update_sprites); |
| 183 | 200 | TIMER_DEVICE_CALLBACK_MEMBER(signal_v60_irq_callback); |
| 201 | void common_start(int multi32); | |
| 202 | void system32_set_vblank(int state); | |
| 203 | inline UINT16 xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(UINT16 value); | |
| 204 | inline UINT16 xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(UINT16 value); | |
| 205 | inline void update_color(int offset, UINT16 data); | |
| 206 | inline UINT16 common_paletteram_r(address_space &space, int which, offs_t offset); | |
| 207 | void common_paletteram_w(address_space &space, int which, offs_t offset, UINT16 data, UINT16 mem_mask); | |
| 208 | tilemap_t *find_cache_entry(int page, int bank); | |
| 209 | inline void get_tilemaps(int bgnum, tilemap_t **tilemaps); | |
| 210 | UINT8 update_tilemaps(screen_device &screen, const rectangle &cliprect); | |
| 211 | void sprite_erase_buffer(); | |
| 212 | void sprite_swap_buffers(); | |
| 213 | int draw_one_sprite(UINT16 *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); | |
| 214 | void sprite_render_list(); | |
| 215 | inline UINT8 compute_color_offsets(int which, int layerbit, int layerflag); | |
| 216 | inline UINT16 compute_sprite_blend(UINT8 encoding); | |
| 217 | inline UINT16 *get_layer_scanline(int layer, int scanline); | |
| 218 | void mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 enablemask); | |
| 219 | void print_mixer_data(int which); | |
| 220 | UINT32 multi32_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int index); | |
| 221 | void decrypt_ga2_protrom(); | |
| 222 | void update_irq_state(); | |
| 223 | void signal_v60_irq(int which); | |
| 224 | void int_control_w(address_space &space, int offset, UINT8 data); | |
| 225 | UINT16 common_io_chip_r(address_space &space, int which, offs_t offset, UINT16 mem_mask); | |
| 226 | void common_io_chip_w(address_space &space, int which, offs_t offset, UINT16 data, UINT16 mem_mask); | |
| 227 | void update_sound_irq_state(); | |
| 228 | void segas32_common_init(read16_delegate custom_r, write16_delegate custom_w); | |
| 229 | void radm_sw1_output( int which, UINT16 data ); | |
| 230 | void radm_sw2_output( int which, UINT16 data ); | |
| 231 | void radr_sw2_output( int which, UINT16 data ); | |
| 232 | void alien3_sw1_output( int which, UINT16 data ); | |
| 233 | void arescue_sw1_output( int which, UINT16 data ); | |
| 234 | void f1lap_sw1_output( int which, UINT16 data ); | |
| 235 | void jpark_sw1_output( int which, UINT16 data ); | |
| 236 | void orunners_sw1_output( int which, UINT16 data ); | |
| 237 | void orunners_sw2_output( int which, UINT16 data ); | |
| 238 | void harddunk_sw1_output( int which, UINT16 data ); | |
| 239 | void harddunk_sw2_output( int which, UINT16 data ); | |
| 240 | void harddunk_sw3_output( int which, UINT16 data ); | |
| 241 | void titlef_sw1_output( int which, UINT16 data ); | |
| 242 | void titlef_sw2_output( int which, UINT16 data ); | |
| 243 | void scross_sw1_output( int which, UINT16 data ); | |
| 244 | void scross_sw2_output( int which, UINT16 data ); | |
| 245 | int compute_clipping_extents(screen_device &screen, int enable, int clipout, int clipmask, const rectangle &cliprect, struct extents_list *list); | |
| 246 | void update_tilemap_zoom(screen_device &screen, struct layer_info *layer, const rectangle &cliprect, int bgnum); | |
| 247 | void update_tilemap_rowscroll(screen_device &screen, struct layer_info *layer, const rectangle &cliprect, int bgnum); | |
| 248 | void update_tilemap_text(screen_device &screen, struct layer_info *layer, const rectangle &cliprect); | |
| 249 | void update_bitmap(screen_device &screen, struct layer_info *layer, const rectangle &cliprect); | |
| 250 | void update_background(struct layer_info *layer, const rectangle &cliprect); | |
| 184 | 251 | }; |
| 185 | 252 | |
| 186 | 253 | /*----------- defined in machine/segas32.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 53 | 53 | UINT32 screen_update_sslam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 54 | 54 | UINT32 screen_update_powerbls(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | 55 | TIMER_CALLBACK_MEMBER(music_playback); |
| 56 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 56 | 57 | }; |
| r20977 | r20978 | |
|---|---|---|
| 44 | 44 | TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info); |
| 45 | 45 | virtual void video_start(); |
| 46 | 46 | UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 47 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 47 | 48 | }; |
| r20977 | r20978 | |
|---|---|---|
| 39 | 39 | UINT32 screen_update_trckydoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 40 | 40 | UINT32 screen_update_sauro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 41 | 41 | INTERRUPT_GEN_MEMBER(sauro_interrupt); |
| 42 | void sauro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 43 | void trckydoc_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 42 | 44 | }; |
| r20977 | r20978 | |
|---|---|---|
| 29 | 29 | virtual void video_start(); |
| 30 | 30 | UINT32 screen_update_srumbler(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 31 | 31 | TIMER_DEVICE_CALLBACK_MEMBER(srumbler_interrupt); |
| 32 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 32 | 33 | }; |
| r20977 | r20978 | |
|---|---|---|
| 49 | 49 | INTERRUPT_GEN_MEMBER(stfight_vb_interrupt); |
| 50 | 50 | TIMER_CALLBACK_MEMBER(stfight_interrupt_1); |
| 51 | 51 | DECLARE_WRITE8_MEMBER(stfight_adpcm_control_w); |
| 52 | void set_pens(); | |
| 53 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 52 | 54 | }; |
| 53 | 55 | |
| 54 | 56 | /*----------- defined in machine/stfight.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 29 | 29 | TILE_GET_INFO_MEMBER(get_fg3_tile_info); |
| 30 | 30 | virtual void video_start(); |
| 31 | 31 | UINT32 screen_update_silkroad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 32 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 32 | 33 | }; |
| r20977 | r20978 | |
|---|---|---|
| 46 | 46 | virtual void video_start(); |
| 47 | 47 | UINT32 screen_update_spy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 48 | 48 | INTERRUPT_GEN_MEMBER(spy_interrupt); |
| 49 | void spy_collision( ); | |
| 49 | 50 | }; |
| 50 | 51 | |
| 51 | 52 | /*----------- defined in video/spy.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 75 | 75 | INTERRUPT_GEN_MEMBER(samshoot_interrupt); |
| 76 | 76 | INTERRUPT_GEN_MEMBER(funcube_sub_timer_irq); |
| 77 | 77 | TIMER_DEVICE_CALLBACK_MEMBER(funcube_interrupt); |
| 78 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 79 | void funcube_debug_outputs(); | |
| 78 | 80 | }; |
| r20977 | r20978 | |
|---|---|---|
| 32 | 32 | virtual void video_start(); |
| 33 | 33 | UINT32 screen_update_solomon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 34 | 34 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 35 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 35 | 36 | }; |
| r20977 | r20978 | |
|---|---|---|
| 27 | 27 | virtual void palette_init(); |
| 28 | 28 | UINT32 screen_update_scotrsht(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 29 | 29 | INTERRUPT_GEN_MEMBER(scotrsht_interrupt); |
| 30 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 30 | 31 | }; |
| r20977 | r20978 | |
|---|---|---|
| 83 | 83 | TIMER_CALLBACK_MEMBER(mcu_acknowledge_callback); |
| 84 | 84 | TIMER_CALLBACK_MEMBER(delayed_z80_mcu_w); |
| 85 | 85 | TIMER_CALLBACK_MEMBER(delayed_mcu_z80_w); |
| 86 | void pbillian_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 87 | void superqix_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 88 | int read_dial(int player); | |
| 89 | void machine_init_common(); | |
| 86 | 90 | }; |
| r20977 | r20978 | |
|---|---|---|
| 33 | 33 | virtual void palette_init(); |
| 34 | 34 | UINT32 screen_update_skyfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 35 | 35 | INTERRUPT_GEN_MEMBER(skyfox_interrupt); |
| 36 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 37 | void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 36 | 38 | }; |
| r20977 | r20978 | |
|---|---|---|
| 84 | 84 | UINT32 screen_update_senjyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 85 | 85 | INTERRUPT_GEN_MEMBER(senjyo_interrupt); |
| 86 | 86 | DECLARE_READ8_MEMBER(pio_pa_r); |
| 87 | void draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 88 | void draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 89 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority); | |
| 87 | 90 | }; |
| 88 | 91 | |
| 89 | 92 | /*----------- defined in audio/senjyo.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 127 | 127 | UINT32 screen_update_slapfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 128 | 128 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 129 | 129 | INTERRUPT_GEN_MEMBER(getstar_interrupt); |
| 130 | void slapfght_log_vram(); | |
| 131 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display ); | |
| 132 | void getstar_init( ); | |
| 130 | 133 | }; |
| 131 | 134 | |
| 132 | 135 |
| r20977 | r20978 | |
|---|---|---|
| 37 | 37 | virtual void palette_init(); |
| 38 | 38 | UINT32 screen_update_ssozumo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | 39 | INTERRUPT_GEN_MEMBER(sound_timer_irq); |
| 40 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 40 | 41 | }; |
| r20977 | r20978 | |
|---|---|---|
| 39 | 39 | virtual void video_start(); |
| 40 | 40 | virtual void palette_init(); |
| 41 | 41 | UINT32 screen_update_sonson(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 42 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 42 | 43 | }; |
| r20977 | r20978 | |
|---|---|---|
| 132 | 132 | TIMER_DEVICE_CALLBACK_MEMBER(gdfs_interrupt); |
| 133 | 133 | void update_irq_state(); |
| 134 | 134 | IRQ_CALLBACK_MEMBER(ssv_irq_callback); |
| 135 | void draw_row(bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int sy, int scroll); | |
| 136 | void draw_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int nr); | |
| 137 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 138 | void ssv_enable_video(int enable); | |
| 139 | void init_ssv(int interrupt_ultrax); | |
| 140 | void init_hypreac2_common(); | |
| 141 | void init_st010(); | |
| 135 | 142 | }; |
| 136 | 143 | |
| 137 | 144 | /*----------- defined in video/ssv.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 33 | 33 | UINT32 screen_update_sprcros2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 34 | 34 | INTERRUPT_GEN_MEMBER(sprcros2_s_interrupt); |
| 35 | 35 | TIMER_DEVICE_CALLBACK_MEMBER(sprcros2_m_interrupt); |
| 36 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 36 | 37 | }; |
| r20977 | r20978 | |
|---|---|---|
| 81 | 81 | UINT32 screen_update_starshp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 82 | 82 | void screen_eof_starshp1(screen_device &screen, bool state); |
| 83 | 83 | INTERRUPT_GEN_MEMBER(starshp1_interrupt); |
| 84 | void set_pens(colortable_t *colortable); | |
| 85 | void draw_starfield(bitmap_ind16 &bitmap); | |
| 86 | int get_sprite_hpos(int i); | |
| 87 | int get_sprite_vpos(int i); | |
| 88 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 89 | void draw_spaceship(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 90 | void draw_phasor(bitmap_ind16 &bitmap); | |
| 91 | int get_radius(); | |
| 92 | int get_circle_hpos(); | |
| 93 | int get_circle_vpos(); | |
| 94 | void draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l); | |
| 95 | void draw_circle(bitmap_ind16 &bitmap); | |
| 96 | int spaceship_collision(bitmap_ind16 &bitmap, const rectangle &rect); | |
| 97 | int point_in_circle(int x, int y, int center_x, int center_y, int r); | |
| 98 | int circle_collision(const rectangle &rect); | |
| 84 | 99 | }; |
| 85 | 100 | |
| 86 | 101 | /*----------- defined in audio/starshp1.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 137 | 137 | DECLARE_WRITE8_MEMBER(rranger_play_samples_w); |
| 138 | 138 | DECLARE_WRITE8_MEMBER(suna8_samples_number_w); |
| 139 | 139 | void play_sample(int index); |
| 140 | void draw_normal_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int which); | |
| 141 | void draw_text_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 142 | UINT8 *brickzn_decrypt(); | |
| 140 | 143 | }; |
| 141 | 144 | |
| 142 | 145 | /*----------- defined in audio/suna8.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 23 | 23 | virtual void video_start(); |
| 24 | 24 | virtual void palette_init(); |
| 25 | 25 | UINT32 screen_update_suprloco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 26 | inline void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip); | |
| 27 | void draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect,int spr_number); | |
| 28 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 26 | 29 | }; |
| r20977 | r20978 | |
|---|---|---|
| 67 | 67 | UINT32 screen_update_sprint2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 68 | 68 | void screen_eof_sprint2(screen_device &screen, bool state); |
| 69 | 69 | INTERRUPT_GEN_MEMBER(sprint2); |
| 70 | UINT8 collision_check(colortable_t *colortable, rectangle& rect); | |
| 71 | inline int get_sprite_code(UINT8 *video_ram, int n); | |
| 72 | inline int get_sprite_x(UINT8 *video_ram, int n); | |
| 73 | inline int get_sprite_y(UINT8 *video_ram, int n); | |
| 74 | int service_mode(); | |
| 70 | 75 | }; |
| 71 | 76 | |
| 72 | 77 | /*----------- defined in audio/sprint2.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 18 | 18 | optional_shared_ptr<UINT8> m_nob_mcu_status; |
| 19 | 19 | |
| 20 | 20 | UINT8 *m_videoram; |
| 21 | void (*m_videomode_custom)( | |
| 21 | void (system1_state::*m_videomode_custom)(UINT8 data, UINT8 prevdata); | |
| 22 | 22 | UINT8 m_mute_xor; |
| 23 | 23 | UINT8 m_dakkochn_mux_data; |
| 24 | 24 | UINT8 m_videomode_prev; |
| r20977 | r20978 | |
| 113 | 113 | TIMER_DEVICE_CALLBACK_MEMBER(soundirq_gen); |
| 114 | 114 | TIMER_DEVICE_CALLBACK_MEMBER(mcu_t0_callback); |
| 115 | 115 | DECLARE_WRITE8_MEMBER(system1_videoram_bank_w); |
| 116 | void video_start_common(int pagecount); | |
| 117 | inline void videoram_wait_states(cpu_device *cpu); | |
| 118 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset); | |
| 119 | void video_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind16 &fgpixmap, bitmap_ind16 **bgpixmaps, const int *bgrowscroll, int bgyscroll, int spritexoffs); | |
| 120 | void bank44_custom_w(UINT8 data, UINT8 prevdata); | |
| 121 | void bank0c_custom_w(UINT8 data, UINT8 prevdata); | |
| 122 | void dakkochn_custom_w(UINT8 data, UINT8 prevdata); | |
| 116 | 123 | }; |
| r20977 | r20978 | |
|---|---|---|
| 29 | 29 | virtual void video_start(); |
| 30 | 30 | virtual void palette_init(); |
| 31 | 31 | UINT32 screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 32 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
| 32 | 33 | }; |
| r20977 | r20978 | |
|---|---|---|
| 67 | 67 | DECLARE_READ8_MEMBER(r6532_porta_r); |
| 68 | 68 | DECLARE_WRITE8_MEMBER(r6532_porta_w); |
| 69 | 69 | DECLARE_WRITE_LINE_MEMBER(snd_interrupt); |
| 70 | void starwars_mproc_init(); | |
| 71 | void starwars_mproc_reset(); | |
| 72 | void run_mproc(); | |
| 73 | void esb_slapstic_tweak(address_space &space, offs_t offset); | |
| 70 | 74 | }; |
| 71 | 75 | |
| 72 | 76 |
| r20977 | r20978 | |
|---|---|---|
| 37 | 37 | virtual void palette_init(); |
| 38 | 38 | UINT32 screen_update_sspeedr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | 39 | void screen_eof_sspeedr(screen_device &screen, bool state); |
| 40 | void draw_track(bitmap_ind16 &bitmap); | |
| 41 | void draw_drones(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 42 | void draw_driver(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 40 | 43 | }; |
| r20977 | r20978 | |
|---|---|---|
| 209 | 209 | TIMER_DEVICE_CALLBACK_MEMBER(setaroul_interrupt); |
| 210 | 210 | TIMER_DEVICE_CALLBACK_MEMBER(crazyfgt_interrupt); |
| 211 | 211 | TIMER_DEVICE_CALLBACK_MEMBER(inttoote_interrupt); |
| 212 | void seta_coin_lockout_w(int data); | |
| 213 | inline void twineagl_tile_info( tile_data &tileinfo, int tile_index, int offset ); | |
| 214 | inline void get_tile_info( tile_data &tileinfo, int tile_index, int layer, int offset ); | |
| 215 | void set_pens(); | |
| 216 | void usclssic_set_pens(); | |
| 217 | void draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen); | |
| 218 | void seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_bank_size, int sprite_setac ); | |
| 219 | void uPD71054_timer_init( ); | |
| 212 | 220 | }; |
| 213 | ||
| 214 | /*----------- defined in video/seta.c -----------*/ | |
| 215 | void seta_coin_lockout_w(running_machine &machine, int data); |
| r20977 | r20978 | |
|---|---|---|
| 1 | 1 | #include "emu.h" |
| 2 | #include "sound/okim6295.h" | |
| 2 | 3 | |
| 3 | 4 | class snowbros_state : public driver_device |
| 4 | 5 | { |
| r20977 | r20978 | |
| 51 | 52 | void screen_eof_snowbros(screen_device &screen, bool state); |
| 52 | 53 | TIMER_DEVICE_CALLBACK_MEMBER(snowbros_irq); |
| 53 | 54 | TIMER_DEVICE_CALLBACK_MEMBER(snowbros3_irq); |
| 55 | void sb3_play_music(int data); | |
| 56 | void sb3_play_sound (okim6295_device *oki, int data); | |
| 54 | 57 | }; |
| r20977 | r20978 | |
|---|---|---|
| 28 | 28 | virtual void palette_init(); |
| 29 | 29 | UINT32 screen_update_skyraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 30 | 30 | DECLARE_WRITE8_MEMBER(skyraid_sound_w); |
| 31 | void draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 32 | void draw_terrain(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 33 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 34 | void draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 35 | void draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src); | |
| 31 | 36 | }; |
| 32 | 37 | |
| 33 | 38 | /*----------- defined in audio/skyraid.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 117 | 117 | UINT32 screen_update_sys386f2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 118 | 118 | INTERRUPT_GEN_MEMBER(spi_interrupt); |
| 119 | 119 | IRQ_CALLBACK_MEMBER(spi_irq_callback); |
| 120 | void rf2_set_layer_banks(int banks); | |
| 121 | void drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy); | |
| 122 | void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri_mask); | |
| 123 | void set_rowscroll(tilemap_t *layer, int scroll, INT16* rows); | |
| 124 | void set_scroll(tilemap_t *layer, int scroll); | |
| 125 | void combine_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tile, int x, int y, int opaque, INT16 *rowscroll); | |
| 126 | UINT8 z80_fifoout_pop(address_space &space); | |
| 127 | void z80_fifoout_push(address_space &space, UINT8 data); | |
| 128 | UINT8 z80_fifoin_pop(address_space &space); | |
| 129 | void z80_fifoin_push(address_space &space, UINT8 data); | |
| 130 | void init_spi(); | |
| 131 | void init_rf2_common(); | |
| 132 | void init_rfjet_common(); | |
| 120 | 133 | }; |
| 121 | 134 | /*----------- defined in machine/spisprit.c -----------*/ |
| 122 | 135 | void seibuspi_sprite_decrypt(UINT8 *src, int romsize); |
| r20977 | r20978 | |
|---|---|---|
| 27 | 27 | virtual void video_start(); |
| 28 | 28 | virtual void palette_init(); |
| 29 | 29 | UINT32 screen_update_speedatk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 30 | UINT8 iox_key_matrix_calc(UINT8 p_side); | |
| 30 | 31 | }; |
| r20977 | r20978 | |
|---|---|---|
| 138 | 138 | void screen_eof_skns(screen_device &screen, bool state); |
| 139 | 139 | TIMER_DEVICE_CALLBACK_MEMBER(interrupt_callback); |
| 140 | 140 | TIMER_DEVICE_CALLBACK_MEMBER(skns_irq); |
| 141 | void suprnova_draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram); | |
| 142 | void palette_set_rgb_brightness (int offset, UINT8 brightness_r, UINT8 brightness_g, UINT8 brightness_b); | |
| 143 | void palette_update(); | |
| 144 | void supernova_draw_a( bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_flags, const rectangle &cliprect, int tran ); | |
| 145 | void supernova_draw_b( bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_flags, const rectangle &cliprect, int tran ); | |
| 146 | void hit_recalc(); | |
| 147 | void init_skns(); | |
| 148 | void set_drc_pcflush(UINT32 addr); | |
| 141 | 149 | }; |
| 142 | 150 | |
| 143 | /*----------- defined in video/suprnova.c -----------*/ | |
| 144 | void skns_sprite_kludge(int x, int y); | |
| 145 | void skns_draw_sprites( | |
| 146 | running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, | |
| 147 | UINT32* spriteram_source, size_t spriteram_size, | |
| 148 | UINT8* gfx_source, size_t gfx_length, | |
| 149 | UINT32* sprite_regs ); |
| r20977 | r20978 | |
|---|---|---|
| 27 | 27 | virtual void palette_init(); |
| 28 | 28 | UINT32 screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 29 | 29 | UINT32 screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 30 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ); | |
| 30 | 31 | }; |
| r20977 | r20978 | |
|---|---|---|
| 40 | 40 | void st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 41 | 41 | UINT32 screen_update_st0016(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 42 | 42 | TIMER_DEVICE_CALLBACK_MEMBER(st0016_int); |
| 43 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 44 | void st0016_save_init(); | |
| 45 | void draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority); | |
| 43 | 46 | }; |
| 44 | 47 | |
| 45 | 48 | #define ISMACS (st0016_game&0x80) |
| r20977 | r20978 | |
|---|---|---|
| 32 | 32 | DECLARE_MACHINE_RESET(shangkid); |
| 33 | 33 | UINT32 screen_update_shangkid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 34 | 34 | UINT32 screen_update_dynamski(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 35 | void draw_sprite(const UINT8 *source, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 36 | void shangkid_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 37 | void dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); | |
| 38 | void dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 35 | 39 | }; |
| r20977 | r20978 | |
|---|---|---|
| 22 | 22 | TILE_GET_INFO_MEMBER(get_speedspn_tile_info); |
| 23 | 23 | virtual void video_start(); |
| 24 | 24 | UINT32 screen_update_speedspn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 25 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 25 | 26 | }; |
| r20977 | r20978 | |
|---|---|---|
| 31 | 31 | virtual void palette_init(); |
| 32 | 32 | UINT32 screen_update_ssrj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 33 | 33 | void screen_eof_ssrj(screen_device &screen, bool state); |
| 34 | void draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 34 | 35 | }; |
| r20977 | r20978 | |
|---|---|---|
| 48 | 48 | virtual void machine_reset(); |
| 49 | 49 | virtual void video_start(); |
| 50 | 50 | UINT32 screen_update_sf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 51 | inline int sf_invert( int nb ); | |
| 52 | void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ); | |
| 53 | void write_dword( address_space &space, offs_t offset, UINT32 data ); | |
| 51 | 54 | }; |
| r20977 | r20978 | |
|---|---|---|
| 31 | 31 | virtual void palette_init(); |
| 32 | 32 | UINT32 screen_update_seicross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 33 | 33 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 34 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); | |
| 34 | 35 | }; |
| r20977 | r20978 | |
|---|---|---|
| 194 | 194 | UINT32 screen_update_s16a_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 195 | 195 | UINT32 screen_update_s16a_bootleg_passht4b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 196 | 196 | INTERRUPT_GEN_MEMBER(sys16_interrupt); |
| 197 | void setup_system16_bootleg_spritebanking( ); | |
| 198 | void update_page( ); | |
| 199 | void set_tile_bank( int data ); | |
| 200 | void set_fg_page( int data ); | |
| 201 | void set_bg_page( int data ); | |
| 202 | void datsu_set_pages( ); | |
| 197 | 203 | }; |
| r20977 | r20978 | |
|---|---|---|
| 45 | 45 | TIMER_CALLBACK_MEMBER(dmaend_callback); |
| 46 | 46 | DECLARE_READ8_MEMBER(simpsons_sound_r); |
| 47 | 47 | void simpsons_postload(); |
| 48 | void simpsons_video_banking( int bank ); | |
| 49 | void sound_nmi_callback( int param ); | |
| 50 | void simpsons_objdma( ); | |
| 48 | 51 | }; |
| 49 | 52 | |
| 50 | 53 | |
| 51 | 54 | /*----------- defined in video/simpsons.c -----------*/ |
| 52 | void simpsons_video_banking( running_machine &machine, int select ); | |
| 53 | ||
| 54 | 55 | extern void simpsons_tile_callback(running_machine &machine, int layer,int bank,int *code,int *color,int *flags,int *priority); |
| 55 | 56 | extern void simpsons_sprite_callback(running_machine &machine, int *code,int *color,int *priority_mask); |
| r20977 | r20978 | |
|---|---|---|
| 42 | 42 | UINT32 screen_update_suna16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 43 | 43 | UINT32 screen_update_bestbest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 44 | 44 | TIMER_DEVICE_CALLBACK_MEMBER(bssoccer_interrupt); |
| 45 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 *sprites, int gfx); | |
| 45 | 46 | }; |
| r20977 | r20978 | |
|---|---|---|
| 51 | 51 | DECLARE_READ8_MEMBER(starcrus_coll_det_r); |
| 52 | 52 | virtual void video_start(); |
| 53 | 53 | UINT32 screen_update_starcrus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 54 | int collision_check_s1s2(); | |
| 55 | int collision_check_p1p2(); | |
| 56 | int collision_check_s1p1p2(); | |
| 57 | int collision_check_s2p1p2(); | |
| 54 | 58 | }; |
| r20977 | r20978 | |
|---|---|---|
| 61 | 61 | DECLARE_PALETTE_INIT(stactics); |
| 62 | 62 | UINT32 screen_update_stactics(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 63 | 63 | INTERRUPT_GEN_MEMBER(stactics_interrupt); |
| 64 | void update_beam(); | |
| 65 | inline int get_pixel_on_plane(UINT8 *videoram, UINT8 y, UINT8 x, UINT8 y_scroll); | |
| 66 | void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 67 | void set_indicator_leds(int data, const char *output_name, int base_index); | |
| 68 | void update_artwork(); | |
| 69 | void move_motor(); | |
| 64 | 70 | }; |
| 65 | 71 | /*----------- defined in video/stactics.c -----------*/ |
| 66 | 72 | MACHINE_CONFIG_EXTERN( stactics_video ); |
| r20977 | r20978 | |
|---|---|---|
| 32 | 32 | virtual void palette_init(); |
| 33 | 33 | UINT32 screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 34 | 34 | TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq); |
| 35 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 35 | 36 | }; |
| r20977 | r20978 | |
|---|---|---|
| 27 | 27 | virtual void palette_init(); |
| 28 | 28 | UINT32 screen_update_shaolins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 29 | 29 | TIMER_DEVICE_CALLBACK_MEMBER(shaolins_interrupt); |
| 30 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 30 | 31 | }; |
| r20977 | r20978 | |
|---|---|---|
| 58 | 58 | virtual void machine_reset(); |
| 59 | 59 | virtual void video_start(); |
| 60 | 60 | UINT32 screen_update_sshangha(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 61 | inline void sshangha_set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data); | |
| 61 | 62 | }; |
| r20977 | r20978 | |
|---|---|---|
| 49 | 49 | UINT32 screen_update_srmp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 50 | 50 | UINT32 screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 51 | 51 | UINT32 screen_update_mjyuugi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 52 | UINT8 iox_key_matrix_calc(UINT8 p_side); | |
| 52 | 53 | }; |
| r20977 | r20978 | |
|---|---|---|
| 45 | 45 | DECLARE_WRITE8_MEMBER(sprint8_screech_w); |
| 46 | 46 | DECLARE_WRITE8_MEMBER(sprint8_attract_w); |
| 47 | 47 | DECLARE_WRITE8_MEMBER(sprint8_motor_w); |
| 48 | void set_pens(sprint8_state *state, colortable_t *colortable); | |
| 49 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 50 | void sprint8_set_collision(int n); | |
| 48 | 51 | }; |
| 49 | 52 | |
| 50 | 53 | /*----------- defined in drivers/sprint8.c -----------*/ |
| r20977 | r20978 | |
|---|---|---|
| 44 | 44 | virtual void video_start(); |
| 45 | 45 | DECLARE_VIDEO_START(searchar); |
| 46 | 46 | UINT32 screen_update_pow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 47 | void common_video_start(); | |
| 48 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int group); | |
| 47 | 49 | }; |
| r20977 | r20978 | |
|---|---|---|
| 110 | 110 | DECLARE_WRITE8_MEMBER(n7751_command_w); |
| 111 | 111 | DECLARE_WRITE8_MEMBER(n7751_rom_control_w); |
| 112 | 112 | DECLARE_WRITE8_MEMBER(n7751_p2_w); |
| 113 | void vblank_latch_set(); | |
| 114 | void g80_set_palette_entry(int entry, UINT8 data); | |
| 115 | void spaceod_bg_init_palette(); | |
| 116 | void draw_videoram(bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *transparent_pens); | |
| 117 | void draw_background_spaceod(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 118 | void draw_background_page_scroll(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 119 | void draw_background_full_scroll(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 120 | offs_t decrypt_offset(address_space &space, offs_t offset); | |
| 121 | inline UINT8 demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0); | |
| 122 | void monsterb_expand_gfx(const char *region); | |
| 113 | 123 | }; |
| 114 | 124 | |
| 115 | 125 |
| Previous | 199869 Revisions | Next |