diff options
Diffstat (limited to 'src/mame/includes/nmk16.h')
-rw-r--r-- | src/mame/includes/nmk16.h | 216 |
1 files changed, 115 insertions, 101 deletions
diff --git a/src/mame/includes/nmk16.h b/src/mame/includes/nmk16.h index 1ba5719f9ef..bd29bef9fbe 100644 --- a/src/mame/includes/nmk16.h +++ b/src/mame/includes/nmk16.h @@ -27,13 +27,12 @@ public: m_palette(*this, "palette"), m_nmk004(*this, "nmk004"), m_soundlatch(*this, "soundlatch"), - m_nmk_bgvideoram(*this, "nmk_bgvideoram%u", 0U), - m_nmk_txvideoram(*this, "nmk_txvideoram"), + m_bgvideoram(*this, "bgvideoram%u", 0U), + m_txvideoram(*this, "txvideoram"), m_mainram(*this, "mainram"), m_gunnail_scrollram(*this, "scrollram"), m_spriteram(*this, "spriteram"), m_gunnail_scrollramy(*this, "scrollramy"), - m_afega_scroll(*this, "afega_scroll_%u", 0U), m_tilemap_rom(*this, "tilerom"), m_audiobank(*this, "audiobank"), m_okibank(*this, "okibank%u", 1U), @@ -43,38 +42,30 @@ public: { } void vandyke(machine_config &config); - void redhawkb(machine_config &config); - void grdnstrm(machine_config &config); void tdragon_prot(machine_config &config); void tdragon2(machine_config &config); void tharrier(machine_config &config); void raphero(machine_config &config); void tdragon(machine_config &config); void tdragonb(machine_config &config); - void twinactn(machine_config &config); - void firehawk(machine_config &config); void gunnail(machine_config &config); void gunnailb(machine_config &config); void hachamf(machine_config &config); - void redhawki(machine_config &config); void bjtwin(machine_config &config); void ssmissin(machine_config &config); void bioship(machine_config &config); - void spec2k(machine_config &config); void macross2(machine_config &config); void blkheart(machine_config &config); - void stagger1(machine_config &config); void manybloc(machine_config &config); void acrobatm(machine_config &config); void strahl(machine_config &config); void tdragon3h(machine_config &config); void atombjt(machine_config &config); void hachamf_prot(machine_config &config); - void popspops(machine_config &config); - void grdnstrmk(machine_config &config); void macross(machine_config &config); void mustangb(machine_config &config); void mustang(machine_config &config); + void twinactn(machine_config &config); void vandykeb(machine_config &config); void init_nmk(); @@ -82,31 +73,23 @@ public: void init_vandykeb(); void init_tdragonb(); void init_ssmissin(); + void init_twinactn(); void init_hachamf_prot(); - void init_redhawk(); - void init_redhawkg(); - void init_redhawki(); void init_tdragon_prot(); - void init_bubl2000(); void init_banked_audiocpu(); - void init_grdnstrm(); - void init_grdnstrmau(); void init_gunnailb(); - void init_spec2k(); - void init_redfoxwp2a(); - void init_grdnstrmg(); void init_bjtwin(); void init_atombjt(); DECLARE_VIDEO_START(gunnail); TIMER_DEVICE_CALLBACK_MEMBER(nmk16_scanline); - uint32_t screen_update_macross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_macross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE16_MEMBER(nmk_txvideoram_w); - DECLARE_WRITE8_MEMBER(nmk_flipscreen_w); - DECLARE_WRITE8_MEMBER(nmk_tilebank_w); + void txvideoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void flipscreen_w(u8 data); + void tilebank_w(u8 data); - DECLARE_WRITE8_MEMBER(macross2_sound_bank_w); + void macross2_sound_bank_w(u8 data); protected: required_device<cpu_device> m_maincpu; @@ -118,15 +101,14 @@ protected: optional_device<nmk004_device> m_nmk004; optional_device<generic_latch_8_device> m_soundlatch; - optional_shared_ptr_array<uint16_t, 2> m_nmk_bgvideoram; - optional_shared_ptr<uint16_t> m_nmk_txvideoram; - required_shared_ptr<uint16_t> m_mainram; - optional_shared_ptr<uint16_t> m_gunnail_scrollram; - optional_shared_ptr<uint8_t> m_spriteram; - optional_shared_ptr<uint16_t> m_gunnail_scrollramy; - optional_shared_ptr_array<uint16_t, 2> m_afega_scroll; + optional_shared_ptr_array<u16, 2> m_bgvideoram; + optional_shared_ptr<u16> m_txvideoram; + required_shared_ptr<u16> m_mainram; + optional_shared_ptr<u16> m_gunnail_scrollram; + optional_shared_ptr<u8> m_spriteram; + optional_shared_ptr<u16> m_gunnail_scrollramy; - optional_region_ptr<uint16_t> m_tilemap_rom; + optional_region_ptr<u16> m_tilemap_rom; optional_memory_bank m_audiobank; optional_memory_bank_array<2> m_okibank; @@ -138,45 +120,43 @@ protected: int m_tilerambank; int m_sprdma_base; int mask[4*2]; - std::unique_ptr<uint16_t[]> m_spriteram_old; - std::unique_ptr<uint16_t[]> m_spriteram_old2; + std::unique_ptr<u16[]> m_spriteram_old; + std::unique_ptr<u16[]> m_spriteram_old2; int m_bgbank; int m_videoshift; int m_bioship_background_bank; tilemap_t *m_bg_tilemap[2]; tilemap_t *m_tx_tilemap; int m_mustang_bg_xscroll; - uint8_t m_scroll[2][4]; - uint16_t m_vscroll[4]; + u8 m_scroll[2][4]; + u16 m_vscroll[4]; int m_prot_count; - uint8_t m_input_pressed; - uint8_t m_start_helper; - uint8_t m_coin_count[2]; - uint8_t m_coin_count_frac[2]; - DECLARE_WRITE16_MEMBER(nmk16_mainram_strange_w); - DECLARE_WRITE8_MEMBER(ssmissin_soundbank_w); - DECLARE_WRITE16_MEMBER(tharrier_mcu_control_w); - DECLARE_READ16_MEMBER(tharrier_mcu_r); - DECLARE_WRITE16_MEMBER(macross2_sound_reset_w); - template<int Chip> DECLARE_WRITE8_MEMBER(tharrier_oki6295_bankswitch_w); - DECLARE_WRITE16_MEMBER(hachamf_mainram_w); - DECLARE_WRITE16_MEMBER(tdragon_mainram_w); - DECLARE_READ16_MEMBER(vandykeb_r); - DECLARE_READ16_MEMBER(tdragonb_prot_r); - DECLARE_READ16_MEMBER(afega_unknown_r); - template<int Scroll> DECLARE_WRITE16_MEMBER(afega_scroll_w); - template<int Layer> DECLARE_WRITE16_MEMBER(nmk_bgvideoram_w); - DECLARE_WRITE16_MEMBER(mustang_scroll_w); - DECLARE_WRITE16_MEMBER(raphero_scroll_w); - template<int Layer> DECLARE_WRITE8_MEMBER(nmk_scroll_w); - DECLARE_WRITE16_MEMBER(vandyke_scroll_w); - DECLARE_WRITE16_MEMBER(vandykeb_scroll_w); - DECLARE_WRITE16_MEMBER(manybloc_scroll_w); - DECLARE_WRITE8_MEMBER(bioship_bank_w); - DECLARE_WRITE8_MEMBER(spec2k_oki1_banking_w); - DECLARE_WRITE8_MEMBER(twinactn_oki_bank_w); - DECLARE_WRITE16_MEMBER(nmk16_x0016_w); - DECLARE_WRITE16_MEMBER(nmk16_bioship_x0016_w); + u8 m_input_pressed; + u8 m_start_helper; + u8 m_coin_count[2]; + u8 m_coin_count_frac[2]; + void mainram_strange_w(offs_t offset, u16 data/*, u16 mem_mask = ~0*/); + u16 mainram_swapped_r(offs_t offset); + void mainram_swapped_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void ssmissin_soundbank_w(u8 data); + void tharrier_mcu_control_w(u16 data); + u16 tharrier_mcu_r(offs_t offset, u16 mem_mask = ~0); + void macross2_sound_reset_w(u16 data); + template<unsigned Chip> void tharrier_oki_bankswitch_w(u8 data); + void hachamf_mainram_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void tdragon_mainram_w(offs_t offset, u16 data, u16 mem_mask = ~0); + u16 vandykeb_r(); + u16 tdragonb_prot_r(); + template<unsigned Layer> void bgvideoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void mustang_scroll_w(u16 data); + void raphero_scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0); + template<unsigned Layer> void scroll_w(offs_t offset, u8 data); + void vandyke_scroll_w(offs_t offset, u16 data); + void vandykeb_scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void manybloc_scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void bioship_bank_w(u8 data); + void nmk004_x0016_w(u16 data); + void nmk004_bioship_x0016_w(u16 data); void save_protregs(); void set_hacky_interrupt_timing(machine_config &config); @@ -184,59 +164,42 @@ protected: void set_hacky_screen_hires(machine_config &config); TILEMAP_MAPPER_MEMBER(tilemap_scan_pages); - template<int Layer, int Gfx> TILE_GET_INFO_MEMBER(common_get_bg_tile_info); + template<unsigned Layer, unsigned Gfx> TILE_GET_INFO_MEMBER(common_get_bg_tile_info); TILE_GET_INFO_MEMBER(common_get_tx_tile_info); TILE_GET_INFO_MEMBER(bioship_get_bg_tile_info); TILE_GET_INFO_MEMBER(bjtwin_get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_tile_info_0_8bit); DECLARE_VIDEO_START(macross); DECLARE_VIDEO_START(bioship); DECLARE_VIDEO_START(strahl); DECLARE_VIDEO_START(macross2); DECLARE_VIDEO_START(bjtwin); - DECLARE_VIDEO_START(afega); - DECLARE_VIDEO_START(grdnstrm); - uint32_t screen_update_tharrier(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_manybloc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_strahl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_tdragon2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_bjtwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_afega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_firehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_redhawki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_redhawkb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_bubl2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_tharrier(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_manybloc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_strahl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_bjtwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(tdragon_mcu_sim); TIMER_DEVICE_CALLBACK_MEMBER(hachamf_mcu_sim); TIMER_DEVICE_CALLBACK_MEMBER(manybloc_scanline); - void nmk16_video_init(); - inline void nmk16_draw_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t *spr); - inline void nmk16_draw_sprite_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t *spr); - void nmk16_draw_sprites_swap(bitmap_ind16 &bitmap, const rectangle &cliprect, int *bittbl); - void nmk16_draw_sprites_swap_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect, int *bittbl); - void nmk16_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void nmk16_draw_sprites_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect); - void nmk16_bg_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer = 0); - void nmk16_tx_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect,int dsw_flipscreen,int xoffset, int yoffset,int attr_mask); - void redhawki_video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); - void mcu_run(uint8_t dsw_setting); - uint8_t decode_byte(uint8_t src, const uint8_t *bitp); - uint32_t bjtwin_address_map_bg0(uint32_t addr); - uint16_t decode_word(uint16_t src, const uint8_t *bitp); - uint32_t bjtwin_address_map_sprites(uint32_t addr); + void video_init(); + inline void draw_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, u16 *spr); + inline void draw_sprite_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect, u16 *spr); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites_flipsupported(bitmap_ind16 &bitmap, const rectangle &cliprect); + void bg_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer = 0); + void tx_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void mcu_run(u8 dsw_setting); + u8 decode_byte(u8 src, const u8 *bitp); + u32 bjtwin_address_map_bg0(u32 addr); + u16 decode_word(u16 src, const u8 *bitp); + u32 bjtwin_address_map_sprites(u32 addr); void decode_gfx(); void decode_tdragonb(); void decode_ssmissin(); void acrobatm_map(address_map &map); - void afega_map(address_map &map); - void afega_sound_cpu(address_map &map); void atombjt_map(address_map &map); void bioship_map(address_map &map); void bjtwin_map(address_map &map); - void firehawk_map(address_map &map); - void firehawk_sound_cpu(address_map &map); void gunnail_map(address_map &map); void gunnailb_map(address_map &map); void gunnailb_sound_map(address_map &map); @@ -256,6 +219,7 @@ protected: void ssmissin_map(address_map &map); void ssmissin_sound_map(address_map &map); void strahl_map(address_map &map); + void tdragon2_map(address_map &map); void tdragon3h_map(address_map &map); void tdragon_map(address_map &map); void tdragonb_map(address_map &map); @@ -263,11 +227,61 @@ protected: void tharrier_sound_io_map(address_map &map); void tharrier_sound_map(address_map &map); void twinactn_map(address_map &map); - void twinactn_sound_cpu(address_map &map); void vandyke_map(address_map &map); void vandykeb_map(address_map &map); }; +class afega_state : public nmk16_state +{ +public: + afega_state(const machine_config &mconfig, device_type type, const char *tag) : + nmk16_state(mconfig, type, tag), + m_afega_scroll(*this, "afega_scroll_%u", 0U) + {} + + void firehawk(machine_config &config); + void grdnstrm(machine_config &config); + void grdnstrmk(machine_config &config); + void popspops(machine_config &config); + void redhawki(machine_config &config); + void redhawkb(machine_config &config); + void stagger1(machine_config &config); + void spec2k(machine_config &config); + void init_bubl2000(); + void init_grdnstrm(); + void init_grdnstrmau(); + void init_redfoxwp2a(); + void init_grdnstrmg(); + void init_redhawk(); + void init_redhawkg(); + void init_redhawki(); + void init_spec2k(); + +private: + optional_shared_ptr_array<u16, 2> m_afega_scroll; + + u16 afega_unknown_r(); + void spec2k_oki1_banking_w(u8 data); + template<unsigned Scroll> void afega_scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0); + + TILE_GET_INFO_MEMBER(get_bg_tile_info_4bit); + TILE_GET_INFO_MEMBER(get_bg_tile_info_8bit); + DECLARE_VIDEO_START(afega); + DECLARE_VIDEO_START(grdnstrm); + u32 screen_update_afega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_firehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_redhawki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_redhawkb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_bubl2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int dsw_flipscreen, int xoffset, int yoffset, int attr_mask); + void redhawki_video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void afega_map(address_map &map); + void afega_sound_cpu(address_map &map); + void firehawk_map(address_map &map); + void firehawk_sound_cpu(address_map &map); +}; + class nmk16_tomagic_state : public nmk16_state { public: |