trunk/src/mame/machine/raiden2cop.c
| r32406 | r32407 | |
| 13 | 13 | // use Z to dump out table info |
| 14 | 14 | //#define TABLE_DUMPER |
| 15 | 15 | |
| 16 | |
| 17 | #define LOG_CMDS 0 |
| 18 | |
| 19 | #define seibu_cop_log \ |
| 20 | if (LOG_CMDS) logerror |
| 21 | |
| 22 | |
| 16 | 23 | const device_type RAIDEN2COP = &device_creator<raiden2cop_device>; |
| 17 | 24 | |
| 18 | 25 | raiden2cop_device::raiden2cop_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r32406 | r32407 | |
| 336 | 343 | cop_latch_trigger = data; |
| 337 | 344 | } |
| 338 | 345 | |
| 339 | | #define seibu_cop_log logerror |
| 340 | | #define LOG_CMDS 1 |
| 341 | 346 | |
| 347 | |
| 348 | |
| 342 | 349 | // currently only used by legionna.c implementation |
| 343 | 350 | int raiden2cop_device::find_trigger_match(UINT16 triggerval, UINT16 mask) |
| 344 | 351 | { |
| r32406 | r32407 | |
| 356 | 363 | |
| 357 | 364 | if ((triggerval & mask) == (cop_func_trigger[i] & mask) && cop_func_trigger[i] != 0) /* cop_func_trigger[i] != 0 is just being used to prevent matching against empty / unused slots */ |
| 358 | 365 | { |
| 359 | | #if LOG_CMDS |
| 366 | int otherlog = 1; |
| 367 | |
| 368 | // just some per-game debug code so that we have a record of exactly which triggers each game is known to use |
| 369 | if (!strcmp(machine().system().name, "legionna")) |
| 370 | { |
| 371 | if (triggerval == 0x0205 || triggerval == 0x0905 || |
| 372 | triggerval == 0x8100 || triggerval == 0x8900 || /* sin / cos */ |
| 373 | triggerval == 0x138e || // atan? |
| 374 | triggerval == 0x3bb0 || // distance? |
| 375 | triggerval == 0x42c2 || // distance? |
| 376 | triggerval == 0xa180 || triggerval == 0xa980 || triggerval == 0xb100 || triggerval == 0xb900) /* collisions */ |
| 377 | otherlog = 0; |
| 378 | } |
| 379 | else |
| 380 | { |
| 381 | otherlog = 0; |
| 382 | } |
| 383 | |
| 360 | 384 | 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]); |
| 361 | | #endif |
| 385 | |
| 386 | if (otherlog == 1) printf("used command %04x\n", triggerval); |
| 387 | |
| 362 | 388 | command = i; |
| 363 | 389 | matched++; |
| 364 | 390 | } |
| r32406 | r32407 | |
| 380 | 406 | else if (matched == 0) |
| 381 | 407 | { |
| 382 | 408 | seibu_cop_log(" Cop Command %04x NOT IN TABLE!\n", triggerval); |
| 409 | printf("Command Not Found!\n"); |
| 383 | 410 | return -1; |
| 384 | 411 | } |
| 385 | 412 | |
| 386 | | printf("multiple matches found with mask passed in! (bad!) (%04x %04x)\n", triggerval, mask); |
| 413 | printf("multiple matches found with mask passed in! (bad!) (%04x %04x)\n", triggerval, mask); // this should never happen with the uploaded tables |
| 387 | 414 | return -1; |
| 388 | 415 | |
| 389 | 416 | } |
| r32406 | r32407 | |
| 1644 | 1671 | dx[i] = INT8(cop_collision_info[slot].dx[i]); |
| 1645 | 1672 | } |
| 1646 | 1673 | |
| 1674 | //printf("%02x %02x %02x %02x %02x %02x\n", (UINT8)size[i], (UINT8)dx[i], (UINT8)size[1], (UINT8)dx[1], (UINT8)size[2], (UINT8)dx[2]); |
| 1675 | |
| 1647 | 1676 | int j = slot; |
| 1648 | 1677 | |
| 1649 | 1678 | UINT8 res; |
| r32406 | r32407 | |
| 1993 | 2022 | int command; |
| 1994 | 2023 | |
| 1995 | 2024 | |
| 1996 | | logerror("%06x: COPX execute table macro command %04x | regs %08x %08x %08x %08x %08x\n", space.device().safe_pc(), data, cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3], cop_regs[4]); |
| 2025 | seibu_cop_log("%06x: COPX execute table macro command %04x | regs %08x %08x %08x %08x %08x\n", space.device().safe_pc(), data, cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3], cop_regs[4]); |
| 1997 | 2026 | |
| 1998 | 2027 | |
| 1999 | 2028 | command = find_trigger_match(data, 0xf800); |
trunk/src/mame/drivers/legionna.c
| r32406 | r32407 | |
| 167 | 167 | AM_IMPORT_FROM( legionna_cop_mem ) |
| 168 | 168 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 169 | 169 | AM_RANGE(0x100000, 0x1003ff) AM_RAM |
| 170 | AM_RANGE(0x100470, 0x100471) AM_WRITENOP // toggles 0x2000 / 0x0000, tile bank on some games |
| 170 | 171 | AM_RANGE(0x100600, 0x10063f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write) |
| 172 | AM_RANGE(0x100680, 0x100681) AM_WRITENOP // writes 0x0000 |
| 171 | 173 | AM_RANGE(0x100700, 0x10071f) AM_READWRITE(sound_comms_r,sound_comms_w) |
| 172 | 174 | AM_RANGE(0x100740, 0x100741) AM_READ_PORT("DSW1") |
| 173 | 175 | AM_RANGE(0x100744, 0x100745) AM_READ_PORT("PLAYERS12") |