trunk/src/mame/drivers/legionna.c
| r32348 | r32349 | |
| 1209 | 1209 | |
| 1210 | 1210 | SEIBU_SOUND_SYSTEM_CPU(14318180/4) |
| 1211 | 1211 | |
| 1212 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1212 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1213 | 1213 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1214 | 1214 | |
| 1215 | 1215 | /* video hardware */ |
| r32348 | r32349 | |
| 1245 | 1245 | |
| 1246 | 1246 | SEIBU_SOUND_SYSTEM_CPU(14318180/4) |
| 1247 | 1247 | |
| 1248 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1248 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1249 | 1249 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1250 | 1250 | |
| 1251 | 1251 | /* video hardware */ |
| r32348 | r32349 | |
| 1282 | 1282 | |
| 1283 | 1283 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| 1284 | 1284 | |
| 1285 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1285 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1286 | 1286 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1287 | 1287 | |
| 1288 | 1288 | /* video hardware */ |
| r32348 | r32349 | |
| 1320 | 1320 | |
| 1321 | 1321 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| 1322 | 1322 | |
| 1323 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1323 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1324 | 1324 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1325 | 1325 | |
| 1326 | 1326 | /* video hardware */ |
| r32348 | r32349 | |
| 1357 | 1357 | |
| 1358 | 1358 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| 1359 | 1359 | |
| 1360 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1360 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1361 | 1361 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1362 | 1362 | |
| 1363 | 1363 | /* video hardware */ |
| r32348 | r32349 | |
| 1395 | 1395 | |
| 1396 | 1396 | SEIBU_SOUND_SYSTEM_CPU(14318180/4) |
| 1397 | 1397 | |
| 1398 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1398 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1399 | 1399 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1400 | 1400 | |
| 1401 | 1401 | /* video hardware */ |
| r32348 | r32349 | |
| 1436 | 1436 | MCFG_CPU_VBLANK_INT_DRIVER("screen", legionna_state, irq4_line_hold) /* VBL */ |
| 1437 | 1437 | |
| 1438 | 1438 | MCFG_SEIBU_COP_ADD("seibucop_boot") |
| 1439 | | MCFG_RAIDEN2COP_ADD("raiden2cop") |
| 1439 | MCFG_LEGIONNACOP_ADD("raiden2cop") |
| 1440 | 1440 | MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(WRITE16(legionna_state, videowrite_cb_w)) |
| 1441 | 1441 | |
| 1442 | 1442 | |
trunk/src/mame/machine/raiden2cop.c
| r32348 | r32349 | |
| 62 | 62 | m_LEGACY_r0(0), |
| 63 | 63 | m_LEGACY_r1(0), |
| 64 | 64 | |
| 65 | m_cpu_is_68k(0), |
| 66 | |
| 65 | 67 | m_videoramout_cb(*this), |
| 66 | 68 | m_palette(*this, ":palette") |
| 67 | 69 | { |
| r32348 | r32349 | |
| 170 | 172 | |
| 171 | 173 | } |
| 172 | 174 | |
| 175 | UINT16 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 | |
| 173 | 181 | /*** Command Table uploads ***/ |
| 174 | 182 | |
| 175 | 183 | |
| 184 | |
| 176 | 185 | WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w) |
| 177 | 186 | { |
| 178 | 187 | assert(ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15); |
| r32348 | r32349 | |
| 789 | 798 | |
| 790 | 799 | 0f - 7905 (7905 ) : (1a2, 2c2, 0a2, 000, 000, 000, 000, 000) 6 fffb (cupsoc, grainbow) |
| 791 | 800 | 0f - 7e05 (7e05 ) : (180, 282, 080, 180, 282, 000, 000, 000) 6 fffb (raidendx) |
| 801 | */ |
| 792 | 802 | |
| 803 | /* |
| 793 | 804 | 10 - 8100 (8100 ) : (b9a, b88, 888, 000, 000, 000, 000, 000) 7 fdfb (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk, raiden2, raidendx, zeroteam, xsedae) |
| 805 | */ |
| 794 | 806 | |
| 807 | void 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 | /* |
| 795 | 821 | 11 - 8900 (8900 ) : (b9a, b8a, 88a, 000, 000, 000, 000, 000) 7 fdfb (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk, raiden2, raidendx, zeroteam, xsedae) |
| 822 | */ |
| 823 | void 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 | } |
| 796 | 835 | |
| 836 | /* |
| 797 | 837 | 12 - 9180 (9100 ) : (b80, b94, b94, 894, 000, 000, 000, 000) 7 f8f7 (heatbrl, legionna, cupsoc, godzilla, grainbow, denjinmk) |
| 798 | 838 | 12 - 9100 (9100 ) : (b80, b94, 894, 000, 000, 000, 000, 000) 7 fefb (raiden2, raidendx) |
| 799 | 839 | 12 - 9100 (9100 ) : (b80, b94, b94, 894, 000, 000, 000, 000) 7 f8f7 (zeroteam, xsedae) |
| r32348 | r32349 | |
| 1081 | 1121 | } |
| 1082 | 1122 | |
| 1083 | 1123 | 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 |
| 1093 | 1125 | break; |
| 1094 | 1126 | } |
| 1095 | 1127 | |
| 1096 | 1128 | 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 |
| 1106 | 1130 | break; |
| 1107 | 1131 | } |
| 1108 | 1132 | |
| r32348 | r32349 | |
| 1499 | 1523 | if (check_command_matches(command, 0xb9a, 0xb88, 0x888, 0x000, 0x000, 0x000, 0x000, 0x000, 7, 0xfdfb)) |
| 1500 | 1524 | { |
| 1501 | 1525 | 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 |
| 1514 | 1527 | return; |
| 1515 | 1528 | } |
| 1516 | 1529 | |
| r32348 | r32349 | |
| 1529 | 1542 | if (check_command_matches(command, 0xb9a, 0xb8a, 0x88a, 0x000, 0x000, 0x000, 0x000, 0x000, 7, 0xfdfb)) |
| 1530 | 1543 | { |
| 1531 | 1544 | 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 |
| 1544 | 1546 | return; |
| 1545 | 1547 | } |
| 1546 | 1548 | |
trunk/src/mame/machine/raiden2cop.h
| r32348 | r32349 | |
| 9 | 9 | #define RAIDEN2COP_H |
| 10 | 10 | |
| 11 | 11 | |
| 12 | | #define MCFG_RAIDEN2COP_ADD(_tag ) \ |
| 13 | | MCFG_DEVICE_ADD(_tag, RAIDEN2COP, 0) |
| 14 | 12 | |
| 13 | |
| 15 | 14 | #define MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(_devcb) \ |
| 16 | 15 | devcb = &raiden2cop_device::set_m_videoramout_cb(*device, DEVCB_##_devcb); |
| 17 | 16 | |
| 18 | 17 | #define MCFG_ITOA_UNUSED_DIGIT_VALUE(value) \ |
| 19 | 18 | raiden2cop_device::set_itoa_unused_digit_value(*device, value); |
| 20 | 19 | |
| 20 | #define MCFG_CPU_IS_68K(value) \ |
| 21 | raiden2cop_device::set_cpu_is_68k(*device, value); |
| 21 | 22 | |
| 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 | |
| 22 | 32 | class raiden2cop_device : public device_t |
| 23 | 33 | { |
| 24 | 34 | public: |
| r32348 | r32349 | |
| 136 | 146 | void cop_collision_read_pos(address_space &space, int slot, UINT32 spradr, bool allow_swap); |
| 137 | 147 | void cop_collision_update_hitbox(address_space &space, int slot, UINT32 hitadr); |
| 138 | 148 | |
| 149 | void execute_8100(address_space &space, int offset, UINT16 data); |
| 150 | void execute_8900(address_space &space, int offset, UINT16 data); |
| 151 | |
| 139 | 152 | // Sort DMA (zeroteam, cupsoc) |
| 140 | 153 | |
| 141 | 154 | UINT32 cop_sort_ram_addr, cop_sort_lookup; |
| r32348 | r32349 | |
| 203 | 216 | void LEGACY_cop_take_hit_box_params(UINT8 offs); |
| 204 | 217 | UINT8 LEGACY_cop_calculate_collsion_detection(); |
| 205 | 218 | |
| 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); |
| 206 | 223 | |
| 207 | | |
| 208 | 224 | // DEBUG |
| 209 | 225 | void dump_table(); |
| 210 | 226 | |