Previous 199869 Revisions Next

r32349 Wednesday 24th September, 2014 at 12:29:17 UTC by David Haywood
merge some common code (nw)
[src/mame/drivers]legionna.c
[src/mame/machine]raiden2cop.c raiden2cop.h

trunk/src/mame/drivers/legionna.c
r32348r32349
12091209
12101210   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
12111211
1212   MCFG_RAIDEN2COP_ADD("raiden2cop")
1212   MCFG_LEGIONNACOP_ADD("raiden2cop")
12131213   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
12141214
12151215   /* video hardware */
r32348r32349
12451245
12461246   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
12471247
1248   MCFG_RAIDEN2COP_ADD("raiden2cop")
1248   MCFG_LEGIONNACOP_ADD("raiden2cop")
12491249   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
12501250
12511251   /* video hardware */
r32348r32349
12821282
12831283   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
12841284
1285   MCFG_RAIDEN2COP_ADD("raiden2cop")
1285   MCFG_LEGIONNACOP_ADD("raiden2cop")
12861286   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
12871287
12881288   /* video hardware */
r32348r32349
13201320
13211321   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
13221322
1323   MCFG_RAIDEN2COP_ADD("raiden2cop")
1323   MCFG_LEGIONNACOP_ADD("raiden2cop")
13241324   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
13251325
13261326   /* video hardware */
r32348r32349
13571357
13581358   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
13591359
1360   MCFG_RAIDEN2COP_ADD("raiden2cop")
1360   MCFG_LEGIONNACOP_ADD("raiden2cop")
13611361   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
13621362
13631363   /* video hardware */
r32348r32349
13951395
13961396   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
13971397
1398   MCFG_RAIDEN2COP_ADD("raiden2cop")
1398   MCFG_LEGIONNACOP_ADD("raiden2cop")
13991399   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
14001400
14011401   /* video hardware */
r32348r32349
14361436   MCFG_CPU_VBLANK_INT_DRIVER("screen", legionna_state,  irq4_line_hold) /* VBL */
14371437
14381438   MCFG_SEIBU_COP_ADD("seibucop_boot")
1439   MCFG_RAIDEN2COP_ADD("raiden2cop")
1439   MCFG_LEGIONNACOP_ADD("raiden2cop")
14401440   MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w))
14411441
14421442
trunk/src/mame/machine/raiden2cop.c
r32348r32349
6262   m_LEGACY_r0(0),
6363   m_LEGACY_r1(0),
6464
65   m_cpu_is_68k(0),
66
6567   m_videoramout_cb(*this),
6668   m_palette(*this, ":palette")
6769{
r32348r32349
170172
171173}
172174
175UINT16 raiden2cop_device::cop_read_word(address_space &space, int address)
176{
177   if (m_cpu_is_68k) return space.read_word(address ^ 2);
178   else return space.read_word(address);
179}
180
173181/*** Command Table uploads ***/
174182
175183
184
176185WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w)
177186{
178187   assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15);
r32348r32349
789798
7907990f - 7905 (7905  ) :  (1a2, 2c2, 0a2, 000, 000, 000, 000, 000)  6     fffb   (cupsoc, grainbow)
7918000f - 7e05 (7e05  ) :  (180, 282, 080, 180, 282, 000, 000, 000)  6     fffb   (raidendx)
801*/
792802
803/*
79380410 - 8100 (8100  ) :  (b9a, b88, 888, 000, 000, 000, 000, 000)  7     fdfb   (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk, raiden2, raidendx, zeroteam, xsedae)
805*/
794806
807void raiden2cop_device::execute_8100(address_space &space, int offset, UINT16 data)
808{
809   int raw_angle = (cop_read_word(space, cop_regs[0] + (0x34)) & 0xff);
810   double angle = raw_angle * M_PI / 128;
811   double amp = (65536 >> 5)*(cop_read_word(space, cop_regs[0] + (0x36)) & 0xff);
812   int res;
813   /* TODO: up direction needs double, why? */
814   if (raw_angle == 0xc0)
815      amp *= 2;
816   res = int(amp*sin(angle)) << cop_scale;
817   space.write_dword(cop_regs[0] + 16, res);
818}
819
820/*
79582111 - 8900 (8900  ) :  (b9a, b8a, 88a, 000, 000, 000, 000, 000)  7     fdfb   (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk, raiden2, raidendx, zeroteam, xsedae)
822*/
823void raiden2cop_device::execute_8900(address_space &space, int offset, UINT16 data)
824{
825   int raw_angle = (cop_read_word(space, cop_regs[0] + (0x34)) & 0xff);
826   double angle = raw_angle * M_PI / 128;
827   double amp = (65536 >> 5)*(cop_read_word(space, cop_regs[0] + (0x36)) & 0xff);
828   int res;
829   /* TODO: up direction needs double, why? */
830   if (raw_angle == 0x80)
831      amp *= 2;
832   res = int(amp*cos(angle)) << cop_scale;
833   space.write_dword(cop_regs[0] + 20, res);
834}
796835
836/*
79783712 - 9180 (9100  ) :  (b80, b94, b94, 894, 000, 000, 000, 000)  7     f8f7   (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk)
79883812 - 9100 (9100  ) :  (b80, b94, 894, 000, 000, 000, 000, 000)  7     fefb   (raiden2, raidendx)
79983912 - 9100 (9100  ) :  (b80, b94, b94, 894, 000, 000, 000, 000)  7     f8f7   (zeroteam, xsedae)
r32348r32349
10811121   }
10821122
10831123   case 0x8100: { // 8100 0007 fdfb 0080 - 0b9a 0b88 0888 0000 0000 0000 0000 0000
1084      int raw_angle = (space.read_word(cop_regs[0]+(0x34)) & 0xff);
1085      double angle = raw_angle * M_PI / 128;
1086      double amp = (65536 >> 5)*(space.read_word(cop_regs[0]+(0x36)) & 0xff);
1087      int res;
1088      /* TODO: up direction, why? (check machine/seicop.c) */
1089      if(raw_angle == 0xc0)
1090         amp*=2;
1091      res = int(amp*sin(angle)) << cop_scale;
1092      space.write_dword(cop_regs[0] + 16, res);
1124      execute_8100(space, offset, data); // SIN
10931125      break;
10941126   }
10951127
10961128   case 0x8900: { // 8900 0007 fdfb 0088 - 0b9a 0b8a 088a 0000 0000 0000 0000 0000
1097      int raw_angle = (space.read_word(cop_regs[0]+(0x34)) & 0xff);
1098      double angle = raw_angle * M_PI / 128;
1099      double amp = (65536 >> 5)*(space.read_word(cop_regs[0]+(0x36)) & 0xff);
1100      int res;
1101      /* TODO: left direction, why? (check machine/seicop.c) */
1102      if(raw_angle == 0x80)
1103         amp*=2;
1104      res = int(amp*cos(angle)) << cop_scale;
1105      space.write_dword(cop_regs[0] + 20, res);
1129      execute_8900(space, offset, data); // COS
11061130      break;
11071131   }
11081132
r32348r32349
14991523   if (check_command_matches(command, 0xb9a, 0xb88, 0x888, 0x000, 0x000, 0x000, 0x000, 0x000, 7, 0xfdfb))
15001524   {
15011525      executed = 1;
1502      int raw_angle = (space.read_word(cop_regs[0] + (0x34 ^ 2)) & 0xff);
1503      double angle = raw_angle * M_PI / 128;
1504      double amp = (65536 >> 5)*(space.read_word(cop_regs[0] + (0x36 ^ 2)) & 0xff);
1505      int res;
1506
1507      /* TODO: up direction, why? */
1508      if (raw_angle == 0xc0)
1509         amp *= 2;
1510
1511      res = int(amp*sin(angle)) << cop_scale;
1512
1513      space.write_dword(cop_regs[0] + 0x10, res);
1526      execute_8100(space, offset, data); // SIN
15141527      return;
15151528   }
15161529
r32348r32349
15291542   if (check_command_matches(command, 0xb9a, 0xb8a, 0x88a, 0x000, 0x000, 0x000, 0x000, 0x000, 7, 0xfdfb))
15301543   {
15311544      executed = 1;
1532      int raw_angle = (space.read_word(cop_regs[0] + (0x34 ^ 2)) & 0xff);
1533      double angle = raw_angle * M_PI / 128;
1534      double amp = (65536 >> 5)*(space.read_word(cop_regs[0] + (0x36 ^ 2)) & 0xff);
1535      int res;
1536
1537      /* TODO: left direction, why? */
1538      if (raw_angle == 0x80)
1539         amp *= 2;
1540
1541      res = int(amp*cos(angle)) << cop_scale;
1542
1543      space.write_dword(cop_regs[0] + 20, res);
1545      execute_8900(space, offset, data); // COS
15441546      return;
15451547   }
15461548
trunk/src/mame/machine/raiden2cop.h
r32348r32349
99#define RAIDEN2COP_H
1010
1111
12#define MCFG_RAIDEN2COP_ADD(_tag ) \
13   MCFG_DEVICE_ADD(_tag, RAIDEN2COP, 0)
1412
13
1514#define MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(_devcb) \
1615   devcb = &raiden2cop_device::set_m_videoramout_cb(*device, DEVCB_##_devcb);
1716
1817#define MCFG_ITOA_UNUSED_DIGIT_VALUE(value) \
1918   raiden2cop_device::set_itoa_unused_digit_value(*device, value);
2019
20#define MCFG_CPU_IS_68K(value) \
21   raiden2cop_device::set_cpu_is_68k(*device, value);
2122
23#define MCFG_RAIDEN2COP_ADD(_tag ) \
24   MCFG_DEVICE_ADD(_tag, RAIDEN2COP, 0) \
25   MCFG_CPU_IS_68K(0)
26
27#define MCFG_LEGIONNACOP_ADD(_tag ) \
28   MCFG_DEVICE_ADD(_tag, RAIDEN2COP, 0) \
29   MCFG_CPU_IS_68K(1)
30
31
2232class raiden2cop_device : public device_t
2333{
2434public:
r32348r32349
136146   void cop_collision_read_pos(address_space &space, int slot, UINT32 spradr, bool allow_swap);
137147   void cop_collision_update_hitbox(address_space &space, int slot, UINT32 hitadr);
138148
149   void execute_8100(address_space &space, int offset, UINT16 data);
150   void execute_8900(address_space &space, int offset, UINT16 data);
151
139152   // Sort DMA (zeroteam, cupsoc)
140153
141154   UINT32 cop_sort_ram_addr, cop_sort_lookup;
r32348r32349
203216   void LEGACY_cop_take_hit_box_params(UINT8 offs);
204217   UINT8 LEGACY_cop_calculate_collsion_detection();
205218
219   // endian stuff?
220   int m_cpu_is_68k;
221   static void set_cpu_is_68k(device_t &device, int value) { downcast<raiden2cop_device &>(device).m_cpu_is_68k = value; }
222   UINT16 cop_read_word(address_space &space, int address);
206223
207
208224   // DEBUG
209225   void dump_table();
210226

Previous 199869 Revisions Next


© 1997-2024 The MAME Team