Previous 199869 Revisions Next

r32282 Monday 22nd September, 2014 at 12:59:04 UTC by David Haywood
de-duplicate seicop table upload code (nw)

(this doesn't seem to be actively changing at the moment, so seems safe to move, if not, revert)
[src/mame/drivers]raiden2.c
[src/mame/includes]raiden2.h
[src/mame/machine]raiden2cop.c raiden2cop.h seicop.c seicop.h

trunk/src/mame/machine/raiden2cop.h
r32281r32282
2121public:
2222   raiden2cop_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2323
24   // Command Table
25   UINT16 cop_func_trigger[0x100/8];       /* function trigger */
26   UINT16 cop_func_value[0x100/8];         /* function value (?) */
27   UINT16 cop_func_mask[0x100/8];          /* function mask (?) */
28   UINT16 cop_program[0x100];              /* program "code" */
29   UINT16 cop_latch_addr, cop_latch_trigger, cop_latch_value, cop_latch_mask;
30
31   DECLARE_WRITE16_MEMBER( cop_pgm_data_w );
32   DECLARE_WRITE16_MEMBER( cop_pgm_addr_w );
33   DECLARE_WRITE16_MEMBER( cop_pgm_value_w );
34   DECLARE_WRITE16_MEMBER( cop_pgm_mask_w );
35   DECLARE_WRITE16_MEMBER( cop_pgm_trigger_w );
36
37   // these are used by legionna.c to find the command based on trigger value
38   // legionna/seicop implementation then looks up the command based on hardcoded sequences in the driver rather than actually using the trigger value (should be changed)
39   UINT16 get_func_value(int command) { return cop_func_value[command]; }
40   UINT16 get_func_mask(int command) { return cop_func_mask[command]; }
41   int find_trigger_match(UINT16 triggerval, UINT16 mask);
42   int check_command_matches(int command, UINT16 seq0, UINT16 seq1, UINT16 seq2, UINT16 seq3, UINT16 seq4, UINT16 seq5, UINT16 seq6, UINT16 seq7, UINT16 _funcval_, UINT16 _funcmask_);
43
44   // DMA
2445   UINT16 cop_dma_v1, cop_dma_v2, cop_dma_mode;
2546   UINT16 cop_dma_src[0x200], cop_dma_dst[0x200], cop_dma_size[0x200];
2647   UINT16 cop_dma_adr_rel;
trunk/src/mame/machine/seicop.c
r32281r32282
15961596#include "includes/raiden2.h"
15971597#include "machine/seicop.h"
15981598
1599#define seibu_cop_log logerror
1600#define LOG_CMDS 1
16011599
16021600const device_type SEIBU_COP_LEGACY = &device_creator<seibu_cop_legacy_device>;
16031601
16041602seibu_cop_legacy_device::seibu_cop_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
16051603   : device_t(mconfig, SEIBU_COP_LEGACY, "Seibu COP Legacy", tag, owner, clock, "seibu_cop_legacy", __FILE__),
16061604   m_cop_mcu_ram(NULL),
1607   m_cop_438(0),
1608   m_cop_43a(0),
1609   m_cop_43c(0),
16101605   m_cop_scale(0),
16111606   m_cop_rng_max_value(0),
16121607   m_copd2_offs(0),
r32281r32282
16281623   m_cop_rom_addr_lo(0),
16291624   m_cop_rom_addr_hi(0),
16301625   m_cop_rom_addr_unk(0),
1631   m_u1(0),
1632   m_u2(0),
16331626   m_cop_sprite_dma_src(0),
16341627   m_cop_sprite_dma_abs_x(0),
16351628   m_cop_sprite_dma_abs_y(0),
r32281r32282
16371630   m_cop_sprite_dma_param(0),
16381631   m_raiden2cop(*this, ":raiden2cop")
16391632{
1640   memset(m_copd2_table, 0, sizeof(UINT16)*0x100);
1641   memset(m_copd2_table_2, 0, sizeof(UINT16)*0x100/8);
1642   memset(m_copd2_table_3, 0, sizeof(UINT16)*0x100/8);
1643   memset(m_copd2_table_4, 0, sizeof(UINT16)*0x100/8);
16441633   memset(m_seibu_vregs, 0, sizeof(UINT16)*0x50/2);
16451634
16461635   for (int i = 0; i < 8; i++)
r32281r32282
16491638   }
16501639}
16511640
1641#define seibu_cop_log logerror
1642
16521643//-------------------------------------------------
16531644//  device_config_complete - perform any
16541645//  operations now that the configuration is
r32281r32282
16671658{
16681659   m_cop_mcu_ram = reinterpret_cast<UINT16 *>(machine().root_device().memshare("cop_mcu_ram")->ptr());
16691660
1670   save_item(NAME(m_cop_438));
1671   save_item(NAME(m_cop_43a));
1672   save_item(NAME(m_cop_43c));
1673   //save_item(NAME(m_cop_dma_fade_table));
1674   //save_item(NAME(m_cop_dma_trigger));
16751661   save_item(NAME(m_cop_scale));
16761662   save_item(NAME(m_cop_rng_max_value));
16771663   save_item(NAME(m_copd2_offs));
r32281r32282
16931679   save_item(NAME(m_cop_rom_addr_lo));
16941680   save_item(NAME(m_cop_rom_addr_hi));
16951681   save_item(NAME(m_cop_rom_addr_unk));
1696   save_item(NAME(m_u1));
1697   save_item(NAME(m_u2));
1698//   save_item(NAME(m_fill_val));
1699//   save_item(NAME(m_pal_brightness_val));
1700//   save_item(NAME(m_pal_brightness_mode));
17011682   save_item(NAME(m_cop_sprite_dma_src));
17021683   save_item(NAME(m_cop_sprite_dma_abs_x));
17031684   save_item(NAME(m_cop_sprite_dma_abs_y));
17041685   save_item(NAME(m_cop_sprite_dma_size));
17051686   save_item(NAME(m_cop_sprite_dma_param));
1706   save_item(NAME(m_copd2_table));
1707   save_item(NAME(m_copd2_table_2));
1708   save_item(NAME(m_copd2_table_3));
1709   save_item(NAME(m_copd2_table_4));
1710//   save_item(NAME(m_cop_dma_src));
1711//   save_item(NAME(m_cop_dma_size));
1712//   save_item(NAME(m_cop_dma_dst));
17131687   save_item(NAME(m_seibu_vregs));
17141688}
17151689
r32281r32282
17211695{
17221696}
17231697
1724void seibu_cop_legacy_device::copd2_set_tableoffset(UINT16 data)
1725{
1726   //logerror("mcu_offs %04x\n", data);
1727   m_copd2_offs = data;
1728   if (m_copd2_offs>0xff)
1729   {
1730      logerror("copd2 offs > 0x100\n");
1731   }
1732
1733   m_copd2_table_2[m_copd2_offs/8] = m_cop_438;
1734   m_copd2_table_3[m_copd2_offs/8] = m_cop_43a;
1735   m_copd2_table_4[m_copd2_offs/8] = m_cop_43c;
1736#if 0
1737
1738   {
1739      FILE *fp;
1740      char filename[256];
1741      sprintf(filename,"copdat_%s.table2", machine.system().name);
1742      fp=fopen(filename, "w+b");
1743      if (fp)
1744      {
1745         fwrite(m_copd2_table_2, 0x200/8, 1, fp);
1746         fclose(fp);
1747      }
1748   }
1749   {
1750      FILE *fp;
1751      char filename[256];
1752      sprintf(filename,"copdat_%s.table3", machine.system().name);
1753      fp=fopen(filename, "w+b");
1754      if (fp)
1755      {
1756         fwrite(m_copd2_table_3, 0x200/8, 1, fp);
1757         fclose(fp);
1758      }
1759   }
1760   {
1761      FILE *fp;
1762      char filename[256];
1763      sprintf(filename,"copdat_%s.table4", machine.system().name);
1764      fp=fopen(filename, "w+b");
1765      if (fp)
1766      {
1767         fwrite(m_copd2_table_4, 0x200/8, 1, fp);
1768         fclose(fp);
1769      }
1770   }
1771
1772   {
1773      int i;
1774
1775      printf("start\n");
1776
1777      for (i=0;i<0x20;i++)
1778      {
1779         int ii;
1780         printf("%02x | %01x | %04x | %04x | ", i, m_copd2_table_2[i], m_copd2_table_3[i], m_copd2_table_4[i]);
1781
1782
1783         for (ii=0;ii<0x8;ii++)
1784         {
1785            printf("%03x ", m_copd2_table[i*8 + ii]);
1786
1787         }
1788         printf("\n");
1789      }
1790
1791   }
1792#endif
1793
1794}
1795
1796void seibu_cop_legacy_device::copd2_set_tabledata(UINT16 data)
1797{
1798   m_copd2_table[m_copd2_offs] = data;
1799
1800   if(data) {
1801      int off = data & 31;
1802      int reg = (data >> 5) & 3;
1803      int op = (data >> 7) & 31;
1804
1805      logerror("COPDIS: %04x s=%02x f1=%x l=%x f2=%02x %x %04x %02x %03x %02x.%x.%02x ", m_cop_43c,  (m_cop_43c >> 11) << 3, (m_cop_43c >> 10) & 1, ((m_cop_43c >> 7) & 7)+1, m_cop_43c & 0x7f, m_cop_438, m_cop_43a, m_copd2_offs, data, op, reg, off);
1806
1807      off *= 2;
1808
1809      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 00 188 03.0.08 read32 10(m_r0)
1810      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 01 282 05.0.02 add32 4(m_r0)
1811      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 02 082 01.0.02 write32 4(m_r0)
1812      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 03 b8e 17.0.0e add16h 1c(m_r0)
1813      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 04 98e 13.0.0e write16h 1c(m_r0)
1814
1815      // 188 182 082 b8e 98e -> 04  = 04+04    1ch = 1c+04
1816      // 188 188 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
1817      // 188 18e 082 b8e 98e -> 04  = 04+1c    1ch = 1c+1c
1818      // 188 282 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
1819      // 188 288 082 b8e 98e -> 04  = 10+10    1ch = 1c+10
1820      // 188 28e 082 b8e 98e -> 04  = 1c+10    1ch = 1c+10
1821      // 188 282 282 282 082 -> 04  = 04+04+10 10h = 04+10
1822      // 188 188 188 188 082 -> 04h = 04+10    04l = 04+10+10
1823      // 188 188 188 188 082 -> 04  = 04+10    04l = 04+10+10  10h = 04+10 (same, but trigger = 020b)
1824
1825      switch(op) {
1826      case 0x01:
1827         if(off)
1828            logerror("addmem32 %x(r%x)\n", off, reg);
1829         else
1830            logerror("addmem32 (r%x)\n", reg);
1831         break;
1832      case 0x03:
1833         if(off)
1834            logerror("read32 %x(r%x)\n", off, reg);
1835         else
1836            logerror("read32 (r%x)\n", reg);
1837         break;
1838      case 0x05:
1839         if(off)
1840            logerror("add32 %x(r%x)\n", off, reg);
1841         else
1842            logerror("add32 (r%x)\n", reg);
1843         break;
1844      case 0x13:
1845         if(off)
1846            logerror("write16h %x(r%x)\n", off, reg);
1847         else
1848            logerror("write16h (r%x)\n", reg);
1849         break;
1850      case 0x15:
1851         if(off)
1852            logerror("sub32 %x(r%x)\n", off, reg);
1853         else
1854            logerror("sub32 (r%x)\n", reg);
1855         break;
1856      case 0x17:
1857         if(off)
1858            logerror("addmem16 %x(r%x)\n", off, reg);
1859         else
1860            logerror("addmem16 (r%x)\n", reg);
1861         break;
1862      default:
1863         logerror("? %x(r%x)\n",off, reg);
1864         break;
1865      }
1866   }
1867   //logerror("mcu_data %04x\n", data);
1868#if 0
1869   {
1870      FILE *fp;
1871      char filename[256];
1872      sprintf(filename,"copdat_%s.data", machine.system().name);
1873      fp=fopen(filename, "w+b");
1874      if (fp)
1875      {
1876         fwrite(m_copd2_table, 0x200, 1, fp);
1877         fclose(fp);
1878      }
1879   }
1880#endif
1881}
1882
18831698WRITE16_MEMBER( seibu_cop_legacy_device::seibu_common_video_regs_w )
18841699{
18851700   legionna_state *state = space.machine().driver_data<legionna_state>();
r32281r32282
22072022     which seems common to all the games
22082023*/
22092024
2210#if 0
2211/* RE from Seibu Cup Soccer bootleg */
2212static const UINT8 fade_table(int v)
2213{
2214   int low  = v & 0x001f;
2215   int high = v & 0x03e0;
22162025
2217   return (low * (high | (high >> 5)) + 0x210) >> 10;
2218}
2219#endif
22202026
2221#define COP_CMD(_1_,_2_,_3_,_4_,_5_,_6_,_7_,_8_,_m_u1_,_m_u2_) \
2222   (m_copd2_table[command+0] == _1_ && m_copd2_table[command+1] == _2_ && m_copd2_table[command+2] == _3_ && m_copd2_table[command+3] == _4_ && \
2223   m_copd2_table[command+4] == _5_ && m_copd2_table[command+5] == _6_ && m_copd2_table[command+6] == _7_ && m_copd2_table[command+7] == _8_ && \
2224   m_u1 == _m_u1_ && m_u2 == _m_u2_)
22252027
2028
22262029/*
2030_
2031*/
2032
2033/*
22272034Godzilla 0x12c0 X = 0x21ed Y = 0x57da
22282035Megaron  0x12d0 X = 0x1ef1 Y = 0x55db
22292036King Ghidorah 0x12c8 X = 0x26eb Y = 0x55dc
r32281r32282
24332240      case (0x02c/2): m_cop_rng_max_value = m_cop_mcu_ram[0x2c/2] & 0xff; break;
24342241
24352242      /* Command tables for 0x500 / 0x502 commands */
2436      case (0x032/2): { copd2_set_tabledata(data); break; }
2437      case (0x034/2): { copd2_set_tableoffset(data); break; }
2438      case (0x038/2): { m_cop_438 = data; break; }
2439      case (0x03a/2): { m_cop_43a = data; break; }
2440      case (0x03c/2): { m_cop_43c = data; break; }
2243      case (0x032/2): { m_raiden2cop->cop_pgm_data_w(space,0,data,mem_mask); break; }
2244      case (0x034/2): { m_raiden2cop->cop_pgm_addr_w(space,0,data,mem_mask); break; }
2245      case (0x038/2): { m_raiden2cop->cop_pgm_value_w(space,0,data,mem_mask); break; }
2246      case (0x03a/2): { m_raiden2cop->cop_pgm_mask_w(space,0,data,mem_mask); break; }
2247      case (0x03c/2): { m_raiden2cop->cop_pgm_trigger_w(space,0,data,mem_mask); break; }
24412248      case (0x03e/2):
24422249         /*
24432250         0 in all 68k based games
r32281r32282
25132320      case (0x102/2):
25142321      case (0x104/2):
25152322      {
2516         int i;
25172323         int command;
25182324
2519         #if LOG_CMDS
2520         seibu_cop_log("%06x: COPX execute table macro command %04x %04x | regs %08x %08x %08x %08x %08x\n", space.device().safe_pc(), data, m_cop_mcu_ram[offset], m_cop_register[0], m_cop_register[1], m_cop_register[2], m_cop_register[3], m_cop_register[4]);
2521         #endif
25222325
2523         command = -1;
2524         /* search the uploaded 'trigger' table for a matching trigger*/
2525         /* note, I don't know what the 'mask' or 'value' tables are... probably important, might determine what actually gets executed! */
2526         /* note: Zero Team triggers macro 0x904 instead of 0x905, Seibu Cup Soccer triggers 0xe30e instead of 0xe38e. I highly doubt that AT LEAST
2527            it isn't supposed to do anything, especially in the former case (it definitely NEEDS that sprites have an arc movement when they are knocked down). */
2528         for (i=0;i<32;i++)
2529         {
2530            if ((m_cop_mcu_ram[offset] & 0xff00) == (m_copd2_table_4[i] & 0xff00))
2531            {
2532               #if LOG_CMDS
2533               seibu_cop_log("    Cop Command %04x found in slot %02x with other params %04x %04x\n", m_cop_mcu_ram[offset], i, m_copd2_table_2[i], m_copd2_table_3[i]);
2534               #endif
2326         logerror("%06x: COPX execute table macro command %04x %04x | regs %08x %08x %08x %08x %08x\n", space.device().safe_pc(), data, m_cop_mcu_ram[offset], m_cop_register[0], m_cop_register[1], m_cop_register[2], m_cop_register[3], m_cop_register[4]);
25352327
2536               m_u1 = m_copd2_table_2[i] & 0x000f;
2537               m_u2 = m_copd2_table_3[i] & 0xffff;
2538               command = i;
2539            }
2540         }
25412328
2329         command = m_raiden2cop->find_trigger_match(m_cop_mcu_ram[offset], 0xff00);
2330
2331
25422332         if (command==-1)
25432333         {
2544            seibu_cop_log("    Cop Command %04x NOT IN TABLE!\n", m_cop_mcu_ram[offset]);
2545            break;
2334            return;
25462335         }
2547         else
2548         {
2549            command*=0x8;
2550            #if LOG_CMDS
2551            {
2552               int j;
2553               seibu_cop_log("     Sequence: ");
2554               for (j=0;j<0x8;j++)
2555               {
2556                  seibu_cop_log("%04x ", m_copd2_table[command+j]);
2557               }
2558               seibu_cop_log("\n");
2559            }
2560            #endif
2561         }
2336         UINT16 funcval,funcmask;
2337         // this is pointless.. all we use it for is comparing against the same value
2338         funcval = m_raiden2cop->get_func_value(command);
2339         funcmask = m_raiden2cop->get_func_mask(command);
2340         //printf("%04x %04x %04x\n",m_cop_mcu_ram[offset],funcval,funcmask);
25622341
2563         //printf("%04x %04x %04x\n",m_cop_mcu_ram[offset],m_u1,m_u2);
2564
25652342         /*
25662343         Macro notes:
25672344         - endianess changes from/to Raiden 2:
r32281r32282
25772354           Surprisingly atan maths are nowhere to be found from the roms.
25782355         */
25792356
2357         int executed = 0;
2358
25802359         /* "automatic" movement, 0205 */
2581         if(COP_CMD(0x188,0x282,0x082,0xb8e,0x98e,0x000,0x000,0x000,6,0xffeb))
2360         if(m_raiden2cop->check_command_matches(command, 0x188,0x282,0x082,0xb8e,0x98e,0x000,0x000,0x000,6,0xffeb))
25822361         {
2362            executed = 1;
25832363            UINT8 offs;
25842364
25852365            offs = (offset & 3) * 4;
r32281r32282
25932373         }
25942374
25952375         /* "automatic" movement, for arcs in Legionnaire / Zero Team (expression adjustment) 0905 */
2596         if(COP_CMD(0x194,0x288,0x088,0x000,0x000,0x000,0x000,0x000,6,0xfbfb))
2376         if(m_raiden2cop->check_command_matches(command, 0x194,0x288,0x088,0x000,0x000,0x000,0x000,0x000,6,0xfbfb))
25972377         {
2378            executed = 1;
25982379            UINT8 offs;
25992380
26002381            offs = (offset & 3) * 4;
r32281r32282
26192400                if(s == 192)
26202401                  val = -2*amp
26212402         */
2622         if(COP_CMD(0xb9a,0xb88,0x888,0x000,0x000,0x000,0x000,0x000,7,0xfdfb))
2403         if(m_raiden2cop->check_command_matches(command, 0xb9a,0xb88,0x888,0x000,0x000,0x000,0x000,0x000,7,0xfdfb))
26232404         {
2405            executed = 1;
26242406            int raw_angle = (space.read_word(m_cop_register[0]+(0x34^2)) & 0xff);
26252407            double angle = raw_angle * M_PI / 128;
26262408            double amp = (65536 >> 5)*(space.read_word(m_cop_register[0]+(0x36^2)) & 0xff);
r32281r32282
26482430            if(s == 128)
26492431              val = -2*amp
26502432         */
2651         if(COP_CMD(0xb9a,0xb8a,0x88a,0x000,0x000,0x000,0x000,0x000,7,0xfdfb))
2433         if(m_raiden2cop->check_command_matches(command, 0xb9a,0xb8a,0x88a,0x000,0x000,0x000,0x000,0x000,7,0xfdfb))
26522434         {
2435            executed = 1;
26532436            int raw_angle = (space.read_word(m_cop_register[0]+(0x34^2)) & 0xff);
26542437            double angle = raw_angle * M_PI / 128;
26552438            double amp = (65536 >> 5)*(space.read_word(m_cop_register[0]+(0x36^2)) & 0xff);
r32281r32282
26662449         }
26672450
26682451         /* 0x130e / 0x138e */
2669         if(COP_CMD(0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xa9a,5,0xbf7f))
2452         if(m_raiden2cop->check_command_matches(command, 0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xa9a,5,0xbf7f))
26702453         {
2454            executed = 1;
26712455            int dy = space.read_dword(m_cop_register[1]+4) - space.read_dword(m_cop_register[0]+4);
26722456            int dx = space.read_dword(m_cop_register[1]+8) - space.read_dword(m_cop_register[0]+8);
26732457
r32281r32282
26932477
26942478         /* Pythagorean theorem, hypotenuse direction - 130e / 138e */
26952479         //(heatbrl)  | 5 | bf7f | 138e | 984 aa4 d82 aa2 39b b9a b9a b9a
2696         if(COP_CMD(0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xb9a,5,0xbf7f))
2480         if(m_raiden2cop->check_command_matches(command, 0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xb9a,5,0xbf7f))
26972481         {
2482            executed = 1;
26982483            int dy = space.read_dword(m_cop_register[1]+4) - space.read_dword(m_cop_register[0]+4);
26992484            int dx = space.read_dword(m_cop_register[1]+8) - space.read_dword(m_cop_register[0]+8);
27002485
r32281r32282
27252510            v2 = (x & 255)*32767/255
27262511            val = sqrt(v1*v1+v2*v2) (unsigned)
27272512         */
2728         if(COP_CMD(0xf9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0x99c,4,0x007f))
2513         if(m_raiden2cop->check_command_matches(command, 0xf9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0x99c,4,0x007f))
27292514         {
2515            executed = 1;
27302516            int dy = m_r0;
27312517            int dx = m_r1;
27322518
r32281r32282
27502536            v2 = (x & 1023)*32
27512537            val = !v1 ? 32767 : trunc(v2/v1+0.5)
27522538         */
2753         if(COP_CMD(0xf9a,0xb9a,0xb9c,0xb9c,0xb9c,0x29c,0x000,0x000,5,0xfcdd))
2539         if(m_raiden2cop->check_command_matches(command, 0xf9a,0xb9a,0xb9c,0xb9c,0xb9c,0x29c,0x000,0x000,5,0xfcdd))
27542540         {
2541            executed = 1;
27552542            int dy = m_r0;
27562543            int dx = m_r1;
27572544            int div = space.read_word(m_cop_register[0]+(0x36^2));
r32281r32282
27922579             int hitbox_param1 = space.read_dword(m_cop_register[2]);
27932580             int hitbox_param2 = space.read_dword(m_cop_register[3]);
27942581
2795             TODO: we are ignoring the m_u1 / m_u2 params for now
2582             TODO: we are ignoring the funcval / funcmask params for now
27962583         */
27972584
2798         if(COP_CMD(0xb80,0xb82,0xb84,0xb86,0x000,0x000,0x000,0x000,m_u1,m_u2))
2585         if(m_raiden2cop->check_command_matches(command, 0xb80,0xb82,0xb84,0xb86,0x000,0x000,0x000,0x000,funcval,funcmask))
27992586         {
2587            executed = 1;
28002588            m_cop_collision_info[0].y = (space.read_dword(m_cop_register[0]+4));
28012589            m_cop_collision_info[0].x = (space.read_dword(m_cop_register[0]+8));
28022590            return;
28032591         }
28042592
28052593         //(heatbrl)  | 9 | ffff | b080 | b40 bc0 bc2
2806         if(COP_CMD(0xb40,0xbc0,0xbc2,0x000,0x000,0x000,0x000,0x000,m_u1,m_u2))
2594         if(m_raiden2cop->check_command_matches(command, 0xb40,0xbc0,0xbc2,0x000,0x000,0x000,0x000,0x000,funcval,funcmask))
28072595         {
2596            executed = 1;
28082597            m_cop_collision_info[0].hitbox = space.read_word(m_cop_register[2]);
28092598            m_cop_collision_info[0].hitbox_y = space.read_word((m_cop_register[2]&0xffff0000)|(m_cop_collision_info[0].hitbox));
28102599            m_cop_collision_info[0].hitbox_x = space.read_word(((m_cop_register[2]&0xffff0000)|(m_cop_collision_info[0].hitbox))+2);
r32281r32282
28162605            return;
28172606         }
28182607
2819         if(COP_CMD(0xba0,0xba2,0xba4,0xba6,0x000,0x000,0x000,0x000,m_u1,m_u2))
2608         if(m_raiden2cop->check_command_matches(command, 0xba0,0xba2,0xba4,0xba6,0x000,0x000,0x000,0x000,funcval,funcmask))
28202609         {
2610            executed = 1;
28212611            m_cop_collision_info[1].y = (space.read_dword(m_cop_register[1]+4));
28222612            m_cop_collision_info[1].x = (space.read_dword(m_cop_register[1]+8));
28232613            return;
28242614         }
28252615
28262616         //(heatbrl)  | 6 | ffff | b880 | b60 be0 be2
2827         if(COP_CMD(0xb60,0xbe0,0xbe2,0x000,0x000,0x000,0x000,0x000,m_u1,m_u2))
2617         if(m_raiden2cop->check_command_matches(command, 0xb60,0xbe0,0xbe2,0x000,0x000,0x000,0x000,0x000,funcval,funcmask))
28282618         {
2619            executed = 1;
28292620            m_cop_collision_info[1].hitbox = space.read_word(m_cop_register[3]);
28302621            m_cop_collision_info[1].hitbox_y = space.read_word((m_cop_register[3]&0xffff0000)|(m_cop_collision_info[1].hitbox));
28312622            m_cop_collision_info[1].hitbox_x = space.read_word(((m_cop_register[3]&0xffff0000)|(m_cop_collision_info[1].hitbox))+2);
r32281r32282
28372628         }
28382629
28392630         // grainbow 0d | a | fff3 | 6980 | b80 ba0
2840         if(COP_CMD(0xb80,0xba0,0x000,0x000,0x000,0x000,0x000,0x000,10,0xfff3))
2631         if(m_raiden2cop->check_command_matches(command, 0xb80,0xba0,0x000,0x000,0x000,0x000,0x000,0x000,10,0xfff3))
28412632         {
2633            executed = 1;
28422634            UINT8 offs;
28432635            int abs_x,abs_y,rel_xy;
28442636
r32281r32282
28622654         }
28632655
28642656         // grainbow 18 | a | ff00 | c480 | 080 882
2865         if(COP_CMD(0x080,0x882,0x000,0x000,0x000,0x000,0x000,0x000,10,0xff00))
2657         if(m_raiden2cop->check_command_matches(command, 0x080,0x882,0x000,0x000,0x000,0x000,0x000,0x000,10,0xff00))
28662658         {
2659            executed = 1;
28672660            UINT8 offs;
28682661
28692662            offs = (offset & 3) * 4;
r32281r32282
28772670         /* radar x/y positions */
28782671         /* FIXME: x/ys are offsetted */
28792672         /* FIXME: uses 0x10044a for something */
2880         if(COP_CMD(0xf80,0xaa2,0x984,0x0c2,0x000,0x000,0x000,0x000,5,0x7ff7))
2673         if(m_raiden2cop->check_command_matches(command, 0xf80,0xaa2,0x984,0x0c2,0x000,0x000,0x000,0x000,5,0x7ff7))
28812674         {
2675            executed = 1;
28822676            UINT8 offs;
28832677            int div;
28842678            INT16 dir_offset;
r32281r32282
29142708         }
29152709
29162710         //(cupsoc)   | 8 | f3e7 | 6200 | 3a0 3a6 380 aa0 2a6
2917         if(COP_CMD(0x3a0,0x3a6,0x380,0xaa0,0x2a6,0x000,0x000,0x000,8,0xf3e7))
2711         if(m_raiden2cop->check_command_matches(command, 0x3a0,0x3a6,0x380,0xaa0,0x2a6,0x000,0x000,0x000,8,0xf3e7))
29182712         {
2713            executed = 1;
29192714            UINT8 cur_angle;
29202715            UINT16 flags;
29212716           
r32281r32282
29672762         //(grainbow) | 8 | f3e7 | 6200 | 380 39a 380 a80 29a
29682763         /* search direction, used on SD Gundam homing weapon */
29692764         /* FIXME: still doesn't work ... */
2970         if(COP_CMD(0x380,0x39a,0x380,0xa80,0x29a,0x000,0x000,0x000,8,0xf3e7))
2765         if(m_raiden2cop->check_command_matches(command, 0x380,0x39a,0x380,0xa80,0x29a,0x000,0x000,0x000,8,0xf3e7))
29712766         {
2767            executed = 1;
29722768            UINT8 cur_angle;
29732769            UINT16 flags;
29742770           
r32281r32282
30122808         }
30132809
30142810         //(cupsoc) 1c | 5 | b07f | e38e | 984 ac4 d82 ac2 39b b9a b9a a9a
3015         if(COP_CMD(0x984,0xac4,0xd82,0xac2,0x39b,0xb9a,0xb9a,0xa9a,5,0xb07f))
2811         if(m_raiden2cop->check_command_matches(command, 0x984,0xac4,0xd82,0xac2,0x39b,0xb9a,0xb9a,0xa9a,5,0xb07f))
30162812         {
2813            executed = 1;
30172814            int dy = space.read_dword(m_cop_register[2]+4) - space.read_dword(m_cop_register[0]+4);
30182815            int dx = space.read_dword(m_cop_register[2]+8) - space.read_dword(m_cop_register[0]+8);
30192816
r32281r32282
30392836
30402837         //(cupsoc) 1a | 5 | fffb | d104 | ac2 9e0 0a2
30412838         /* controls player vs. player collision detection, 0xf105 controls player vs. ball */
3042         if(COP_CMD(0xac2,0x9e0,0x0a2,0x000,0x000,0x000,0x000,0x000,5,0xfffb))
2839         if(m_raiden2cop->check_command_matches(command, 0xac2,0x9e0,0x0a2,0x000,0x000,0x000,0x000,0x000,5,0xfffb))
30432840         {
2841            executed = 1;
30442842            UINT8 *ROM = space.machine().root_device().memregion("maincpu")->base();
30452843            UINT32 rom_addr = (m_cop_rom_addr_hi << 16 | m_cop_rom_addr_lo) & ~1;
30462844            UINT16 rom_data = (ROM[rom_addr + 0]) | (ROM[rom_addr + 1]<<8);
r32281r32282
30522850            return;
30532851         }
30542852
3055         printf("%04x\n",m_cop_mcu_ram[offset]);
2853         if (executed==0) printf("did not execute %04x\n",m_cop_mcu_ram[offset]);
30562854         break;
30572855      }
30582856
trunk/src/mame/machine/seicop.h
r32281r32282
5252
5353private:
5454   UINT16 *m_cop_mcu_ram;
55   UINT16 m_copd2_table[0x100];
56   UINT16 m_copd2_table_2[0x100/8];
57   UINT16 m_copd2_table_3[0x100/8];
58   UINT16 m_copd2_table_4[0x100/8];
59   UINT16 m_cop_438;
60   UINT16 m_cop_43a;
61   UINT16 m_cop_43c;
6255
56
6357   UINT16 m_cop_scale;
6458   UINT8 m_cop_rng_max_value;
6559   UINT16 m_copd2_offs;
r32281r32282
7468   struct collision_info m_cop_collision_info[2];
7569   int m_r0, m_r1;
7670   UINT16 m_cop_rom_addr_lo,m_cop_rom_addr_hi,m_cop_rom_addr_unk;
77   UINT16 m_u1,m_u2;
7871
7972   UINT32 m_cop_sprite_dma_src;
8073   int m_cop_sprite_dma_abs_x,m_cop_sprite_dma_abs_y,m_cop_sprite_dma_size;
trunk/src/mame/machine/raiden2cop.c
r32281r32282
1212
1313raiden2cop_device::raiden2cop_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1414   : device_t(mconfig, RAIDEN2COP, "RAIDEN2COP", tag, owner, clock, "raiden2cop", __FILE__),
15   cop_latch_addr(0),
16   cop_latch_trigger(0),
17   cop_latch_value(0),
18   cop_latch_mask(0),     
1519   cop_dma_v1(0),
1620   cop_dma_v2(0),
1721   cop_dma_mode(0),
r32281r32282
2125   m_videoramout_cb(*this),
2226   m_palette(*this, ":palette")
2327{
24     memset(cop_dma_src, 0, sizeof(UINT16)*(0x200));
25     memset(cop_dma_dst, 0, sizeof(UINT16)*(0x200));
26     memset(cop_dma_size, 0, sizeof(UINT16)*(0x200));
28   memset(cop_func_trigger, 0, sizeof(UINT16)*(0x100/8));
29   memset(cop_func_value, 0, sizeof(UINT16)*(0x100/8));
30   memset(cop_func_mask, 0, sizeof(UINT16)*(0x100/8));
31   memset(cop_program, 0, sizeof(UINT16)*(0x100));
32   
33   memset(cop_dma_src, 0, sizeof(UINT16)*(0x200));
34   memset(cop_dma_dst, 0, sizeof(UINT16)*(0x200));
35   memset(cop_dma_size, 0, sizeof(UINT16)*(0x200));
2736}
2837
2938
r32281r32282
3241//-------------------------------------------------
3342void raiden2cop_device::device_start()
3443{
44   save_item(NAME(cop_func_trigger));
45   save_item(NAME(cop_func_value));
46   save_item(NAME(cop_func_mask));
47   save_item(NAME(cop_program));
48
49   save_item(NAME(cop_latch_addr));
50   save_item(NAME(cop_latch_trigger));
51   save_item(NAME(cop_latch_value));
52   save_item(NAME(cop_latch_mask));
53
3554   save_item(NAME(cop_dma_v1));
3655   save_item(NAME(cop_dma_v2));
3756   save_item(NAME(cop_dma_mode));
r32281r32282
4665   m_videoramout_cb.resolve_safe();
4766}
4867
68/*** Command Table uploads ***/
4969
70
71WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w)
72{
73   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
74   cop_program[cop_latch_addr] = data;
75   int idx = cop_latch_addr >> 3;
76   cop_func_trigger[idx] = cop_latch_trigger;
77   cop_func_value[idx]   = cop_latch_value;
78   cop_func_mask[idx]    = cop_latch_mask;
79
80   if(data) {
81      int off = data & 31;
82      int reg = (data >> 5) & 3;
83      int op = (data >> 7) & 31;
84
85      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);
86
87      off *= 2;
88
89      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 00 188 03.0.08 read32 10(r0)
90      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 01 282 05.0.02 add32 4(r0)
91      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 02 082 01.0.02 write32 4(r0)
92      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 03 b8e 17.0.0e add16h 1c(r0)
93      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 04 98e 13.0.0e write16h 1c(r0)
94
95      // 188 182 082 b8e 98e -> 04  = 04+04    1ch = 1c+04
96      // 188 188 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
97      // 188 18e 082 b8e 98e -> 04  = 04+1c    1ch = 1c+1c
98      // 188 282 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
99      // 188 288 082 b8e 98e -> 04  = 10+10    1ch = 1c+10
100      // 188 28e 082 b8e 98e -> 04  = 1c+10    1ch = 1c+10
101      // 188 282 282 282 082 -> 04  = 04+04+10 10h = 04+10
102      // 188 188 188 188 082 -> 04h = 04+10    04l = 04+10+10
103      // 188 188 188 188 082 -> 04  = 04+10    04l = 04+10+10  10h = 04+10 (same, but trigger = 020b)
104
105      switch(op) {
106      case 0x01:
107         if(off)
108            logerror("addmem32 %x(r%x)\n", off, reg);
109         else
110            logerror("addmem32 (r%x)\n", reg);
111         break;
112      case 0x03:
113         if(off)
114            logerror("read32 %x(r%x)\n", off, reg);
115         else
116            logerror("read32 (r%x)\n", reg);
117         break;
118      case 0x05:
119         if(off)
120            logerror("add32 %x(r%x)\n", off, reg);
121         else
122            logerror("add32 (r%x)\n", reg);
123         break;
124      case 0x13:
125         if(off)
126            logerror("write16h %x(r%x)\n", off, reg);
127         else
128            logerror("write16h (r%x)\n", reg);
129         break;
130      case 0x15:
131         if(off)
132            logerror("sub32 %x(r%x)\n", off, reg);
133         else
134            logerror("sub32 (r%x)\n", reg);
135         break;
136      case 0x17:
137         if(off)
138            logerror("addmem16 %x(r%x)\n", off, reg);
139         else
140            logerror("addmem16 (r%x)\n", reg);
141         break;
142      default:
143         logerror("?\n");
144         break;
145      }
146   }
147}
148
149WRITE16_MEMBER(raiden2cop_device::cop_pgm_addr_w)
150{
151   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
152   assert(data < 0x100);
153   cop_latch_addr = data;
154}
155
156WRITE16_MEMBER(raiden2cop_device::cop_pgm_value_w)
157{
158   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
159   cop_latch_value = data;
160}
161
162WRITE16_MEMBER(raiden2cop_device::cop_pgm_mask_w)
163{
164   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
165   cop_latch_mask = data;
166}
167
168WRITE16_MEMBER(raiden2cop_device::cop_pgm_trigger_w)
169{
170   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
171   cop_latch_trigger = data;
172}
173
174#define seibu_cop_log logerror
175#define LOG_CMDS 1
176
177// currently only used by legionna.c implementation
178int raiden2cop_device::find_trigger_match(UINT16 triggerval, UINT16 mask)
179{
180   /* search the uploaded 'trigger' table for a matching trigger*/
181   /* note, I don't know what the 'mask' or 'value' tables are... probably important, might determine what actually gets executed! */
182   /* note: Zero Team triggers macro 0x904 instead of 0x905, Seibu Cup Soccer triggers 0xe30e instead of 0xe38e. I highly doubt that AT LEAST
183      it isn't supposed to do anything, especially in the former case (it definitely NEEDS that sprites have an arc movement when they are knocked down). */
184   // we currently pass in mask 0xff00 to look at only match the top bits, but this is wrong, only specific bits are ignored (maybe depends on the 'mask' value uploaded with each trigger?)
185   int matched = 0;
186   int command = -1;
187
188   for (int i = 0; i < 32; i++)
189   {
190      if ((triggerval & mask) == (cop_func_trigger[i] & mask))
191      {
192#if LOG_CMDS
193         seibu_cop_log("    Cop Command %04x found in slot %02x with other params %04x %04x\n", triggerval, i, cop_func_value[i], cop_func_mask[i]);
194#endif
195         command = i;
196         matched++;
197      }
198   }
199
200   if (matched == 1)
201   {
202
203      int j;
204      seibu_cop_log("     Sequence: ");
205      for (j=0;j<0x8;j++)
206      {
207         seibu_cop_log("%04x ", cop_program[command*8+j]);
208      }
209      seibu_cop_log("\n");
210
211      return command;
212   }
213   else if (matched == 0)
214   {
215      seibu_cop_log("    Cop Command %04x NOT IN TABLE!\n", triggerval);
216      return -1;
217   }
218
219   printf("multiple matches found with mask passed in! (bad!)\n");
220   return -1;
221
222}
223
224//  only used by legionna.c implementation
225int raiden2cop_device::check_command_matches(int command, UINT16 seq0, UINT16 seq1, UINT16 seq2, UINT16 seq3, UINT16 seq4, UINT16 seq5, UINT16 seq6, UINT16 seq7, UINT16 _funcval_, UINT16 _funcmask_)
226{
227   command *= 8;
228
229   if (cop_program[command+0] == seq0 && cop_program[command+1] == seq1 && cop_program[command+2] == seq2 && cop_program[command+3] == seq3 &&
230       cop_program[command+4] == seq4 && cop_program[command+5] == seq5 && cop_program[command+6] == seq6 && cop_program[command+7] == seq7 &&
231       cop_func_value[command/8] == _funcval_ &&
232       cop_func_mask[command/8] == _funcmask_)
233      return 1;
234   else
235      return 0;
236}
237
238/*** Regular DMA ***/
239
50240WRITE16_MEMBER(raiden2cop_device::cop_dma_adr_rel_w)
51241{
52242   COMBINE_DATA(&cop_dma_adr_rel);
trunk/src/mame/includes/raiden2.h
r32281r32282
3232        cop_itoa_digit_count(0),
3333        cop_angle(0),
3434        cop_dist(0),
35        cop_latch_addr(0),
36        cop_latch_trigger(0),
37        cop_latch_value(0),
38        cop_latch_mask(0),
35
3936        cop_angle_target(0),
4037        cop_angle_step(0),
4138        sprite_prot_x(0),
r32281r32282
5653        memset(cop_regs, 0, sizeof(UINT32)*8);
5754        memset(cop_itoa_digits, 0, sizeof(UINT8)*10);
5855
59        memset(cop_func_trigger, 0, sizeof(UINT16)*(0x100/8));
60        memset(cop_func_value, 0, sizeof(UINT16)*(0x100/8));
61        memset(cop_func_mask, 0, sizeof(UINT16)*(0x100/8));
62        memset(cop_program, 0, sizeof(UINT16)*(0x100));
6356        memset(sprite_prot_src_addr, 0, sizeof(UINT16)*2);
6457        memset(cop_collision_info, 0, sizeof(colinfo)*2);
6558   }
r32281r32282
8275   DECLARE_WRITE16_MEMBER( cop_reg_high_w );
8376   DECLARE_READ16_MEMBER ( cop_reg_low_r );
8477   DECLARE_WRITE16_MEMBER( cop_reg_low_w );
85   DECLARE_WRITE16_MEMBER( cop_pgm_data_w );
86   DECLARE_WRITE16_MEMBER( cop_pgm_addr_w );
87   DECLARE_WRITE16_MEMBER( cop_pgm_value_w );
88   DECLARE_WRITE16_MEMBER( cop_pgm_mask_w );
89   DECLARE_WRITE16_MEMBER( cop_pgm_trigger_w );
78
9079   DECLARE_WRITE16_MEMBER( cop_cmd_w );
9180   DECLARE_READ16_MEMBER ( cop_itoa_digits_r );
9281   DECLARE_READ16_MEMBER ( cop_collision_status_r );
r32281r32282
150139   UINT16 cop_status, cop_scale, cop_itoa_digit_count, cop_angle, cop_dist;
151140   UINT8 cop_itoa_digits[10];
152141
153   UINT16 cop_func_trigger[0x100/8];       /* function trigger */
154   UINT16 cop_func_value[0x100/8];         /* function value (?) */
155   UINT16 cop_func_mask[0x100/8];          /* function mask (?) */
156   UINT16 cop_program[0x100];              /* program "code" */
157   UINT16 cop_latch_addr, cop_latch_trigger, cop_latch_value, cop_latch_mask;
158142   UINT16 cop_angle_target;
159143   UINT16 cop_angle_step;
160144
trunk/src/mame/drivers/raiden2.c
r32281r32282
179179   save_item(NAME(cop_itoa_digit_count));
180180   save_item(NAME(cop_angle));
181181   save_item(NAME(cop_dist));
182   save_item(NAME(cop_latch_addr));
183   save_item(NAME(cop_latch_trigger));
184   save_item(NAME(cop_latch_value));
185   save_item(NAME(cop_latch_mask));
182
186183   save_item(NAME(cop_angle_target));
187184   save_item(NAME(cop_angle_step));
188185   save_item(NAME(sprite_prot_x));
r32281r32282
201198   save_item(NAME(scrollvals));
202199   save_item(NAME(cop_regs));
203200   save_item(NAME(cop_itoa_digits));
204   save_item(NAME(cop_func_trigger));
205   save_item(NAME(cop_func_value));
206   save_item(NAME(cop_func_mask));
207   save_item(NAME(cop_program));
201
208202   save_item(NAME(sprite_prot_src_addr));
209203
210204   save_item(NAME(cop_collision_info[0].pos));
r32281r32282
234228
235229int cnt=0, ccol = -1;
236230
237WRITE16_MEMBER(raiden2_state::cop_pgm_data_w)
238{
239   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
240   cop_program[cop_latch_addr] = data;
241   int idx = cop_latch_addr >> 3;
242   cop_func_trigger[idx] = cop_latch_trigger;
243   cop_func_value[idx]   = cop_latch_value;
244   cop_func_mask[idx]    = cop_latch_mask;
245231
246   if(data) {
247      int off = data & 31;
248      int reg = (data >> 5) & 3;
249      int op = (data >> 7) & 31;
250
251      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);
252
253      off *= 2;
254
255      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 00 188 03.0.08 read32 10(r0)
256      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 01 282 05.0.02 add32 4(r0)
257      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 02 082 01.0.02 write32 4(r0)
258      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 03 b8e 17.0.0e add16h 1c(r0)
259      // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 04 98e 13.0.0e write16h 1c(r0)
260
261      // 188 182 082 b8e 98e -> 04  = 04+04    1ch = 1c+04
262      // 188 188 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
263      // 188 18e 082 b8e 98e -> 04  = 04+1c    1ch = 1c+1c
264      // 188 282 082 b8e 98e -> 04  = 04+10    1ch = 1c+10
265      // 188 288 082 b8e 98e -> 04  = 10+10    1ch = 1c+10
266      // 188 28e 082 b8e 98e -> 04  = 1c+10    1ch = 1c+10
267      // 188 282 282 282 082 -> 04  = 04+04+10 10h = 04+10
268      // 188 188 188 188 082 -> 04h = 04+10    04l = 04+10+10
269      // 188 188 188 188 082 -> 04  = 04+10    04l = 04+10+10  10h = 04+10 (same, but trigger = 020b)
270
271      switch(op) {
272      case 0x01:
273         if(off)
274            logerror("addmem32 %x(r%x)\n", off, reg);
275         else
276            logerror("addmem32 (r%x)\n", reg);
277         break;
278      case 0x03:
279         if(off)
280            logerror("read32 %x(r%x)\n", off, reg);
281         else
282            logerror("read32 (r%x)\n", reg);
283         break;
284      case 0x05:
285         if(off)
286            logerror("add32 %x(r%x)\n", off, reg);
287         else
288            logerror("add32 (r%x)\n", reg);
289         break;
290      case 0x13:
291         if(off)
292            logerror("write16h %x(r%x)\n", off, reg);
293         else
294            logerror("write16h (r%x)\n", reg);
295         break;
296      case 0x15:
297         if(off)
298            logerror("sub32 %x(r%x)\n", off, reg);
299         else
300            logerror("sub32 (r%x)\n", reg);
301         break;
302      case 0x17:
303         if(off)
304            logerror("addmem16 %x(r%x)\n", off, reg);
305         else
306            logerror("addmem16 (r%x)\n", reg);
307         break;
308      default:
309         logerror("?\n");
310         break;
311      }
312   }
313}
314
315WRITE16_MEMBER(raiden2_state::cop_pgm_addr_w)
316{
317   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
318   assert(data < 0x100);
319   cop_latch_addr = data;
320}
321
322WRITE16_MEMBER(raiden2_state::cop_pgm_value_w)
323{
324   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
325   cop_latch_value = data;
326}
327
328WRITE16_MEMBER(raiden2_state::cop_pgm_mask_w)
329{
330   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
331   cop_latch_mask = data;
332}
333
334WRITE16_MEMBER(raiden2_state::cop_pgm_trigger_w)
335{
336   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
337   cop_latch_trigger = data;
338}
339
340232WRITE16_MEMBER(raiden2_state::m_videoram_private_w)
341233{
342234   //AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(raiden2_background_w) AM_SHARE("back_data")
r32281r32282
14451337   AM_RANGE(0x00424, 0x00425) AM_WRITE(cop_itoa_digit_count_w)
14461338   AM_RANGE(0x00428, 0x00429) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_dma_v1_w)
14471339   AM_RANGE(0x0042a, 0x0042b) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_dma_v2_w)
1448   AM_RANGE(0x00432, 0x00433) AM_WRITE(cop_pgm_data_w)
1449   AM_RANGE(0x00434, 0x00435) AM_WRITE(cop_pgm_addr_w)
1340   AM_RANGE(0x00432, 0x00433) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_pgm_data_w)
1341   AM_RANGE(0x00434, 0x00435) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_pgm_addr_w)
14501342   AM_RANGE(0x00436, 0x00437) AM_WRITE(cop_hitbox_baseadr_w)
1451   AM_RANGE(0x00438, 0x00439) AM_WRITE(cop_pgm_value_w)
1452   AM_RANGE(0x0043a, 0x0043b) AM_WRITE(cop_pgm_mask_w)
1453   AM_RANGE(0x0043c, 0x0043d) AM_WRITE(cop_pgm_trigger_w)
1343   AM_RANGE(0x00438, 0x00439) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_pgm_value_w)
1344   AM_RANGE(0x0043a, 0x0043b) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_pgm_mask_w)
1345   AM_RANGE(0x0043c, 0x0043d) AM_DEVWRITE("raiden2cop", raiden2cop_device, cop_pgm_trigger_w)
14541346   AM_RANGE(0x00444, 0x00445) AM_WRITE(cop_scale_w)
14551347   AM_RANGE(0x00450, 0x00451) AM_WRITE(cop_sort_ram_addr_hi_w)
14561348   AM_RANGE(0x00452, 0x00453) AM_WRITE(cop_sort_ram_addr_lo_w)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team