Previous 199869 Revisions Next

r17979 Monday 17th September, 2012 at 21:53:48 UTC by Angelo Salese
Seibu COP: Added 0x1c param to 0x0205 command, fixes at least sprite positioning during intros of Raiden 2 and Zero Team
(but breaks gameplay in Zero Team, needs investigation) [Angelo Salese, Smitdogg]

Seibu COP: Made 0x42c2 command more accurate, makes Legionnaire enemies to behave properly and match finally starts in Seibu Cup Soccer [Angelo Salese, Smitdogg]
[src/mame/drivers]raiden2.c
[src/mame/machine]seicop.c

trunk/src/mame/machine/seicop.c
r17978r17979
147814780x1c0  0x00    0x71
147914790x1e0  0x00    0x72
14801480
1481
1482command 0x3bb0
1483dx    dy   | dist
1484-----------|-----
14850x00  0x00 | 0xb5
14860x20  0x00 | 0xa0
14870x40  0x00 | 0x8f
14880x60  0x00 | 0x83
14890x80  0x00 | 0x80
14900xa0  0x00 | 0x83
14910xc0  0x00 | 0x8f
14920xe0  0x00 | 0xa0
1493
1494command 0x42c2
1495dx    dy   | stat   dist angle scale  r34(r) r36     r38*  r3a
1496-----------|-----------------------------------------------------
14970x00  0x00 | 0x0067 0x20 0x20  0x0000 0x0001 0x0020  0xb5 0x16a0
14980x20  0x00 | 0x0027 0x20 0x26  0x0000 0x0001 0x0026  0xa0 0x1400
14990x40  0x00 | 0x0067 0x20 0x2d  0x0000 0x0001 0x002d  0x8f 0x11e3
15000x60  0x00 | 0x0067 0x20 0x36  0x0000 0x0001 0x0036  0x83 0x107e
15010x80  0x00 | 0x0027 0x20 0x00  0x0000 0x0001 0x0000  0x80 0x1000
15020xa0  0x00 | 0x0067 0x20 0x4a  0x0000 0x0001 0x004a  0x83 0x107e
15030xc0  0x00 | 0x0067 0x20 0x53  0x0000 0x0001 0x0053  0x8f 0x11e3
15040xe0  0x00 | 0x0027 0x20 0x5a  0x0000 0x0001 0x005a  0xa0 0x1400
1505
15060x00  0x00 | ****** 0x10 0x20  0x0000 0x0002 0x0020  0xb5 0x0b50
15070x20  0x00 | ****** 0x10 0x26  0x0000 0x0002 0x0026  0xa0 0x0a00
15080x40  0x00 | ****** 0x10 0x2d  0x0000 0x0002 0x002d  0x8f 0x08f1
15090x60  0x00 | ****** 0x10 0x36  0x0000 0x0002 0x0036  0x83 0x083f
15100x80  0x00 | ****** 0x10 0x00  0x0000 0x0002 0x0000  0x80 0x0800
15110xa0  0x00 | ****** 0x10 0x4a  0x0000 0x0002 0x004a  0x83 0x083f
15120xc0  0x00 | ****** 0x10 0x53  0x0000 0x0002 0x0053  0x8f 0x08f1
15130xe0  0x00 | ****** 0x10 0x5a  0x0000 0x0002 0x005a  0xa0 0x0a00
1514
15150x00  0x00 | ****** 0x08 0x20  0x0000 0x0004 0x0020  0xb5 0x05a8
15160x20  0x00 | ****** 0x08 0x26  0x0000 0x0004 0x0026  0xa0 0x0500
1517
15180x20  0x00 | ****** 0x02 0x26  0x0000 0x0010 0x0026  0xa0 0x0140
1519
15200xc0  0x00 | 0x0047 0x01 0x53  0x0000 0x0020 0x0053  0x8f 0x008f
1521
15220x60  0x00 | 0x0047 0x00 0x36  0x0000 0x0040 0x0036  0x83 0x0041
1523
15240x40  0x00 | 0x0047 0x00 0x2d  0x0000 0x0080 0x002d  0x8f 0x0023
1525
15260x40  0x00 | 0x8007 0x00 0x2d  0x0000 0x0400 0x008f  0x8f 0x0000
1527
15280x00  0x00 | 0x0067 0x10 0x2d  0x0000 0x0001 0x0020  0xb5 0x0b50
1529
1530
1531*same as 0x3bb0
14811532*/
14821533
14831534#include "emu.h"
r17978r17979
18651916{
18661917   INT16 start_x,start_y,end_x,end_y;
18671918
1868   end_y = INT8(cop_collision_info[offs].hitbox_y >> 8);
1869   start_y = INT8(cop_collision_info[offs].hitbox_y);
1870   end_x = INT8(cop_collision_info[offs].hitbox_x >> 8);
1871   start_x = INT8(cop_collision_info[offs].hitbox_x);
1919   /* TODO: hack for SD Gundam */
1920   #if 0
1921   if(cop_collision_info[offs].hitbox_y == 0x2800 && cop_collision_info[offs].hitbox_x == 0xa000)
1922   {
1923      end_y = 0xff;
1924      start_y = -16;
1925      end_x = 0xff;
1926      start_x = 0;
1927   }
1928   else
1929   #endif
1930   {
1931      end_y = INT8(cop_collision_info[offs].hitbox_y >> 8);
1932      start_y = INT8(cop_collision_info[offs].hitbox_y);
1933      end_x = INT8(cop_collision_info[offs].hitbox_x >> 8);
1934      start_x = INT8(cop_collision_info[offs].hitbox_x);
1935   }
18721936
18731937   cop_collision_info[offs].min_x = start_x + (cop_collision_info[offs].x >> 16);
18741938   cop_collision_info[offs].min_y = start_y + (cop_collision_info[offs].y >> 16);
r17978r17979
18871951   if(cop_collision_info[0].max_x >= cop_collision_info[1].min_x && cop_collision_info[0].min_x <= cop_collision_info[1].max_x)
18881952      res &= ~2;
18891953
1954   if(cop_collision_info[1].max_x >= cop_collision_info[0].min_x && cop_collision_info[1].min_x <= cop_collision_info[0].max_x)
1955      res &= ~2;
1956
18901957   /* outbound Y check */
18911958   if(cop_collision_info[0].max_y >= cop_collision_info[1].min_y && cop_collision_info[0].min_y <= cop_collision_info[1].max_y)
18921959      res &= ~1;
18931960
1961   if(cop_collision_info[1].max_y >= cop_collision_info[0].min_y && cop_collision_info[1].min_y <= cop_collision_info[0].max_y)
1962      res &= ~1;
1963
18941964   cop_hit_val_x = (cop_collision_info[0].x - cop_collision_info[1].x) >> 16;
18951965   cop_hit_val_y = (cop_collision_info[0].y - cop_collision_info[1].y) >> 16;
18961966   cop_hit_val_z = 1;
18971967   cop_hit_val_unk = res; // TODO: there's also bit 2 and 3 triggered in the tests, no known meaning
18981968
1899
19001969   //popmessage("%d %d %04x %04x %04x %04x",cop_hit_val_x,cop_hit_val_y,cop_collision_info[0].hitbox_x,cop_collision_info[0].hitbox_y,cop_collision_info[1].hitbox_x,cop_collision_info[1].hitbox_y);
19011970
19021971   //if(res == 0)
19031972   //popmessage("0:%08x %08x %08x 1:%08x %08x %08x\n",cop_collision_info[0].x,cop_collision_info[0].y,cop_collision_info[0].hitbox,cop_collision_info[1].x,cop_collision_info[1].y,cop_collision_info[1].hitbox);
1973//   popmessage("0:%08x %08x %08x %08x 1:%08x %08x %08x %08x\n",cop_collision_info[0].min_x,cop_collision_info[0].max_x,cop_collision_info[0].min_y, cop_collision_info[0].max_y,
1974//                                                    cop_collision_info[1].min_x,cop_collision_info[1].max_x,cop_collision_info[1].min_y, cop_collision_info[1].max_y);
19041975
19051976   return res;
19061977}
r17978r17979
22282299
22292300            offs = (offset & 3) * 4;
22302301
2231            /* TODO: 0x1c operation? */
2232
22332302            space.write_dword(cop_register[0] + 0x04 + offs, space.read_dword(cop_register[0] + 0x04 + offs) + space.read_dword(cop_register[0] + 0x10 + offs));
2303            space.write_dword(cop_register[0] + 0x1c + offs, space.read_dword(cop_register[0] + 0x10 + offs) + space.read_dword(cop_register[0] + 0x1c + offs));
22342304            return;
22352305         }
22362306
r17978r17979
23232393                  cop_angle += 0x80;
23242394            }
23252395
2396            r0 = dy;
2397            r1 = dx;
2398
23262399            //printf("%d %d %f %04x\n",dx,dy,atan(double(dy)/double(dx)) * 128 / M_PI,cop_angle);
23272400
23282401            if(cop_mcu_ram[offset] & 0x80)
r17978r17979
23682441            int dy = r0;
23692442            int dx = r1;
23702443
2371            dx = dx >> 16;
2372            dy = dy >> 16;
2444            dx >>= 16;
2445            dy >>= 16;
23732446            cop_dist = sqrt((double)(dx*dx+dy*dy));
23742447
23752448            if(cop_mcu_ram[offset] & 0x80)
2376               space.write_word(cop_register[0]+(0x38^2), cop_dist);
2449               space.write_word(cop_register[0]+(0x38), cop_dist);
23772450            return;
23782451         }
23792452
r17978r17979
23882461               v2 = (x & 1023)*32
23892462               val = !v1 ? 32767 : trunc(v2/v1+0.5)
23902463            */
2391            /* TODO: this is WRONG! */
23922464         if(COP_CMD(0xf9a,0xb9a,0xb9c,0xb9c,0xb9c,0x29c,0x000,0x000,5,0xfcdd))
23932465         {
23942466            int div = space.read_word(cop_register[0]+(0x36^2));
r17978r17979
24002472               div = 1;
24012473            }
24022474
2403            res = space.read_word(cop_register[0]+(0x38^2)) / div;
2404            res <<= cop_scale + 2; /* TODO: check this */
2475            /* TODO: not yet accurate (throws some bits away while converting) */
2476            res = cop_dist;
2477            res <<= 5 - cop_scale;
2478            res /= div;
24052479
2480            cop_dist = (1 << (5 - cop_scale)) / div;
2481
2482            /* TODO: bits 5-6-15 */
2483            cop_status = 7;
2484
24062485            space.write_word(cop_register[0]+(0x38^2), res);
24072486            return;
24082487         }
trunk/src/mame/drivers/raiden2.c
r17978r17979
497497
498498   switch(data) {
499499   case 0x0205:   // 0205 0006 ffeb 0000 - 0188 0282 0082 0b8e 098e 0000 0000 0000
500      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));
500      printf("%08x %08x\n",space.read_dword(cop_regs[0] + 0x1c + offset*4),space.read_dword(cop_regs[0] + 0x10 + offset*4));
501
502      space.write_dword(cop_regs[0] + 4 + offset*4, space.read_dword(cop_regs[0] + 4 + offset*4) + space.read_dword(cop_regs[0] + 0x10 + offset*4));
501503      /* TODO: check the following, makes Zero Team to crash as soon as this command is triggered. */
502      //space.write_word(cop_regs[0] + 0x1c + offset*4, space.read_word(cop_regs[0] + 0x1c + offset*4) + space.read_word(cop_regs[0] + 16 + offset*4));
504      space.write_dword(cop_regs[0] + 0x1c + offset*4, space.read_dword(cop_regs[0] + 0x1c + offset*4) + space.read_dword(cop_regs[0] + 0x10 + offset*4));
503505      break;
504506
505507   case 0x0904: { /* X Se Dae and Zero Team uses this variant */
r17978r17979
523525         if(dy<0)
524526            cop_angle += 0x80;
525527      }
526      dx = dx >> 16;
527      dy = dy >> 16;
528      cop_dist = sqrt((double)(dx*dx+dy*dy));
529528
530529      if(data & 0x0080) {
531530         space.write_byte(cop_regs[0]+0x34, cop_angle);
532         space.write_word(cop_regs[0]+0x38, cop_dist);
533531      }
534532      break;
535533   }
536534
535   case 0x3b30:
537536   case 0x3bb0: { // 3bb0 0004 007f 0038 - 0f9c 0b9c 0b9c 0b9c 0b9c 0b9c 0b9c 099c
538      // called systematically after 130e/138e, no results expected it seems
537      /* TODO: these are actually internally loaded */
538      int dx = space.read_dword(cop_regs[1]+4) - space.read_dword(cop_regs[0]+4);
539      int dy = space.read_dword(cop_regs[1]+8) - space.read_dword(cop_regs[0]+8);
540
541      dx = dx >> 16;
542      dy = dy >> 16;
543      cop_dist = sqrt((double)(dx*dx+dy*dy));
544
545      if(data & 0x0080)
546         space.write_word(cop_regs[0]+0x38, cop_dist);
539547      break;
540548   }
541549
r17978r17979
18671875   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
18681876
18691877   MCFG_SCREEN_ADD("screen", RASTER)
1870   MCFG_SCREEN_REFRESH_RATE(55.47)    /* verified on pcb */
1871   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate *//2)
1872   MCFG_SCREEN_SIZE(64*8, 64*8)
1873   MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0, 32*8-1)
1878//   MCFG_SCREEN_REFRESH_RATE(55.47)    /* verified on pcb */
1879   MCFG_SCREEN_RAW_PARAMS(XTAL_32MHz/4,546,0,40*8,264,0,32*8) /* hand-tuned to match ~55.47 */
18741880   MCFG_SCREEN_UPDATE_DRIVER(raiden2_state, screen_update_raiden2)
18751881   MCFG_GFXDECODE(raiden2)
18761882   MCFG_PALETTE_LENGTH(2048)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team