From 5fc8470a00f7d8c482b65db7c0977cc9eed7b519 Mon Sep 17 00:00:00 2001 From: angelosa Date: Sun, 19 Nov 2017 20:05:18 +0100 Subject: hyprduel.cpp: removed sprite register hack (nw) --- src/mame/drivers/hyprduel.cpp | 2 ++ src/mame/includes/hyprduel.h | 73 +++++++++++++++++++++++-------------------- src/mame/video/hyprduel.cpp | 12 +++---- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/mame/drivers/hyprduel.cpp b/src/mame/drivers/hyprduel.cpp index e178b21a2b0..18ff03e7846 100644 --- a/src/mame/drivers/hyprduel.cpp +++ b/src/mame/drivers/hyprduel.cpp @@ -424,6 +424,7 @@ static ADDRESS_MAP_START( hyprduel_map, AS_PROGRAM, 16, hyprduel_state ) AM_RANGE(0x475000, 0x477fff) AM_RAM /* only used memory test */ AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_SHARE("tiletable") /* Tiles Set */ AM_RANGE(0x478840, 0x47884d) AM_WRITE(blitter_w) AM_SHARE("blitter_regs") /* Tiles Blitter */ + AM_RANGE(0x478850, 0x478853) AM_RAM AM_SHARE("spriteregs") AM_RANGE(0x478860, 0x47886b) AM_WRITE(window_w) AM_SHARE("window") /* Tilemap Window */ AM_RANGE(0x478870, 0x47887b) AM_RAM_WRITE(scrollreg_w) AM_SHARE("scroll") /* Scroll Regs */ AM_RANGE(0x47887c, 0x47887d) AM_WRITE(scrollreg_init_w) @@ -471,6 +472,7 @@ static ADDRESS_MAP_START( magerror_map, AS_PROGRAM, 16, hyprduel_state ) AM_RANGE(0x875000, 0x877fff) AM_RAM /* only used memory test */ AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_SHARE("tiletable") /* Tiles Set */ AM_RANGE(0x878840, 0x87884d) AM_WRITE(blitter_w) AM_SHARE("blitter_regs") /* Tiles Blitter */ + AM_RANGE(0x878850, 0x878853) AM_RAM AM_SHARE("spriteregs") AM_RANGE(0x878860, 0x87886b) AM_WRITE(window_w) AM_SHARE("window") /* Tilemap Window */ AM_RANGE(0x878870, 0x87887b) AM_RAM_WRITE(scrollreg_w) AM_SHARE("scroll") /* Scroll Regs */ AM_RANGE(0x87887c, 0x87887d) AM_WRITE(scrollreg_init_w) diff --git a/src/mame/includes/hyprduel.h b/src/mame/includes/hyprduel.h index 14e3397c785..0503888a071 100644 --- a/src/mame/includes/hyprduel.h +++ b/src/mame/includes/hyprduel.h @@ -18,6 +18,7 @@ public: m_vram_2(*this, "vram_2"), m_paletteram(*this, "paletteram"), m_spriteram(*this, "spriteram"), + m_spriteregs(*this, "spriteregs"), m_tiletable(*this, "tiletable"), m_blitter_regs(*this, "blitter_regs"), m_window(*this, "window"), @@ -34,12 +35,49 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette") { } + DECLARE_READ16_MEMBER(irq_cause_r); + DECLARE_WRITE16_MEMBER(irq_cause_w); + DECLARE_WRITE16_MEMBER(subcpu_control_w); + DECLARE_READ16_MEMBER(hyprduel_cpusync_trigger1_r); + DECLARE_WRITE16_MEMBER(hyprduel_cpusync_trigger1_w); + DECLARE_READ16_MEMBER(hyprduel_cpusync_trigger2_r); + DECLARE_WRITE16_MEMBER(hyprduel_cpusync_trigger2_w); + DECLARE_READ16_MEMBER(bankedrom_r); + DECLARE_WRITE16_MEMBER(blitter_w); + DECLARE_WRITE16_MEMBER(paletteram_w); + DECLARE_WRITE16_MEMBER(vram_0_w); + DECLARE_WRITE16_MEMBER(vram_1_w); + DECLARE_WRITE16_MEMBER(vram_2_w); + DECLARE_WRITE16_MEMBER(window_w); + DECLARE_WRITE16_MEMBER(scrollreg_w); + DECLARE_WRITE16_MEMBER(scrollreg_init_w); + DECLARE_DRIVER_INIT(magerror); + DECLARE_DRIVER_INIT(hyprduel); + TILE_GET_INFO_MEMBER(get_tile_info_0_8bit); + TILE_GET_INFO_MEMBER(get_tile_info_1_8bit); + TILE_GET_INFO_MEMBER(get_tile_info_2_8bit); + DECLARE_MACHINE_START(hyprduel); + DECLARE_VIDEO_START(hyprduel_14220); + DECLARE_MACHINE_START(magerror); + DECLARE_VIDEO_START(magerror_14220); + DECLARE_VIDEO_START(common_14220); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(vblank_end_callback); + TIMER_CALLBACK_MEMBER(magerror_irq_callback); + TIMER_CALLBACK_MEMBER(blit_done); + TIMER_DEVICE_CALLBACK_MEMBER(interrupt); + +protected: + virtual void machine_reset() override; + +private: /* memory pointers */ required_shared_ptr m_vram_0; required_shared_ptr m_vram_1; required_shared_ptr m_vram_2; required_shared_ptr m_paletteram; required_shared_ptr m_spriteram; + required_shared_ptr m_spriteregs; required_shared_ptr m_tiletable; required_shared_ptr m_blitter_regs; required_shared_ptr m_window; @@ -58,7 +96,6 @@ public: std::unique_ptr m_dirtyindex; int m_sprite_xoffs; int m_sprite_yoffs; - int m_sprite_yoffs_sub; std::unique_ptr m_expanded_gfx1; /* misc */ @@ -78,39 +115,6 @@ public: required_device m_screen; required_device m_palette; - DECLARE_READ16_MEMBER(irq_cause_r); - DECLARE_WRITE16_MEMBER(irq_cause_w); - DECLARE_WRITE16_MEMBER(subcpu_control_w); - DECLARE_READ16_MEMBER(hyprduel_cpusync_trigger1_r); - DECLARE_WRITE16_MEMBER(hyprduel_cpusync_trigger1_w); - DECLARE_READ16_MEMBER(hyprduel_cpusync_trigger2_r); - DECLARE_WRITE16_MEMBER(hyprduel_cpusync_trigger2_w); - DECLARE_READ16_MEMBER(bankedrom_r); - DECLARE_WRITE16_MEMBER(blitter_w); - DECLARE_WRITE16_MEMBER(paletteram_w); - DECLARE_WRITE16_MEMBER(vram_0_w); - DECLARE_WRITE16_MEMBER(vram_1_w); - DECLARE_WRITE16_MEMBER(vram_2_w); - DECLARE_WRITE16_MEMBER(window_w); - DECLARE_WRITE16_MEMBER(scrollreg_w); - DECLARE_WRITE16_MEMBER(scrollreg_init_w); - void blt_write( address_space &space, const int tmap, const offs_t offs, const uint16_t data, const uint16_t mask ); - DECLARE_DRIVER_INIT(magerror); - DECLARE_DRIVER_INIT(hyprduel); - TILE_GET_INFO_MEMBER(get_tile_info_0_8bit); - TILE_GET_INFO_MEMBER(get_tile_info_1_8bit); - TILE_GET_INFO_MEMBER(get_tile_info_2_8bit); - virtual void machine_reset() override; - DECLARE_MACHINE_START(hyprduel); - DECLARE_VIDEO_START(hyprduel_14220); - DECLARE_MACHINE_START(magerror); - DECLARE_VIDEO_START(magerror_14220); - DECLARE_VIDEO_START(common_14220); - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(vblank_end_callback); - TIMER_CALLBACK_MEMBER(magerror_irq_callback); - TIMER_CALLBACK_MEMBER(blit_done); - TIMER_DEVICE_CALLBACK_MEMBER(interrupt); void postload(); inline void get_tile_info( tile_data &tileinfo, int tile_index, int layer, uint16_t *vram); inline void get_tile_info_8bit( tile_data &tileinfo, int tile_index, int layer, uint16_t *vram ); @@ -123,4 +127,5 @@ public: void dirty_tiles( int layer, uint16_t *vram ); void update_irq_state( ); inline int blt_read( const uint8_t *ROM, const int offs ); + void blt_write( address_space &space, const int tmap, const offs_t offs, const uint16_t data, const uint16_t mask ); }; diff --git a/src/mame/video/hyprduel.cpp b/src/mame/video/hyprduel.cpp index bff54803a75..a5dfa1b7417 100644 --- a/src/mame/video/hyprduel.cpp +++ b/src/mame/video/hyprduel.cpp @@ -378,15 +378,11 @@ VIDEO_START_MEMBER(hyprduel_state,common_14220) VIDEO_START_MEMBER(hyprduel_state,hyprduel_14220) { - m_sprite_yoffs_sub = 2; - VIDEO_START_CALL_MEMBER(common_14220); } VIDEO_START_MEMBER(hyprduel_state,magerror_14220) { - m_sprite_yoffs_sub = 0; - VIDEO_START_CALL_MEMBER(common_14220); } @@ -453,8 +449,8 @@ void hyprduel_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, uint8_t *base_gfx8 = memregion("gfx1")->base(); uint32_t gfx_size = memregion("gfx1")->bytes(); - int max_x = m_screen->width(); - int max_y = m_screen->height(); + int max_x = (m_spriteregs[1]+1) * 2; + int max_y = (m_spriteregs[0]+1) * 2; int max_sprites = m_spriteram.bytes() / 8; int sprites = m_videoregs[0x00 / 2] % max_sprites; @@ -682,8 +678,8 @@ uint32_t hyprduel_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } } - m_sprite_xoffs = m_videoregs[0x06 / 2] - screen.width() / 2; - m_sprite_yoffs = m_videoregs[0x04 / 2] - screen.height() / 2 - m_sprite_yoffs_sub; + m_sprite_xoffs = m_videoregs[0x06 / 2] - (m_spriteregs[1]+1); + m_sprite_yoffs = m_videoregs[0x04 / 2] - (m_spriteregs[0]+1); /* The background color is selected by a register */ screen.priority().fill(0, cliprect); -- cgit v1.2.3