diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c index d9ce85c97be..c9653bec5ee 100644 --- a/src/mame/drivers/legionna.c +++ b/src/mame/drivers/legionna.c @@ -93,6 +93,10 @@ static ADDRESS_MAP_START( legionna_cop_mem, AS_PROGRAM, 16, legionna_state ) AM_RANGE(0x100400, 0x100401) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_param_lo_w) // grainbow AM_RANGE(0x100402, 0x100403) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_param_hi_w) // grainbow AM_RANGE(0x10040c, 0x10040d) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_size_w) // grainbow + AM_RANGE(0x100410, 0x100411) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_inc_w) // grainbow + AM_RANGE(0x100412, 0x100413) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_src_hi_w) // grainbow + AM_RANGE(0x100414, 0x100415) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_sprite_dma_src_lo_w) // grainbow + // AM_RANGE(0x10041c, 0x10041d) AM_WRITE(cop_angle_target_w) // angle target (for 0x6200 COP macro) // AM_RANGE(0x10041e, 0x10041f) AM_WRITE(cop_angle_step_w) // angle step (for 0x6200 COP macro) diff --git a/src/mame/machine/raiden2cop.c b/src/mame/machine/raiden2cop.c index c275de79cf6..c8509697085 100644 --- a/src/mame/machine/raiden2cop.c +++ b/src/mame/machine/raiden2cop.c @@ -44,6 +44,7 @@ raiden2cop_device::raiden2cop_device(const machine_config &mconfig, const char * m_cop_rng_max_value(0), m_cop_sprite_dma_param(0), + m_cop_sprite_dma_src(0), m_cop_sprite_dma_size(0), @@ -136,6 +137,7 @@ void raiden2cop_device::device_start() save_item(NAME(m_cop_sprite_dma_param)); save_item(NAME(m_cop_sprite_dma_size)); + save_item(NAME(m_cop_sprite_dma_src)); m_videoramout_cb.resolve_safe(); @@ -1106,3 +1108,34 @@ WRITE16_MEMBER(raiden2cop_device::cop_sprite_dma_size_w) { m_cop_sprite_dma_size = data; } + + +WRITE16_MEMBER( raiden2cop_device::cop_sprite_dma_src_hi_w) +{ + m_cop_sprite_dma_src = (m_cop_sprite_dma_src&0x0000ffff)|(data<<16); +} + +WRITE16_MEMBER( raiden2cop_device::cop_sprite_dma_src_lo_w) +{ + m_cop_sprite_dma_src = (m_cop_sprite_dma_src&0xffff0000)|(data&0xffff); +} + +// guess +WRITE16_MEMBER(raiden2cop_device::cop_sprite_dma_inc_w) +{ + if (data) + printf("Warning: COP RAM 0x410 used with %04x\n", data); + else + { + /* guess */ + cop_regs[4] += 8; + m_cop_sprite_dma_src += 6; + + m_cop_sprite_dma_size--; + + if (m_cop_sprite_dma_size > 0) + cop_status &= ~2; + else + cop_status |= 2; + } +} diff --git a/src/mame/machine/raiden2cop.h b/src/mame/machine/raiden2cop.h index b08ed207c9b..e583d60d3e3 100644 --- a/src/mame/machine/raiden2cop.h +++ b/src/mame/machine/raiden2cop.h @@ -156,9 +156,14 @@ public: // misc 68k (grainbow) UINT32 m_cop_sprite_dma_param; + UINT32 m_cop_sprite_dma_src; + DECLARE_WRITE16_MEMBER(cop_sprite_dma_param_hi_w); DECLARE_WRITE16_MEMBER(cop_sprite_dma_param_lo_w); DECLARE_WRITE16_MEMBER(cop_sprite_dma_size_w); + DECLARE_WRITE16_MEMBER(cop_sprite_dma_src_hi_w); + DECLARE_WRITE16_MEMBER(cop_sprite_dma_src_lo_w); + DECLARE_WRITE16_MEMBER(cop_sprite_dma_inc_w); int m_cop_sprite_dma_size; protected: diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c index c530e637104..f4e442bf1e3 100644 --- a/src/mame/machine/seicop.c +++ b/src/mame/machine/seicop.c @@ -1611,7 +1611,6 @@ seibu_cop_legacy_device::seibu_cop_legacy_device(const machine_config &mconfig, m_cop_rom_addr_lo(0), m_cop_rom_addr_hi(0), m_cop_rom_addr_unk(0), - m_cop_sprite_dma_src(0), m_cop_sprite_dma_abs_x(0), m_cop_sprite_dma_abs_y(0), m_raiden2cop(*this, ":raiden2cop") @@ -1651,7 +1650,6 @@ void seibu_cop_legacy_device::device_start() save_item(NAME(m_cop_rom_addr_lo)); save_item(NAME(m_cop_rom_addr_hi)); save_item(NAME(m_cop_rom_addr_unk)); - save_item(NAME(m_cop_sprite_dma_src)); save_item(NAME(m_cop_sprite_dma_abs_x)); save_item(NAME(m_cop_sprite_dma_abs_y)); } @@ -2070,30 +2068,7 @@ WRITE16_MEMBER( seibu_cop_legacy_device::generic_cop_w ) - case (0x010/2): - { - if(data) - printf("Warning: COP RAM 0x410 used with %04x\n",data); - else - { - /* guess */ - m_raiden2cop->cop_regs[4]+=8; - m_cop_sprite_dma_src+=6; - m_raiden2cop->m_cop_sprite_dma_size--; - - if(m_raiden2cop->m_cop_sprite_dma_size > 0) - m_raiden2cop->cop_status &= ~2; - else - m_raiden2cop->cop_status |= 2; - } - break; - } - - case (0x012/2): - case (0x014/2): - m_cop_sprite_dma_src = (m_cop_mcu_ram[0x014/2]) | (m_cop_mcu_ram[0x012/2] << 16); - break; /* triggered before 0x6200 in Seibu Cup, looks like an angle value ... */ case (0x01c/2): m_legacycop_angle_compare = UINT16(m_cop_mcu_ram[0x1c/2]); break; @@ -2470,7 +2445,7 @@ WRITE16_MEMBER( seibu_cop_legacy_device::generic_cop_w ) /* TODO: I really suspect that following two are actually taken from the 0xa180 macro command then internally loaded */ abs_x = space.read_word(m_raiden2cop->cop_regs[0] + 8) - m_cop_sprite_dma_abs_x; abs_y = space.read_word(m_raiden2cop->cop_regs[0] + 4) - m_cop_sprite_dma_abs_y; - rel_xy = space.read_word(m_cop_sprite_dma_src + 4 + offs); + rel_xy = space.read_word(m_raiden2cop->m_cop_sprite_dma_src + 4 + offs); //if(rel_xy & 0x0706) // printf("sprite rel_xy = %04x\n",rel_xy); @@ -2492,8 +2467,8 @@ WRITE16_MEMBER( seibu_cop_legacy_device::generic_cop_w ) offs = (offset & 3) * 4; - space.write_word(m_raiden2cop->cop_regs[4] + offs + 0,space.read_word(m_cop_sprite_dma_src + offs) + (m_raiden2cop->m_cop_sprite_dma_param & 0x3f)); - //space.write_word(m_raiden2cop->cop_regs[4] + offs + 2,space.read_word(m_cop_sprite_dma_src+2 + offs)); + space.write_word(m_raiden2cop->cop_regs[4] + offs + 0,space.read_word(m_raiden2cop->m_cop_sprite_dma_src + offs) + (m_raiden2cop->m_cop_sprite_dma_param & 0x3f)); + //space.write_word(m_raiden2cop->cop_regs[4] + offs + 2,space.read_word(m_raiden2cop->m_cop_sprite_dma_src+2 + offs)); return; } diff --git a/src/mame/machine/seicop.h b/src/mame/machine/seicop.h index 1698f202818..d5496314f7e 100644 --- a/src/mame/machine/seicop.h +++ b/src/mame/machine/seicop.h @@ -49,7 +49,6 @@ private: int m_r0, m_r1; UINT16 m_cop_rom_addr_lo,m_cop_rom_addr_hi,m_cop_rom_addr_unk; - UINT32 m_cop_sprite_dma_src; int m_cop_sprite_dma_abs_x,m_cop_sprite_dma_abs_y;