trunk/src/mame/drivers/taitojc.c
r22564 | r22565 | |
12 | 12 | - TC0870HVP : Vertex processor? |
13 | 13 | |
14 | 14 | TODO: |
15 | | - games are running too slow compared to pcb recordings, easily noticeable on sidebs/sidebs2 |
| 15 | - games are running at wrong speed(unthrottled?) compared to pcb recordings, easily noticeable on sidebs/sidebs2, |
| 16 | for example the selection screens are too fast, and the driving is almost twice as slow |
16 | 17 | - dendego intro object RAM usage has various gfx bugs (check video file) |
17 | 18 | - dendego title screen builds up and it shouldn't |
18 | | - dendego attract mode train doesn't ride |
| 19 | - dendego attract mode train doesn't ride, demo mode doesn't set the throttle, but it does set the brake pressure |
19 | 20 | - landgear has some weird crashes (after playing one round, after a couple of loops in attract mode) (needs testing -AS) |
20 | 21 | - landgear has huge 3d problems on gameplay (CPU comms?) |
21 | 22 | - dangcurv DSP program crashes very soon due to undumped rom, so no 3d is currently shown. |
r22564 | r22565 | |
567 | 568 | } |
568 | 569 | #endif |
569 | 570 | |
570 | | if (offset == 0x1ff8/4) |
571 | | m_maincpu->set_input_line(6, CLEAR_LINE); |
572 | | |
573 | 571 | if (offset == 0x1ffc/4) |
574 | 572 | { |
575 | 573 | if ((data & 0x80000) == 0) |
r22564 | r22565 | |
599 | 597 | |
600 | 598 | |
601 | 599 | |
602 | | UINT8 taitojc_state::mcu_comm_reg_r(address_space &space, int reg) |
| 600 | READ8_MEMBER(taitojc_state::mcu_comm_r) |
603 | 601 | { |
604 | | UINT8 r = 0; |
605 | | |
606 | | switch (reg) |
| 602 | switch (offset) |
607 | 603 | { |
608 | 604 | case 0x03: |
609 | | { |
610 | | r = m_mcu_data_main; |
611 | | break; |
612 | | } |
| 605 | return m_mcu_data_main; |
| 606 | |
613 | 607 | case 0x04: |
614 | | { |
615 | | r = m_mcu_comm_main | 0x14; |
616 | | break; |
617 | | } |
| 608 | return m_mcu_comm_main | 0x14; |
| 609 | |
618 | 610 | default: |
619 | | { |
620 | | //mame_printf_debug("hc11_reg_r: %02X at %08X\n", reg, space.device().safe_pc()); |
| 611 | logerror("mcu_comm_r: %02X at %08X\n", offset, space.device().safe_pc()); |
621 | 612 | break; |
622 | | } |
623 | 613 | } |
624 | 614 | |
625 | | return r; |
| 615 | return 0; |
626 | 616 | } |
627 | 617 | |
628 | | void taitojc_state::mcu_comm_reg_w(address_space &space, int reg, UINT8 data) |
| 618 | WRITE8_MEMBER(taitojc_state::mcu_comm_w) |
629 | 619 | { |
630 | | switch (reg) |
| 620 | switch (offset) |
631 | 621 | { |
632 | 622 | case 0x00: |
633 | | { |
634 | 623 | m_mcu_data_hc11 = data; |
635 | 624 | m_mcu_comm_hc11 &= ~0x04; |
636 | 625 | m_mcu_comm_main &= ~0x20; |
637 | 626 | break; |
638 | | } |
| 627 | |
639 | 628 | case 0x04: |
640 | | { |
641 | 629 | break; |
642 | | } |
| 630 | |
643 | 631 | default: |
644 | | { |
645 | | //mame_printf_debug("hc11_reg_w: %02X, %02X at %08X\n", reg, data, space.device().safe_pc()); |
| 632 | logerror("mcu_comm_w: %02X, %02X at %08X\n", offset, data, space.device().safe_pc()); |
646 | 633 | break; |
647 | | } |
648 | 634 | } |
649 | 635 | } |
650 | 636 | |
651 | | READ32_MEMBER(taitojc_state::mcu_comm_r) |
652 | | { |
653 | | UINT32 r = 0; |
654 | | int reg = offset * 4; |
655 | | |
656 | | if (ACCESSING_BITS_24_31) |
657 | | { |
658 | | r |= mcu_comm_reg_r(space, reg + 0) << 24; |
659 | | } |
660 | | if (ACCESSING_BITS_16_23) |
661 | | { |
662 | | r |= mcu_comm_reg_r(space, reg + 1) << 16; |
663 | | } |
664 | | if (ACCESSING_BITS_8_15) |
665 | | { |
666 | | r |= mcu_comm_reg_r(space, reg + 2) << 8; |
667 | | } |
668 | | if (ACCESSING_BITS_0_7) |
669 | | { |
670 | | r |= mcu_comm_reg_r(space, reg + 3) << 0; |
671 | | } |
672 | | |
673 | | return r; |
674 | | } |
675 | | |
676 | | WRITE32_MEMBER(taitojc_state::mcu_comm_w) |
677 | | { |
678 | | int reg = offset * 4; |
679 | | |
680 | | if (ACCESSING_BITS_24_31) |
681 | | { |
682 | | mcu_comm_reg_w(space, reg + 0, (data >> 24) & 0xff); |
683 | | } |
684 | | if (ACCESSING_BITS_16_23) |
685 | | { |
686 | | mcu_comm_reg_w(space, reg + 1, (data >> 16) & 0xff); |
687 | | } |
688 | | if (ACCESSING_BITS_8_15) |
689 | | { |
690 | | mcu_comm_reg_w(space, reg + 2, (data >> 8) & 0xff); |
691 | | } |
692 | | if (ACCESSING_BITS_0_7) |
693 | | { |
694 | | mcu_comm_reg_w(space, reg + 3, (data >> 0) & 0xff); |
695 | | } |
696 | | } |
697 | | |
698 | 637 | READ32_MEMBER(taitojc_state::snd_share_r) |
699 | 638 | { |
700 | 639 | switch (offset & 3) |
r22564 | r22565 | |
734 | 673 | } |
735 | 674 | |
736 | 675 | |
| 676 | WRITE8_MEMBER(taitojc_state::jc_irq_ack_w) |
| 677 | { |
| 678 | // gets written to at the end of irq6 routine |
| 679 | // writes $02 or $06, depending on a value in DSP RAM, what does it mean? |
| 680 | m_maincpu->set_input_line(6, CLEAR_LINE); |
| 681 | } |
| 682 | |
| 683 | |
737 | 684 | /* |
738 | 685 | |
739 | 686 | Some games (Dangerous Curves, Side by Side, Side by Side 2) were released as Twin cabinets, |
r22564 | r22565 | |
761 | 708 | AM_RANGE(0x040fc000, 0x040fefff) AM_READWRITE(taitojc_char_r, taitojc_char_w) |
762 | 709 | AM_RANGE(0x040ff000, 0x040fffff) AM_RAM AM_SHARE("objlist") |
763 | 710 | AM_RANGE(0x05800000, 0x0580003f) AM_READ8(jc_pcbid_r, 0xffffffff) |
764 | | AM_RANGE(0x05900000, 0x05900007) AM_READWRITE(mcu_comm_r, mcu_comm_w) |
| 711 | AM_RANGE(0x05900000, 0x05900007) AM_READWRITE8(mcu_comm_r, mcu_comm_w, 0xffffffff) |
765 | 712 | AM_RANGE(0x06400000, 0x0641ffff) AM_READWRITE(taitojc_palette_r, taitojc_palette_w) AM_SHARE("palette_ram") |
766 | 713 | AM_RANGE(0x06600000, 0x0660001f) AM_DEVREADWRITE8_LEGACY("tc0640fio", tc0640fio_r, tc0640fio_w, 0xff000000) |
767 | 714 | AM_RANGE(0x0660004c, 0x0660004f) AM_WRITE_PORT("EEPROMOUT") |
768 | | AM_RANGE(0x06800000, 0x06800003) AM_WRITENOP // irq mask/ack? a watchdog? |
| 715 | AM_RANGE(0x06800000, 0x06800003) AM_WRITE8(jc_irq_ack_w, 0x00ff0000) |
769 | 716 | AM_RANGE(0x06a00000, 0x06a01fff) AM_READWRITE(snd_share_r, snd_share_w) AM_SHARE("snd_shared") |
770 | 717 | AM_RANGE(0x06c00000, 0x06c0001f) AM_READWRITE8(jc_lan_r, jc_lan_w, 0x00ff0000) |
771 | 718 | AM_RANGE(0x08000000, 0x080fffff) AM_RAM AM_SHARE("main_ram") |
r22564 | r22565 | |
987 | 934 | int x, y; |
988 | 935 | //mame_printf_debug("texture write %08X, %04X\n", dsp_addr1, data); |
989 | 936 | |
990 | | x = (m_dsp_tex_offset >> 0) & 0x1f; |
991 | | y = (m_dsp_tex_offset >> 5) & 0x1f; |
| 937 | x = (m_dsp_tex_offset >> 0 & 0x1f) | (m_dsp_tex_offset >> 5 & 0x20); |
| 938 | y = (m_dsp_tex_offset >> 5 & 0x1f) | (m_dsp_tex_offset >> 6 & 0x20); |
992 | 939 | |
993 | | x += (m_dsp_tex_offset & 0x400) ? 0x20 : 0; |
994 | | y += (m_dsp_tex_offset & 0x800) ? 0x20 : 0; |
995 | | |
996 | 940 | index = (((m_texture_y * 32) + y) * 2048) + ((m_texture_x * 32) + x); |
997 | 941 | m_texture[index] = data & 0xff; |
998 | 942 | |
r22564 | r22565 | |
1039 | 983 | |
1040 | 984 | WRITE16_MEMBER(taitojc_state::dsp_to_main_w) |
1041 | 985 | { |
1042 | | m_maincpu->set_input_line(6, ASSERT_LINE); |
| 986 | m_maincpu->set_input_line(6, ASSERT_LINE); // probably not correct to do it here |
1043 | 987 | |
1044 | 988 | COMBINE_DATA(&m_dsp_shared_ram[0x7fe]); |
1045 | 989 | } |
r22564 | r22565 | |
1090 | 1034 | |
1091 | 1035 | PORT_START("COINS") |
1092 | 1036 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit) |
1093 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1037 | PORT_DIPNAME( 0x02, 0x02, "Dev Skip RAM Test" ) // skips mainram test on page 1 of POST |
| 1038 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1039 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
1094 | 1040 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
1095 | 1041 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
1096 | 1042 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
r22564 | r22565 | |
1115 | 1061 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
1116 | 1062 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
1117 | 1063 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
1118 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // debug related in dendego/sidebs |
| 1064 | PORT_DIPNAME( 0x40, 0x40, "Dev Debug" ) // debug related in dendego/sidebs |
| 1065 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1066 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
1119 | 1067 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
1120 | 1068 | |
1121 | 1069 | PORT_START("BUTTONS") |
r22564 | r22565 | |
1247 | 1195 | |
1248 | 1196 | INTERRUPT_GEN_MEMBER(taitojc_state::taitojc_vblank) |
1249 | 1197 | { |
1250 | | device.execute().set_input_line_and_vector(2, HOLD_LINE, 130); |
| 1198 | device.execute().set_input_line_and_vector(2, HOLD_LINE, 0x82); // where does it come from? |
1251 | 1199 | } |
1252 | 1200 | |
1253 | 1201 | static const tc0640fio_interface taitojc_io_intf = |
r22564 | r22565 | |
1268 | 1216 | /* basic machine hardware */ |
1269 | 1217 | MCFG_CPU_ADD("maincpu", M68040, XTAL_10MHz*2) // 20MHz, clock source = CY7C991 |
1270 | 1218 | MCFG_CPU_PROGRAM_MAP(taitojc_map) |
1271 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", taitojc_state, taitojc_vblank) |
| 1219 | MCFG_CPU_VBLANK_INT_DRIVER("screen", taitojc_state, taitojc_vblank) |
1272 | 1220 | |
1273 | 1221 | MCFG_CPU_ADD("sub", MC68HC11, XTAL_16MHz/2) // 8MHz, MC68HC11M0 |
1274 | 1222 | MCFG_CPU_PROGRAM_MAP(hc11_pgm_map) |