diff options
Diffstat (limited to 'src/mame/includes/cave.h')
-rw-r--r-- | src/mame/includes/cave.h | 190 |
1 files changed, 98 insertions, 92 deletions
diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index 6b11383cdf3..8aa51958f2a 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -27,7 +27,9 @@ public: , m_vram(*this, "vram.%u", 0) , m_vctrl(*this, "vctrl.%u", 0) , m_spriteram(*this, "spriteram.%u", 0) - , m_paletteram(*this, "paletteram.%u", 0) + , m_io_in0(*this, "IN0") + , m_touch_x(*this, "TOUCH%u_X", 1U) + , m_touch_y(*this, "TOUCH%u_Y", 1U) , m_spriteregion(*this, "sprites%u", 0) , m_tileregion(*this, "layer%u", 0) , m_okiregion(*this, "oki%u", 1) @@ -42,9 +44,9 @@ public: , m_int_timer_left(*this, "int_timer_left") , m_int_timer_right(*this, "int_timer_right") , m_eeprom(*this, "eeprom") - , m_gfxdecode(*this, "gfxdecode") - , m_screen(*this, "screen") - , m_palette(*this, "palette") + , m_gfxdecode(*this, "gfxdecode.%u", 0U) + , m_screen(*this, "screen.%u", 0U) + , m_palette(*this, "palette.%u", 0U) , m_soundlatch(*this, "soundlatch") , m_startup(*this, "startup") , m_led_outputs(*this, "led%u", 0U) @@ -105,46 +107,47 @@ private: 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); + u16 soundflags_ack_r(); + void sound_cmd_w(u16 data); + u8 soundlatch_lo_r(); + u8 soundlatch_hi_r(); + u16 soundlatch_ack_r(); + void soundlatch_ack_w(u8 data); 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); + u16 donpachi_videoregs_r(offs_t offset); + void korokoro_leds_w(offs_t offset, u16 data, u16 mem_mask); + template<int Chip> void pwrinst2_vctrl_w(offs_t offset, u16 data, u16 mem_mask); + u16 sailormn_input0_r(); 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); + template<int Chip> void vram_w(offs_t offset, u16 data, u16 mem_mask); + template<int Chip> void vram_8x8_w(offs_t offset, u16 data, u16 mem_mask); 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); + void korokoro_eeprom_w(offs_t offset, u16 data, u16 mem_mask); + u16 pwrinst2_eeprom_r(); 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 ppsatan_eeprom_w(offs_t offset, u16 data, u16 mem_mask); + void ppsatan_io_mux_w(offs_t offset, u16 data, u16 mem_mask); + template<int Player> u16 ppsatan_touch_r(); + void ppsatan_out_w(offs_t offset, u16 data, u16 mem_mask); TILE_GET_INFO_MEMBER(sailormn_get_tile_info_2); - template<int Chip> TILE_GET_INFO_MEMBER(get_tile_info); + template<int Chip, int Gfx> TILE_GET_INFO_MEMBER(get_tile_info); DECLARE_MACHINE_RESET(sailormn); - DECLARE_VIDEO_START(cave_1_layer); - DECLARE_VIDEO_START(cave_2_layers); - DECLARE_VIDEO_START(cave_3_layers); - DECLARE_VIDEO_START(cave_4_layers); - DECLARE_VIDEO_START(sailormn_3_layers); + DECLARE_VIDEO_START(ddonpach); + DECLARE_VIDEO_START(dfeveron); + DECLARE_VIDEO_START(donpachi); + DECLARE_VIDEO_START(korokoro); + DECLARE_VIDEO_START(ppsatan); + DECLARE_VIDEO_START(pwrinst2); + DECLARE_VIDEO_START(sailormn); + DECLARE_VIDEO_START(uopoko); void cave_palette(palette_device &palette); void dfeveron_palette(palette_device &palette); void korokoro_palette(palette_device &palette); @@ -152,11 +155,11 @@ private: void pwrinst2_palette(palette_device &palette); void sailormn_palette(palette_device &palette); void ppsatan_palette(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); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update_ppsatan_core (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip); + u32 screen_update_ppsatan_top (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update_ppsatan_left (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update_ppsatan_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(interrupt); INTERRUPT_GEN_MEMBER(interrupt_ppsatan); TIMER_CALLBACK_MEMBER(vblank_end); @@ -178,11 +181,14 @@ private: virtual void machine_reset() override; /* memory pointers */ - optional_shared_ptr_array<uint16_t, 4> m_videoregs; - optional_shared_ptr_array<uint16_t, 4> m_vram; - optional_shared_ptr_array<uint16_t, 4> m_vctrl; - optional_shared_ptr_array<uint16_t, 4> m_spriteram; - optional_shared_ptr_array<uint16_t, 4> m_paletteram; + optional_shared_ptr_array<u16, 4> m_videoregs; + optional_shared_ptr_array<u16, 4> m_vram; + optional_shared_ptr_array<u16, 4> m_vctrl; + optional_shared_ptr_array<u16, 4> m_spriteram; + + optional_ioport m_io_in0; + optional_ioport_array<2> m_touch_x; + optional_ioport_array<2> m_touch_y; /* memory regions */ optional_memory_region_array<4> m_spriteregion; @@ -206,7 +212,7 @@ private: int priority = 0, flags = 0; - const uint8_t *pen_data = nullptr; /* points to top left corner of tile data */ + const u8 *pen_data = nullptr; /* points to top left corner of tile data */ int line_offset = 0; pen_t base_pen = 0; @@ -218,64 +224,64 @@ private: struct { - int clip_left, clip_right, clip_top, clip_bottom; - uint8_t *baseaddr; - int line_offset; - uint8_t *baseaddr_zbuf; - int line_offset_zbuf; + int clip_left, clip_right, clip_top, clip_bottom; + u8 *baseaddr; + int line_offset; + u8 *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]; - tilemap_t *m_tilemap[4]; - int m_tiledim[4]; - int m_old_tiledim[4]; - - bitmap_ind16 m_sprite_zbuf; - uint16_t m_sprite_zbuf_baseval; + tilemap_t *m_tilemap[4]; + bool m_tiledim[4]; + bool m_old_tiledim[4]; - int m_num_sprites[4]; + bitmap_ind16 m_sprite_zbuf[4]; + u16 m_sprite_zbuf_baseval; - int m_spriteram_bank[4]; - int m_spriteram_bank_delay[4]; + int m_num_sprites[4]; - std::unique_ptr<uint16_t[]> m_palette_map[4]; + int m_spriteram_bank[4]; + int m_spriteram_bank_delay[4]; - int m_layers_offs_x; - int m_layers_offs_y; - int m_row_effect_offs_n; - int m_row_effect_offs_f; - int m_background_pen; + int m_layers_offs_x; + int m_layers_offs_y; + int m_row_effect_offs_n; + int m_row_effect_offs_f; + u16 m_background_pen[4]; - int m_spritetype[2]; - int m_kludge; + int m_spritetype[2]; + int m_kludge; emu_timer *m_vblank_end_timer; + u16 m_sprite_base_pal; + u16 m_sprite_granularity; /* misc */ - int m_time_vblank_irq; - uint8_t m_irq_level; - uint8_t m_vblank_irq; - uint8_t m_sound_irq; - uint8_t m_unknown_irq; - uint8_t m_agallet_vblank_irq; + int m_time_vblank_irq; + u8 m_irq_level; + u8 m_vblank_irq; + u8 m_sound_irq; + u8 m_unknown_irq; + u8 m_agallet_vblank_irq; /* sound related */ - int m_soundbuf_wptr; - int m_soundbuf_rptr; - uint8_t m_soundbuf_data[32]; - bool m_soundbuf_empty; - //uint8_t m_sound_flag[2]; + int m_soundbuf_wptr; + int m_soundbuf_rptr; + u8 m_soundbuf_data[32]; + bool m_soundbuf_empty; + //u8 m_sound_flag[2]; /* game specific */ // sailormn - int m_sailormn_tilebank; + int m_sailormn_tilebank; // korokoro - uint16_t m_leds[2]; - int m_hopper; + u16 m_leds[2]; + int m_hopper; // ppsatan - uint16_t m_ppsatan_io_mux; + u16 m_ppsatan_io_mux; /* devices */ required_device<cpu_device> m_maincpu; @@ -285,9 +291,9 @@ private: optional_device<timer_device> m_int_timer_left; optional_device<timer_device> m_int_timer_right; optional_device<eeprom_serial_93cxx_device> m_eeprom; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; + optional_device_array<gfxdecode_device, 4> m_gfxdecode; + optional_device_array<screen_device, 4> m_screen; + optional_device_array<palette_device, 4> m_palette; optional_device<generic_latch_16_device> m_soundlatch; optional_device<timer_device> m_startup; output_finder<9> m_led_outputs; @@ -295,21 +301,21 @@ private: int m_rasflag; int m_old_rasflag; - 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 ); + inline void tilemap_draw(int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u32 flags, u32 priority, u32 priority2, int GFX); void set_pens(int chip); - void vh_start( int num ); + void vh_start(int num, u16 sprcol_base, u16 sprcol_granularity); void get_sprite_info_cave(int chip); void get_sprite_info_donpachi(int chip); - void sprite_init(); + void sprite_init(int chip); 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 ); - void sprite_draw_donpachi_zbuf( int chip, int priority ); + 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); + void sprite_draw_donpachi_zbuf(int chip, int priority); void init_cave(); void init_z80_bank(); void init_oki_bank(int chip); |