diff options
Diffstat (limited to 'src/mame/includes/cave.h')
-rw-r--r-- | src/mame/includes/cave.h | 298 |
1 files changed, 150 insertions, 148 deletions
diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index 9a92d23ad64..9e8f7f0856a 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -22,28 +22,6 @@ class cave_state : public driver_device { public: - enum - { - MAX_PRIORITY = 4, - MAX_SPRITE_NUM = 0x400 - }; - - struct sprite_cave - { - sprite_cave() { } - - int priority = 0, flags = 0; - - const uint8_t *pen_data = nullptr; /* points to top left corner of tile data */ - int line_offset = 0; - - pen_t base_pen = 0; - int tile_width = 0, tile_height = 0; - int total_width = 0, total_height = 0; /* in screen coordinates */ - int x = 0, y = 0, xcount0 = 0, ycount0 = 0; - int zoomx_re = 0, zoomy_re = 0; - }; - cave_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_videoregs(*this, "videoregs.%u", 0) @@ -73,105 +51,119 @@ public: , m_led_outputs(*this, "led%u", 0U) { } - struct - { - int clip_left, clip_right, clip_top, clip_bottom; - uint8_t *baseaddr; - int line_offset; - uint8_t *baseaddr_zbuf; - int line_offset_zbuf; - } m_blit; + DECLARE_CUSTOM_INPUT_MEMBER(korokoro_hopper_r); + DECLARE_CUSTOM_INPUT_MEMBER(tjumpman_hopper_r); + void init_uopoko(); + void init_donpachi(); + void init_mazinger(); + void init_gaia(); + void init_pwrinst2(); + void init_ddonpach(); + void init_agallet(); + void init_hotdogst(); + void init_tjumpman(); + void init_korokoro(); + void init_esprade(); + void init_pwrinst2j(); + void init_guwange(); + void init_feversos(); + void init_sailormn(); + void init_dfeveron(); + void init_metmqstr(); + void init_ppsatan(); + void uopoko(machine_config &config); + void sailormn(machine_config &config); + void paceight(machine_config &config); + void pacslot(machine_config &config); + void hotdogst(machine_config &config); + void crusherm(machine_config &config); + void donpachi(machine_config &config); + void tekkencw(machine_config &config); + void korokoro(machine_config &config); + void esprade(machine_config &config); + void mazinger(machine_config &config); + void tjumpman(machine_config &config); + void tekkenbs(machine_config &config); + void gaia(machine_config &config); + void metmqstr(machine_config &config); + void ppsatan(machine_config &config); + void guwange(machine_config &config); + void dfeveron(machine_config &config); + void ddonpach(machine_config &config); + void pwrinst2(machine_config &config); + +protected: + virtual void device_post_load() override; + +private: void (cave_state::*m_get_sprite_info)(int chip); void (cave_state::*m_sprite_draw)(int chip, int priority); - DECLARE_READ16_MEMBER(cave_irq_cause_r); - DECLARE_READ8_MEMBER(soundflags_r); + u16 irq_cause_r(offs_t offset); + u8 soundflags_r(); DECLARE_READ16_MEMBER(soundflags_ack_r); DECLARE_WRITE16_MEMBER(sound_cmd_w); DECLARE_READ8_MEMBER(soundlatch_lo_r); DECLARE_READ8_MEMBER(soundlatch_hi_r); DECLARE_READ16_MEMBER(soundlatch_ack_r); DECLARE_WRITE8_MEMBER(soundlatch_ack_w); - DECLARE_WRITE16_MEMBER(gaia_coin_lsb_w); + void gaia_coin_w(u8 data); DECLARE_READ16_MEMBER(donpachi_videoregs_r); DECLARE_WRITE16_MEMBER(korokoro_leds_w); template<int Chip> DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_w); DECLARE_READ16_MEMBER(sailormn_input0_r); - DECLARE_WRITE16_MEMBER(tjumpman_leds_w); - DECLARE_WRITE16_MEMBER(pacslot_leds_w); - template<int Mask> DECLARE_WRITE8_MEMBER(z80_rombank_w); - template<int Mask> DECLARE_WRITE8_MEMBER(oki1_bank_w); - template<int Mask> DECLARE_WRITE8_MEMBER(oki2_bank_w); + void tjumpman_leds_w(u8 data); + void pacslot_leds_w(u8 data); + template<int Mask> void z80_rombank_w(u8 data); + template<int Mask> void oki1_bank_w(u8 data); + template<int Mask> void oki2_bank_w(u8 data); template<int Chip> DECLARE_WRITE16_MEMBER(vram_w); template<int Chip> DECLARE_WRITE16_MEMBER(vram_8x8_w); - DECLARE_CUSTOM_INPUT_MEMBER(korokoro_hopper_r); - DECLARE_CUSTOM_INPUT_MEMBER(tjumpman_hopper_r); - DECLARE_WRITE16_MEMBER(cave_eeprom_msb_w); - DECLARE_WRITE16_MEMBER(sailormn_eeprom_msb_w); - DECLARE_WRITE16_MEMBER(hotdogst_eeprom_msb_w); - DECLARE_WRITE16_MEMBER(cave_eeprom_lsb_w); - DECLARE_WRITE16_MEMBER(metmqstr_eeprom_msb_w); - DECLARE_WRITE16_MEMBER(korokoro_eeprom_msb_w); + void eeprom_w(u8 data); + void sailormn_eeprom_w(u8 data); + void hotdogst_eeprom_w(u8 data); + void guwange_eeprom_w(u8 data); + void metmqstr_eeprom_w(u8 data); + void korokoro_eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask); DECLARE_READ16_MEMBER(pwrinst2_eeprom_r); - DECLARE_WRITE16_MEMBER(tjumpman_eeprom_lsb_w); - DECLARE_WRITE16_MEMBER(ppsatan_eeprom_msb_w); + void tjumpman_eeprom_w(u8 data); + void ppsatan_eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask); DECLARE_WRITE16_MEMBER(ppsatan_io_mux_w); DECLARE_READ16_MEMBER(ppsatan_touch1_r); DECLARE_READ16_MEMBER(ppsatan_touch2_r); DECLARE_WRITE16_MEMBER(ppsatan_out_w); uint16_t ppsatan_touch_r(int player); - void init_uopoko(); - void init_donpachi(); - void init_mazinger(); - void init_gaia(); - void init_pwrinst2(); - void init_ddonpach(); - void init_agallet(); - void init_hotdogst(); - void init_tjumpman(); - void init_korokoro(); - void init_esprade(); - void init_pwrinst2j(); - void init_guwange(); - void init_feversos(); - void init_sailormn(); - void init_dfeveron(); - void init_metmqstr(); - void init_ppsatan(); TILE_GET_INFO_MEMBER(sailormn_get_tile_info_2); template<int Chip> TILE_GET_INFO_MEMBER(get_tile_info); - DECLARE_MACHINE_RESET(cave); DECLARE_MACHINE_RESET(sailormn); + DECLARE_VIDEO_START(cave_1_layer); DECLARE_VIDEO_START(cave_2_layers); - DECLARE_PALETTE_INIT(dfeveron); DECLARE_VIDEO_START(cave_3_layers); - DECLARE_PALETTE_INIT(ddonpach); - DECLARE_PALETTE_INIT(cave); - DECLARE_VIDEO_START(cave_1_layer); - DECLARE_PALETTE_INIT(korokoro); - DECLARE_PALETTE_INIT(mazinger); DECLARE_VIDEO_START(cave_4_layers); - DECLARE_PALETTE_INIT(pwrinst2); DECLARE_VIDEO_START(sailormn_3_layers); - DECLARE_PALETTE_INIT(sailormn); - DECLARE_PALETTE_INIT(ppsatan); - uint32_t screen_update_cave(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void palette_init_cave(palette_device &palette); + void palette_init_dfeveron(palette_device &palette); + void palette_init_korokoro(palette_device &palette); + void palette_init_mazinger(palette_device &palette); + void palette_init_pwrinst2(palette_device &palette); + void palette_init_sailormn(palette_device &palette); + void palette_init_ppsatan(palette_device &palette); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_ppsatan_core (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip); uint32_t screen_update_ppsatan_top (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_ppsatan_left (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_ppsatan_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(cave_interrupt); - INTERRUPT_GEN_MEMBER(cave_interrupt_ppsatan); - TIMER_CALLBACK_MEMBER(cave_vblank_end); - TIMER_DEVICE_CALLBACK_MEMBER(cave_vblank_start); - TIMER_DEVICE_CALLBACK_MEMBER(cave_vblank_start_left); - TIMER_DEVICE_CALLBACK_MEMBER(cave_vblank_start_right); + INTERRUPT_GEN_MEMBER(interrupt); + INTERRUPT_GEN_MEMBER(interrupt_ppsatan); + TIMER_CALLBACK_MEMBER(vblank_end); + TIMER_DEVICE_CALLBACK_MEMBER(vblank_start); + TIMER_DEVICE_CALLBACK_MEMBER(vblank_start_left); + TIMER_DEVICE_CALLBACK_MEMBER(vblank_start_right); TIMER_DEVICE_CALLBACK_MEMBER(timer_lev2_cb); TIMER_DEVICE_CALLBACK_MEMBER(sailormn_startup); - void cave_get_sprite_info(int chip); - void cave_get_sprite_info_all(); + void get_sprite_info(int chip); void sailormn_tilebank_w(int bank); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); void update_irq_state(); @@ -180,60 +172,8 @@ public: void esprade_unpack_sprites(int chip); void sailormn_unpack_tiles(int chip); - void uopoko(machine_config &config); - void sailormn(machine_config &config); - void paceight(machine_config &config); - void pacslot(machine_config &config); - void hotdogst(machine_config &config); - void crusherm(machine_config &config); - void donpachi(machine_config &config); - void tekkencw(machine_config &config); - void korokoro(machine_config &config); - void esprade(machine_config &config); - void mazinger(machine_config &config); - void tjumpman(machine_config &config); - void tekkenbs(machine_config &config); - void gaia(machine_config &config); - void metmqstr(machine_config &config); - void ppsatan(machine_config &config); - void guwange(machine_config &config); - void dfeveron(machine_config &config); - void ddonpach(machine_config &config); - void pwrinst2(machine_config &config); - void crusherm_map(address_map &map); - void ddonpach_map(address_map &map); - void dfeveron_map(address_map &map); - void donpachi_map(address_map &map); - void esprade_map(address_map &map); - void gaia_map(address_map &map); - void guwange_map(address_map &map); - void hotdogst_map(address_map &map); - void hotdogst_sound_map(address_map &map); - void hotdogst_sound_portmap(address_map &map); - void korokoro_map(address_map &map); - void mazinger_map(address_map &map); - void mazinger_sound_map(address_map &map); - void mazinger_sound_portmap(address_map &map); - void metmqstr_map(address_map &map); - void metmqstr_sound_map(address_map &map); - void metmqstr_sound_portmap(address_map &map); - void oki2_map(address_map &map); - void oki_map(address_map &map); - void paceight_map(address_map &map); - void pacslot_map(address_map &map); - void ppsatan_map(address_map &map); - void pwrinst2_map(address_map &map); - void pwrinst2_sound_map(address_map &map); - void pwrinst2_sound_portmap(address_map &map); - void sailormn_map(address_map &map); - void sailormn_sound_map(address_map &map); - void sailormn_sound_portmap(address_map &map); - void tekkenbs_map(address_map &map); - void tekkencw_map(address_map &map); - void tjumpman_map(address_map &map); - void uopoko_map(address_map &map); -protected: virtual void machine_start() override; + virtual void machine_reset() override; /* memory pointers */ optional_shared_ptr_array<uint16_t, 4> m_videoregs; @@ -252,6 +192,37 @@ protected: optional_memory_bank_array<2> m_okibank_hi; /* video-related */ + enum + { + MAX_PRIORITY = 4, + MAX_SPRITE_NUM = 0x400 + }; + + struct sprite_cave + { + sprite_cave() { } + + int priority = 0, flags = 0; + + const uint8_t *pen_data = nullptr; /* points to top left corner of tile data */ + int line_offset = 0; + + pen_t base_pen = 0; + int tile_width = 0, tile_height = 0; + int total_width = 0, total_height = 0; /* in screen coordinates */ + int x = 0, y = 0, xcount0 = 0, ycount0 = 0; + int zoomx_re = 0, zoomy_re = 0; + }; + + struct + { + int clip_left, clip_right, clip_top, clip_bottom; + uint8_t *baseaddr; + int line_offset; + uint8_t *baseaddr_zbuf; + int line_offset_zbuf; + } m_blit; + std::unique_ptr<sprite_cave []> m_sprite[4]; sprite_cave *m_sprite_table[4][MAX_PRIORITY][MAX_SPRITE_NUM + 1]; @@ -293,8 +264,7 @@ protected: int m_soundbuf_rptr; uint8_t m_soundbuf_data[32]; bool m_soundbuf_empty; - //uint8_t m_sound_flag1; - //uint8_t m_sound_flag2; + //uint8_t m_sound_flag[2]; /* game specific */ // sailormn @@ -323,18 +293,17 @@ protected: int m_rasflag; int m_old_rasflag; -private: inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t priority, uint32_t priority2, int GFX ); void set_pens(int chip); - void cave_vh_start( int num ); + void vh_start( int num ); void get_sprite_info_cave(int chip); void get_sprite_info_donpachi(int chip); - void sprite_init_cave(); - void cave_sprite_check(int chip, screen_device &screen, const rectangle &clip); - void do_blit_zoom32_cave( int chip, const sprite_cave *sprite ); - void do_blit_zoom32_cave_zb( int chip, const sprite_cave *sprite ); - void do_blit_32_cave( int chip, const sprite_cave *sprite ); - void do_blit_32_cave_zb( int chip, const sprite_cave *sprite ); + void sprite_init(); + void sprite_check(int chip, screen_device &screen, const rectangle &clip); + void do_blit_zoom32( int chip, const sprite_cave *sprite ); + void do_blit_zoom32_zb( int chip, const sprite_cave *sprite ); + void do_blit_32( int chip, const sprite_cave *sprite ); + void do_blit_32_zb( int chip, const sprite_cave *sprite ); void sprite_draw_cave( int chip, int priority ); void sprite_draw_cave_zbuf( int chip, int priority ); void sprite_draw_donpachi( int chip, int priority ); @@ -343,6 +312,39 @@ private: void init_z80_bank(); void init_oki_bank(int chip); void show_leds(); + + void crusherm_map(address_map &map); + void ddonpach_map(address_map &map); + void dfeveron_map(address_map &map); + void donpachi_map(address_map &map); + void esprade_map(address_map &map); + void gaia_map(address_map &map); + void guwange_map(address_map &map); + void hotdogst_map(address_map &map); + void hotdogst_sound_map(address_map &map); + void hotdogst_sound_portmap(address_map &map); + void korokoro_map(address_map &map); + void mazinger_map(address_map &map); + void mazinger_sound_map(address_map &map); + void mazinger_sound_portmap(address_map &map); + void metmqstr_map(address_map &map); + void metmqstr_sound_map(address_map &map); + void metmqstr_sound_portmap(address_map &map); + void oki2_map(address_map &map); + void oki_map(address_map &map); + void paceight_map(address_map &map); + void pacslot_map(address_map &map); + void ppsatan_map(address_map &map); + void pwrinst2_map(address_map &map); + void pwrinst2_sound_map(address_map &map); + void pwrinst2_sound_portmap(address_map &map); + void sailormn_map(address_map &map); + void sailormn_sound_map(address_map &map); + void sailormn_sound_portmap(address_map &map); + void tekkenbs_map(address_map &map); + void tekkencw_map(address_map &map); + void tjumpman_map(address_map &map); + void uopoko_map(address_map &map); }; #endif // MAME_INCLUDES_CAVE_H |