mirror of
https://github.com/holub/mame
synced 2025-05-23 22:20:01 +03:00
raiden2: Advance the cop code a little [O. Galibert]
This commit is contained in:
parent
e9007eba58
commit
8ae2b4887e
@ -274,6 +274,16 @@ READ16_MEMBER(raiden2_state::cop_status_r)
|
||||
return cop_status;
|
||||
}
|
||||
|
||||
READ16_MEMBER(raiden2_state::cop_angle_r)
|
||||
{
|
||||
return cop_angle;
|
||||
}
|
||||
|
||||
READ16_MEMBER(raiden2_state::cop_dist_r)
|
||||
{
|
||||
return cop_dist;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(raiden2_state::cop_scale_w)
|
||||
{
|
||||
COMBINE_DATA(&cop_scale);
|
||||
@ -308,24 +318,31 @@ WRITE16_MEMBER(raiden2_state::cop_cmd_w)
|
||||
space.write_dword(cop_regs[0] + 4 + offset*4, space.read_dword(cop_regs[0] + 4 + offset*4) + space.read_dword(cop_regs[0] + 16 + offset*4));
|
||||
break;
|
||||
|
||||
case 0x130e:
|
||||
case 0x138e: { // 130e 0005 bf7f 0010 - 0984 0aa4 0d82 0aa2 039b 0b9a 0b9a 0a9a
|
||||
int dx = space.read_dword(cop_regs[1]+4) - space.read_dword(cop_regs[0]+4);
|
||||
int dy = space.read_dword(cop_regs[1]+8) - space.read_dword(cop_regs[0]+8);
|
||||
if(!dy)
|
||||
if(!dy) {
|
||||
cop_status |= 0x8000;
|
||||
else {
|
||||
UINT8 angle = atan(double(dx)/double(dy)) * 128 / M_PI;
|
||||
if(dx<0)
|
||||
angle += 0x80;
|
||||
space.write_byte(cop_regs[0]+0x34, angle);
|
||||
cop_angle = 0;
|
||||
} else {
|
||||
cop_angle = atan(double(dx)/double(dy)) * 128 / M_PI;
|
||||
if(dy<0)
|
||||
cop_angle += 0x80;
|
||||
}
|
||||
dx = dx >> 16;
|
||||
dy = dy >> 16;
|
||||
cop_dist = sqrt((double)(dx*dx+dy*dy));
|
||||
|
||||
if(data & 0x0080) {
|
||||
space.write_byte(cop_regs[0]+0x34, cop_angle);
|
||||
space.write_word(cop_regs[0]+0x38, cop_dist);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x3bb0: { // 3bb0 0004 007f 0038 - 0f9c 0b9c 0b9c 0b9c 0b9c 0b9c 0b9c 099c
|
||||
int dx = (space.read_dword(cop_regs[1]+4) - space.read_dword(cop_regs[0]+4)) >> 16;
|
||||
int dy = (space.read_dword(cop_regs[1]+8) - space.read_dword(cop_regs[0]+8)) >> 16;
|
||||
space.write_word(cop_regs[0]+0x38, sqrt((double)(dx*dx+dy*dy)));
|
||||
// called systematically after 130e/138e, no results expected it seems
|
||||
break;
|
||||
}
|
||||
|
||||
@ -806,6 +823,8 @@ static ADDRESS_MAP_START( raiden2_mem, ADDRESS_SPACE_PROGRAM, 16, raiden2_state
|
||||
AM_RANGE(0x00500, 0x00503) AM_WRITE(cop_cmd_w)
|
||||
AM_RANGE(0x00590, 0x00599) AM_READ(cop_itoa_digits_r)
|
||||
AM_RANGE(0x005b0, 0x005b1) AM_READ(cop_status_r)
|
||||
AM_RANGE(0x005b2, 0x005b3) AM_READ(cop_dist_r)
|
||||
AM_RANGE(0x005b4, 0x005b5) AM_READ(cop_angle_r)
|
||||
|
||||
AM_RANGE(0x00620, 0x0062b) AM_WRITE(tile_scroll_w)
|
||||
AM_RANGE(0x006a0, 0x006a3) AM_WRITE(sprcpt_val_1_w)
|
||||
|
@ -26,14 +26,16 @@ public:
|
||||
DECLARE_WRITE16_MEMBER( cop_cmd_w );
|
||||
DECLARE_READ16_MEMBER ( cop_itoa_digits_r );
|
||||
DECLARE_READ16_MEMBER ( cop_status_r );
|
||||
DECLARE_READ16_MEMBER ( cop_dist_r );
|
||||
DECLARE_READ16_MEMBER ( cop_angle_r );
|
||||
DECLARE_WRITE16_MEMBER ( cop_dma_trigger_w );
|
||||
DECLARE_WRITE16_MEMBER ( cop_tile_bank_2_w );
|
||||
DECLARE_WRITE16_MEMBER ( tile_scroll_w );
|
||||
DECLARE_WRITE16_MEMBER ( tile_bank_01_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_background_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_foreground_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_midground_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_text_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_midground_w );
|
||||
DECLARE_WRITE16_MEMBER ( raiden2_text_w );
|
||||
|
||||
DECLARE_WRITE16_MEMBER( sprcpt_val_1_w );
|
||||
DECLARE_WRITE16_MEMBER( sprcpt_val_2_w );
|
||||
@ -62,7 +64,7 @@ public:
|
||||
|
||||
UINT16 scrollvals[6];
|
||||
UINT32 cop_regs[4], cop_itoa;
|
||||
UINT16 cop_status, cop_scale, cop_itoa_digit_count;
|
||||
UINT16 cop_status, cop_scale, cop_itoa_digit_count, cop_angle, cop_dist;
|
||||
UINT8 cop_itoa_digits[10];
|
||||
UINT16 cop_dma_mode, cop_dma_adr, cop_dma_size, cop_dma_v1, cop_dma_v2, cop_dma_v3;
|
||||
UINT16 sprites[0x800], sprites_cur_start;
|
||||
|
Loading…
Reference in New Issue
Block a user