diff --git a/src/mame/machine/seibucop/seibucop.cpp b/src/mame/machine/seibucop/seibucop.cpp index b5defce18c3..2ae09fbd5b7 100644 --- a/src/mame/machine/seibucop/seibucop.cpp +++ b/src/mame/machine/seibucop/seibucop.cpp @@ -49,7 +49,25 @@ - stage 4: has sprite stuck on bottom-left of screen; - palette dims too much on attract / continue screen. It's known that the DMA data arrangement gives same results on a real Legionnaire board, so shrug? - + Seibu Cup Soccer + - Handles collision detection via the 130e/3bb0 macros + 130e version in this makes a sub instead of an add as last opcode, which in turn reflects with + the distance (which we do know that is internally loaded somehow). +013F3C: 3D7C 130E 0100 move.w #$130e, ($100,A6) // angle macro +013F42: 302E 01B4 move.w ($1b4,A6), D0 // take the angle +013F46: 082E 000F 01B0 btst #$f, ($1b0,A6) // is status exception flag raised? +013F4C: 6712 beq $13f60 +013F4E: 2228 0004 move.l ($4,A0), D1 +013F52: B2A8 0044 cmp.l ($44,A0), D1 // compares Y value against the next object (yes, cop_regs[1] + 0x40 = cop_regs[0]) +013F56: 6708 beq $13f60 // if equal then check the distance +013F58: 6E04 bgt $13f5e +013F5A: 7040 moveq #$40, D0 // set angle direction left ... +013F5C: 6002 bra $13f60 +013F5E: 70C0 moveq #-$40, D0 // ... or right +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 + Tech notes (to move into own file with doxy mainpage): ----------- [0x6fc] DMA mode bit scheme: @@ -66,6 +84,8 @@ [0x10-0x13] Y offset (a.k.a. calculated sine) [0x14-0x17] X offset (a.k.a. calculated cosine) [0x37] angle direction + TOC + [0x11381c] ball object ***************************************************************************/ diff --git a/src/mame/machine/seibucop/seibucop_cmd.hxx b/src/mame/machine/seibucop/seibucop_cmd.hxx index 73a81399a09..ac5dc0ee487 100644 --- a/src/mame/machine/seibucop/seibucop_cmd.hxx +++ b/src/mame/machine/seibucop/seibucop_cmd.hxx @@ -72,16 +72,20 @@ void raiden2cop_device::LEGACY_execute_130e_cupsoc(int offset, UINT16 data) { int dy = m_host_space->read_dword(cop_regs[1] + 4) - m_host_space->read_dword(cop_regs[0] + 4); int dx = m_host_space->read_dword(cop_regs[1] + 8) - m_host_space->read_dword(cop_regs[0] + 8); - + cop_status = 7; + if (!dx) { cop_status |= 0x8000; cop_angle = 0; } - else { + else + { cop_angle = (int)(atan(double(dy) / double(dx)) * 128.0 / M_PI); if (dx < 0) cop_angle += 0x80; + + cop_angle &= 0xff; } m_LEGACY_r0 = dy; @@ -90,7 +94,7 @@ void raiden2cop_device::LEGACY_execute_130e_cupsoc(int offset, UINT16 data) //printf("%d %d %f %04x\n",dx,dy,atan(double(dy)/double(dx)) * 128 / M_PI,cop_angle); if (data & 0x80) - m_host_space->write_word(cop_regs[0] + (0x34 ^ 2), cop_angle); + cop_write_byte(cop_regs[0] + (0x34), cop_angle); } /*