trunk/src/mame/includes/taitojc.h
| r32534 | r32535 | |
| 1 | 1 | #include "video/poly.h" |
| 2 | | #include "machine/mb8421.h" |
| 3 | 2 | #include "machine/taitoio.h" |
| 4 | 3 | |
| 5 | 4 | #define TAITOJC_POLYGON_FIFO_SIZE 0x20000 |
| r32534 | r32535 | |
| 43 | 42 | m_maincpu(*this,"maincpu"), |
| 44 | 43 | m_dsp(*this,"dsp"), |
| 45 | 44 | m_tc0640fio(*this, "tc0640fio"), |
| 46 | | m_mb8421(*this, "mb8421"), |
| 47 | 45 | m_gfx2(*this, "gfx2"), |
| 48 | 46 | m_vram(*this, "vram"), |
| 49 | 47 | m_objlist(*this, "objlist"), |
| 50 | 48 | m_snd_shared_ram(*this, "snd_shared"), |
| 51 | 49 | m_main_ram(*this, "main_ram"), |
| 50 | m_dsp_shared_ram(*this, "dsp_shared"), |
| 52 | 51 | m_palette_ram(*this, "palette_ram"), |
| 53 | 52 | m_gfxdecode(*this, "gfxdecode"), |
| 54 | 53 | m_screen(*this, "screen"), |
| r32534 | r32535 | |
| 64 | 63 | required_device<cpu_device> m_maincpu; |
| 65 | 64 | required_device<cpu_device> m_dsp; |
| 66 | 65 | required_device<tc0640fio_device> m_tc0640fio; |
| 67 | | required_device<mb8421_device> m_mb8421; |
| 68 | 66 | required_memory_region m_gfx2; |
| 69 | 67 | |
| 70 | 68 | required_shared_ptr<UINT32> m_vram; |
| 71 | 69 | required_shared_ptr<UINT32> m_objlist; |
| 72 | 70 | required_shared_ptr<UINT32> m_snd_shared_ram; |
| 73 | 71 | required_shared_ptr<UINT32> m_main_ram; |
| 72 | required_shared_ptr<UINT16> m_dsp_shared_ram; |
| 74 | 73 | required_shared_ptr<UINT32> m_palette_ram; |
| 75 | 74 | |
| 76 | 75 | required_device<gfxdecode_device> m_gfxdecode; |
| r32534 | r32535 | |
| 88 | 87 | UINT16 m_dsp_tex_offset; |
| 89 | 88 | |
| 90 | 89 | int m_first_dsp_reset; |
| 91 | | UINT8 m_dsp_shared_ram_hi[0x800]; |
| 92 | 90 | INT16 m_viewport_data[3]; |
| 93 | 91 | INT16 m_projection_data[3]; |
| 94 | 92 | INT16 m_intersection_data[3]; |
| r32534 | r32535 | |
| 119 | 117 | |
| 120 | 118 | DECLARE_READ8_MEMBER(mcu_comm_r); |
| 121 | 119 | DECLARE_WRITE8_MEMBER(mcu_comm_w); |
| 122 | | DECLARE_READ8_MEMBER(dsp_shared_r); |
| 123 | | DECLARE_WRITE8_MEMBER(dsp_shared_w); |
| 124 | 120 | DECLARE_READ32_MEMBER(snd_share_r); |
| 125 | 121 | DECLARE_WRITE32_MEMBER(snd_share_w); |
| 126 | 122 | DECLARE_READ8_MEMBER(jc_pcbid_r); |
| r32534 | r32535 | |
| 138 | 134 | DECLARE_WRITE8_MEMBER(hc11_data_w); |
| 139 | 135 | DECLARE_READ8_MEMBER(hc11_analog_r); |
| 140 | 136 | |
| 137 | DECLARE_READ16_MEMBER(dsp_shared_r); |
| 138 | DECLARE_WRITE16_MEMBER(dsp_shared_w); |
| 139 | DECLARE_READ16_MEMBER(dsp_to_main_7fe_r); |
| 140 | DECLARE_WRITE16_MEMBER(dsp_to_main_7fe_w); |
| 141 | DECLARE_WRITE16_MEMBER(main_to_dsp_7ff_w); |
| 142 | |
| 141 | 143 | DECLARE_READ16_MEMBER(dsp_rom_r); |
| 142 | 144 | DECLARE_WRITE16_MEMBER(dsp_rom_w); |
| 143 | 145 | DECLARE_WRITE16_MEMBER(dsp_texture_w); |
| r32534 | r32535 | |
| 173 | 175 | UINT32 screen_update_taitojc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 174 | 176 | UINT32 screen_update_dendego(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 175 | 177 | INTERRUPT_GEN_MEMBER(taitojc_vblank); |
| 176 | | DECLARE_WRITE_LINE_MEMBER(mb8421_intl); |
| 177 | | DECLARE_WRITE_LINE_MEMBER(mb8421_intr); |
| 178 | 178 | void draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 w1, UINT32 w2, UINT8 bank_type); |
| 179 | 179 | void draw_object_bank(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 bank_type, UINT8 pri); |
| 180 | 180 | void taitojc_clear_frame(); |
trunk/src/mame/drivers/taitojc.c
| r32534 | r32535 | |
| 380 | 380 | #include "cpu/mc68hc11/mc68hc11.h" |
| 381 | 381 | #include "sound/es5506.h" |
| 382 | 382 | #include "sound/okim6295.h" |
| 383 | | #include "machine/mb8421.h" |
| 384 | 383 | #include "machine/taitoio.h" |
| 385 | 384 | #include "machine/eepromser.h" |
| 386 | 385 | #include "audio/taito_en.h" |
| r32534 | r32535 | |
| 455 | 454 | |
| 456 | 455 | ***************************************************************************/ |
| 457 | 456 | |
| 458 | | // boob :( this is probably not the MB8421, need to change this |
| 459 | | WRITE_LINE_MEMBER(taitojc_state::mb8421_intl) |
| 457 | // dsp common ram has similar interrupt capability as MB8421 |
| 458 | WRITE16_MEMBER(taitojc_state::dsp_to_main_7fe_w) |
| 460 | 459 | { |
| 460 | COMBINE_DATA(&m_dsp_shared_ram[0x7fe]); |
| 461 | |
| 461 | 462 | // shared ram interrupt request from dsp side |
| 462 | | m_maincpu->set_input_line(6, state ? ASSERT_LINE : CLEAR_LINE); |
| 463 | if (ACCESSING_BITS_0_7) |
| 464 | m_maincpu->set_input_line(6, ASSERT_LINE); |
| 463 | 465 | } |
| 464 | 466 | |
| 465 | | WRITE_LINE_MEMBER(taitojc_state::mb8421_intr) |
| 467 | READ16_MEMBER(taitojc_state::dsp_to_main_7fe_r) |
| 466 | 468 | { |
| 467 | | // shared ram interrupt request from maincpu side |
| 468 | | // this is hacky, acquiring the internal dsp romdump should allow it to be cleaned up |
| 469 | | if (state) |
| 469 | if (ACCESSING_BITS_0_7) |
| 470 | m_maincpu->set_input_line(6, CLEAR_LINE); |
| 471 | |
| 472 | return m_dsp_shared_ram[0x7fe]; |
| 473 | } |
| 474 | |
| 475 | WRITE16_MEMBER(taitojc_state::main_to_dsp_7ff_w) |
| 476 | { |
| 477 | COMBINE_DATA(&m_dsp_shared_ram[0x7ff]); |
| 478 | |
| 479 | if (ACCESSING_BITS_0_7) |
| 470 | 480 | { |
| 471 | | if (m_mb8421->peek(0x7ff) & 0x08) |
| 481 | // shared ram interrupt request from maincpu side |
| 482 | // this is hacky, acquiring the internal dsp romdump should allow it to be cleaned up(?) |
| 483 | if (data & 0x08) |
| 472 | 484 | { |
| 473 | 485 | m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 474 | 486 | } |
| r32534 | r32535 | |
| 512 | 524 | |
| 513 | 525 | ***************************************************************************/ |
| 514 | 526 | |
| 515 | | READ8_MEMBER(taitojc_state::dsp_shared_r) |
| 527 | READ16_MEMBER(taitojc_state::dsp_shared_r) |
| 516 | 528 | { |
| 517 | | return m_dsp_shared_ram_hi[offset]; |
| 529 | return m_dsp_shared_ram[offset]; |
| 518 | 530 | } |
| 519 | 531 | |
| 520 | | WRITE8_MEMBER(taitojc_state::dsp_shared_w) |
| 532 | WRITE16_MEMBER(taitojc_state::dsp_shared_w) |
| 521 | 533 | { |
| 522 | | m_dsp_shared_ram_hi[offset] = data; |
| 534 | COMBINE_DATA(&m_dsp_shared_ram[offset]); |
| 523 | 535 | } |
| 524 | 536 | |
| 525 | 537 | |
| r32534 | r32535 | |
| 634 | 646 | AM_RANGE(0x06a00000, 0x06a01fff) AM_READWRITE(snd_share_r, snd_share_w) AM_SHARE("snd_shared") |
| 635 | 647 | AM_RANGE(0x06c00000, 0x06c0001f) AM_READWRITE8(jc_lan_r, jc_lan_w, 0x00ff0000) |
| 636 | 648 | AM_RANGE(0x08000000, 0x080fffff) AM_RAM AM_SHARE("main_ram") |
| 637 | | AM_RANGE(0x10000000, 0x10001fff) AM_DEVREADWRITE8("mb8421", mb8421_device, left_r, left_w, 0x00ff0000) |
| 638 | | AM_RANGE(0x10000000, 0x10001fff) AM_READWRITE8(dsp_shared_r, dsp_shared_w, 0xff000000) // which chip is this? |
| 649 | AM_RANGE(0x10001ff8, 0x10001ffb) AM_READ16(dsp_to_main_7fe_r, 0xffff0000) |
| 650 | AM_RANGE(0x10001ffc, 0x10001fff) AM_WRITE16(main_to_dsp_7ff_w, 0xffff0000) |
| 651 | AM_RANGE(0x10000000, 0x10001fff) AM_READWRITE16(dsp_shared_r, dsp_shared_w, 0xffff0000) |
| 639 | 652 | ADDRESS_MAP_END |
| 640 | 653 | |
| 641 | 654 | |
| r32534 | r32535 | |
| 909 | 922 | AM_RANGE(0x701d, 0x701d) AM_READ(dsp_math_projection_y_r) |
| 910 | 923 | AM_RANGE(0x701f, 0x701f) AM_READ(dsp_math_projection_x_r) |
| 911 | 924 | AM_RANGE(0x7022, 0x7022) AM_READ(dsp_math_unk_r) |
| 912 | | AM_RANGE(0x7800, 0x7fff) AM_DEVREADWRITE8("mb8421", mb8421_device, right_r, right_w, 0x00ff) |
| 913 | | AM_RANGE(0x7800, 0x7fff) AM_READWRITE8(dsp_shared_r, dsp_shared_w, 0xff00) // which chip is this? |
| 925 | AM_RANGE(0x7ffe, 0x7ffe) AM_WRITE(dsp_to_main_7fe_w) |
| 926 | AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("dsp_shared") |
| 914 | 927 | AM_RANGE(0x8000, 0xffff) AM_RAM |
| 915 | 928 | ADDRESS_MAP_END |
| 916 | 929 | |
| r32534 | r32535 | |
| 1090 | 1103 | m_dsp_tex_offset = 0; |
| 1091 | 1104 | m_polygon_fifo_ptr = 0; |
| 1092 | 1105 | |
| 1093 | | memset(m_dsp_shared_ram_hi, 0, sizeof(m_dsp_shared_ram_hi)); |
| 1094 | 1106 | memset(m_viewport_data, 0, sizeof(m_viewport_data)); |
| 1095 | 1107 | memset(m_projection_data, 0, sizeof(m_projection_data)); |
| 1096 | 1108 | memset(m_intersection_data, 0, sizeof(m_intersection_data)); |
| r32534 | r32535 | |
| 1108 | 1120 | save_item(NAME(m_dsp_tex_address)); |
| 1109 | 1121 | save_item(NAME(m_dsp_tex_offset)); |
| 1110 | 1122 | save_item(NAME(m_first_dsp_reset)); |
| 1111 | | save_item(NAME(m_dsp_shared_ram_hi)); |
| 1112 | 1123 | save_item(NAME(m_viewport_data)); |
| 1113 | 1124 | save_item(NAME(m_projection_data)); |
| 1114 | 1125 | save_item(NAME(m_intersection_data)); |
| r32534 | r32535 | |
| 1146 | 1157 | |
| 1147 | 1158 | MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") |
| 1148 | 1159 | |
| 1149 | | MCFG_DEVICE_ADD("mb8421", MB8421, 0) |
| 1150 | | MCFG_MB8421_INTL_HANDLER(WRITELINE(taitojc_state, mb8421_intl)) |
| 1151 | | MCFG_MB8421_INTR_HANDLER(WRITELINE(taitojc_state, mb8421_intr)) |
| 1152 | | |
| 1153 | 1160 | MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) |
| 1154 | 1161 | MCFG_TC0640FIO_READ_0_CB(IOPORT("SERVICE")) |
| 1155 | 1162 | MCFG_TC0640FIO_READ_1_CB(IOPORT("COINS")) |
| r32534 | r32535 | |
| 1201 | 1208 | if (space.device().safe_pc() == 0x404c) |
| 1202 | 1209 | space.device().execute().spin_until_time(attotime::from_usec(500)); |
| 1203 | 1210 | |
| 1204 | | return m_dsp_shared_ram_hi[0x7f0] << 8 | m_mb8421->peek(0x7f0); |
| 1211 | return m_dsp_shared_ram[0x7f0]; |
| 1205 | 1212 | } |
| 1206 | 1213 | |
| 1207 | 1214 | READ16_MEMBER(taitojc_state::dendego2_dsp_idle_skip_r) |
| r32534 | r32535 | |
| 1209 | 1216 | if (space.device().safe_pc() == 0x402e) |
| 1210 | 1217 | space.device().execute().spin_until_time(attotime::from_usec(500)); |
| 1211 | 1218 | |
| 1212 | | return m_dsp_shared_ram_hi[0x7f0] << 8 | m_mb8421->peek(0x7f0); |
| 1219 | return m_dsp_shared_ram[0x7f0]; |
| 1213 | 1220 | } |
| 1214 | 1221 | |
| 1215 | 1222 | |