trunk/src/mame/drivers/raiden2.c
| r31827 | r31828 | |
| 480 | 480 | cop_scale &= 3; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | WRITE16_MEMBER(raiden2_state::cop_angle_target_w) |
| 484 | { |
| 485 | COMBINE_DATA(&cop_angle_target); |
| 486 | } |
| 487 | |
| 488 | WRITE16_MEMBER(raiden2_state::cop_angle_step_w) |
| 489 | { |
| 490 | COMBINE_DATA(&cop_angle_step); |
| 491 | } |
| 492 | |
| 483 | 493 | READ16_MEMBER(raiden2_state::cop_reg_high_r) |
| 484 | 494 | { |
| 485 | 495 | return cop_regs[offset] >> 16; |
| r31827 | r31828 | |
| 625 | 635 | break; |
| 626 | 636 | } |
| 627 | 637 | |
| 638 | case 0x6200: { |
| 639 | UINT8 angle = space.read_byte(cop_regs[0]+0x34); |
| 640 | UINT16 flags = space.read_word(cop_regs[0]); |
| 641 | cop_angle_target &= 0xff; |
| 642 | cop_angle_step &= 0xff; |
| 643 | flags &= ~0x0004; |
| 644 | int delta = angle - cop_angle_target; |
| 645 | if(delta >= 128) |
| 646 | delta -= 256; |
| 647 | else if(delta < -128) |
| 648 | delta += 256; |
| 649 | if(delta < 0) { |
| 650 | if(delta >= -cop_angle_step) { |
| 651 | angle = cop_angle_target; |
| 652 | flags |= 0x0004; |
| 653 | } else |
| 654 | angle += cop_angle_step; |
| 655 | } else { |
| 656 | if(delta <= cop_angle_step) { |
| 657 | angle = cop_angle_target; |
| 658 | flags |= 0x0004; |
| 659 | } else |
| 660 | angle -= cop_angle_step; |
| 661 | } |
| 662 | space.write_word(cop_regs[0], flags); |
| 663 | space.write_byte(cop_regs[0]+0x34, angle); |
| 664 | break; |
| 665 | } |
| 666 | |
| 628 | 667 | case 0x8100: { // 8100 0007 fdfb 0080 - 0b9a 0b88 0888 0000 0000 0000 0000 0000 |
| 629 | 668 | int raw_angle = (space.read_word(cop_regs[0]+(0x34)) & 0xff); |
| 630 | 669 | double angle = raw_angle * M_PI / 128; |
| r31827 | r31828 | |
| 1396 | 1435 | |
| 1397 | 1436 | /* MEMORY MAPS */ |
| 1398 | 1437 | static ADDRESS_MAP_START( raiden2_cop_mem, AS_PROGRAM, 16, raiden2_state ) |
| 1399 | | // AM_RANGE(0x0041c, 0x0041d) AM_WRITENOP // angle compare (for 0x6200 COP macro) |
| 1400 | | // AM_RANGE(0x0041e, 0x0041f) AM_WRITENOP // angle mod value (for 0x6200 COP macro) |
| 1438 | AM_RANGE(0x0041c, 0x0041d) AM_WRITE(cop_angle_target_w) // angle target (for 0x6200 COP macro) |
| 1439 | AM_RANGE(0x0041e, 0x0041f) AM_WRITE(cop_angle_step_w) // angle step (for 0x6200 COP macro) |
| 1401 | 1440 | AM_RANGE(0x00420, 0x00421) AM_WRITE(cop_itoa_low_w) |
| 1402 | 1441 | AM_RANGE(0x00422, 0x00423) AM_WRITE(cop_itoa_high_w) |
| 1403 | 1442 | AM_RANGE(0x00424, 0x00425) AM_WRITE(cop_itoa_digit_count_w) |
trunk/src/mame/includes/raiden2.h
| r31827 | r31828 | |
| 27 | 27 | DECLARE_WRITE16_MEMBER( cop_dma_v1_w ); |
| 28 | 28 | DECLARE_WRITE16_MEMBER( cop_dma_v2_w ); |
| 29 | 29 | DECLARE_WRITE16_MEMBER( cop_scale_w ); |
| 30 | DECLARE_WRITE16_MEMBER( cop_angle_target_w ); |
| 31 | DECLARE_WRITE16_MEMBER( cop_angle_step_w ); |
| 30 | 32 | DECLARE_WRITE16_MEMBER( cop_dma_adr_rel_w ); |
| 31 | 33 | DECLARE_WRITE16_MEMBER( cop_dma_src_w ); |
| 32 | 34 | DECLARE_WRITE16_MEMBER( cop_dma_size_w ); |
| r31827 | r31828 | |
| 108 | 110 | UINT16 cop_func_mask[0x100/8]; /* function mask (?) */ |
| 109 | 111 | UINT16 cop_program[0x100]; /* program "code" */ |
| 110 | 112 | UINT16 cop_latch_addr, cop_latch_trigger, cop_latch_value, cop_latch_mask; |
| 111 | | INT8 cop_angle_compare; |
| 112 | | UINT8 cop_angle_mod_val; |
| 113 | UINT16 cop_angle_target; |
| 114 | UINT16 cop_angle_step; |
| 113 | 115 | |
| 114 | 116 | DECLARE_WRITE16_MEMBER( sprite_prot_x_w ); |
| 115 | 117 | DECLARE_WRITE16_MEMBER( sprite_prot_y_w ); |