trunk/src/mame/drivers/galaxian.c
| r20824 | r20825 | |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | |
| 830 | | static void monsterz_set_latch(running_machine &machine) |
| 830 | void galaxian_state::monsterz_set_latch() |
| 831 | 831 | { |
| 832 | 832 | // read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious) |
| 833 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 834 | | UINT8 *rom = state->memregion("audiocpu")->base(); |
| 835 | | state->m_protection_result = rom[0x2000 | (state->m_protection_state & 0x1fff)]; // probably needs a BITSWAP8 |
| 833 | UINT8 *rom = memregion("audiocpu")->base(); |
| 834 | m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a BITSWAP8 |
| 836 | 835 | |
| 837 | 836 | // and an irq on the main z80 afterwards |
| 838 | | machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE ); |
| 837 | machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE ); |
| 839 | 838 | } |
| 840 | 839 | |
| 841 | 840 | |
| r20824 | r20825 | |
| 844 | 843 | // d7 high: set latch + advance address high bits (and reset low bits?) |
| 845 | 844 | if (data & 0x80) |
| 846 | 845 | { |
| 847 | | monsterz_set_latch(machine()); |
| 846 | monsterz_set_latch(); |
| 848 | 847 | m_protection_state = (m_protection_state + 0x100) & 0xff00; |
| 849 | 848 | } |
| 850 | 849 | } |
| r20824 | r20825 | |
| 854 | 853 | // d3 high: set latch + advance address low bits |
| 855 | 854 | if (data & 0x08) |
| 856 | 855 | { |
| 857 | | monsterz_set_latch(machine()); |
| 856 | monsterz_set_latch(); |
| 858 | 857 | m_protection_state = ((m_protection_state + 1) & 0x00ff) | (m_protection_state & 0xff00); |
| 859 | 858 | } |
| 860 | 859 | } |
| r20824 | r20825 | |
| 2514 | 2513 | * |
| 2515 | 2514 | *************************************/ |
| 2516 | 2515 | |
| 2517 | | static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest) |
| 2516 | void galaxian_state::decode_mooncrst(int length, UINT8 *dest) |
| 2518 | 2517 | { |
| 2519 | | UINT8 *rom = machine.root_device().memregion("maincpu")->base(); |
| 2518 | UINT8 *rom = machine().root_device().memregion("maincpu")->base(); |
| 2520 | 2519 | int offs; |
| 2521 | 2520 | |
| 2522 | 2521 | for (offs = 0; offs < length; offs++) |
| r20824 | r20825 | |
| 2531 | 2530 | } |
| 2532 | 2531 | |
| 2533 | 2532 | |
| 2534 | | static void decode_checkman(running_machine &machine) |
| 2533 | void galaxian_state::decode_checkman() |
| 2535 | 2534 | { |
| 2536 | 2535 | /* |
| 2537 | 2536 | Encryption Table |
| r20824 | r20825 | |
| 2578 | 2577 | { 0,2,0,2 }, |
| 2579 | 2578 | { 1,4,1,4 } |
| 2580 | 2579 | }; |
| 2581 | | UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); |
| 2582 | | UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); |
| 2580 | UINT8 *rombase = machine().root_device().memregion("maincpu")->base(); |
| 2581 | UINT32 romlength = machine().root_device().memregion("maincpu")->bytes(); |
| 2583 | 2582 | UINT32 offs; |
| 2584 | 2583 | |
| 2585 | 2584 | for (offs = 0; offs < romlength; offs++) |
| r20824 | r20825 | |
| 2593 | 2592 | } |
| 2594 | 2593 | |
| 2595 | 2594 | |
| 2596 | | static void decode_dingoe(running_machine &machine) |
| 2595 | void galaxian_state::decode_dingoe() |
| 2597 | 2596 | { |
| 2598 | | UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); |
| 2599 | | UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); |
| 2597 | UINT8 *rombase = machine().root_device().memregion("maincpu")->base(); |
| 2598 | UINT32 romlength = machine().root_device().memregion("maincpu")->bytes(); |
| 2600 | 2599 | UINT32 offs; |
| 2601 | 2600 | |
| 2602 | 2601 | for (offs = 0; offs < romlength; offs++) |
| r20824 | r20825 | |
| 2616 | 2615 | } |
| 2617 | 2616 | |
| 2618 | 2617 | |
| 2619 | | static void decode_frogger_sound(running_machine &machine) |
| 2618 | void galaxian_state::decode_frogger_sound() |
| 2620 | 2619 | { |
| 2621 | | UINT8 *rombase = machine.root_device().memregion("audiocpu")->base(); |
| 2620 | UINT8 *rombase = machine().root_device().memregion("audiocpu")->base(); |
| 2622 | 2621 | UINT32 offs; |
| 2623 | 2622 | |
| 2624 | 2623 | /* the first ROM of the sound CPU has data lines D0 and D1 swapped */ |
| r20824 | r20825 | |
| 2627 | 2626 | } |
| 2628 | 2627 | |
| 2629 | 2628 | |
| 2630 | | static void decode_frogger_gfx(running_machine &machine) |
| 2629 | void galaxian_state::decode_frogger_gfx() |
| 2631 | 2630 | { |
| 2632 | | UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); |
| 2631 | UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); |
| 2633 | 2632 | UINT32 offs; |
| 2634 | 2633 | |
| 2635 | 2634 | /* the 2nd gfx ROM has data lines D0 and D1 swapped */ |
| r20824 | r20825 | |
| 2638 | 2637 | } |
| 2639 | 2638 | |
| 2640 | 2639 | |
| 2641 | | static void decode_anteater_gfx(running_machine &machine) |
| 2640 | void galaxian_state::decode_anteater_gfx() |
| 2642 | 2641 | { |
| 2643 | | UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); |
| 2644 | | UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); |
| 2645 | | UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); |
| 2642 | UINT32 romlength = machine().root_device().memregion("gfx1")->bytes(); |
| 2643 | UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); |
| 2644 | UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength); |
| 2646 | 2645 | UINT32 offs; |
| 2647 | 2646 | |
| 2648 | 2647 | memcpy(scratch, rombase, romlength); |
| r20824 | r20825 | |
| 2654 | 2653 | srcoffs |= (BIT(offs,0) ^ BIT(offs,6) ^ 1) << 10; |
| 2655 | 2654 | rombase[offs] = scratch[srcoffs]; |
| 2656 | 2655 | } |
| 2657 | | auto_free(machine, scratch); |
| 2656 | auto_free(machine(), scratch); |
| 2658 | 2657 | } |
| 2659 | 2658 | |
| 2660 | 2659 | |
| 2661 | | static void decode_losttomb_gfx(running_machine &machine) |
| 2660 | void galaxian_state::decode_losttomb_gfx() |
| 2662 | 2661 | { |
| 2663 | | UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); |
| 2664 | | UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); |
| 2665 | | UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); |
| 2662 | UINT32 romlength = machine().root_device().memregion("gfx1")->bytes(); |
| 2663 | UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); |
| 2664 | UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength); |
| 2666 | 2665 | UINT32 offs; |
| 2667 | 2666 | |
| 2668 | 2667 | memcpy(scratch, rombase, romlength); |
| r20824 | r20825 | |
| 2674 | 2673 | srcoffs |= ((BIT(offs,1) & BIT(offs,7)) | ((1 ^ BIT(offs,1)) & (BIT(offs,8)))) << 10; |
| 2675 | 2674 | rombase[offs] = scratch[srcoffs]; |
| 2676 | 2675 | } |
| 2677 | | auto_free(machine, scratch); |
| 2676 | auto_free(machine(), scratch); |
| 2678 | 2677 | } |
| 2679 | 2678 | |
| 2680 | 2679 | |
| 2681 | | static void decode_superbon(running_machine &machine) |
| 2680 | void galaxian_state::decode_superbon() |
| 2682 | 2681 | { |
| 2683 | 2682 | offs_t i; |
| 2684 | 2683 | UINT8 *RAM; |
| 2685 | 2684 | |
| 2686 | 2685 | /* Deryption worked out by hand by Chris Hardy. */ |
| 2687 | 2686 | |
| 2688 | | RAM = machine.root_device().memregion("maincpu")->base(); |
| 2687 | RAM = machine().root_device().memregion("maincpu")->base(); |
| 2689 | 2688 | |
| 2690 | 2689 | for (i = 0;i < 0x1000;i++) |
| 2691 | 2690 | { |
| r20824 | r20825 | |
| 2715 | 2714 | * |
| 2716 | 2715 | *************************************/ |
| 2717 | 2716 | |
| 2718 | | static void common_init( |
| 2719 | | running_machine &machine, |
| 2720 | | galaxian_draw_bullet_func draw_bullet, |
| 2721 | | galaxian_draw_background_func draw_background, |
| 2722 | | galaxian_extend_tile_info_func extend_tile_info, |
| 2723 | | galaxian_extend_sprite_info_func extend_sprite_info) |
| 2717 | void galaxian_state::common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background, |
| 2718 | galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info) |
| 2724 | 2719 | { |
| 2725 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 2726 | | state->m_irq_enabled = 0; |
| 2727 | | state->m_irq_line = INPUT_LINE_NMI; |
| 2728 | | state->m_numspritegens = 1; |
| 2729 | | state->m_bullets_base = 0x60; |
| 2730 | | state->m_frogger_adjust = FALSE; |
| 2731 | | state->m_sfx_tilemap = FALSE; |
| 2732 | | state->m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet; |
| 2733 | | state->m_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background; |
| 2734 | | state->m_extend_tile_info_ptr = extend_tile_info; |
| 2735 | | state->m_extend_sprite_info_ptr = extend_sprite_info; |
| 2720 | m_irq_enabled = 0; |
| 2721 | m_irq_line = INPUT_LINE_NMI; |
| 2722 | m_numspritegens = 1; |
| 2723 | m_bullets_base = 0x60; |
| 2724 | m_frogger_adjust = FALSE; |
| 2725 | m_sfx_tilemap = FALSE; |
| 2726 | m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : &galaxian_state::galaxian_draw_bullet; |
| 2727 | m_draw_background_ptr = (draw_background != NULL) ? draw_background : &galaxian_state::galaxian_draw_background; |
| 2728 | m_extend_tile_info_ptr = extend_tile_info; |
| 2729 | m_extend_sprite_info_ptr = extend_sprite_info; |
| 2736 | 2730 | } |
| 2737 | 2731 | |
| 2738 | 2732 | |
| 2739 | | static void unmap_galaxian_sound(running_machine &machine, offs_t base) |
| 2733 | void galaxian_state::unmap_galaxian_sound(offs_t base) |
| 2740 | 2734 | { |
| 2741 | | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 2735 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2742 | 2736 | |
| 2743 | 2737 | space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8); |
| 2744 | 2738 | space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8); |
| r20824 | r20825 | |
| 2755 | 2749 | |
| 2756 | 2750 | DRIVER_INIT_MEMBER(galaxian_state,galaxian) |
| 2757 | 2751 | { |
| 2758 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 2752 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 2759 | 2753 | } |
| 2760 | 2754 | |
| 2761 | 2755 | |
| r20824 | r20825 | |
| 2776 | 2770 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2777 | 2771 | |
| 2778 | 2772 | /* yellow bullets instead of white ones */ |
| 2779 | | common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 2773 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 2780 | 2774 | |
| 2781 | 2775 | /* coin lockout disabled */ |
| 2782 | 2776 | space.unmap_write(0x6002, 0x6002, 0, 0x7f8); |
| r20824 | r20825 | |
| 2788 | 2782 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2789 | 2783 | |
| 2790 | 2784 | /* video extensions */ |
| 2791 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info); |
| 2785 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::gmgalax_extend_tile_info, &galaxian_state::gmgalax_extend_sprite_info); |
| 2792 | 2786 | |
| 2793 | 2787 | /* ROM is banked */ |
| 2794 | 2788 | space.install_read_bank(0x0000, 0x3fff, "bank1"); |
| r20824 | r20825 | |
| 2805 | 2799 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2806 | 2800 | |
| 2807 | 2801 | /* video extensions */ |
| 2808 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); |
| 2802 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info); |
| 2809 | 2803 | |
| 2810 | 2804 | /* coin lockout replaced by graphics bank */ |
| 2811 | 2805 | space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); |
| r20824 | r20825 | |
| 2817 | 2811 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2818 | 2812 | |
| 2819 | 2813 | /* video extensions */ |
| 2820 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); |
| 2814 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); |
| 2821 | 2815 | |
| 2822 | 2816 | /* coin lockout replaced by graphics bank */ |
| 2823 | 2817 | space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); |
| r20824 | r20825 | |
| 2829 | 2823 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2830 | 2824 | |
| 2831 | 2825 | /* same as galaxian... */ |
| 2832 | | common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); |
| 2826 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); |
| 2833 | 2827 | |
| 2834 | 2828 | /* ...but needs a full 2k of RAM */ |
| 2835 | 2829 | space.install_ram(0x4000, 0x47ff); |
| r20824 | r20825 | |
| 2846 | 2840 | DRIVER_INIT_MEMBER(galaxian_state,mooncrst) |
| 2847 | 2841 | { |
| 2848 | 2842 | /* video extensions */ |
| 2849 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 2843 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 2850 | 2844 | |
| 2851 | 2845 | /* decrypt program code */ |
| 2852 | | decode_mooncrst(machine(), 0x8000, machine().root_device().memregion("maincpu")->base()); |
| 2846 | decode_mooncrst(0x8000, machine().root_device().memregion("maincpu")->base()); |
| 2853 | 2847 | } |
| 2854 | 2848 | |
| 2855 | 2849 | |
| 2856 | 2850 | DRIVER_INIT_MEMBER(galaxian_state,mooncrsu) |
| 2857 | 2851 | { |
| 2858 | 2852 | /* video extensions */ |
| 2859 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 2853 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 2860 | 2854 | } |
| 2861 | 2855 | |
| 2862 | 2856 | |
| r20824 | r20825 | |
| 2865 | 2859 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2866 | 2860 | |
| 2867 | 2861 | /* video extensions */ |
| 2868 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 2862 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 2869 | 2863 | |
| 2870 | 2864 | /* LEDs and coin lockout replaced by graphics banking */ |
| 2871 | 2865 | space.install_write_handler(0x6000, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); |
| r20824 | r20825 | |
| 2878 | 2872 | UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); |
| 2879 | 2873 | |
| 2880 | 2874 | /* video extensions */ |
| 2881 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info); |
| 2875 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::moonqsr_extend_tile_info, &galaxian_state::moonqsr_extend_sprite_info); |
| 2882 | 2876 | |
| 2883 | 2877 | /* decrypt program code */ |
| 2884 | | decode_mooncrst(machine(), 0x8000, decrypt); |
| 2878 | decode_mooncrst(0x8000, decrypt); |
| 2885 | 2879 | space.set_decrypted_region(0x0000, 0x7fff, decrypt); |
| 2886 | 2880 | } |
| 2887 | 2881 | |
| r20824 | r20825 | |
| 2957 | 2951 | which tenspot appears to have copied */ |
| 2958 | 2952 | |
| 2959 | 2953 | /* video extensions */ |
| 2960 | | //common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); |
| 2954 | //common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); |
| 2961 | 2955 | |
| 2962 | 2956 | /* coin lockout replaced by graphics bank */ |
| 2963 | 2957 | //space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w)); |
| r20824 | r20825 | |
| 2979 | 2973 | DRIVER_INIT_MEMBER(galaxian_state,devilfsg) |
| 2980 | 2974 | { |
| 2981 | 2975 | /* video extensions */ |
| 2982 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 2976 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 2983 | 2977 | |
| 2984 | 2978 | /* IRQ line is INT, not NMI */ |
| 2985 | 2979 | m_irq_line = 0; |
| r20824 | r20825 | |
| 2991 | 2985 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 2992 | 2986 | |
| 2993 | 2987 | /* video extensions */ |
| 2994 | | common_init(machine(), NULL, galaxian_draw_background, NULL, NULL); |
| 2988 | common_init(NULL, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 2995 | 2989 | m_draw_bullet_ptr = NULL; |
| 2996 | 2990 | |
| 2997 | 2991 | /* two sprite generators */ |
| r20824 | r20825 | |
| 3016 | 3010 | space.unmap_write(0x6002, 0x6002, 0, 0x7f8); |
| 3017 | 3011 | |
| 3018 | 3012 | /* remove the galaxian sound hardware */ |
| 3019 | | unmap_galaxian_sound(machine(), 0x6000); |
| 3013 | unmap_galaxian_sound( 0x6000); |
| 3020 | 3014 | |
| 3021 | 3015 | /* install our AY-8910 handler */ |
| 3022 | 3016 | space.install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),this)); |
| r20824 | r20825 | |
| 3026 | 3020 | DRIVER_INIT_MEMBER(galaxian_state,jumpbug) |
| 3027 | 3021 | { |
| 3028 | 3022 | /* video extensions */ |
| 3029 | | common_init(machine(), scramble_draw_bullet, jumpbug_draw_background, jumpbug_extend_tile_info, jumpbug_extend_sprite_info); |
| 3023 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::jumpbug_draw_background, &galaxian_state::jumpbug_extend_tile_info, &galaxian_state::jumpbug_extend_sprite_info); |
| 3030 | 3024 | } |
| 3031 | 3025 | |
| 3032 | 3026 | |
| r20824 | r20825 | |
| 3036 | 3030 | address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); |
| 3037 | 3031 | |
| 3038 | 3032 | /* video extensions */ |
| 3039 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 3033 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 3040 | 3034 | |
| 3041 | 3035 | /* move the interrupt enable from $b000 to $b001 */ |
| 3042 | 3036 | space.unmap_write(0xb000, 0xb000, 0, 0x7f8); |
| r20824 | r20825 | |
| 3046 | 3040 | iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); |
| 3047 | 3041 | |
| 3048 | 3042 | /* decrypt program code */ |
| 3049 | | decode_checkman(machine()); |
| 3043 | decode_checkman(); |
| 3050 | 3044 | } |
| 3051 | 3045 | |
| 3052 | 3046 | |
| r20824 | r20825 | |
| 3055 | 3049 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3056 | 3050 | |
| 3057 | 3051 | /* video extensions */ |
| 3058 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 3052 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 3059 | 3053 | |
| 3060 | 3054 | /* attach the sound command handler */ |
| 3061 | 3055 | space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); |
| r20824 | r20825 | |
| 3070 | 3064 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3071 | 3065 | |
| 3072 | 3066 | /* video extensions */ |
| 3073 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 3067 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 3074 | 3068 | |
| 3075 | 3069 | /* attach the sound command handler */ |
| 3076 | 3070 | space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); |
| r20824 | r20825 | |
| 3086 | 3080 | address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); |
| 3087 | 3081 | |
| 3088 | 3082 | /* video extensions */ |
| 3089 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 3083 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 3090 | 3084 | |
| 3091 | 3085 | /* move the interrupt enable from $b000 to $b001 */ |
| 3092 | 3086 | space.unmap_write(0xb000, 0xb000, 0, 0x7f8); |
| r20824 | r20825 | |
| 3098 | 3092 | space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this)); /* Protection check */ |
| 3099 | 3093 | |
| 3100 | 3094 | /* decrypt program code */ |
| 3101 | | decode_dingoe(machine()); |
| 3095 | decode_dingoe(); |
| 3102 | 3096 | } |
| 3103 | 3097 | |
| 3104 | 3098 | |
| r20824 | r20825 | |
| 3107 | 3101 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3108 | 3102 | |
| 3109 | 3103 | /* video extensions */ |
| 3110 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); |
| 3104 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info); |
| 3111 | 3105 | |
| 3112 | 3106 | /* coin lockout replaced by graphics bank */ |
| 3113 | 3107 | space.install_write_handler(0xa002, 0xa002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); |
| r20824 | r20825 | |
| 3125 | 3119 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3126 | 3120 | |
| 3127 | 3121 | /* video extensions */ |
| 3128 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); |
| 3122 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info); |
| 3129 | 3123 | |
| 3130 | 3124 | /* needs a full 2k of RAM */ |
| 3131 | 3125 | space.install_ram(0x8000, 0x87ff); |
| r20824 | r20825 | |
| 3135 | 3129 | } |
| 3136 | 3130 | |
| 3137 | 3131 | |
| 3138 | | static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16]) |
| 3132 | void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16]) |
| 3139 | 3133 | { |
| 3140 | | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 3141 | | UINT8 *rom = machine.root_device().memregion("maincpu")->base(); |
| 3142 | | UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); |
| 3134 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3135 | UINT8 *rom = machine().root_device().memregion("maincpu")->base(); |
| 3136 | UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000); |
| 3143 | 3137 | int A; |
| 3144 | 3138 | |
| 3145 | 3139 | space.set_decrypted_region(0x0000, 0xffff, decrypt); |
| r20824 | r20825 | |
| 3178 | 3172 | }; |
| 3179 | 3173 | |
| 3180 | 3174 | /* video extensions */ |
| 3181 | | common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); |
| 3175 | common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info); |
| 3182 | 3176 | |
| 3183 | 3177 | /* IRQ line is INT, not NMI */ |
| 3184 | 3178 | m_irq_line = 0; |
| 3185 | 3179 | |
| 3186 | 3180 | /* decrypt the code */ |
| 3187 | | mshuttle_decode(machine(), convtable); |
| 3181 | mshuttle_decode(convtable); |
| 3188 | 3182 | } |
| 3189 | 3183 | |
| 3190 | 3184 | |
| r20824 | r20825 | |
| 3203 | 3197 | }; |
| 3204 | 3198 | |
| 3205 | 3199 | /* video extensions */ |
| 3206 | | common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); |
| 3200 | common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info); |
| 3207 | 3201 | |
| 3208 | 3202 | /* IRQ line is INT, not NMI */ |
| 3209 | 3203 | m_irq_line = 0; |
| 3210 | 3204 | |
| 3211 | 3205 | /* decrypt the code */ |
| 3212 | | mshuttle_decode(machine(), convtable); |
| 3206 | mshuttle_decode(convtable); |
| 3213 | 3207 | } |
| 3214 | 3208 | |
| 3215 | 3209 | |
| 3216 | 3210 | DRIVER_INIT_MEMBER(galaxian_state,fantastc) |
| 3217 | 3211 | { |
| 3218 | 3212 | /* video extensions */ |
| 3219 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); |
| 3213 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info); |
| 3220 | 3214 | |
| 3221 | 3215 | /* two sprite generators */ |
| 3222 | 3216 | m_numspritegens = 2; |
| r20824 | r20825 | |
| 3251 | 3245 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3252 | 3246 | |
| 3253 | 3247 | /* video extensions */ |
| 3254 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 3248 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 3255 | 3249 | |
| 3256 | 3250 | /* disable the stars */ |
| 3257 | 3251 | space.unmap_write(0xb004, 0xb004, 0, 0x07f8); |
| r20824 | r20825 | |
| 3271 | 3265 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3272 | 3266 | |
| 3273 | 3267 | /* video extensions */ |
| 3274 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); |
| 3268 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); |
| 3275 | 3269 | |
| 3276 | 3270 | /* move the interrupt enable from $b000 to $b001 */ |
| 3277 | 3271 | space.unmap_write(0xb000, 0xb000, 0, 0x7f8); |
| r20824 | r20825 | |
| 3292 | 3286 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3293 | 3287 | |
| 3294 | 3288 | /* video extensions */ |
| 3295 | | common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); |
| 3289 | common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); |
| 3296 | 3290 | |
| 3297 | 3291 | /* move the interrupt enable from $b000 to $b001 */ |
| 3298 | 3292 | space.unmap_write(0xb000, 0xb000, 0, 0x7f8); |
| r20824 | r20825 | |
| 3316 | 3310 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3317 | 3311 | |
| 3318 | 3312 | /* video extensions */ |
| 3319 | | common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL); |
| 3313 | common_init(&galaxian_state::theend_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); |
| 3320 | 3314 | |
| 3321 | 3315 | /* coin counter on the upper bit of port C */ |
| 3322 | 3316 | space.unmap_write(0x6802, 0x6802, 0, 0x7f8); |
| r20824 | r20825 | |
| 3326 | 3320 | DRIVER_INIT_MEMBER(galaxian_state,scramble) |
| 3327 | 3321 | { |
| 3328 | 3322 | /* video extensions */ |
| 3329 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3323 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3330 | 3324 | } |
| 3331 | 3325 | |
| 3332 | 3326 | |
| r20824 | r20825 | |
| 3335 | 3329 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3336 | 3330 | |
| 3337 | 3331 | /* video extensions */ |
| 3338 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3332 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3339 | 3333 | |
| 3340 | 3334 | /* watchdog works for writes as well? (or is it just disabled?) */ |
| 3341 | 3335 | space.install_write_handler(0x7000, 0x7000, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::watchdog_reset_w),this)); |
| r20824 | r20825 | |
| 3354 | 3348 | DRIVER_INIT_MEMBER(galaxian_state,sfx) |
| 3355 | 3349 | { |
| 3356 | 3350 | /* basic configuration */ |
| 3357 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, upper_extend_tile_info, NULL); |
| 3351 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::upper_extend_tile_info, NULL); |
| 3358 | 3352 | m_sfx_tilemap = TRUE; |
| 3359 | 3353 | |
| 3360 | 3354 | /* sound board has space for extra ROM */ |
| r20824 | r20825 | |
| 3368 | 3362 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3369 | 3363 | |
| 3370 | 3364 | /* video extensions */ |
| 3371 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3365 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3372 | 3366 | |
| 3373 | 3367 | /* watchdog is at $7800? (or is it just disabled?) */ |
| 3374 | 3368 | space.unmap_read(0x7000, 0x7000, 0, 0x7ff); |
| r20824 | r20825 | |
| 3379 | 3373 | DRIVER_INIT_MEMBER(galaxian_state,scobra) |
| 3380 | 3374 | { |
| 3381 | 3375 | /* video extensions */ |
| 3382 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3376 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3383 | 3377 | } |
| 3384 | 3378 | |
| 3385 | 3379 | |
| 3386 | 3380 | DRIVER_INIT_MEMBER(galaxian_state,losttomb) |
| 3387 | 3381 | { |
| 3388 | 3382 | /* video extensions */ |
| 3389 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3383 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3390 | 3384 | |
| 3391 | 3385 | /* decrypt */ |
| 3392 | | decode_losttomb_gfx(machine()); |
| 3386 | decode_losttomb_gfx(); |
| 3393 | 3387 | } |
| 3394 | 3388 | |
| 3395 | 3389 | |
| 3396 | 3390 | DRIVER_INIT_MEMBER(galaxian_state,frogger) |
| 3397 | 3391 | { |
| 3398 | 3392 | /* video extensions */ |
| 3399 | | common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); |
| 3393 | common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); |
| 3400 | 3394 | m_frogger_adjust = TRUE; |
| 3401 | 3395 | |
| 3402 | 3396 | /* decrypt */ |
| 3403 | | decode_frogger_sound(machine()); |
| 3404 | | decode_frogger_gfx(machine()); |
| 3397 | decode_frogger_sound(); |
| 3398 | decode_frogger_gfx(); |
| 3405 | 3399 | } |
| 3406 | 3400 | |
| 3407 | 3401 | |
| r20824 | r20825 | |
| 3410 | 3404 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3411 | 3405 | |
| 3412 | 3406 | /* video extensions */ |
| 3413 | | common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); |
| 3407 | common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); |
| 3414 | 3408 | |
| 3415 | 3409 | space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this)); |
| 3416 | 3410 | space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),this)); |
| r20824 | r20825 | |
| 3419 | 3413 | space.install_ram(0x8000, 0x87ff); |
| 3420 | 3414 | |
| 3421 | 3415 | /* decrypt */ |
| 3422 | | decode_frogger_sound(machine()); |
| 3416 | decode_frogger_sound(); |
| 3423 | 3417 | } |
| 3424 | 3418 | |
| 3425 | 3419 | |
| 3426 | 3420 | DRIVER_INIT_MEMBER(galaxian_state,froggers) |
| 3427 | 3421 | { |
| 3428 | 3422 | /* video extensions */ |
| 3429 | | common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); |
| 3423 | common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); |
| 3430 | 3424 | |
| 3431 | 3425 | /* decrypt */ |
| 3432 | | decode_frogger_sound(machine()); |
| 3426 | decode_frogger_sound(); |
| 3433 | 3427 | } |
| 3434 | 3428 | |
| 3435 | 3429 | |
| 3436 | 3430 | DRIVER_INIT_MEMBER(galaxian_state,turtles) |
| 3437 | 3431 | { |
| 3438 | 3432 | /* video extensions */ |
| 3439 | | common_init(machine(), NULL, turtles_draw_background, NULL, NULL); |
| 3433 | common_init(NULL, &galaxian_state::turtles_draw_background, NULL, NULL); |
| 3440 | 3434 | } |
| 3441 | 3435 | |
| 3442 | 3436 | |
| r20824 | r20825 | |
| 3445 | 3439 | { |
| 3446 | 3440 | /* no existing amidar sets run on Amidar hardware as described by Amidar schematics! */ |
| 3447 | 3441 | /* video extensions */ |
| 3448 | | common_init(machine(), scramble_draw_bullet, amidar_draw_background, NULL, NULL); |
| 3442 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::amidar_draw_background, NULL, NULL); |
| 3449 | 3443 | } |
| 3450 | 3444 | #endif |
| 3451 | 3445 | |
| r20824 | r20825 | |
| 3454 | 3448 | { |
| 3455 | 3449 | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 3456 | 3450 | |
| 3457 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); |
| 3451 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); |
| 3458 | 3452 | |
| 3459 | 3453 | /* hook up AY8910 */ |
| 3460 | 3454 | machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this)); |
| r20824 | r20825 | |
| 3490 | 3484 | DRIVER_INIT_MEMBER(galaxian_state,anteater) |
| 3491 | 3485 | { |
| 3492 | 3486 | /* video extensions */ |
| 3493 | | common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); |
| 3487 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL); |
| 3494 | 3488 | |
| 3495 | 3489 | /* decode graphics */ |
| 3496 | | decode_anteater_gfx(machine()); |
| 3490 | decode_anteater_gfx(); |
| 3497 | 3491 | } |
| 3498 | 3492 | |
| 3499 | 3493 | |
| 3500 | 3494 | DRIVER_INIT_MEMBER(galaxian_state,anteateruk) |
| 3501 | 3495 | { |
| 3502 | 3496 | /* video extensions */ |
| 3503 | | common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); |
| 3497 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL); |
| 3504 | 3498 | } |
| 3505 | 3499 | |
| 3506 | 3500 | |
| 3507 | 3501 | DRIVER_INIT_MEMBER(galaxian_state,superbon) |
| 3508 | 3502 | { |
| 3509 | 3503 | /* video extensions */ |
| 3510 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3504 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3511 | 3505 | |
| 3512 | 3506 | /* decode code */ |
| 3513 | | decode_superbon(machine()); |
| 3507 | decode_superbon(); |
| 3514 | 3508 | } |
| 3515 | 3509 | |
| 3516 | 3510 | |
| 3517 | 3511 | DRIVER_INIT_MEMBER(galaxian_state,calipso) |
| 3518 | 3512 | { |
| 3519 | 3513 | /* video extensions */ |
| 3520 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, calipso_extend_sprite_info); |
| 3514 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, &galaxian_state::calipso_extend_sprite_info); |
| 3521 | 3515 | } |
| 3522 | 3516 | |
| 3523 | 3517 | |
| 3524 | 3518 | DRIVER_INIT_MEMBER(galaxian_state,moonwar) |
| 3525 | 3519 | { |
| 3526 | 3520 | /* video extensions */ |
| 3527 | | common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); |
| 3521 | common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); |
| 3528 | 3522 | |
| 3529 | 3523 | state_save_register_global(machine(), m_moonwar_port_select); |
| 3530 | 3524 | } |
| r20824 | r20825 | |
| 3543 | 3537 | DRIVER_INIT_MEMBER( galaxian_state, froggrs ) |
| 3544 | 3538 | { |
| 3545 | 3539 | /* video extensions */ |
| 3546 | | common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); |
| 3540 | common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); |
| 3547 | 3541 | |
| 3548 | 3542 | /* decrypt */ |
| 3549 | | decode_frogger_sound(machine()); |
| 3550 | | decode_frogger_gfx(machine()); |
| 3543 | decode_frogger_sound(); |
| 3544 | decode_frogger_gfx(); |
| 3551 | 3545 | } |
| 3552 | 3546 | |
| 3553 | 3547 | |
trunk/src/mame/video/galaxian.c
| r20824 | r20825 | |
| 227 | 227 | #define RGB_MAXIMUM 224 |
| 228 | 228 | |
| 229 | 229 | |
| 230 | | |
| 231 | 230 | /************************************* |
| 232 | 231 | * |
| 233 | | * Function prototypes |
| 234 | | * |
| 235 | | *************************************/ |
| 236 | | |
| 237 | | static void state_save_register(running_machine &machine); |
| 238 | | |
| 239 | | |
| 240 | | static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase); |
| 241 | | |
| 242 | | static void stars_init(running_machine &machine); |
| 243 | | static void stars_update_origin(running_machine &machine); |
| 244 | | static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); |
| 245 | | |
| 246 | | static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base); |
| 247 | | |
| 248 | | |
| 249 | | |
| 250 | | /************************************* |
| 251 | | * |
| 252 | 232 | * Palette setup |
| 253 | 233 | * |
| 254 | 234 | *************************************/ |
| r20824 | r20825 | |
| 417 | 397 | m_background_green = 0; |
| 418 | 398 | |
| 419 | 399 | /* initialize stars */ |
| 420 | | stars_init(machine()); |
| 400 | stars_init(); |
| 421 | 401 | |
| 422 | 402 | /* register for save states */ |
| 423 | | state_save_register(machine()); |
| 403 | state_save_register(); |
| 424 | 404 | } |
| 425 | 405 | |
| 426 | 406 | |
| 427 | | static void state_save_register(running_machine &machine) |
| 407 | void galaxian_state::state_save_register() |
| 428 | 408 | { |
| 429 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 430 | | state_save_register_global(machine, state->m_flipscreen_x); |
| 431 | | state_save_register_global(machine, state->m_flipscreen_y); |
| 432 | | state_save_register_global(machine, state->m_background_enable); |
| 433 | | state_save_register_global(machine, state->m_background_red); |
| 434 | | state_save_register_global(machine, state->m_background_green); |
| 435 | | state_save_register_global(machine, state->m_background_blue); |
| 409 | state_save_register_global(machine(), m_flipscreen_x); |
| 410 | state_save_register_global(machine(), m_flipscreen_y); |
| 411 | state_save_register_global(machine(), m_background_enable); |
| 412 | state_save_register_global(machine(), m_background_red); |
| 413 | state_save_register_global(machine(), m_background_green); |
| 414 | state_save_register_global(machine(), m_background_blue); |
| 436 | 415 | |
| 437 | | state_save_register_global_array(machine, state->m_gfxbank); |
| 416 | state_save_register_global_array(machine(), m_gfxbank); |
| 438 | 417 | |
| 439 | | state_save_register_global(machine, state->m_stars_enabled); |
| 440 | | state_save_register_global(machine, state->m_star_rng_origin); |
| 441 | | state_save_register_global(machine, state->m_star_rng_origin_frame); |
| 442 | | state_save_register_global(machine, state->m_stars_blink_state); |
| 418 | state_save_register_global(machine(), m_stars_enabled); |
| 419 | state_save_register_global(machine(), m_star_rng_origin); |
| 420 | state_save_register_global(machine(), m_star_rng_origin_frame); |
| 421 | state_save_register_global(machine(), m_stars_blink_state); |
| 443 | 422 | } |
| 444 | 423 | |
| 445 | 424 | |
| r20824 | r20825 | |
| 453 | 432 | UINT32 galaxian_state::screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 454 | 433 | { |
| 455 | 434 | /* draw the background layer (including stars) */ |
| 456 | | (*m_draw_background_ptr)(machine(), bitmap, cliprect); |
| 435 | (this->*m_draw_background_ptr)(bitmap, cliprect); |
| 457 | 436 | |
| 458 | 437 | /* draw the tilemap characters over top */ |
| 459 | 438 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 460 | 439 | |
| 461 | 440 | /* render the sprites next. Some custom pcbs (eg. zigzag, fantastc) have more than one sprite generator (ideally, this should be rendered in parallel) */ |
| 462 | 441 | for (int i = 0; i < m_numspritegens; i++) |
| 463 | | sprites_draw(machine(), bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]); |
| 442 | sprites_draw(bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]); |
| 464 | 443 | |
| 465 | 444 | /* if we have bullets to draw, render them following */ |
| 466 | 445 | if (m_draw_bullet_ptr != NULL) |
| 467 | | bullets_draw(machine(), bitmap, cliprect, &m_spriteram[m_bullets_base]); |
| 446 | bullets_draw(bitmap, cliprect, &m_spriteram[m_bullets_base]); |
| 468 | 447 | |
| 469 | 448 | return 0; |
| 470 | 449 | } |
| r20824 | r20825 | |
| 487 | 466 | UINT8 color = attrib & 7; |
| 488 | 467 | |
| 489 | 468 | if (m_extend_tile_info_ptr != NULL) |
| 490 | | (*m_extend_tile_info_ptr)(machine(), &code, &color, attrib, x); |
| 469 | (this->*m_extend_tile_info_ptr)(&code, &color, attrib, x); |
| 491 | 470 | |
| 492 | 471 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 493 | 472 | } |
| r20824 | r20825 | |
| 545 | 524 | * |
| 546 | 525 | *************************************/ |
| 547 | 526 | |
| 548 | | static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase) |
| 527 | void galaxian_state::sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase) |
| 549 | 528 | { |
| 550 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 551 | 529 | rectangle clip = cliprect; |
| 552 | 530 | int sprnum; |
| 553 | 531 | |
| r20824 | r20825 | |
| 556 | 534 | |
| 557 | 535 | /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ |
| 558 | 536 | /* according to the schematics, it should be the first 16 pixels */ |
| 559 | | clip.min_x = MAX(clip.min_x, (!state->m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE); |
| 560 | | clip.max_x = MIN(clip.max_x, (256 - state->m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1); |
| 537 | clip.min_x = MAX(clip.min_x, (!m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE); |
| 538 | clip.max_x = MIN(clip.max_x, (256 - m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1); |
| 561 | 539 | |
| 562 | 540 | /* The line buffer is only written if it contains a '0' currently; */ |
| 563 | 541 | /* it is cleared during the visible area, and populated during HBLANK */ |
| r20824 | r20825 | |
| 567 | 545 | { |
| 568 | 546 | const UINT8 *base = &spritebase[sprnum * 4]; |
| 569 | 547 | /* Frogger: top and bottom 4 bits swapped entering the adder */ |
| 570 | | UINT8 base0 = state->m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; |
| 548 | UINT8 base0 = m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; |
| 571 | 549 | /* the first three sprites match against y-1 */ |
| 572 | 550 | UINT8 sy = 240 - (base0 - (sprnum < 3)); |
| 573 | 551 | UINT16 code = base[1] & 0x3f; |
| r20824 | r20825 | |
| 577 | 555 | UINT8 sx = base[3] + hoffset; |
| 578 | 556 | |
| 579 | 557 | /* extend the sprite information */ |
| 580 | | if (state->m_extend_sprite_info_ptr != NULL) |
| 581 | | (*state->m_extend_sprite_info_ptr)(machine, base, &sx, &sy, &flipx, &flipy, &code, &color); |
| 558 | if (m_extend_sprite_info_ptr != NULL) |
| 559 | (this->*m_extend_sprite_info_ptr)(base, &sx, &sy, &flipx, &flipy, &code, &color); |
| 582 | 560 | |
| 583 | 561 | /* apply flipscreen in X direction */ |
| 584 | | if (state->m_flipscreen_x) |
| 562 | if (m_flipscreen_x) |
| 585 | 563 | { |
| 586 | 564 | sx = 240 - sx; |
| 587 | 565 | flipx = !flipx; |
| 588 | 566 | } |
| 589 | 567 | |
| 590 | 568 | /* apply flipscreen in Y direction */ |
| 591 | | if (state->m_flipscreen_y) |
| 569 | if (m_flipscreen_y) |
| 592 | 570 | { |
| 593 | 571 | sy = 240 - sy; |
| 594 | 572 | flipy = !flipy; |
| r20824 | r20825 | |
| 596 | 574 | |
| 597 | 575 | /* draw */ |
| 598 | 576 | drawgfx_transpen(bitmap, clip, |
| 599 | | machine.gfx[1], |
| 577 | machine().gfx[1], |
| 600 | 578 | code, color, |
| 601 | 579 | flipx, flipy, |
| 602 | 580 | GALAXIAN_H0START + GALAXIAN_XSCALE * sx, sy, 0); |
| r20824 | r20825 | |
| 611 | 589 | * |
| 612 | 590 | *************************************/ |
| 613 | 591 | |
| 614 | | static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base) |
| 592 | void galaxian_state::bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base) |
| 615 | 593 | { |
| 616 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 617 | 594 | int y; |
| 618 | 595 | |
| 619 | 596 | /* iterate over scanlines */ |
| r20824 | r20825 | |
| 624 | 601 | int which; |
| 625 | 602 | |
| 626 | 603 | /* the first 3 entries match Y-1 */ |
| 627 | | effy = state->m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); |
| 604 | effy = m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); |
| 628 | 605 | for (which = 0; which < 3; which++) |
| 629 | 606 | if ((UINT8)(base[which*4+1] + effy) == 0xff) |
| 630 | 607 | shell = which; |
| 631 | 608 | |
| 632 | 609 | /* remaining entries match Y */ |
| 633 | | effy = state->m_flipscreen_y ? (y ^ 255) : y; |
| 610 | effy = m_flipscreen_y ? (y ^ 255) : y; |
| 634 | 611 | for (which = 3; which < 8; which++) |
| 635 | 612 | if ((UINT8)(base[which*4+1] + effy) == 0xff) |
| 636 | 613 | { |
| r20824 | r20825 | |
| 642 | 619 | |
| 643 | 620 | /* draw the shell */ |
| 644 | 621 | if (shell != 0xff) |
| 645 | | (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y); |
| 622 | (this->*m_draw_bullet_ptr)(bitmap, cliprect, shell, 255 - base[shell*4+3], y); |
| 646 | 623 | if (missile != 0xff) |
| 647 | | (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y); |
| 624 | (this->*m_draw_bullet_ptr)(bitmap, cliprect, missile, 255 - base[missile*4+3], y); |
| 648 | 625 | } |
| 649 | 626 | } |
| 650 | 627 | |
| r20824 | r20825 | |
| 665 | 642 | /* when the direction changes, we count a different number of clocks */ |
| 666 | 643 | /* per frame, so we need to reset the origin of the stars to the current */ |
| 667 | 644 | /* frame before we flip */ |
| 668 | | stars_update_origin(machine()); |
| 645 | stars_update_origin(); |
| 669 | 646 | |
| 670 | 647 | m_flipscreen_x = data & 0x01; |
| 671 | 648 | m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); |
| r20824 | r20825 | |
| 774 | 751 | * |
| 775 | 752 | *************************************/ |
| 776 | 753 | |
| 777 | | static void stars_init(running_machine &machine) |
| 754 | void galaxian_state::stars_init() |
| 778 | 755 | { |
| 779 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 780 | 756 | UINT32 shiftreg; |
| 781 | 757 | int i; |
| 782 | 758 | |
| 783 | 759 | /* reset the blink and enabled states */ |
| 784 | | state->m_stars_enabled = FALSE; |
| 785 | | state->m_stars_blink_state = 0; |
| 760 | m_stars_enabled = FALSE; |
| 761 | m_stars_blink_state = 0; |
| 786 | 762 | |
| 787 | 763 | /* precalculate the RNG */ |
| 788 | | state->m_stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); |
| 764 | m_stars = auto_alloc_array(machine(), UINT8, STAR_RNG_PERIOD); |
| 789 | 765 | shiftreg = 0; |
| 790 | 766 | for (i = 0; i < STAR_RNG_PERIOD; i++) |
| 791 | 767 | { |
| r20824 | r20825 | |
| 796 | 772 | int color = (~shiftreg & 0x1f8) >> 3; |
| 797 | 773 | |
| 798 | 774 | /* store the color value in the low 6 bits and the enable in the upper bit */ |
| 799 | | state->m_stars[i] = color | (enabled << 7); |
| 775 | m_stars[i] = color | (enabled << 7); |
| 800 | 776 | |
| 801 | 777 | /* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */ |
| 802 | 778 | shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16); |
| r20824 | r20825 | |
| 811 | 787 | * |
| 812 | 788 | *************************************/ |
| 813 | 789 | |
| 814 | | static void stars_update_origin(running_machine &machine) |
| 790 | void galaxian_state::stars_update_origin() |
| 815 | 791 | { |
| 816 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 817 | | int curframe = machine.primary_screen->frame_number(); |
| 792 | int curframe = machine().primary_screen->frame_number(); |
| 818 | 793 | |
| 819 | 794 | /* only update on a different frame */ |
| 820 | | if (curframe != state->m_star_rng_origin_frame) |
| 795 | if (curframe != m_star_rng_origin_frame) |
| 821 | 796 | { |
| 822 | 797 | /* The RNG period is 2^17-1; each frame, the shift register is clocked */ |
| 823 | 798 | /* 512*256 = 2^17 times. This means that we clock one extra time each */ |
| r20824 | r20825 | |
| 825 | 800 | /* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */ |
| 826 | 801 | /* In this case, we only one time less than the period each frame. Both */ |
| 827 | 802 | /* of these off-by-one countings produce the horizontal star scrolling. */ |
| 828 | | int per_frame_delta = state->m_flipscreen_x ? 1 : -1; |
| 829 | | int total_delta = per_frame_delta * (curframe - state->m_star_rng_origin_frame); |
| 803 | int per_frame_delta = m_flipscreen_x ? 1 : -1; |
| 804 | int total_delta = per_frame_delta * (curframe - m_star_rng_origin_frame); |
| 830 | 805 | |
| 831 | 806 | /* we can't just use % here because mod of a negative number is undefined */ |
| 832 | 807 | while (total_delta < 0) |
| 833 | 808 | total_delta += STAR_RNG_PERIOD; |
| 834 | 809 | |
| 835 | 810 | /* now that everything is positive, do the mod */ |
| 836 | | state->m_star_rng_origin = (state->m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; |
| 837 | | state->m_star_rng_origin_frame = curframe; |
| 811 | m_star_rng_origin = (m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; |
| 812 | m_star_rng_origin_frame = curframe; |
| 838 | 813 | } |
| 839 | 814 | } |
| 840 | 815 | |
| r20824 | r20825 | |
| 859 | 834 | * |
| 860 | 835 | *************************************/ |
| 861 | 836 | |
| 862 | | static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) |
| 837 | void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) |
| 863 | 838 | { |
| 864 | 839 | int x; |
| 865 | 840 | |
| r20824 | r20825 | |
| 891 | 866 | */ |
| 892 | 867 | |
| 893 | 868 | /* first RNG clock: one pixel */ |
| 894 | | star = state->m_stars[star_offs++]; |
| 869 | star = m_stars[star_offs++]; |
| 895 | 870 | if (star_offs >= STAR_RNG_PERIOD) |
| 896 | 871 | star_offs = 0; |
| 897 | 872 | if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) |
| 898 | | bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = state->m_star_color[star & 0x3f]; |
| 873 | bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; |
| 899 | 874 | |
| 900 | 875 | /* second RNG clock: two pixels */ |
| 901 | | star = state->m_stars[star_offs++]; |
| 876 | star = m_stars[star_offs++]; |
| 902 | 877 | if (star_offs >= STAR_RNG_PERIOD) |
| 903 | 878 | star_offs = 0; |
| 904 | 879 | if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) |
| 905 | 880 | { |
| 906 | | bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = state->m_star_color[star & 0x3f]; |
| 907 | | bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = state->m_star_color[star & 0x3f]; |
| 881 | bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; |
| 882 | bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; |
| 908 | 883 | } |
| 909 | 884 | } |
| 910 | 885 | } |
| r20824 | r20825 | |
| 917 | 892 | * |
| 918 | 893 | *************************************/ |
| 919 | 894 | |
| 920 | | void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 895 | void galaxian_state::galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 921 | 896 | { |
| 922 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 923 | 897 | /* erase the background to black first */ |
| 924 | 898 | bitmap.fill(RGB_BLACK, cliprect); |
| 925 | 899 | |
| 926 | 900 | /* update the star origin to the current frame */ |
| 927 | | stars_update_origin(machine); |
| 901 | stars_update_origin(); |
| 928 | 902 | |
| 929 | 903 | /* render stars if enabled */ |
| 930 | | if (state->m_stars_enabled) |
| 904 | if (m_stars_enabled) |
| 931 | 905 | { |
| 932 | 906 | int y; |
| 933 | 907 | |
| 934 | 908 | /* iterate over scanlines */ |
| 935 | 909 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 936 | 910 | { |
| 937 | | UINT32 star_offs = state->m_star_rng_origin + y * 512; |
| 938 | | stars_draw_row(state, bitmap, 256, y, star_offs, 0xff); |
| 911 | UINT32 star_offs = m_star_rng_origin + y * 512; |
| 912 | stars_draw_row(bitmap, 256, y, star_offs, 0xff); |
| 939 | 913 | } |
| 940 | 914 | } |
| 941 | 915 | } |
| 942 | 916 | |
| 943 | 917 | |
| 944 | | static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped) |
| 918 | void galaxian_state::background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped) |
| 945 | 919 | { |
| 946 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 947 | 920 | /* horizontal bgcolor split */ |
| 948 | | if (state->m_flipscreen_x) |
| 921 | if (m_flipscreen_x) |
| 949 | 922 | { |
| 950 | 923 | rectangle draw = cliprect; |
| 951 | 924 | draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1); |
| r20824 | r20825 | |
| 972 | 945 | } |
| 973 | 946 | |
| 974 | 947 | |
| 975 | | static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx) |
| 948 | void galaxian_state::scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx) |
| 976 | 949 | { |
| 977 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 978 | 950 | /* update the star origin to the current frame */ |
| 979 | | stars_update_origin(machine); |
| 951 | stars_update_origin(); |
| 980 | 952 | |
| 981 | 953 | /* render stars if enabled */ |
| 982 | | if (state->m_stars_enabled) |
| 954 | if (m_stars_enabled) |
| 983 | 955 | { |
| 984 | | int blink_state = state->m_stars_blink_state & 3; |
| 956 | int blink_state = m_stars_blink_state & 3; |
| 985 | 957 | int y; |
| 986 | 958 | |
| 987 | 959 | /* iterate over scanlines */ |
| r20824 | r20825 | |
| 992 | 964 | { |
| 993 | 965 | /* blink states 0 and 1 suppress stars when certain bits of the color == 0 */ |
| 994 | 966 | static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff }; |
| 995 | | stars_draw_row(state, bitmap, maxx, y, y * 512, colormask_table[blink_state]); |
| 967 | stars_draw_row(bitmap, maxx, y, y * 512, colormask_table[blink_state]); |
| 996 | 968 | } |
| 997 | 969 | } |
| 998 | 970 | } |
| 999 | 971 | } |
| 1000 | 972 | |
| 1001 | 973 | |
| 1002 | | void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 974 | void galaxian_state::scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1003 | 975 | { |
| 1004 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1005 | 976 | /* blue background - 390 ohm resistor */ |
| 1006 | | bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); |
| 977 | bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); |
| 1007 | 978 | |
| 1008 | | scramble_draw_stars(machine, bitmap, cliprect, 256); |
| 979 | scramble_draw_stars(bitmap, cliprect, 256); |
| 1009 | 980 | } |
| 1010 | 981 | |
| 1011 | 982 | |
| 1012 | | void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 983 | void galaxian_state::anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1013 | 984 | { |
| 1014 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1015 | 985 | /* blue background, horizontal split as seen on flyer and real cabinet */ |
| 1016 | | background_draw_colorsplit(machine, bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); |
| 986 | background_draw_colorsplit(bitmap, cliprect, m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); |
| 1017 | 987 | |
| 1018 | | scramble_draw_stars(machine, bitmap, cliprect, 256); |
| 988 | scramble_draw_stars(bitmap, cliprect, 256); |
| 1019 | 989 | } |
| 1020 | 990 | |
| 1021 | 991 | |
| 1022 | | void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 992 | void galaxian_state::jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1023 | 993 | { |
| 1024 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1025 | 994 | /* blue background - 390 ohm resistor */ |
| 1026 | | bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); |
| 995 | bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); |
| 1027 | 996 | |
| 1028 | 997 | /* render stars same as scramble but nothing in the status area */ |
| 1029 | | scramble_draw_stars(machine, bitmap, cliprect, 240); |
| 998 | scramble_draw_stars(bitmap, cliprect, 240); |
| 1030 | 999 | } |
| 1031 | 1000 | |
| 1032 | 1001 | |
| 1033 | | void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1002 | void galaxian_state::turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1034 | 1003 | { |
| 1035 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1036 | 1004 | /* |
| 1037 | 1005 | The background color generator is connected this way: |
| 1038 | 1006 | |
| r20824 | r20825 | |
| 1040 | 1008 | GREEN - 470 ohm resistor |
| 1041 | 1009 | BLUE - 390 ohm resistor |
| 1042 | 1010 | */ |
| 1043 | | bitmap.fill(MAKE_RGB(state->m_background_red * 0x55, state->m_background_green * 0x47, state->m_background_blue * 0x55), cliprect); |
| 1011 | bitmap.fill(MAKE_RGB(m_background_red * 0x55, m_background_green * 0x47, m_background_blue * 0x55), cliprect); |
| 1044 | 1012 | } |
| 1045 | 1013 | |
| 1046 | 1014 | |
| 1047 | | void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1015 | void galaxian_state::frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1048 | 1016 | { |
| 1049 | 1017 | /* color split point verified on real machine */ |
| 1050 | 1018 | /* hmmm, according to schematics it is at 128+8; which is right? */ |
| 1051 | | background_draw_colorsplit(machine, bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8); |
| 1019 | background_draw_colorsplit(bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8); |
| 1052 | 1020 | } |
| 1053 | 1021 | |
| 1054 | 1022 | |
| 1055 | 1023 | #ifdef UNUSED_FUNCTION |
| 1056 | | static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect) |
| 1024 | int galaxian_state::flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect) |
| 1057 | 1025 | { |
| 1058 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1059 | 1026 | draw = cliprect; |
| 1060 | | if (!state->m_flipscreen_x) |
| 1027 | if (!m_flipscreen_x) |
| 1061 | 1028 | { |
| 1062 | 1029 | draw.min_x = xstart * GALAXIAN_XSCALE; |
| 1063 | 1030 | draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1); |
| r20824 | r20825 | |
| 1071 | 1038 | return (draw.min_x <= draw.max_x); |
| 1072 | 1039 | } |
| 1073 | 1040 | |
| 1074 | | void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1041 | void galaxian_state::amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1075 | 1042 | { |
| 1076 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1077 | | const UINT8 *prom = state->memregion("user1")->base(); |
| 1043 | const UINT8 *prom = memregion("user1")->base(); |
| 1078 | 1044 | rectangle draw; |
| 1079 | 1045 | int x; |
| 1080 | 1046 | |
| r20824 | r20825 | |
| 1095 | 1061 | GREEN - 560 ohm resistor |
| 1096 | 1062 | BLUE - 470 ohm resistor |
| 1097 | 1063 | */ |
| 1098 | | UINT8 red = ((~prom[x] & 0x02) && state->m_background_red) ? 0x7c : 0x00; |
| 1099 | | UINT8 green = ((~prom[x] & 0x02) && state->m_background_green) ? 0x3c : 0x00; |
| 1100 | | UINT8 blue = ((~prom[x] & 0x01) && state->m_background_blue) ? 0x47 : 0x00; |
| 1064 | UINT8 red = ((~prom[x] & 0x02) && m_background_red) ? 0x7c : 0x00; |
| 1065 | UINT8 green = ((~prom[x] & 0x02) && m_background_green) ? 0x3c : 0x00; |
| 1066 | UINT8 blue = ((~prom[x] & 0x01) && m_background_blue) ? 0x47 : 0x00; |
| 1101 | 1067 | bitmap.fill(MAKE_RGB(red, green, blue, draw)); |
| 1102 | 1068 | } |
| 1103 | 1069 | } |
| r20824 | r20825 | |
| 1111 | 1077 | * |
| 1112 | 1078 | *************************************/ |
| 1113 | 1079 | |
| 1114 | | INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color) |
| 1080 | inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color) |
| 1115 | 1081 | { |
| 1116 | 1082 | if (y >= cliprect.min_y && y <= cliprect.max_y) |
| 1117 | 1083 | { |
| r20824 | r20825 | |
| 1131 | 1097 | } |
| 1132 | 1098 | |
| 1133 | 1099 | |
| 1134 | | void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1100 | void galaxian_state::galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1135 | 1101 | { |
| 1136 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1137 | 1102 | /* |
| 1138 | 1103 | Both "shells" and "missiles" begin displaying when the horizontal counter |
| 1139 | 1104 | reaches $FC, and they stop displaying when it reaches $00, resulting in |
| r20824 | r20825 | |
| 1141 | 1106 | white; the final entry is called a "missile" and renders as yellow. |
| 1142 | 1107 | */ |
| 1143 | 1108 | x -= 4; |
| 1144 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1145 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1146 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1147 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); |
| 1109 | galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); |
| 1110 | galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); |
| 1111 | galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); |
| 1112 | galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); |
| 1148 | 1113 | } |
| 1149 | 1114 | |
| 1150 | 1115 | |
| 1151 | | void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1116 | void galaxian_state::mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1152 | 1117 | { |
| 1153 | 1118 | /* verified by schematics: |
| 1154 | 1119 | * both "W" and "Y" bullets are 4 pixels long |
| r20824 | r20825 | |
| 1177 | 1142 | } |
| 1178 | 1143 | |
| 1179 | 1144 | |
| 1180 | | void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1145 | void galaxian_state::scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1181 | 1146 | { |
| 1182 | 1147 | /* |
| 1183 | 1148 | Scramble only has "shells", which begin displaying when the counter |
| r20824 | r20825 | |
| 1189 | 1154 | } |
| 1190 | 1155 | |
| 1191 | 1156 | |
| 1192 | | void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1157 | void galaxian_state::theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1193 | 1158 | { |
| 1194 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1195 | 1159 | /* Same as galaxian except blue/green are swapped */ |
| 1196 | 1160 | x -= 4; |
| 1197 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1198 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1199 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1200 | | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); |
| 1161 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); |
| 1162 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); |
| 1163 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); |
| 1164 | galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); |
| 1201 | 1165 | } |
| 1202 | 1166 | |
| 1203 | 1167 | |
| r20824 | r20825 | |
| 1209 | 1173 | *************************************/ |
| 1210 | 1174 | |
| 1211 | 1175 | /*** generic ***/ |
| 1212 | | void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1176 | void galaxian_state::upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1213 | 1177 | { |
| 1214 | 1178 | /* tiles are in the upper half of a larger ROM */ |
| 1215 | 1179 | *code += 0x100; |
| 1216 | 1180 | } |
| 1217 | 1181 | |
| 1218 | | void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1182 | void galaxian_state::upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1219 | 1183 | { |
| 1220 | 1184 | /* sprites are in the upper half of a larger ROM */ |
| 1221 | 1185 | *code += 0x40; |
| r20824 | r20825 | |
| 1223 | 1187 | |
| 1224 | 1188 | |
| 1225 | 1189 | /*** Frogger ***/ |
| 1226 | | void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1190 | void galaxian_state::frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1227 | 1191 | { |
| 1228 | 1192 | *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); |
| 1229 | 1193 | } |
| 1230 | 1194 | |
| 1231 | | void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1195 | void galaxian_state::frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1232 | 1196 | { |
| 1233 | 1197 | *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); |
| 1234 | 1198 | } |
| 1235 | 1199 | |
| 1236 | 1200 | |
| 1237 | 1201 | /*** Ghostmuncher Galaxian ***/ |
| 1238 | | void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1202 | void galaxian_state::gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1239 | 1203 | { |
| 1240 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1241 | | *code |= state->m_gfxbank[0] << 9; |
| 1242 | | // *color |= state->m_gfxbank[0] << 3; |
| 1204 | *code |= m_gfxbank[0] << 9; |
| 1205 | // *color |= m_gfxbank[0] << 3; |
| 1243 | 1206 | } |
| 1244 | 1207 | |
| 1245 | | void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1208 | void galaxian_state::gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1246 | 1209 | { |
| 1247 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1248 | | *code |= (state->m_gfxbank[0] << 7) | 0x40; |
| 1249 | | *color |= state->m_gfxbank[0] << 3; |
| 1210 | *code |= (m_gfxbank[0] << 7) | 0x40; |
| 1211 | *color |= m_gfxbank[0] << 3; |
| 1250 | 1212 | } |
| 1251 | 1213 | |
| 1252 | 1214 | |
| 1253 | 1215 | /*** Pisces ***/ |
| 1254 | | void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1216 | void galaxian_state::pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1255 | 1217 | { |
| 1256 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1257 | | *code |= state->m_gfxbank[0] << 8; |
| 1218 | *code |= m_gfxbank[0] << 8; |
| 1258 | 1219 | } |
| 1259 | 1220 | |
| 1260 | | void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1221 | void galaxian_state::pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1261 | 1222 | { |
| 1262 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1263 | | *code |= state->m_gfxbank[0] << 6; |
| 1223 | *code |= m_gfxbank[0] << 6; |
| 1264 | 1224 | } |
| 1265 | 1225 | |
| 1266 | 1226 | |
| 1267 | 1227 | /*** Batman Part 2 ***/ |
| 1268 | | void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1228 | void galaxian_state::batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1269 | 1229 | { |
| 1270 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1271 | 1230 | if (*code & 0x80) |
| 1272 | | *code |= state->m_gfxbank[0] << 8; |
| 1231 | *code |= m_gfxbank[0] << 8; |
| 1273 | 1232 | } |
| 1274 | 1233 | |
| 1275 | 1234 | |
| 1276 | 1235 | /*** Moon Cresta ***/ |
| 1277 | | void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1236 | void galaxian_state::mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1278 | 1237 | { |
| 1279 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1280 | | if (state->m_gfxbank[2] && (*code & 0xc0) == 0x80) |
| 1281 | | *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; |
| 1238 | if (m_gfxbank[2] && (*code & 0xc0) == 0x80) |
| 1239 | *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100; |
| 1282 | 1240 | } |
| 1283 | 1241 | |
| 1284 | | void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1242 | void galaxian_state::mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1285 | 1243 | { |
| 1286 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1287 | | if (state->m_gfxbank[2] && (*code & 0x30) == 0x20) |
| 1288 | | *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; |
| 1244 | if (m_gfxbank[2] && (*code & 0x30) == 0x20) |
| 1245 | *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40; |
| 1289 | 1246 | } |
| 1290 | 1247 | |
| 1291 | 1248 | |
| 1292 | 1249 | /*** Moon Quasar ***/ |
| 1293 | | void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1250 | void galaxian_state::moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1294 | 1251 | { |
| 1295 | 1252 | *code |= (attrib & 0x20) << 3; |
| 1296 | 1253 | } |
| 1297 | 1254 | |
| 1298 | | void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1255 | void galaxian_state::moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1299 | 1256 | { |
| 1300 | 1257 | *code |= (base[2] & 0x20) << 1; |
| 1301 | 1258 | } |
| 1302 | 1259 | |
| 1303 | 1260 | |
| 1304 | 1261 | /*** Moon Shuttle ***/ |
| 1305 | | void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1262 | void galaxian_state::mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1306 | 1263 | { |
| 1307 | 1264 | *code |= (attrib & 0x30) << 4; |
| 1308 | 1265 | } |
| 1309 | 1266 | |
| 1310 | | void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1267 | void galaxian_state::mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1311 | 1268 | { |
| 1312 | 1269 | *code |= (base[2] & 0x30) << 2; |
| 1313 | 1270 | } |
| 1314 | 1271 | |
| 1315 | 1272 | |
| 1316 | 1273 | /*** Calipso ***/ |
| 1317 | | void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1274 | void galaxian_state::calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1318 | 1275 | { |
| 1319 | 1276 | /* same as the others, but no sprite flipping, but instead the bits are used |
| 1320 | 1277 | as extra sprite code bits, giving 256 sprite images */ |
| r20824 | r20825 | |
| 1326 | 1283 | |
| 1327 | 1284 | |
| 1328 | 1285 | /*** Jumpbug ***/ |
| 1329 | | void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1286 | void galaxian_state::jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) |
| 1330 | 1287 | { |
| 1331 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1332 | | if ((*code & 0xc0) == 0x80 && (state->m_gfxbank[2] & 0x01)) |
| 1333 | | *code += 128 + (( state->m_gfxbank[0] & 0x01) << 6) + |
| 1334 | | (( state->m_gfxbank[1] & 0x01) << 7) + |
| 1335 | | ((~state->m_gfxbank[4] & 0x01) << 8); |
| 1288 | if ((*code & 0xc0) == 0x80 && (m_gfxbank[2] & 0x01)) |
| 1289 | *code += 128 + (( m_gfxbank[0] & 0x01) << 6) + |
| 1290 | (( m_gfxbank[1] & 0x01) << 7) + |
| 1291 | ((~m_gfxbank[4] & 0x01) << 8); |
| 1336 | 1292 | } |
| 1337 | 1293 | |
| 1338 | | void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1294 | void galaxian_state::jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) |
| 1339 | 1295 | { |
| 1340 | | galaxian_state *state = machine.driver_data<galaxian_state>(); |
| 1341 | | if ((*code & 0x30) == 0x20 && (state->m_gfxbank[2] & 0x01) != 0) |
| 1296 | if ((*code & 0x30) == 0x20 && (m_gfxbank[2] & 0x01) != 0) |
| 1342 | 1297 | { |
| 1343 | | *code += 32 + (( state->m_gfxbank[0] & 0x01) << 4) + |
| 1344 | | (( state->m_gfxbank[1] & 0x01) << 5) + |
| 1345 | | ((~state->m_gfxbank[4] & 0x01) << 6); |
| 1298 | *code += 32 + (( m_gfxbank[0] & 0x01) << 4) + |
| 1299 | (( m_gfxbank[1] & 0x01) << 5) + |
| 1300 | ((~m_gfxbank[4] & 0x01) << 6); |
| 1346 | 1301 | } |
| 1347 | 1302 | } |
trunk/src/mame/video/gstriker.c
| r20824 | r20825 | |
| 50 | 50 | m_VS920A[1].tmap->mark_tile_dirty(offset); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | | static void VS920A_init(running_machine &machine, int numchips) |
| 53 | void gstriker_state::VS920A_init(int numchips) |
| 54 | 54 | { |
| 55 | | gstriker_state *state = machine.driver_data<gstriker_state>(); |
| 56 | 55 | int i; |
| 57 | 56 | |
| 58 | 57 | if (numchips > MAX_VS920A) |
| r20824 | r20825 | |
| 60 | 59 | |
| 61 | 60 | for (i=0;i<numchips;i++) |
| 62 | 61 | { |
| 63 | | state->m_VS920A[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),state),TILEMAP_SCAN_ROWS,8,8,64,32); |
| 62 | m_VS920A[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); |
| 64 | 63 | |
| 65 | | state->m_VS920A[i].tmap->set_transparent_pen(0); |
| 64 | m_VS920A[i].tmap->set_transparent_pen(0); |
| 66 | 65 | } |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | | static tilemap_t* VS920A_get_tilemap(gstriker_state *state, int numchip) |
| 68 | tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip) |
| 70 | 69 | { |
| 71 | | return state->m_VS920A[numchip].tmap; |
| 70 | return m_VS920A[numchip].tmap; |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | | static void VS920A_set_pal_base(gstriker_state *state, int numchip, int pal_base) |
| 73 | void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base) |
| 75 | 74 | { |
| 76 | | state->m_VS920A[numchip].pal_base = pal_base; |
| 75 | m_VS920A[numchip].pal_base = pal_base; |
| 77 | 76 | } |
| 78 | 77 | |
| 79 | | static void VS920A_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) |
| 78 | void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region) |
| 80 | 79 | { |
| 81 | | state->m_VS920A[numchip].gfx_region = gfx_region; |
| 80 | m_VS920A[numchip].gfx_region = gfx_region; |
| 82 | 81 | } |
| 83 | 82 | |
| 84 | | static void VS920A_draw(gstriker_state *state, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) |
| 83 | void gstriker_state::VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) |
| 85 | 84 | { |
| 86 | | state->m_VS920A_cur_chip = &state->m_VS920A[numchip]; |
| 85 | m_VS920A_cur_chip = &m_VS920A[numchip]; |
| 87 | 86 | |
| 88 | | state->m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority); |
| 87 | m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority); |
| 89 | 88 | } |
| 90 | 89 | |
| 91 | 90 | |
| r20824 | r20825 | |
| 207 | 206 | return (row*64) + (col&63) + ((col&64)<<6); |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | | static void MB60553_init(running_machine &machine, int numchips) |
| 209 | void gstriker_state::MB60553_init(int numchips) |
| 211 | 210 | { |
| 212 | | gstriker_state *state = machine.driver_data<gstriker_state>(); |
| 213 | 211 | int i; |
| 214 | 212 | |
| 215 | 213 | if (numchips > MAX_MB60553) |
| r20824 | r20825 | |
| 217 | 215 | |
| 218 | 216 | for (i=0;i<numchips;i++) |
| 219 | 217 | { |
| 220 | | state->m_MB60553[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),state),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),state), 16,16,128,64); |
| 218 | m_MB60553[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64); |
| 221 | 219 | |
| 222 | | state->m_MB60553[i].tmap->set_transparent_pen(0); |
| 220 | m_MB60553[i].tmap->set_transparent_pen(0); |
| 223 | 221 | } |
| 224 | 222 | } |
| 225 | 223 | |
| 226 | | static void MB60553_set_pal_base(gstriker_state *state, int numchip, int pal_base) |
| 224 | void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base) |
| 227 | 225 | { |
| 228 | | state->m_MB60553[numchip].pal_base = pal_base; |
| 226 | m_MB60553[numchip].pal_base = pal_base; |
| 229 | 227 | } |
| 230 | 228 | |
| 231 | | static void MB60553_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) |
| 229 | void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region) |
| 232 | 230 | { |
| 233 | | state->m_MB60553[numchip].gfx_region = gfx_region; |
| 231 | m_MB60553[numchip].gfx_region = gfx_region; |
| 234 | 232 | } |
| 235 | 233 | |
| 236 | 234 | /* THIS IS STILL WRONG! */ |
| 237 | | static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) |
| 235 | void gstriker_state::MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) |
| 238 | 236 | { |
| 239 | | gstriker_state *state = machine.driver_data<gstriker_state>(); |
| 240 | 237 | int line; |
| 241 | 238 | rectangle clip; |
| 242 | | state->m_MB60553_cur_chip = &state->m_MB60553[numchip]; |
| 239 | m_MB60553_cur_chip = &m_MB60553[numchip]; |
| 243 | 240 | |
| 244 | | clip.min_x = machine.primary_screen->visible_area().min_x; |
| 245 | | clip.max_x = machine.primary_screen->visible_area().max_x; |
| 241 | clip.min_x = machine().primary_screen->visible_area().min_x; |
| 242 | clip.max_x = machine().primary_screen->visible_area().max_x; |
| 246 | 243 | |
| 247 | 244 | for (line = 0; line < 224;line++) |
| 248 | 245 | { |
| r20824 | r20825 | |
| 253 | 250 | |
| 254 | 251 | UINT32 incxx,incyy; |
| 255 | 252 | |
| 256 | | startx = state->m_MB60553_cur_chip->regs[0]; |
| 257 | | starty = state->m_MB60553_cur_chip->regs[1]; |
| 253 | startx = m_MB60553_cur_chip->regs[0]; |
| 254 | starty = m_MB60553_cur_chip->regs[1]; |
| 258 | 255 | |
| 259 | 256 | startx += (24<<4); // maybe not.. |
| 260 | 257 | |
| 261 | | startx -= state->m_lineram[(line)*8+7]/2; |
| 258 | startx -= m_lineram[(line)*8+7]/2; |
| 262 | 259 | |
| 263 | | incxx = state->m_lineram[(line)*8+0]<<4; |
| 264 | | incyy = state->m_lineram[(line)*8+3]<<4; |
| 260 | incxx = m_lineram[(line)*8+0]<<4; |
| 261 | incyy = m_lineram[(line)*8+3]<<4; |
| 265 | 262 | |
| 266 | 263 | clip.min_y = clip.max_y = line; |
| 267 | 264 | |
| 268 | | state->m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12, |
| 265 | m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12, |
| 269 | 266 | incxx,0,0,incyy, |
| 270 | 267 | 1, |
| 271 | 268 | 0,priority); |
| r20824 | r20825 | |
| 276 | 273 | |
| 277 | 274 | } |
| 278 | 275 | |
| 279 | | static tilemap_t* MB60553_get_tilemap(gstriker_state *state, int numchip) |
| 276 | tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip) |
| 280 | 277 | { |
| 281 | | return state->m_MB60553[numchip].tmap; |
| 278 | return m_MB60553[numchip].tmap; |
| 282 | 279 | } |
| 283 | 280 | |
| 284 | 281 | |
| r20824 | r20825 | |
| 338 | 335 | |
| 339 | 336 | // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably |
| 340 | 337 | // needs sprite orthogonality |
| 341 | | MB60553_draw(machine(), 0, bitmap,cliprect, 0); |
| 338 | MB60553_draw(0, bitmap,cliprect, 0); |
| 342 | 339 | |
| 343 | 340 | m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0); |
| 344 | 341 | |
| 345 | | VS920A_draw(this, 0, bitmap, cliprect, 0); |
| 342 | VS920A_draw(0, bitmap, cliprect, 0); |
| 346 | 343 | |
| 347 | 344 | m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2); |
| 348 | 345 | |
| r20824 | r20825 | |
| 367 | 364 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 368 | 365 | |
| 369 | 366 | // Initalize the chip for the score plane |
| 370 | | VS920A_init(machine(), 1); |
| 371 | | VS920A_set_gfx_region(this, 0, 0); |
| 372 | | VS920A_set_pal_base(this, 0, 0x30); |
| 373 | | VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 367 | VS920A_init(1); |
| 368 | VS920A_set_gfx_region(0, 0); |
| 369 | VS920A_set_pal_base(0, 0x30); |
| 370 | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 374 | 371 | |
| 375 | 372 | // Initalize the chip for the screen plane |
| 376 | | MB60553_init(machine(), 1); |
| 377 | | MB60553_set_gfx_region(this, 0, 1); |
| 378 | | MB60553_set_pal_base(this, 0, 0); |
| 379 | | MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 373 | MB60553_init(1); |
| 374 | MB60553_set_gfx_region(0, 1); |
| 375 | MB60553_set_pal_base(0, 0); |
| 376 | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 380 | 377 | } |
| 381 | 378 | |
| 382 | 379 | VIDEO_START_MEMBER(gstriker_state,twrldc94) |
| r20824 | r20825 | |
| 384 | 381 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 385 | 382 | |
| 386 | 383 | // Initalize the chip for the score plane |
| 387 | | VS920A_init(machine(), 1); |
| 388 | | VS920A_set_gfx_region(this, 0, 0); |
| 389 | | VS920A_set_pal_base(this, 0, 0x40); |
| 390 | | VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 384 | VS920A_init(1); |
| 385 | VS920A_set_gfx_region(0, 0); |
| 386 | VS920A_set_pal_base(0, 0x40); |
| 387 | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 391 | 388 | |
| 392 | 389 | // Initalize the chip for the screen plane |
| 393 | | MB60553_init(machine(), 1); |
| 394 | | MB60553_set_gfx_region(this, 0, 1); |
| 395 | | MB60553_set_pal_base(this, 0, 0x50); |
| 396 | | MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 390 | MB60553_init(1); |
| 391 | MB60553_set_gfx_region(0, 1); |
| 392 | MB60553_set_pal_base(0, 0x50); |
| 393 | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 397 | 394 | } |
| 398 | 395 | |
| 399 | 396 | VIDEO_START_MEMBER(gstriker_state,vgoalsoc) |
| r20824 | r20825 | |
| 401 | 398 | // Palette bases are hardcoded, but should be probably extracted from the mixer registers |
| 402 | 399 | |
| 403 | 400 | // Initalize the chip for the score plane |
| 404 | | VS920A_init(machine(), 1); |
| 405 | | VS920A_set_gfx_region(this, 0, 0); |
| 406 | | VS920A_set_pal_base(this, 0, 0x30); |
| 407 | | VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 401 | VS920A_init(1); |
| 402 | VS920A_set_gfx_region(0, 0); |
| 403 | VS920A_set_pal_base(0, 0x30); |
| 404 | VS920A_get_tilemap(0)->set_transparent_pen(0xf); |
| 408 | 405 | |
| 409 | 406 | // Initalize the chip for the screen plane |
| 410 | | MB60553_init(machine(), 1); |
| 411 | | MB60553_set_gfx_region(this, 0, 1); |
| 412 | | MB60553_set_pal_base(this, 0, 0x20); |
| 413 | | MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); |
| 407 | MB60553_init(1); |
| 408 | MB60553_set_gfx_region(0, 1); |
| 409 | MB60553_set_pal_base(0, 0x20); |
| 410 | MB60553_get_tilemap(0)->set_transparent_pen(0xf); |
| 414 | 411 | } |
trunk/src/mame/video/galaxold.c
| r20824 | r20825 | |
| 7 | 7 | #include "emu.h" |
| 8 | 8 | #include "includes/galaxold.h" |
| 9 | 9 | |
| 10 | | #define STARS_COLOR_BASE_LEGACY (machine.root_device().memregion("proms")->bytes()) |
| 11 | 10 | #define STARS_COLOR_BASE (machine().root_device().memregion("proms")->bytes()) |
| 12 | 11 | #define BULLETS_COLOR_BASE (STARS_COLOR_BASE + 64) |
| 13 | | #define BULLETS_COLOR_BASE_LEGACY (STARS_COLOR_BASE_LEGACY + 64) |
| 14 | 12 | #define BACKGROUND_COLOR_BASE (BULLETS_COLOR_BASE + 2) |
| 15 | | #define BACKGROUND_COLOR_BASE_LEGACY (BULLETS_COLOR_BASE_LEGACY + 2) |
| 16 | 13 | |
| 17 | | |
| 18 | | |
| 19 | | |
| 20 | | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 21 | | static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 22 | | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 23 | | static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 24 | | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); |
| 25 | | |
| 26 | | static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 27 | | static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 28 | | static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 29 | | static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 30 | | static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 31 | | static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); |
| 32 | | |
| 33 | | static void drivfrcg_modify_color(UINT8 *color); |
| 34 | | |
| 35 | | |
| 36 | | |
| 37 | | |
| 38 | | void galaxold_init_stars(running_machine &machine, int colors_offset); |
| 39 | | static void noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 40 | | void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 41 | | static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 42 | | static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 43 | | static void mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 44 | | static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c); |
| 45 | | static void start_stars_scroll_timer(running_machine &machine); |
| 46 | | |
| 47 | | /* bullets circuit */ |
| 48 | | static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 49 | | static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 50 | | static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 51 | | static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 52 | | |
| 53 | | /* background circuit */ |
| 54 | | static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | | static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 56 | | static void ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 57 | | static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 58 | | static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | | static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 60 | | static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | | static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 62 | | |
| 63 | | |
| 64 | | |
| 65 | | |
| 66 | 14 | /*************************************************************************** |
| 67 | 15 | |
| 68 | 16 | Convert the color PROMs into a more useable format. |
| r20824 | r20825 | |
| 127 | 75 | } |
| 128 | 76 | |
| 129 | 77 | |
| 130 | | galaxold_init_stars(machine(), STARS_COLOR_BASE); |
| 78 | galaxold_init_stars(STARS_COLOR_BASE); |
| 131 | 79 | |
| 132 | 80 | |
| 133 | 81 | /* bullets - yellow and white */ |
| r20824 | r20825 | |
| 372 | 320 | } |
| 373 | 321 | |
| 374 | 322 | |
| 375 | | galaxold_init_stars(machine(), STARS_COLOR_BASE); |
| 323 | galaxold_init_stars(STARS_COLOR_BASE); |
| 376 | 324 | |
| 377 | 325 | |
| 378 | 326 | /* bullets - yellow and white */ |
| r20824 | r20825 | |
| 430 | 378 | |
| 431 | 379 | ***************************************************************************/ |
| 432 | 380 | |
| 433 | | static void state_save_register(running_machine &machine) |
| 381 | void galaxold_state::state_save_register() |
| 434 | 382 | { |
| 435 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 436 | | state_save_register_global_array(machine, state->m_gfxbank); |
| 437 | | state_save_register_global(machine, state->m_flipscreen_x); |
| 438 | | state_save_register_global(machine, state->m_flipscreen_y); |
| 383 | state_save_register_global_array(machine(), m_gfxbank); |
| 384 | state_save_register_global(machine(), m_flipscreen_x); |
| 385 | state_save_register_global(machine(), m_flipscreen_y); |
| 439 | 386 | |
| 440 | | state_save_register_global(machine, state->m_stars_on); |
| 441 | | state_save_register_global(machine, state->m_stars_scrollpos); |
| 442 | | state_save_register_global(machine, state->m_stars_blink_state); |
| 387 | state_save_register_global(machine(), m_stars_on); |
| 388 | state_save_register_global(machine(), m_stars_scrollpos); |
| 389 | state_save_register_global(machine(), m_stars_blink_state); |
| 443 | 390 | |
| 444 | | state_save_register_global(machine, state->m_darkplnt_bullet_color); |
| 391 | state_save_register_global(machine(), m_darkplnt_bullet_color); |
| 445 | 392 | |
| 446 | | state_save_register_global(machine, state->m_background_enable); |
| 447 | | state_save_register_global(machine, state->m_background_red); |
| 448 | | state_save_register_global(machine, state->m_background_green); |
| 449 | | state_save_register_global(machine, state->m_background_blue); |
| 393 | state_save_register_global(machine(), m_background_enable); |
| 394 | state_save_register_global(machine(), m_background_red); |
| 395 | state_save_register_global(machine(), m_background_green); |
| 396 | state_save_register_global(machine(), m_background_blue); |
| 450 | 397 | } |
| 451 | 398 | |
| 452 | | static void video_start_common(running_machine &machine) |
| 399 | void galaxold_state::video_start_common() |
| 453 | 400 | { |
| 454 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 455 | | state->m_modify_charcode = 0; |
| 456 | | state->m_modify_spritecode = 0; |
| 457 | | state->m_modify_color = 0; |
| 458 | | state->m_modify_ypos = 0; |
| 401 | m_modify_charcode = 0; |
| 402 | m_modify_spritecode = 0; |
| 403 | m_modify_color = 0; |
| 404 | m_modify_ypos = 0; |
| 459 | 405 | |
| 460 | | state->m_mooncrst_gfxextend = 0; |
| 406 | m_mooncrst_gfxextend = 0; |
| 461 | 407 | |
| 462 | | state->m_draw_bullets = 0; |
| 408 | m_draw_bullets = 0; |
| 463 | 409 | |
| 464 | | state->m_draw_background = galaxold_draw_background; |
| 465 | | state->m_background_enable = 0; |
| 466 | | state->m_background_blue = 0; |
| 467 | | state->m_background_red = 0; |
| 468 | | state->m_background_green = 0; |
| 410 | m_draw_background = &galaxold_state::galaxold_draw_background; |
| 411 | m_background_enable = 0; |
| 412 | m_background_blue = 0; |
| 413 | m_background_red = 0; |
| 414 | m_background_green = 0; |
| 469 | 415 | |
| 470 | | state->m_draw_stars = noop_draw_stars; |
| 416 | m_draw_stars = &galaxold_state::noop_draw_stars; |
| 471 | 417 | |
| 472 | | state->m_flipscreen_x = 0; |
| 473 | | state->m_flipscreen_y = 0; |
| 418 | m_flipscreen_x = 0; |
| 419 | m_flipscreen_y = 0; |
| 474 | 420 | |
| 475 | | state->m_spriteram2_present = 0; |
| 421 | m_spriteram2_present = 0; |
| 476 | 422 | |
| 477 | | state_save_register(machine); |
| 423 | state_save_register(); |
| 478 | 424 | } |
| 479 | 425 | |
| 480 | 426 | VIDEO_START_MEMBER(galaxold_state,galaxold_plain) |
| 481 | 427 | { |
| 482 | | video_start_common(machine()); |
| 428 | video_start_common(); |
| 483 | 429 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 484 | 430 | m_bg_tilemap->set_transparent_pen(0); |
| 485 | 431 | |
| r20824 | r20825 | |
| 492 | 438 | { |
| 493 | 439 | VIDEO_START_CALL_MEMBER(galaxold_plain); |
| 494 | 440 | |
| 495 | | m_draw_stars = galaxold_draw_stars; |
| 441 | m_draw_stars = &galaxold_state::galaxold_draw_stars; |
| 496 | 442 | |
| 497 | | m_draw_bullets = galaxold_draw_bullets; |
| 443 | m_draw_bullets = &galaxold_state::galaxold_draw_bullets; |
| 498 | 444 | } |
| 499 | 445 | |
| 500 | 446 | VIDEO_START_MEMBER(galaxold_state,scrambold) |
| r20824 | r20825 | |
| 506 | 452 | */ |
| 507 | 453 | m_bg_tilemap->set_scrolldx(0, 0); |
| 508 | 454 | |
| 509 | | m_draw_stars = scrambold_draw_stars; |
| 455 | m_draw_stars = &galaxold_state::scrambold_draw_stars; |
| 510 | 456 | |
| 511 | | m_draw_bullets = scrambold_draw_bullets; |
| 457 | m_draw_bullets = &galaxold_state::scrambold_draw_bullets; |
| 512 | 458 | |
| 513 | | m_draw_background = scrambold_draw_background; |
| 459 | m_draw_background = &galaxold_state::scrambold_draw_background; |
| 514 | 460 | } |
| 515 | 461 | |
| 516 | 462 | VIDEO_START_MEMBER(galaxold_state,darkplnt) |
| r20824 | r20825 | |
| 518 | 464 | VIDEO_START_CALL_MEMBER(galaxold_plain); |
| 519 | 465 | |
| 520 | 466 | m_bg_tilemap->set_scrolldx(0, 0); |
| 521 | | m_draw_bullets = darkplnt_draw_bullets; |
| 467 | m_draw_bullets = &galaxold_state::darkplnt_draw_bullets; |
| 522 | 468 | } |
| 523 | 469 | |
| 524 | 470 | VIDEO_START_MEMBER(galaxold_state,rescue) |
| 525 | 471 | { |
| 526 | 472 | VIDEO_START_CALL_MEMBER(scrambold); |
| 527 | 473 | |
| 528 | | m_draw_stars = rescue_draw_stars; |
| 474 | m_draw_stars = &galaxold_state::rescue_draw_stars; |
| 529 | 475 | |
| 530 | | m_draw_background = rescue_draw_background; |
| 476 | m_draw_background = &galaxold_state::rescue_draw_background; |
| 531 | 477 | } |
| 532 | 478 | |
| 533 | 479 | VIDEO_START_MEMBER(galaxold_state,minefld) |
| 534 | 480 | { |
| 535 | 481 | VIDEO_START_CALL_MEMBER(scrambold); |
| 536 | 482 | |
| 537 | | m_draw_stars = rescue_draw_stars; |
| 483 | m_draw_stars = &galaxold_state::rescue_draw_stars; |
| 538 | 484 | |
| 539 | | m_draw_background = minefld_draw_background; |
| 485 | m_draw_background = &galaxold_state::minefld_draw_background; |
| 540 | 486 | } |
| 541 | 487 | |
| 542 | 488 | VIDEO_START_MEMBER(galaxold_state,stratgyx) |
| 543 | 489 | { |
| 544 | 490 | VIDEO_START_CALL_MEMBER(galaxold_plain); |
| 545 | 491 | |
| 546 | | m_draw_background = stratgyx_draw_background; |
| 492 | m_draw_background = &galaxold_state::stratgyx_draw_background; |
| 547 | 493 | } |
| 548 | 494 | |
| 549 | 495 | VIDEO_START_MEMBER(galaxold_state,ckongs) |
| 550 | 496 | { |
| 551 | 497 | VIDEO_START_CALL_MEMBER(scrambold); |
| 552 | 498 | |
| 553 | | m_modify_spritecode = mshuttle_modify_spritecode; |
| 499 | m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode; |
| 554 | 500 | } |
| 555 | 501 | |
| 556 | 502 | VIDEO_START_MEMBER(galaxold_state,mariner) |
| 557 | 503 | { |
| 558 | 504 | VIDEO_START_CALL_MEMBER(galaxold_plain); |
| 559 | 505 | |
| 560 | | m_draw_stars = mariner_draw_stars; |
| 506 | m_draw_stars = &galaxold_state::mariner_draw_stars; |
| 561 | 507 | |
| 562 | | m_draw_bullets = scrambold_draw_bullets; |
| 508 | m_draw_bullets = &galaxold_state::scrambold_draw_bullets; |
| 563 | 509 | |
| 564 | | m_draw_background = mariner_draw_background; |
| 510 | m_draw_background = &galaxold_state::mariner_draw_background; |
| 565 | 511 | |
| 566 | | m_modify_charcode = mariner_modify_charcode; |
| 512 | m_modify_charcode = &galaxold_state::mariner_modify_charcode; |
| 567 | 513 | } |
| 568 | 514 | |
| 569 | 515 | VIDEO_START_MEMBER(galaxold_state,mimonkey) |
| 570 | 516 | { |
| 571 | 517 | VIDEO_START_CALL_MEMBER(scrambold); |
| 572 | 518 | |
| 573 | | m_modify_charcode = mimonkey_modify_charcode; |
| 574 | | m_modify_spritecode = mimonkey_modify_spritecode; |
| 519 | m_modify_charcode = &galaxold_state::mimonkey_modify_charcode; |
| 520 | m_modify_spritecode = &galaxold_state::mimonkey_modify_spritecode; |
| 575 | 521 | } |
| 576 | 522 | |
| 577 | 523 | VIDEO_START_MEMBER(galaxold_state,dkongjrm) |
| 578 | 524 | { |
| 579 | 525 | VIDEO_START_CALL_MEMBER(galaxold_plain); |
| 580 | 526 | |
| 581 | | m_modify_charcode = pisces_modify_charcode; |
| 582 | | m_modify_spritecode = dkongjrm_modify_spritecode; |
| 527 | m_modify_charcode = &galaxold_state::pisces_modify_charcode; |
| 528 | m_modify_spritecode = &galaxold_state::dkongjrm_modify_spritecode; |
| 583 | 529 | |
| 584 | 530 | m_spriteram2_present= 1; |
| 585 | 531 | } |
| r20824 | r20825 | |
| 588 | 534 | { |
| 589 | 535 | VIDEO_START_CALL_MEMBER(scrambold); |
| 590 | 536 | |
| 591 | | m_modify_spritecode = batman2_modify_spritecode; |
| 537 | m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; |
| 592 | 538 | } |
| 593 | 539 | |
| 594 | | static void pisces_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 540 | void galaxold_state::pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 595 | 541 | { |
| 596 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 597 | | *code |= (state->m_gfxbank[0] << 6); |
| 542 | *code |= (m_gfxbank[0] << 6); |
| 598 | 543 | } |
| 599 | 544 | |
| 600 | 545 | VIDEO_START_MEMBER(galaxold_state,pisces) |
| 601 | 546 | { |
| 602 | 547 | VIDEO_START_CALL_MEMBER(galaxold); |
| 603 | 548 | |
| 604 | | m_modify_charcode = pisces_modify_charcode; |
| 605 | | m_modify_spritecode = pisces_modify_spritecode; |
| 549 | m_modify_charcode = &galaxold_state::pisces_modify_charcode; |
| 550 | m_modify_spritecode = &galaxold_state::pisces_modify_spritecode; |
| 606 | 551 | } |
| 607 | 552 | |
| 608 | 553 | #ifdef UNUSED_FUNCTION |
| 609 | | static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 554 | void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 610 | 555 | { |
| 611 | 556 | int i; |
| 612 | 557 | |
| r20824 | r20825 | |
| 625 | 570 | { |
| 626 | 571 | VIDEO_START_CALL_MEMBER(galaxold); |
| 627 | 572 | |
| 628 | | m_draw_bullets = theend_draw_bullets; |
| 573 | m_draw_bullets = &galaxold_state::theend_draw_bullets; |
| 629 | 574 | } |
| 630 | 575 | #endif |
| 631 | 576 | |
| 632 | | static void mooncrst_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 577 | void galaxold_state::mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 633 | 578 | { |
| 634 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 635 | | if (state->m_gfxbank[2] && ((*code & 0x30) == 0x20)) |
| 579 | if (m_gfxbank[2] && ((*code & 0x30) == 0x20)) |
| 636 | 580 | { |
| 637 | | *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; |
| 581 | *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40; |
| 638 | 582 | } |
| 639 | 583 | } |
| 640 | 584 | |
| r20824 | r20825 | |
| 642 | 586 | { |
| 643 | 587 | VIDEO_START_CALL_MEMBER(galaxold); |
| 644 | 588 | |
| 645 | | m_modify_charcode = mooncrst_modify_charcode; |
| 646 | | m_modify_spritecode = mooncrst_modify_spritecode; |
| 589 | m_modify_charcode = &galaxold_state::mooncrst_modify_charcode; |
| 590 | m_modify_spritecode = &galaxold_state::mooncrst_modify_spritecode; |
| 647 | 591 | } |
| 648 | 592 | |
| 649 | | static void batman2_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 593 | void galaxold_state::batman2_modify_charcode(UINT16 *code, UINT8 x) |
| 650 | 594 | { |
| 651 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 652 | 595 | if (*code & 0x80) |
| 653 | 596 | { |
| 654 | | *code |= (state->m_gfxbank[0] << 8); |
| 597 | *code |= (m_gfxbank[0] << 8); |
| 655 | 598 | } |
| 656 | 599 | } |
| 657 | 600 | |
| r20824 | r20825 | |
| 659 | 602 | { |
| 660 | 603 | VIDEO_START_CALL_MEMBER(galaxold); |
| 661 | 604 | |
| 662 | | m_modify_charcode = batman2_modify_charcode; |
| 663 | | m_modify_spritecode = batman2_modify_spritecode; |
| 605 | m_modify_charcode = &galaxold_state::batman2_modify_charcode; |
| 606 | m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; |
| 664 | 607 | } |
| 665 | 608 | |
| 666 | 609 | |
| 667 | 610 | |
| 668 | | static void rockclim_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 611 | void galaxold_state::rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 669 | 612 | { |
| 670 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 671 | | state->m_rockclim_tilemap->draw(bitmap, cliprect, 0,0); |
| 613 | m_rockclim_tilemap->draw(bitmap, cliprect, 0,0); |
| 672 | 614 | } |
| 673 | 615 | |
| 674 | | static void rockclim_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 616 | void galaxold_state::rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 675 | 617 | { |
| 676 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 677 | | if (state->m_gfxbank[2]) *code|=0x40; |
| 618 | if (m_gfxbank[2]) *code|=0x40; |
| 678 | 619 | } |
| 679 | 620 | |
| 680 | 621 | VIDEO_START_MEMBER(galaxold_state,rockclim) |
| r20824 | r20825 | |
| 682 | 623 | VIDEO_START_CALL_MEMBER(galaxold); |
| 683 | 624 | m_rockclim_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::rockclim_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); |
| 684 | 625 | |
| 685 | | m_draw_background = rockclim_draw_background; |
| 686 | | m_modify_charcode = mooncrst_modify_charcode; |
| 687 | | m_modify_spritecode = rockclim_modify_spritecode; |
| 626 | m_draw_background = &galaxold_state::rockclim_draw_background; |
| 627 | m_modify_charcode = &galaxold_state::mooncrst_modify_charcode; |
| 628 | m_modify_spritecode = &galaxold_state::rockclim_modify_spritecode; |
| 688 | 629 | |
| 689 | 630 | m_rockclim_v = m_rockclim_h = 0; |
| 690 | 631 | state_save_register_global(machine(), m_rockclim_v); |
| r20824 | r20825 | |
| 706 | 647 | |
| 707 | 648 | VIDEO_START_MEMBER(galaxold_state,drivfrcg) |
| 708 | 649 | { |
| 709 | | video_start_common(machine()); |
| 650 | video_start_common(); |
| 710 | 651 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 711 | 652 | |
| 712 | 653 | m_bg_tilemap->set_transparent_pen(0); |
| 713 | 654 | m_bg_tilemap->set_scroll_cols(32); |
| 714 | 655 | |
| 715 | | m_modify_spritecode = mshuttle_modify_spritecode; |
| 716 | | m_modify_color = drivfrcg_modify_color; |
| 656 | m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode; |
| 657 | m_modify_color = &galaxold_state::drivfrcg_modify_color; |
| 717 | 658 | |
| 718 | 659 | m_color_mask = 0xff; |
| 719 | 660 | } |
| 720 | 661 | |
| 721 | 662 | VIDEO_START_MEMBER(galaxold_state,ad2083) |
| 722 | 663 | { |
| 723 | | video_start_common(machine()); |
| 664 | video_start_common(); |
| 724 | 665 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 725 | 666 | |
| 726 | 667 | m_bg_tilemap->set_transparent_pen(0); |
| 727 | 668 | m_bg_tilemap->set_scroll_cols(32); |
| 728 | 669 | |
| 729 | | m_modify_spritecode = ad2083_modify_spritecode; |
| 670 | m_modify_spritecode = &galaxold_state::ad2083_modify_spritecode; |
| 730 | 671 | |
| 731 | | m_draw_bullets = scrambold_draw_bullets; |
| 672 | m_draw_bullets = &galaxold_state::scrambold_draw_bullets; |
| 732 | 673 | |
| 733 | | m_draw_background = ad2083_draw_background; |
| 674 | m_draw_background = &galaxold_state::ad2083_draw_background; |
| 734 | 675 | |
| 735 | 676 | m_color_mask = 7; |
| 736 | 677 | } |
| r20824 | r20825 | |
| 756 | 697 | |
| 757 | 698 | VIDEO_START_MEMBER(galaxold_state,racknrol) |
| 758 | 699 | { |
| 759 | | video_start_common(machine()); |
| 700 | video_start_common(); |
| 760 | 701 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::racknrol_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 761 | 702 | |
| 762 | 703 | m_bg_tilemap->set_transparent_pen(0); |
| r20824 | r20825 | |
| 780 | 721 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 781 | 722 | } |
| 782 | 723 | |
| 783 | | static void harem_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 724 | void galaxold_state::harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 784 | 725 | { |
| 785 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 786 | | *code |= (state->m_gfxbank[0] << 7) | 0x40; |
| 726 | *code |= (m_gfxbank[0] << 7) | 0x40; |
| 787 | 727 | } |
| 788 | 728 | |
| 789 | 729 | VIDEO_START_MEMBER(galaxold_state,harem) |
| 790 | 730 | { |
| 791 | | video_start_common(machine()); |
| 731 | video_start_common(); |
| 792 | 732 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::harem_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); |
| 793 | 733 | // m_bg_tilemap->set_transparent_pen(0); // opaque tilemap to get sky and sand colors |
| 794 | 734 | |
| r20824 | r20825 | |
| 796 | 736 | |
| 797 | 737 | m_color_mask = (machine().gfx[0]->granularity() == 4) ? 7 : 3; |
| 798 | 738 | |
| 799 | | m_modify_spritecode = harem_modify_spritecode; |
| 739 | m_modify_spritecode = &galaxold_state::harem_modify_spritecode; |
| 800 | 740 | } |
| 801 | 741 | |
| 802 | 742 | VIDEO_START_MEMBER(galaxold_state,ozon1) |
| r20824 | r20825 | |
| 812 | 752 | |
| 813 | 753 | m_bg_tilemap->set_scrolldx(0, 384-256); |
| 814 | 754 | |
| 815 | | m_modify_spritecode = batman2_modify_spritecode; |
| 755 | m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; |
| 816 | 756 | } |
| 817 | 757 | |
| 818 | 758 | TILE_GET_INFO_MEMBER(galaxold_state::dambustr_get_tile_info2) |
| r20824 | r20825 | |
| 824 | 764 | |
| 825 | 765 | if (m_modify_charcode) |
| 826 | 766 | { |
| 827 | | (*m_modify_charcode)(machine(), &code, x); |
| 767 | (this->*m_modify_charcode)(&code, x); |
| 828 | 768 | } |
| 829 | 769 | |
| 830 | 770 | if (m_modify_color) |
| 831 | 771 | { |
| 832 | | (*m_modify_color)(&color); |
| 772 | (this->*m_modify_color)(&color); |
| 833 | 773 | } |
| 834 | 774 | |
| 835 | 775 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| r20824 | r20825 | |
| 845 | 785 | m_dambustr_bg_priority = 0; |
| 846 | 786 | m_dambustr_char_bank = 0; |
| 847 | 787 | |
| 848 | | m_draw_background = dambustr_draw_background; |
| 788 | m_draw_background = &galaxold_state::dambustr_draw_background; |
| 849 | 789 | |
| 850 | | m_modify_charcode = dambustr_modify_charcode; |
| 851 | | m_modify_spritecode = dambustr_modify_spritecode; |
| 790 | m_modify_charcode = &galaxold_state::dambustr_modify_charcode; |
| 791 | m_modify_spritecode = &galaxold_state::dambustr_modify_spritecode; |
| 852 | 792 | |
| 853 | | m_draw_bullets = dambustr_draw_bullets; |
| 793 | m_draw_bullets = &galaxold_state::dambustr_draw_bullets; |
| 854 | 794 | |
| 855 | 795 | /* allocate the temporary bitmap for the background priority */ |
| 856 | 796 | m_dambustr_tmpbitmap = auto_bitmap_ind16_alloc(machine(), machine().primary_screen->width(), machine().primary_screen->height()); |
| r20824 | r20825 | |
| 891 | 831 | { |
| 892 | 832 | if (m_modify_ypos) |
| 893 | 833 | { |
| 894 | | (*m_modify_ypos)(&data); |
| 834 | (this->*m_modify_ypos)(&data); |
| 895 | 835 | } |
| 896 | 836 | |
| 897 | 837 | m_bg_tilemap->set_scrolly(offset >> 1, data); |
| r20824 | r20825 | |
| 1036 | 976 | |
| 1037 | 977 | /* character banking functions */ |
| 1038 | 978 | |
| 1039 | | static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 979 | void galaxold_state::mooncrst_modify_charcode(UINT16 *code, UINT8 x) |
| 1040 | 980 | { |
| 1041 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1042 | | if (state->m_gfxbank[2] && ((*code & 0xc0) == 0x80)) |
| 981 | if (m_gfxbank[2] && ((*code & 0xc0) == 0x80)) |
| 1043 | 982 | { |
| 1044 | | *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; |
| 983 | *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100; |
| 1045 | 984 | } |
| 1046 | 985 | } |
| 1047 | 986 | |
| 1048 | | static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 987 | void galaxold_state::pisces_modify_charcode(UINT16 *code, UINT8 x) |
| 1049 | 988 | { |
| 1050 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1051 | | *code |= (state->m_gfxbank[0] << 8); |
| 989 | *code |= (m_gfxbank[0] << 8); |
| 1052 | 990 | } |
| 1053 | 991 | |
| 1054 | | static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 992 | void galaxold_state::mimonkey_modify_charcode(UINT16 *code, UINT8 x) |
| 1055 | 993 | { |
| 1056 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1057 | | *code |= (state->m_gfxbank[0] << 8) | (state->m_gfxbank[2] << 9); |
| 994 | *code |= (m_gfxbank[0] << 8) | (m_gfxbank[2] << 9); |
| 1058 | 995 | } |
| 1059 | 996 | |
| 1060 | | static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 997 | void galaxold_state::mariner_modify_charcode(UINT16 *code, UINT8 x) |
| 1061 | 998 | { |
| 1062 | 999 | UINT8 *prom; |
| 1063 | 1000 | |
| 1064 | 1001 | |
| 1065 | 1002 | /* bit 0 of the PROM controls character banking */ |
| 1066 | 1003 | |
| 1067 | | prom = machine.root_device().memregion("user2")->base(); |
| 1004 | prom = machine().root_device().memregion("user2")->base(); |
| 1068 | 1005 | |
| 1069 | 1006 | *code |= ((prom[x] & 0x01) << 8); |
| 1070 | 1007 | } |
| 1071 | 1008 | |
| 1072 | | static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1009 | void galaxold_state::dambustr_modify_charcode(UINT16 *code, UINT8 x) |
| 1073 | 1010 | { |
| 1074 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1075 | | if (state->m_dambustr_char_bank == 0) { // text mode |
| 1011 | if (m_dambustr_char_bank == 0) { // text mode |
| 1076 | 1012 | *code |= 0x0300; |
| 1077 | 1013 | } |
| 1078 | 1014 | else { // graphics mode |
| r20824 | r20825 | |
| 1087 | 1023 | |
| 1088 | 1024 | /* sprite banking functions */ |
| 1089 | 1025 | |
| 1090 | | static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1026 | void galaxold_state::mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1091 | 1027 | { |
| 1092 | 1028 | *code |= ((spriteram[offs + 2] & 0x30) << 2); |
| 1093 | 1029 | } |
| 1094 | 1030 | |
| 1095 | 1031 | |
| 1096 | | static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1032 | void galaxold_state::mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1097 | 1033 | { |
| 1098 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1099 | | *code |= (state->m_gfxbank[0] << 6) | (state->m_gfxbank[2] << 7); |
| 1034 | *code |= (m_gfxbank[0] << 6) | (m_gfxbank[2] << 7); |
| 1100 | 1035 | } |
| 1101 | 1036 | |
| 1102 | | static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1037 | void galaxold_state::batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1103 | 1038 | { |
| 1104 | 1039 | /* only the upper 64 sprites are used */ |
| 1105 | 1040 | *code |= 0x40; |
| 1106 | 1041 | } |
| 1107 | 1042 | |
| 1108 | | static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1043 | void galaxold_state::dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1109 | 1044 | { |
| 1110 | 1045 | /* No x flip */ |
| 1111 | 1046 | *code = (spriteram[offs + 1] & 0x7f) | 0x80; |
| 1112 | 1047 | *flipx = 0; |
| 1113 | 1048 | } |
| 1114 | 1049 | |
| 1115 | | static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1050 | void galaxold_state::ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1116 | 1051 | { |
| 1117 | 1052 | /* No x flip */ |
| 1118 | 1053 | *code = (spriteram[offs + 1] & 0x7f) | ((spriteram[offs + 2] & 0x30) << 2); |
| 1119 | 1054 | *flipx = 0; |
| 1120 | 1055 | } |
| 1121 | 1056 | |
| 1122 | | static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1057 | void galaxold_state::dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1123 | 1058 | { |
| 1124 | 1059 | *code += 0x40; |
| 1125 | 1060 | } |
| r20824 | r20825 | |
| 1127 | 1062 | |
| 1128 | 1063 | /* color PROM mapping functions */ |
| 1129 | 1064 | |
| 1130 | | static void drivfrcg_modify_color(UINT8 *color) |
| 1065 | void galaxold_state::drivfrcg_modify_color(UINT8 *color) |
| 1131 | 1066 | { |
| 1132 | 1067 | *color = ((*color & 0x40) >> 3) | (*color & 7); |
| 1133 | 1068 | } |
| r20824 | r20825 | |
| 1137 | 1072 | |
| 1138 | 1073 | /* bullet drawing functions */ |
| 1139 | 1074 | |
| 1140 | | static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1075 | void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1141 | 1076 | { |
| 1142 | 1077 | int i; |
| 1143 | 1078 | |
| r20824 | r20825 | |
| 1152 | 1087 | |
| 1153 | 1088 | |
| 1154 | 1089 | /* yellow missile, white shells (this is the terminology on the schematics) */ |
| 1155 | | color = ((offs == 7*4) ? BULLETS_COLOR_BASE_LEGACY : BULLETS_COLOR_BASE_LEGACY + 1); |
| 1090 | color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); |
| 1156 | 1091 | |
| 1157 | 1092 | bitmap.pix16(y, x) = color; |
| 1158 | 1093 | } |
| 1159 | 1094 | } |
| 1160 | 1095 | } |
| 1161 | 1096 | |
| 1162 | | static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1097 | void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1163 | 1098 | { |
| 1164 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1165 | | if (state->m_flipscreen_x) x++; |
| 1099 | if (m_flipscreen_x) x++; |
| 1166 | 1100 | |
| 1167 | 1101 | x = x - 6; |
| 1168 | 1102 | |
| 1169 | 1103 | if (cliprect.contains(x, y)) |
| 1170 | 1104 | /* yellow bullets */ |
| 1171 | | bitmap.pix16(y, x) = BULLETS_COLOR_BASE_LEGACY; |
| 1105 | bitmap.pix16(y, x) = BULLETS_COLOR_BASE; |
| 1172 | 1106 | } |
| 1173 | 1107 | |
| 1174 | | static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1108 | void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1175 | 1109 | { |
| 1176 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1177 | | if (state->m_flipscreen_x) x++; |
| 1110 | if (m_flipscreen_x) x++; |
| 1178 | 1111 | |
| 1179 | 1112 | x = x - 6; |
| 1180 | 1113 | |
| 1181 | 1114 | if (cliprect.contains(x, y)) |
| 1182 | | bitmap.pix16(y, x) = 32 + state->m_darkplnt_bullet_color; |
| 1115 | bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color; |
| 1183 | 1116 | } |
| 1184 | 1117 | |
| 1185 | | static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1118 | void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) |
| 1186 | 1119 | { |
| 1187 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1188 | 1120 | int i, color; |
| 1189 | 1121 | |
| 1190 | | if (state->flip_screen_x()) x++; |
| 1122 | if (flip_screen_x()) x++; |
| 1191 | 1123 | |
| 1192 | 1124 | x = x - 6; |
| 1193 | 1125 | |
| r20824 | r20825 | |
| 1196 | 1128 | { |
| 1197 | 1129 | if (offs < 4*4) |
| 1198 | 1130 | { |
| 1199 | | color = BULLETS_COLOR_BASE_LEGACY; |
| 1131 | color = BULLETS_COLOR_BASE; |
| 1200 | 1132 | y--; |
| 1201 | 1133 | } |
| 1202 | 1134 | else { |
| 1203 | | color = BULLETS_COLOR_BASE_LEGACY + 1; |
| 1135 | color = BULLETS_COLOR_BASE + 1; |
| 1204 | 1136 | x--; |
| 1205 | 1137 | } |
| 1206 | 1138 | |
| r20824 | r20825 | |
| 1213 | 1145 | |
| 1214 | 1146 | /* background drawing functions */ |
| 1215 | 1147 | |
| 1216 | | static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1148 | void galaxold_state::galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1217 | 1149 | { |
| 1218 | 1150 | /* plain black background */ |
| 1219 | 1151 | bitmap.fill(0, cliprect); |
| 1220 | 1152 | } |
| 1221 | 1153 | |
| 1222 | | static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1154 | void galaxold_state::scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1223 | 1155 | { |
| 1224 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1225 | | if (state->m_background_enable) |
| 1226 | | bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY, cliprect); |
| 1156 | if (m_background_enable) |
| 1157 | bitmap.fill(BACKGROUND_COLOR_BASE, cliprect); |
| 1227 | 1158 | else |
| 1228 | 1159 | bitmap.fill(0, cliprect); |
| 1229 | 1160 | } |
| 1230 | 1161 | |
| 1231 | | static void ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1162 | void galaxold_state::ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1232 | 1163 | { |
| 1233 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1234 | | int color = (state->m_background_blue << 2) | (state->m_background_green << 1) | state->m_background_red; |
| 1164 | int color = (m_background_blue << 2) | (m_background_green << 1) | m_background_red; |
| 1235 | 1165 | |
| 1236 | | bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY + color, cliprect); |
| 1166 | bitmap.fill(BACKGROUND_COLOR_BASE + color, cliprect); |
| 1237 | 1167 | } |
| 1238 | 1168 | |
| 1239 | | static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1169 | void galaxold_state::stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1240 | 1170 | { |
| 1241 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1242 | 1171 | UINT8 x; |
| 1243 | 1172 | UINT8 *prom; |
| 1244 | | int base = BACKGROUND_COLOR_BASE_LEGACY; |
| 1173 | int base = BACKGROUND_COLOR_BASE; |
| 1245 | 1174 | |
| 1246 | 1175 | |
| 1247 | 1176 | /* the background PROM is connected the following way: |
| r20824 | r20825 | |
| 1251 | 1180 | the green gun if BCG is asserted |
| 1252 | 1181 | bits 2-7 are unconnected */ |
| 1253 | 1182 | |
| 1254 | | prom = state->memregion("user1")->base(); |
| 1183 | prom = memregion("user1")->base(); |
| 1255 | 1184 | |
| 1256 | 1185 | for (x = 0; x < 32; x++) |
| 1257 | 1186 | { |
| r20824 | r20825 | |
| 1260 | 1189 | |
| 1261 | 1190 | color = 0; |
| 1262 | 1191 | |
| 1263 | | if ((~prom[x] & 0x02) && state->m_background_red) color |= 0x01; |
| 1264 | | if ((~prom[x] & 0x02) && state->m_background_green) color |= 0x02; |
| 1265 | | if ((~prom[x] & 0x01) && state->m_background_blue) color |= 0x04; |
| 1192 | if ((~prom[x] & 0x02) && m_background_red) color |= 0x01; |
| 1193 | if ((~prom[x] & 0x02) && m_background_green) color |= 0x02; |
| 1194 | if ((~prom[x] & 0x01) && m_background_blue) color |= 0x04; |
| 1266 | 1195 | |
| 1267 | | if (state->m_flipscreen_x) |
| 1196 | if (m_flipscreen_x) |
| 1268 | 1197 | sx = 8 * (31 - x); |
| 1269 | 1198 | else |
| 1270 | 1199 | sx = 8 * x; |
| r20824 | r20825 | |
| 1273 | 1202 | } |
| 1274 | 1203 | } |
| 1275 | 1204 | |
| 1276 | | static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1205 | void galaxold_state::minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1277 | 1206 | { |
| 1278 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1279 | | if (state->m_background_enable) |
| 1207 | if (m_background_enable) |
| 1280 | 1208 | { |
| 1281 | | int base = BACKGROUND_COLOR_BASE_LEGACY; |
| 1209 | int base = BACKGROUND_COLOR_BASE; |
| 1282 | 1210 | int x; |
| 1283 | 1211 | |
| 1284 | 1212 | |
| r20824 | r20825 | |
| 1294 | 1222 | bitmap.fill(0, cliprect); |
| 1295 | 1223 | } |
| 1296 | 1224 | |
| 1297 | | static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1225 | void galaxold_state::rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1298 | 1226 | { |
| 1299 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1300 | | if (state->m_background_enable) |
| 1227 | if (m_background_enable) |
| 1301 | 1228 | { |
| 1302 | | int base = BACKGROUND_COLOR_BASE_LEGACY; |
| 1229 | int base = BACKGROUND_COLOR_BASE; |
| 1303 | 1230 | int x; |
| 1304 | 1231 | |
| 1305 | 1232 | for (x = 0; x < 128; x++) |
| r20824 | r20825 | |
| 1314 | 1241 | bitmap.fill(0, cliprect); |
| 1315 | 1242 | } |
| 1316 | 1243 | |
| 1317 | | static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1244 | void galaxold_state::mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1318 | 1245 | { |
| 1319 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1320 | | int base = BACKGROUND_COLOR_BASE_LEGACY; |
| 1246 | int base = BACKGROUND_COLOR_BASE; |
| 1321 | 1247 | UINT8 x; |
| 1322 | 1248 | UINT8 *prom; |
| 1323 | 1249 | |
| r20824 | r20825 | |
| 1326 | 1252 | line (column) of the screen. The first 0x20 bytes for unflipped, |
| 1327 | 1253 | and the 2nd 0x20 bytes for flipped screen. */ |
| 1328 | 1254 | |
| 1329 | | prom = state->memregion("user1")->base(); |
| 1255 | prom = memregion("user1")->base(); |
| 1330 | 1256 | |
| 1331 | | if (state->m_flipscreen_x) |
| 1257 | if (m_flipscreen_x) |
| 1332 | 1258 | { |
| 1333 | 1259 | for (x = 0; x < 32; x++) |
| 1334 | 1260 | { |
| r20824 | r20825 | |
| 1358 | 1284 | } |
| 1359 | 1285 | } |
| 1360 | 1286 | |
| 1361 | | static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1287 | void galaxold_state::dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1362 | 1288 | { |
| 1363 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1364 | | int base = BACKGROUND_COLOR_BASE_LEGACY; |
| 1365 | | int col1 = base + state->m_dambustr_bg_color_1; |
| 1366 | | int col2 = base + state->m_dambustr_bg_color_2; |
| 1289 | int base = BACKGROUND_COLOR_BASE; |
| 1290 | int col1 = base + m_dambustr_bg_color_1; |
| 1291 | int col2 = base + m_dambustr_bg_color_2; |
| 1367 | 1292 | |
| 1368 | | if (state->flip_screen_x()) |
| 1293 | if (flip_screen_x()) |
| 1369 | 1294 | { |
| 1370 | | bitmap.plot_box( 0, 0, 256-state->m_dambustr_bg_split_line, 256, col2); |
| 1371 | | bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1); |
| 1295 | bitmap.plot_box( 0, 0, 256-m_dambustr_bg_split_line, 256, col2); |
| 1296 | bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col1); |
| 1372 | 1297 | } |
| 1373 | 1298 | else |
| 1374 | 1299 | { |
| 1375 | | bitmap.plot_box( 0, 0, 256-state->m_dambustr_bg_split_line, 256, col1); |
| 1376 | | bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col2); |
| 1300 | bitmap.plot_box( 0, 0, 256-m_dambustr_bg_split_line, 256, col1); |
| 1301 | bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col2); |
| 1377 | 1302 | } |
| 1378 | 1303 | |
| 1379 | 1304 | } |
| 1380 | 1305 | |
| 1381 | | static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1306 | void galaxold_state::dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1382 | 1307 | { |
| 1383 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1384 | 1308 | |
| 1385 | | if (state->flip_screen_x()) |
| 1309 | if (flip_screen_x()) |
| 1386 | 1310 | { |
| 1387 | | rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255); |
| 1388 | | copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); |
| 1311 | rectangle clip(254 - m_dambustr_bg_split_line, m_dambustr_bg_split_line, 0, 255); |
| 1312 | copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); |
| 1389 | 1313 | } |
| 1390 | 1314 | else |
| 1391 | 1315 | { |
| 1392 | | rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255); |
| 1393 | | copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); |
| 1316 | rectangle clip(0, 254 - m_dambustr_bg_split_line, 0, 255); |
| 1317 | copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); |
| 1394 | 1318 | } |
| 1395 | 1319 | } |
| 1396 | 1320 | |
| r20824 | r20825 | |
| 1398 | 1322 | |
| 1399 | 1323 | /* star drawing functions */ |
| 1400 | 1324 | |
| 1401 | | void galaxold_init_stars(running_machine &machine, int colors_offset) |
| 1325 | void galaxold_state::galaxold_init_stars(int colors_offset) |
| 1402 | 1326 | { |
| 1403 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1404 | | struct star *stars = state->m_stars; |
| 1327 | struct star *stars = m_stars; |
| 1405 | 1328 | int i; |
| 1406 | 1329 | int total_stars; |
| 1407 | 1330 | UINT32 generator; |
| 1408 | 1331 | int x,y; |
| 1409 | 1332 | |
| 1410 | 1333 | |
| 1411 | | state->m_stars_on = 0; |
| 1412 | | state->m_stars_blink_state = 0; |
| 1413 | | state->m_stars_blink_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),state)); |
| 1414 | | state->m_stars_scroll_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),state)); |
| 1415 | | state->m_timer_adjusted = 0; |
| 1416 | | state->m_stars_colors_start = colors_offset; |
| 1334 | m_stars_on = 0; |
| 1335 | m_stars_blink_state = 0; |
| 1336 | m_stars_blink_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),this)); |
| 1337 | m_stars_scroll_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),this)); |
| 1338 | m_timer_adjusted = 0; |
| 1339 | m_stars_colors_start = colors_offset; |
| 1417 | 1340 | |
| 1418 | 1341 | for (i = 0;i < 64;i++) |
| 1419 | 1342 | { |
| r20824 | r20825 | |
| 1427 | 1350 | g = map[bits]; |
| 1428 | 1351 | bits = (i >> 4) & 0x03; |
| 1429 | 1352 | b = map[bits]; |
| 1430 | | palette_set_color_rgb(machine,colors_offset+i,r,g,b); |
| 1353 | palette_set_color_rgb(machine(),colors_offset+i,r,g,b); |
| 1431 | 1354 | } |
| 1432 | 1355 | |
| 1433 | 1356 | |
| r20824 | r20825 | |
| 1471 | 1394 | } |
| 1472 | 1395 | } |
| 1473 | 1396 | |
| 1474 | | static void plot_star(galaxold_state *state, bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect) |
| 1397 | void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect) |
| 1475 | 1398 | { |
| 1476 | | if (state->m_flipscreen_x) |
| 1399 | if (m_flipscreen_x) |
| 1477 | 1400 | x = 255 - x; |
| 1478 | 1401 | |
| 1479 | | if (state->m_flipscreen_y) |
| 1402 | if (m_flipscreen_y) |
| 1480 | 1403 | y = 255 - y; |
| 1481 | 1404 | |
| 1482 | 1405 | if (cliprect.contains(x, y)) |
| 1483 | | bitmap.pix16(y, x) = state->m_stars_colors_start + color; |
| 1406 | bitmap.pix16(y, x) = m_stars_colors_start + color; |
| 1484 | 1407 | } |
| 1485 | 1408 | |
| 1486 | | static void noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1409 | void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1487 | 1410 | { |
| 1488 | 1411 | } |
| 1489 | 1412 | |
| 1490 | | void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1413 | void galaxold_state::galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1491 | 1414 | { |
| 1492 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1493 | | struct star *stars = state->m_stars; |
| 1415 | struct star *stars = m_stars; |
| 1494 | 1416 | int offs; |
| 1495 | 1417 | |
| 1496 | 1418 | |
| 1497 | | if (!state->m_timer_adjusted) |
| 1419 | if (!m_timer_adjusted) |
| 1498 | 1420 | { |
| 1499 | | start_stars_scroll_timer(machine); |
| 1500 | | state->m_timer_adjusted = 1; |
| 1421 | start_stars_scroll_timer(); |
| 1422 | m_timer_adjusted = 1; |
| 1501 | 1423 | } |
| 1502 | 1424 | |
| 1503 | 1425 | |
| r20824 | r20825 | |
| 1506 | 1428 | int x,y; |
| 1507 | 1429 | |
| 1508 | 1430 | |
| 1509 | | x = ((stars[offs].x + state->m_stars_scrollpos) & 0x01ff) >> 1; |
| 1510 | | y = ( stars[offs].y + ((state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1431 | x = ((stars[offs].x + m_stars_scrollpos) & 0x01ff) >> 1; |
| 1432 | y = ( stars[offs].y + ((m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1511 | 1433 | |
| 1512 | 1434 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1513 | 1435 | { |
| 1514 | | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1436 | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1515 | 1437 | } |
| 1516 | 1438 | } |
| 1517 | 1439 | } |
| 1518 | 1440 | |
| 1519 | | static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1441 | void galaxold_state::scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1520 | 1442 | { |
| 1521 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1522 | | struct star *stars = state->m_stars; |
| 1443 | struct star *stars = m_stars; |
| 1523 | 1444 | int offs; |
| 1524 | 1445 | |
| 1525 | 1446 | |
| 1526 | | if (!state->m_timer_adjusted) |
| 1447 | if (!m_timer_adjusted) |
| 1527 | 1448 | { |
| 1528 | | start_stars_blink_timer(machine, 100000, 10000, 0.00001); |
| 1529 | | state->m_timer_adjusted = 1; |
| 1449 | start_stars_blink_timer(100000, 10000, 0.00001); |
| 1450 | m_timer_adjusted = 1; |
| 1530 | 1451 | } |
| 1531 | 1452 | |
| 1532 | 1453 | |
| r20824 | r20825 | |
| 1541 | 1462 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1542 | 1463 | { |
| 1543 | 1464 | /* determine when to skip plotting */ |
| 1544 | | switch (state->m_stars_blink_state & 0x03) |
| 1465 | switch (m_stars_blink_state & 0x03) |
| 1545 | 1466 | { |
| 1546 | 1467 | case 0: |
| 1547 | 1468 | if (!(stars[offs].color & 0x01)) continue; |
| r20824 | r20825 | |
| 1557 | 1478 | break; |
| 1558 | 1479 | } |
| 1559 | 1480 | |
| 1560 | | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1481 | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1561 | 1482 | } |
| 1562 | 1483 | } |
| 1563 | 1484 | } |
| 1564 | 1485 | |
| 1565 | | static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1486 | void galaxold_state::rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1566 | 1487 | { |
| 1567 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1568 | | struct star *stars = state->m_stars; |
| 1488 | struct star *stars = m_stars; |
| 1569 | 1489 | int offs; |
| 1570 | 1490 | |
| 1571 | 1491 | |
| 1572 | 1492 | /* same as Scramble, but only top (left) half of screen */ |
| 1573 | 1493 | |
| 1574 | | if (!state->m_timer_adjusted) |
| 1494 | if (!m_timer_adjusted) |
| 1575 | 1495 | { |
| 1576 | | start_stars_blink_timer(machine, 100000, 10000, 0.00001); |
| 1577 | | state->m_timer_adjusted = 1; |
| 1496 | start_stars_blink_timer(100000, 10000, 0.00001); |
| 1497 | m_timer_adjusted = 1; |
| 1578 | 1498 | } |
| 1579 | 1499 | |
| 1580 | 1500 | |
| r20824 | r20825 | |
| 1589 | 1509 | if ((x < 128) && ((y & 0x01) ^ ((x >> 3) & 0x01))) |
| 1590 | 1510 | { |
| 1591 | 1511 | /* determine when to skip plotting */ |
| 1592 | | switch (state->m_stars_blink_state & 0x03) |
| 1512 | switch (m_stars_blink_state & 0x03) |
| 1593 | 1513 | { |
| 1594 | 1514 | case 0: |
| 1595 | 1515 | if (!(stars[offs].color & 0x01)) continue; |
| r20824 | r20825 | |
| 1605 | 1525 | break; |
| 1606 | 1526 | } |
| 1607 | 1527 | |
| 1608 | | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1528 | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1609 | 1529 | } |
| 1610 | 1530 | } |
| 1611 | 1531 | } |
| 1612 | 1532 | |
| 1613 | | static void mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1533 | void galaxold_state::mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1614 | 1534 | { |
| 1615 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1616 | | struct star *stars = state->m_stars; |
| 1535 | struct star *stars = m_stars; |
| 1617 | 1536 | int offs; |
| 1618 | 1537 | UINT8 *prom; |
| 1619 | 1538 | |
| 1620 | 1539 | |
| 1621 | | if (!state->m_timer_adjusted) |
| 1540 | if (!m_timer_adjusted) |
| 1622 | 1541 | { |
| 1623 | | start_stars_scroll_timer(machine); |
| 1624 | | state->m_timer_adjusted = 1; |
| 1542 | start_stars_scroll_timer(); |
| 1543 | m_timer_adjusted = 1; |
| 1625 | 1544 | } |
| 1626 | 1545 | |
| 1627 | 1546 | |
| 1628 | 1547 | /* bit 2 of the PROM controls star visibility */ |
| 1629 | 1548 | |
| 1630 | | prom = machine.root_device().memregion("user2")->base(); |
| 1549 | prom = machine().root_device().memregion("user2")->base(); |
| 1631 | 1550 | |
| 1632 | 1551 | for (offs = 0;offs < STAR_COUNT;offs++) |
| 1633 | 1552 | { |
| 1634 | 1553 | int x,y; |
| 1635 | 1554 | |
| 1636 | 1555 | |
| 1637 | | x = ((stars[offs].x + -state->m_stars_scrollpos) & 0x01ff) >> 1; |
| 1638 | | y = ( stars[offs].y + ((-state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1556 | x = ((stars[offs].x + -m_stars_scrollpos) & 0x01ff) >> 1; |
| 1557 | y = ( stars[offs].y + ((-m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; |
| 1639 | 1558 | |
| 1640 | 1559 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 1641 | 1560 | { |
| 1642 | 1561 | if (prom[(x/8 + 1) & 0x1f] & 0x04) |
| 1643 | 1562 | { |
| 1644 | | plot_star(state, bitmap, x, y, stars[offs].color, cliprect); |
| 1563 | plot_star(bitmap, x, y, stars[offs].color, cliprect); |
| 1645 | 1564 | } |
| 1646 | 1565 | } |
| 1647 | 1566 | } |
| r20824 | r20825 | |
| 1652 | 1571 | m_stars_blink_state++; |
| 1653 | 1572 | } |
| 1654 | 1573 | |
| 1655 | | static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c) |
| 1574 | void galaxold_state::start_stars_blink_timer(double ra, double rb, double c) |
| 1656 | 1575 | { |
| 1657 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1658 | 1576 | /* calculate the period using the formula given in the 555 datasheet */ |
| 1659 | 1577 | |
| 1660 | 1578 | int period_in_ms = 693 * (ra + 2.0 * rb) * c; |
| 1661 | 1579 | |
| 1662 | | state->m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); |
| 1580 | m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); |
| 1663 | 1581 | } |
| 1664 | 1582 | |
| 1665 | 1583 | |
| r20824 | r20825 | |
| 1671 | 1589 | } |
| 1672 | 1590 | } |
| 1673 | 1591 | |
| 1674 | | static void start_stars_scroll_timer(running_machine &machine) |
| 1592 | void galaxold_state::start_stars_scroll_timer() |
| 1675 | 1593 | { |
| 1676 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1677 | | state->m_stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); |
| 1594 | m_stars_scroll_timer->adjust(machine().primary_screen->frame_period(), 0, machine().primary_screen->frame_period()); |
| 1678 | 1595 | } |
| 1679 | 1596 | |
| 1680 | 1597 | |
| r20824 | r20825 | |
| 1688 | 1605 | |
| 1689 | 1606 | if (m_modify_charcode) |
| 1690 | 1607 | { |
| 1691 | | (*m_modify_charcode)(machine(), &code, x); |
| 1608 | (this->*m_modify_charcode)(&code, x); |
| 1692 | 1609 | } |
| 1693 | 1610 | |
| 1694 | 1611 | if (m_modify_color) |
| 1695 | 1612 | { |
| 1696 | | (*m_modify_color)(&color); |
| 1613 | (this->*m_modify_color)(&color); |
| 1697 | 1614 | } |
| 1698 | 1615 | |
| 1699 | 1616 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| r20824 | r20825 | |
| 1705 | 1622 | SET_TILE_INFO_MEMBER(2, code, 0, 0); |
| 1706 | 1623 | } |
| 1707 | 1624 | |
| 1708 | | static void draw_bullets_common(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1625 | void galaxold_state::draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1709 | 1626 | { |
| 1710 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1711 | 1627 | int offs; |
| 1712 | 1628 | |
| 1713 | 1629 | |
| 1714 | | for (offs = 0;offs < state->m_bulletsram.bytes();offs += 4) |
| 1630 | for (offs = 0;offs < m_bulletsram.bytes();offs += 4) |
| 1715 | 1631 | { |
| 1716 | 1632 | UINT8 sx,sy; |
| 1717 | 1633 | |
| 1718 | | sy = 255 - state->m_bulletsram[offs + 1]; |
| 1719 | | sx = 255 - state->m_bulletsram[offs + 3]; |
| 1634 | sy = 255 - m_bulletsram[offs + 1]; |
| 1635 | sx = 255 - m_bulletsram[offs + 3]; |
| 1720 | 1636 | |
| 1721 | | if (state->m_flipscreen_y) sy = 255 - sy; |
| 1637 | if (m_flipscreen_y) sy = 255 - sy; |
| 1722 | 1638 | |
| 1723 | | (*state->m_draw_bullets)(machine, bitmap, cliprect, offs, sx, sy); |
| 1639 | (this->*m_draw_bullets)(bitmap, cliprect, offs, sx, sy); |
| 1724 | 1640 | } |
| 1725 | 1641 | } |
| 1726 | 1642 | |
| 1727 | 1643 | |
| 1728 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size) |
| 1644 | void galaxold_state::draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size) |
| 1729 | 1645 | { |
| 1730 | 1646 | const rectangle spritevisiblearea(2*8+1, 32*8-1, 2*8, 30*8-1); |
| 1731 | 1647 | const rectangle spritevisibleareaflipx(0*8, 30*8-2, 2*8, 30*8-1); |
| 1732 | 1648 | |
| 1733 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1734 | 1649 | int offs; |
| 1735 | 1650 | |
| 1736 | 1651 | |
| r20824 | r20825 | |
| 1745 | 1660 | flipx = spriteram[offs + 1] & 0x40; |
| 1746 | 1661 | flipy = spriteram[offs + 1] & 0x80; |
| 1747 | 1662 | code = spriteram[offs + 1] & 0x3f; |
| 1748 | | color = spriteram[offs + 2] & state->m_color_mask; |
| 1663 | color = spriteram[offs + 2] & m_color_mask; |
| 1749 | 1664 | |
| 1750 | | if (state->m_modify_spritecode) |
| 1665 | if (m_modify_spritecode) |
| 1751 | 1666 | { |
| 1752 | | (*state->m_modify_spritecode)(machine, spriteram, &code, &flipx, &flipy, offs); |
| 1667 | (this->*m_modify_spritecode)(spriteram, &code, &flipx, &flipy, offs); |
| 1753 | 1668 | } |
| 1754 | 1669 | |
| 1755 | | if (state->m_modify_color) |
| 1670 | if (m_modify_color) |
| 1756 | 1671 | { |
| 1757 | | (*state->m_modify_color)(&color); |
| 1672 | (this->*m_modify_color)(&color); |
| 1758 | 1673 | } |
| 1759 | 1674 | |
| 1760 | | if (state->m_modify_ypos) |
| 1675 | if (m_modify_ypos) |
| 1761 | 1676 | { |
| 1762 | | (*state->m_modify_ypos)(&sy); |
| 1677 | (this->*m_modify_ypos)(&sy); |
| 1763 | 1678 | } |
| 1764 | 1679 | |
| 1765 | | if (state->m_flipscreen_x) |
| 1680 | if (m_flipscreen_x) |
| 1766 | 1681 | { |
| 1767 | 1682 | sx = 240 - sx; |
| 1768 | 1683 | flipx = !flipx; |
| 1769 | 1684 | } |
| 1770 | 1685 | |
| 1771 | | if (state->m_flipscreen_y) |
| 1686 | if (m_flipscreen_y) |
| 1772 | 1687 | { |
| 1773 | 1688 | flipy = !flipy; |
| 1774 | 1689 | } |
| r20824 | r20825 | |
| 1786 | 1701 | if (offs < 3*4) sy++; |
| 1787 | 1702 | |
| 1788 | 1703 | |
| 1789 | | drawgfx_transpen(bitmap, state->m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine.gfx[1], |
| 1704 | drawgfx_transpen(bitmap, m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine().gfx[1], |
| 1790 | 1705 | code,color, |
| 1791 | 1706 | flipx,flipy, |
| 1792 | 1707 | sx,sy,0); |
| r20824 | r20825 | |
| 1796 | 1711 | |
| 1797 | 1712 | UINT32 galaxold_state::screen_update_galaxold(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1798 | 1713 | { |
| 1799 | | (*m_draw_background)(machine(), bitmap, cliprect); |
| 1714 | (this->*m_draw_background)(bitmap, cliprect); |
| 1800 | 1715 | |
| 1801 | 1716 | if (m_stars_on) |
| 1802 | 1717 | { |
| 1803 | | (*m_draw_stars)(machine(), bitmap, cliprect); |
| 1718 | (this->*m_draw_stars)(bitmap, cliprect); |
| 1804 | 1719 | } |
| 1805 | 1720 | |
| 1806 | 1721 | |
| r20824 | r20825 | |
| 1808 | 1723 | |
| 1809 | 1724 | if (m_draw_bullets) |
| 1810 | 1725 | { |
| 1811 | | draw_bullets_common(machine(), bitmap, cliprect); |
| 1726 | draw_bullets_common(bitmap, cliprect); |
| 1812 | 1727 | } |
| 1813 | 1728 | |
| 1814 | 1729 | |
| 1815 | | draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes()); |
| 1730 | draw_sprites(bitmap, m_spriteram, m_spriteram.bytes()); |
| 1816 | 1731 | |
| 1817 | 1732 | if (m_spriteram2_present) |
| 1818 | 1733 | { |
| 1819 | | draw_sprites(machine(), bitmap, m_spriteram2, m_spriteram2.bytes()); |
| 1734 | draw_sprites(bitmap, m_spriteram2, m_spriteram2.bytes()); |
| 1820 | 1735 | } |
| 1821 | 1736 | return 0; |
| 1822 | 1737 | } |
| r20824 | r20825 | |
| 1827 | 1742 | int i, j; |
| 1828 | 1743 | UINT8 color; |
| 1829 | 1744 | |
| 1830 | | (*m_draw_background)(machine(), bitmap, cliprect); |
| 1745 | (this->*m_draw_background)(bitmap, cliprect); |
| 1831 | 1746 | |
| 1832 | 1747 | if (m_stars_on) |
| 1833 | 1748 | { |
| 1834 | | (*m_draw_stars)(machine(), bitmap, cliprect); |
| 1749 | (this->*m_draw_stars)(bitmap, cliprect); |
| 1835 | 1750 | } |
| 1836 | 1751 | |
| 1837 | 1752 | /* save the background for drawing it again later, if background has priority over characters */ |
| r20824 | r20825 | |
| 1841 | 1756 | |
| 1842 | 1757 | if (m_draw_bullets) |
| 1843 | 1758 | { |
| 1844 | | draw_bullets_common(machine(), bitmap, cliprect); |
| 1759 | draw_bullets_common(bitmap, cliprect); |
| 1845 | 1760 | } |
| 1846 | 1761 | |
| 1847 | | draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes()); |
| 1762 | draw_sprites(bitmap, m_spriteram, m_spriteram.bytes()); |
| 1848 | 1763 | |
| 1849 | 1764 | if (m_dambustr_bg_priority) |
| 1850 | 1765 | { |
| 1851 | 1766 | /* draw the upper part of the background, as it has priority */ |
| 1852 | | dambustr_draw_upper_background(machine(), bitmap, cliprect); |
| 1767 | dambustr_draw_upper_background(bitmap, cliprect); |
| 1853 | 1768 | |
| 1854 | 1769 | /* only rows with color code > 3 are stronger than the background */ |
| 1855 | 1770 | memset(m_dambustr_videoram2, 0x20, 0x0400); |
| r20824 | r20825 | |
| 1867 | 1782 | return 0; |
| 1868 | 1783 | } |
| 1869 | 1784 | |
| 1870 | | static void bagmanmc_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) |
| 1785 | void galaxold_state::bagmanmc_modify_charcode(UINT16 *code, UINT8 x) |
| 1871 | 1786 | { |
| 1872 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1873 | | *code |= (state->m_gfxbank[0] << 9); |
| 1787 | *code |= (m_gfxbank[0] << 9); |
| 1874 | 1788 | } |
| 1875 | 1789 | |
| 1876 | | static void bagmanmc_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1790 | void galaxold_state::bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) |
| 1877 | 1791 | { |
| 1878 | | galaxold_state *state = machine.driver_data<galaxold_state>(); |
| 1879 | | *code |= (state->m_gfxbank[0] << 7) | 0x40; |
| 1792 | *code |= (m_gfxbank[0] << 7) | 0x40; |
| 1880 | 1793 | } |
| 1881 | 1794 | |
| 1882 | 1795 | VIDEO_START_MEMBER(galaxold_state,bagmanmc) |
| 1883 | 1796 | { |
| 1884 | 1797 | VIDEO_START_CALL_MEMBER(galaxold); |
| 1885 | 1798 | |
| 1886 | | m_modify_charcode = bagmanmc_modify_charcode; |
| 1887 | | m_modify_spritecode = bagmanmc_modify_spritecode; |
| 1799 | m_modify_charcode = &galaxold_state::bagmanmc_modify_charcode; |
| 1800 | m_modify_spritecode = &galaxold_state::bagmanmc_modify_spritecode; |
| 1888 | 1801 | } |
trunk/src/mame/includes/galaxian.h
| r20824 | r20825 | |
| 27 | 27 | #define GALAXIAN_VBEND (16) |
| 28 | 28 | #define GALAXIAN_VBSTART (224+16) |
| 29 | 29 | |
| 30 | | /* video extension callbacks */ |
| 31 | | typedef void (*galaxian_extend_tile_info_func)(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 32 | | typedef void (*galaxian_extend_sprite_info_func)(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 33 | | typedef void (*galaxian_draw_bullet_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 34 | | typedef void (*galaxian_draw_background_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 35 | 30 | |
| 36 | | |
| 37 | 31 | class galaxian_state : public driver_device |
| 38 | 32 | { |
| 39 | 33 | public: |
| r20824 | r20825 | |
| 70 | 64 | int m_tenspot_current_game; |
| 71 | 65 | UINT8 m_frogger_adjust; |
| 72 | 66 | UINT8 m_sfx_tilemap; |
| 67 | |
| 68 | /* video extension callbacks */ |
| 69 | typedef void (galaxian_state::*galaxian_extend_tile_info_func)(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 70 | typedef void (galaxian_state::*galaxian_extend_sprite_info_func)(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 71 | typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 72 | typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 73 | |
| 73 | 74 | galaxian_extend_tile_info_func m_extend_tile_info_ptr; |
| 74 | 75 | galaxian_extend_sprite_info_func m_extend_sprite_info_ptr; |
| 75 | 76 | galaxian_draw_bullet_func m_draw_bullet_ptr; |
| 76 | 77 | galaxian_draw_background_func m_draw_background_ptr; |
| 78 | |
| 77 | 79 | tilemap_t *m_bg_tilemap; |
| 78 | 80 | UINT8 m_flipscreen_x; |
| 79 | 81 | UINT8 m_flipscreen_y; |
| r20824 | r20825 | |
| 230 | 232 | INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen); |
| 231 | 233 | TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen); |
| 232 | 234 | TIMER_DEVICE_CALLBACK_MEMBER(galaxian_stars_blink_timer); |
| 235 | void state_save_register(); |
| 236 | void sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase); |
| 237 | void bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base); |
| 238 | void stars_init(); |
| 239 | void stars_update_origin(); |
| 240 | void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); |
| 241 | void galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 242 | void background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped); |
| 243 | void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx); |
| 244 | void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 245 | void anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 246 | void jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 247 | void turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 248 | void frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 249 | int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect); |
| 250 | void amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 251 | inline void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color); |
| 252 | void galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 253 | void mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 254 | void scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 255 | void theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 256 | void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 257 | void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 258 | void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 259 | void frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 260 | void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 261 | void gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 262 | void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 263 | void pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 264 | void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 265 | void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 266 | void mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 267 | void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 268 | void moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 269 | void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 270 | void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 271 | void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 272 | void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 273 | void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 274 | void monsterz_set_latch(); |
| 275 | void decode_mooncrst(int length, UINT8 *dest); |
| 276 | void decode_checkman(); |
| 277 | void decode_dingoe(); |
| 278 | void decode_frogger_sound(); |
| 279 | void decode_frogger_gfx(); |
| 280 | void decode_anteater_gfx(); |
| 281 | void decode_losttomb_gfx(); |
| 282 | void decode_superbon(); |
| 283 | void unmap_galaxian_sound(offs_t base); |
| 284 | void mshuttle_decode(const UINT8 convtable[8][16]); |
| 285 | void common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background, |
| 286 | galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info); |
| 233 | 287 | }; |
| 234 | | |
| 235 | | |
| 236 | | /*----------- defined in video/galaxian.c -----------*/ |
| 237 | | |
| 238 | | /* special purpose background rendering */ |
| 239 | | void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 240 | | void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 241 | | //void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 242 | | void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 243 | | void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 244 | | void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 245 | | void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 246 | | |
| 247 | | /* special purpose bullet rendering */ |
| 248 | | void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 249 | | void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 250 | | void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 251 | | void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); |
| 252 | | |
| 253 | | /* generic extensions */ |
| 254 | | void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 255 | | void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 256 | | |
| 257 | | /* Frogger extensions */ |
| 258 | | void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 259 | | void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 260 | | |
| 261 | | /* Ghostmuncher Galaxian extensions */ |
| 262 | | void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 263 | | void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 264 | | |
| 265 | | /* Pisces extensions */ |
| 266 | | void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 267 | | void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 268 | | |
| 269 | | /* Batman Part 2 extensions */ |
| 270 | | void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 271 | | |
| 272 | | /* Moon Cresta extensions */ |
| 273 | | void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 274 | | void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 275 | | |
| 276 | | /* Moon Quasar extensions */ |
| 277 | | void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 278 | | void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 279 | | |
| 280 | | /* Moon Shuttle extensions */ |
| 281 | | void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 282 | | void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 283 | | |
| 284 | | /* Calipso extensions */ |
| 285 | | void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 286 | | |
| 287 | | /* Jumpbug extensions */ |
| 288 | | void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 289 | | void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |