raiden2: Add 6200 (nw)

This commit is contained in:
Olivier Galibert 2014-08-29 13:21:14 +00:00
parent 14bf816628
commit 040ee1c0e0
2 changed files with 45 additions and 4 deletions

View File

@ -480,6 +480,16 @@ WRITE16_MEMBER(raiden2_state::cop_scale_w)
cop_scale &= 3;
}
WRITE16_MEMBER(raiden2_state::cop_angle_target_w)
{
COMBINE_DATA(&cop_angle_target);
}
WRITE16_MEMBER(raiden2_state::cop_angle_step_w)
{
COMBINE_DATA(&cop_angle_step);
}
READ16_MEMBER(raiden2_state::cop_reg_high_r)
{
return cop_regs[offset] >> 16;
@ -625,6 +635,35 @@ WRITE16_MEMBER(raiden2_state::cop_cmd_w)
break;
}
case 0x6200: {
UINT8 angle = space.read_byte(cop_regs[0]+0x34);
UINT16 flags = space.read_word(cop_regs[0]);
cop_angle_target &= 0xff;
cop_angle_step &= 0xff;
flags &= ~0x0004;
int delta = angle - cop_angle_target;
if(delta >= 128)
delta -= 256;
else if(delta < -128)
delta += 256;
if(delta < 0) {
if(delta >= -cop_angle_step) {
angle = cop_angle_target;
flags |= 0x0004;
} else
angle += cop_angle_step;
} else {
if(delta <= cop_angle_step) {
angle = cop_angle_target;
flags |= 0x0004;
} else
angle -= cop_angle_step;
}
space.write_word(cop_regs[0], flags);
space.write_byte(cop_regs[0]+0x34, angle);
break;
}
case 0x8100: { // 8100 0007 fdfb 0080 - 0b9a 0b88 0888 0000 0000 0000 0000 0000
int raw_angle = (space.read_word(cop_regs[0]+(0x34)) & 0xff);
double angle = raw_angle * M_PI / 128;
@ -1396,8 +1435,8 @@ WRITE16_MEMBER(raiden2_state::cop_sort_dma_trig_w)
/* MEMORY MAPS */
static ADDRESS_MAP_START( raiden2_cop_mem, AS_PROGRAM, 16, raiden2_state )
// AM_RANGE(0x0041c, 0x0041d) AM_WRITENOP // angle compare (for 0x6200 COP macro)
// AM_RANGE(0x0041e, 0x0041f) AM_WRITENOP // angle mod value (for 0x6200 COP macro)
AM_RANGE(0x0041c, 0x0041d) AM_WRITE(cop_angle_target_w) // angle target (for 0x6200 COP macro)
AM_RANGE(0x0041e, 0x0041f) AM_WRITE(cop_angle_step_w) // angle step (for 0x6200 COP macro)
AM_RANGE(0x00420, 0x00421) AM_WRITE(cop_itoa_low_w)
AM_RANGE(0x00422, 0x00423) AM_WRITE(cop_itoa_high_w)
AM_RANGE(0x00424, 0x00425) AM_WRITE(cop_itoa_digit_count_w)

View File

@ -27,6 +27,8 @@ public:
DECLARE_WRITE16_MEMBER( cop_dma_v1_w );
DECLARE_WRITE16_MEMBER( cop_dma_v2_w );
DECLARE_WRITE16_MEMBER( cop_scale_w );
DECLARE_WRITE16_MEMBER( cop_angle_target_w );
DECLARE_WRITE16_MEMBER( cop_angle_step_w );
DECLARE_WRITE16_MEMBER( cop_dma_adr_rel_w );
DECLARE_WRITE16_MEMBER( cop_dma_src_w );
DECLARE_WRITE16_MEMBER( cop_dma_size_w );
@ -108,8 +110,8 @@ public:
UINT16 cop_func_mask[0x100/8]; /* function mask (?) */
UINT16 cop_program[0x100]; /* program "code" */
UINT16 cop_latch_addr, cop_latch_trigger, cop_latch_value, cop_latch_mask;
INT8 cop_angle_compare;
UINT8 cop_angle_mod_val;
UINT16 cop_angle_target;
UINT16 cop_angle_step;
DECLARE_WRITE16_MEMBER( sprite_prot_x_w );
DECLARE_WRITE16_MEMBER( sprite_prot_y_w );