F1 is presumed to be upper regs selector. More work with the bootleg (nw)

This commit is contained in:
angelosa 2016-07-07 20:16:30 +02:00
parent d252e41b4f
commit 304481a872
4 changed files with 85 additions and 23 deletions

View File

@ -797,10 +797,10 @@ ROM_START( cupsocsb3 )
ROM_COPY( "adpcm", 0xe0000, 0x1e0000, 0x20000 )
/* these are maths tables, for whatever COP replacement the bootlegs use */
ROM_REGION( 0x500000, "unknown0", 0 )
ROM_REGION( 0x020000, "unknown0", 0 )
ROM_LOAD16_BYTE( "sc_13.bin", 0x00000, 0x010000, CRC(229bddd8) SHA1(0924bf29db9c5a970546f154e7752697fdce6a58) )
ROM_LOAD16_BYTE( "sc_12.bin", 0x00001, 0x010000, CRC(dabfa826) SHA1(0db587c846755491b169ef7751ba8e7cdc2607e6) )
ROM_REGION( 0x500000, "unknown1", 0 )
ROM_REGION( 0x100000, "unknown1", 0 )
ROM_LOAD16_BYTE( "sc_15.bin", 0x00000, 0x080000, CRC(8fd87e65) SHA1(acc9fd0289fa9ab60bec16d3e642039380e5180a) )
ROM_LOAD16_BYTE( "sc_14.bin", 0x00001, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
ROM_END

View File

@ -38,8 +38,8 @@
- (btanb) Throw is made by quickly double jumping (!)
Heated Barrel
- gives random value to hi-score if you continue (only the first time, not a bug?);
- (fixed?) throws random address exceptions at level 3 and above, a RAM address arrives corrupt in the snippet at 0x136a;
- (fixed?) some corrupt sprites, probably a non-fatal version of the one above;
- (fixed) throws random address exceptions at level 3 and above, a RAM address arrives corrupt in the snippet at 0x136a;
- (fixed) some corrupt sprites, probably a non-fatal version of the one above;
- stage 2 boss attacks only in vertical (regressed with the 130e / 3b30 / 42c2 command merge);
- (fixed) level 3+ boss movements looks wrong;
- stage 3 "homing" missiles doesn't seem to like our 6200 hookup here, except it's NOT 6200!?
@ -69,7 +69,10 @@
013F60: 3D7C 3BB0 0100 move.w #$3bb0, ($100,A6) // dist macro
013F66: 1140 003D move.b D0, ($3d,A0) // move angle value to [0x3d]
013F6A: 4E75 rts
Zero Team
- Bird Boss jumps to wrong direction
the sequence called is:
write to reg 4 then execute 0xfc84 and 0xf790, finally reads the distance.
Tech notes (to move into own file with doxy mainpage):
-----------
@ -311,16 +314,17 @@ WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w)
cop_func_trigger[idx] = cop_latch_trigger;
cop_func_value[idx] = cop_latch_value;
cop_func_mask[idx] = cop_latch_mask;
bool upper_regs = ((cop_latch_trigger >> 10) & 1) == 1; // f1
if(data) {
int off = data & 31;
int reg = (data >> 5) & 3;
int reg = ((data >> 5) & 3) + (upper_regs == true ? 4 : 0);
int op = (data >> 7) & 31;
logerror("COPDIS: %04x s=%02x f1=%x l=%x f2=%02x %x %04x %02x %03x %02x.%x.%02x ", cop_latch_trigger, (cop_latch_trigger >> 11) << 3, (cop_latch_trigger >> 10) & 1, ((cop_latch_trigger >> 7) & 7)+1, cop_latch_trigger & 0x7f, cop_latch_value, cop_latch_mask, cop_latch_addr, data, op, reg, off);
off *= 2;
// COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 00 188 03.0.08 read32 10(r0)
// COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 01 282 05.0.02 add32 4(r0)
// COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 02 082 01.0.02 write32 4(r0)
@ -1140,7 +1144,7 @@ WRITE16_MEMBER( raiden2cop_device::cop_cmd_w)
case 0x7e05:
execute_7e05(offset, data);
break;
case 0xa100:
case 0xa180:
execute_a100(offset, data); // collisions

View File

@ -43,20 +43,25 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::reg_hi_addr_w)
WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
{
//printf("%04x %08x %08x\n",data,m_reg[0],m_reg[1]);
UINT8 offs;
offs = (offset & 3) * 4;
switch(data)
{
default:
//printf("trigger write %04x\n",data);
printf("trigger write %04x\n",data);
break;
case 0x0000:
break;
case 0xf105:
break;
case 0xdde5:
{
UINT8 offs;
int div;
INT16 dir_offset;
offs = (offset & 3) * 4;
div = m_host_space->read_word(m_reg[4] + offs);
dir_offset = m_host_space->read_word(m_reg[4] + offs + 8);
@ -67,9 +72,6 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
}
case 0x0205:
{
UINT8 offs;
offs = (offset & 3) * 4;
int ppos = m_host_space->read_dword(m_reg[0] + 4 + offs);
int npos = ppos + m_host_space->read_dword(m_reg[0] + 0x10 + offs);
int delta = (npos >> 16) - (ppos >> 16);
@ -78,7 +80,8 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
m_host_space->write_word(m_reg[0] + 0x1c + offs, m_host_space->read_word(m_reg[0] + 0x1c + offs) + delta);
break;
}
case 0x130e:
case 0x138e:
case 0xe30e:
case 0xe18e:
@ -88,12 +91,12 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
int dx = (m_host_space->read_dword(m_reg[target_reg]+8) >> 16) - (m_host_space->read_dword(m_reg[0]+8) >> 16);
//m_status = 7;
if(!dx) {
if(!dy) {
m_status = 0x8000;
m_angle = 0;
} else {
m_status = 0;
m_angle = atan(double(dy)/double(dx)) * 128.0 / M_PI;
m_angle = atan(double(dx)/double(dy)) * 128.0 / M_PI;
if(dx<0)
{
@ -105,7 +108,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
m_dx = dx;
if(data & 0x80)
m_host_space->write_word(m_reg[0]+(0x34^2), m_angle & 0xff);
m_host_space->write_byte(m_reg[0]+(0x37), m_angle & 0xff);
break;
}
@ -118,25 +121,59 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
dx >>= 16;
dy >>= 16;
m_dist = sqrt((double)(dx*dx+dy*dy));
// TODO: is this right?
m_host_space->write_word(m_reg[0]+(0x38), m_dist);
break;
}
// TODO: wrong
case 0x42c2:
{
int div = m_host_space->read_word(m_reg[0] + (0x34));
if (!div)
{
m_status |= 0x8000;
m_host_space->write_dword(m_reg[0] + (0x38), 0);
break;
}
m_host_space->write_dword(m_reg[0] + (0x38), (m_dist << (5 - 1)) / div);
break;
}
/*
00000-0ffff:
amp = x/256
ang = x & 255
s = sin(ang*2*pi/256)
val = trunc(s*amp)
if(s<0)
val--
if(s == 192)
val = -2*amp
*/
case 0x8100:
{
UINT16 sin_offs; //= m_host_space->read_dword(m_reg[0]+(0x34));
sin_offs = m_host_space->read_byte(m_reg[0]+(0x35));
sin_offs |= m_host_space->read_byte(m_reg[0]+(0x37)) << 8;
int raw_angle = (m_host_space->read_word(m_reg[0]+(0x34^2)) & 0xff);
double angle = raw_angle * M_PI / 128;
double amp = (65536 >> 5)*(m_host_space->read_word(m_reg[0]+(0x36^2)) & 0xff);
int res;
/* TODO: up direction, why? */
/* TODO: up direction, why? */
if(raw_angle == 0xc0)
amp*=2;
res = int(amp*sin(angle)) << 1;//m_raiden2cop->cop_scale;
printf("%04x %02x %08x\n",sin_offs,raw_angle,res);
m_host_space->write_dword(m_reg[0] + 0x10, res);
break;
@ -160,7 +197,11 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w)
break;
}
case 0xd104:
{
//m_host_space->write_dword(m_reg[0] + 4 + offs, 0x04000000);
break;
}
}
}
@ -180,9 +221,23 @@ READ16_MEMBER(seibu_cop_bootleg_device::angle_r)
return m_angle;
}
READ16_MEMBER(seibu_cop_bootleg_device::d104_move_r)
{
return m_d104_move_offset >> offset*16;
}
WRITE16_MEMBER(seibu_cop_bootleg_device::d104_move_w)
{
if(offset == 1)
m_d104_move_offset = (m_d104_move_offset & 0xffff0000) | (data & 0xffff);
else
m_d104_move_offset = (m_d104_move_offset & 0xffff) | (data << 16);
}
// anything that is read thru ROM range 0xc**** is replacement code, therefore on this HW they are latches.
static ADDRESS_MAP_START( seibucopbl_map, AS_0, 16, seibu_cop_bootleg_device )
AM_RANGE(0x01e, 0x01f) AM_RAM // angle step, PC=0xc0186
AM_RANGE(0x046, 0x049) AM_READWRITE(d104_move_r,d104_move_w)
AM_RANGE(0x070, 0x07f) AM_RAM // DMA registers, PC=0xc0034
AM_RANGE(0x0a0, 0x0af) AM_READWRITE(reg_hi_addr_r,reg_hi_addr_w)
AM_RANGE(0x0c0, 0x0cf) AM_READWRITE(reg_lo_addr_r,reg_lo_addr_w)

View File

@ -22,6 +22,8 @@ public:
DECLARE_WRITE16_MEMBER( reg_lo_addr_w );
DECLARE_WRITE16_MEMBER( reg_hi_addr_w );
DECLARE_WRITE16_MEMBER( cmd_trigger_w );
DECLARE_READ16_MEMBER( d104_move_r );
DECLARE_WRITE16_MEMBER( d104_move_w );
protected:
// device-level overrides
@ -40,6 +42,7 @@ private:
UINT32 m_reg[8];
UINT16 m_angle,m_dist,m_status;
int m_dx,m_dy;
UINT32 m_d104_move_offset;
//required_device<raiden2cop_device> m_raiden2cop;
};