trunk/src/mess/drivers/ip22.c
| r20493 | r20494 | |
| 95 | 95 | public: |
| 96 | 96 | ip22_state(const machine_config &mconfig, device_type type, const char *tag) |
| 97 | 97 | : driver_device(mconfig, type, tag), |
| 98 | | m_wd33c93(*this, "scsi:wd33c93"), |
| 99 | | m_unkpbus0(*this, "unkpbus0"), |
| 100 | | m_mainram(*this, "mainram") { } |
| 98 | m_maincpu(*this, "maincpu"), |
| 99 | m_wd33c93(*this, "scsi:wd33c93"), |
| 100 | m_unkpbus0(*this, "unkpbus0"), |
| 101 | m_mainram(*this, "mainram"), |
| 102 | m_lpt0(*this, "lpt_0"), |
| 103 | m_pit(*this, "pit8254"), |
| 104 | m_dac(*this, "dac") |
| 105 | { } |
| 101 | 106 | |
| 102 | | required_device<wd33c93_device> m_wd33c93; |
| 103 | | required_shared_ptr<UINT32> m_unkpbus0; |
| 104 | | required_shared_ptr<UINT32> m_mainram; |
| 105 | 107 | RTC_t m_RTC; |
| 106 | 108 | UINT32 m_int3_regs[64]; |
| 107 | 109 | UINT32 m_nIOC_ParReadCnt; |
| r20493 | r20494 | |
| 134 | 136 | INTERRUPT_GEN_MEMBER(ip22_vbl); |
| 135 | 137 | TIMER_CALLBACK_MEMBER(ip22_dma); |
| 136 | 138 | TIMER_CALLBACK_MEMBER(ip22_timer); |
| 139 | required_device<cpu_device> m_maincpu; |
| 140 | required_device<wd33c93_device> m_wd33c93; |
| 141 | required_shared_ptr<UINT32> m_unkpbus0; |
| 142 | required_shared_ptr<UINT32> m_mainram; |
| 143 | required_device<device_t> m_lpt0; |
| 144 | required_device<pit8254_device> m_pit; |
| 145 | required_device<dac_device> m_dac; |
| 137 | 146 | }; |
| 138 | 147 | |
| 139 | 148 | |
| r20493 | r20494 | |
| 208 | 217 | |
| 209 | 218 | // if it's not masked, also assert it now at the CPU |
| 210 | 219 | if (state->m_int3_regs[1] & source_mask) |
| 211 | | { |
| 212 | | machine.device("maincpu")->execute().set_input_line(MIPS3_IRQ0, ASSERT_LINE); |
| 213 | | } |
| 220 | state->m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); |
| 214 | 221 | } |
| 215 | 222 | |
| 216 | 223 | // lower a local0 interrupt |
| r20493 | r20494 | |
| 229 | 236 | |
| 230 | 237 | // if it's not masked, also assert it now at the CPU |
| 231 | 238 | if (state->m_int3_regs[2] & source_mask) |
| 232 | | { |
| 233 | | machine.device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); |
| 234 | | } |
| 239 | state->m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); |
| 235 | 240 | } |
| 236 | 241 | |
| 237 | 242 | // lower a local1 interrupt |
| r20493 | r20494 | |
| 244 | 249 | |
| 245 | 250 | READ32_MEMBER(ip22_state::hpc3_pbus6_r) |
| 246 | 251 | { |
| 247 | | device_t *lpt = machine().device("lpt_0"); |
| 248 | 252 | UINT8 ret8; |
| 249 | 253 | switch( offset ) |
| 250 | 254 | { |
| 251 | 255 | case 0x004/4: |
| 252 | | ret8 = pc_lpt_control_r(lpt, space, 0) ^ 0x0d; |
| 256 | ret8 = pc_lpt_control_r(m_lpt0, space, 0) ^ 0x0d; |
| 253 | 257 | //verboselog(( machine, 0, "Parallel Control Read: %02x\n", ret8 ); |
| 254 | 258 | return ret8; |
| 255 | 259 | case 0x008/4: |
| 256 | | ret8 = pc_lpt_status_r(lpt, space, 0) ^ 0x80; |
| 260 | ret8 = pc_lpt_status_r(m_lpt0, space, 0) ^ 0x80; |
| 257 | 261 | //verboselog(( machine, 0, "Parallel Status Read: %02x\n", ret8 ); |
| 258 | 262 | return ret8; |
| 259 | 263 | case 0x030/4: |
| r20493 | r20494 | |
| 293 | 297 | // mame_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc()); |
| 294 | 298 | return m_int3_regs[offset-0x80/4]; |
| 295 | 299 | case 0xb0/4: |
| 296 | | ret8 = pit8253_r(machine().device("pit8254"), space, 0); |
| 300 | ret8 = pit8253_r(m_pit, space, 0); |
| 297 | 301 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 298 | 302 | return ret8; |
| 299 | 303 | case 0xb4/4: |
| 300 | | ret8 = pit8253_r(machine().device("pit8254"), space, 1); |
| 304 | ret8 = pit8253_r(m_pit, space, 1); |
| 301 | 305 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 302 | 306 | return ret8; |
| 303 | 307 | case 0xb8/4: |
| 304 | | ret8 = pit8253_r(machine().device("pit8254"), space, 2); |
| 308 | ret8 = pit8253_r(m_pit, space, 2); |
| 305 | 309 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 306 | 310 | return ret8; |
| 307 | 311 | case 0xbc/4: |
| 308 | | ret8 = pit8253_r(machine().device("pit8254"), space, 3); |
| 312 | ret8 = pit8253_r(m_pit, space, 3); |
| 309 | 313 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 310 | 314 | return ret8; |
| 311 | 315 | default: |
| r20493 | r20494 | |
| 317 | 321 | |
| 318 | 322 | WRITE32_MEMBER(ip22_state::hpc3_pbus6_w) |
| 319 | 323 | { |
| 320 | | device_t *lpt = machine().device("lpt_0"); |
| 321 | 324 | char cChar; |
| 322 | 325 | |
| 323 | 326 | switch( offset ) |
| 324 | 327 | { |
| 325 | 328 | case 0x004/4: |
| 326 | 329 | //verboselog(( machine, 0, "Parallel Control Write: %08x\n", data ); |
| 327 | | pc_lpt_control_w(lpt, space, 0, data ^ 0x0d); |
| 330 | pc_lpt_control_w(m_lpt0, space, 0, data ^ 0x0d); |
| 328 | 331 | //m_nIOC_ParCntl = data; |
| 329 | 332 | break; |
| 330 | 333 | case 0x030/4: |
| r20493 | r20494 | |
| 378 | 381 | |
| 379 | 382 | // if no local0 interrupts now, clear the input to the CPU |
| 380 | 383 | if ((m_int3_regs[0] & m_int3_regs[1]) == 0) |
| 381 | | { |
| 382 | | machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ0, CLEAR_LINE); |
| 383 | | } |
| 384 | m_maincpu->set_input_line(MIPS3_IRQ0, CLEAR_LINE); |
| 384 | 385 | else |
| 385 | | { |
| 386 | | machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ0, ASSERT_LINE); |
| 387 | | } |
| 386 | m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); |
| 388 | 387 | |
| 389 | 388 | // if no local1 interrupts now, clear the input to the CPU |
| 390 | 389 | if ((m_int3_regs[2] & m_int3_regs[3]) == 0) |
| 391 | | { |
| 392 | | machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ1, CLEAR_LINE); |
| 393 | | } |
| 390 | m_maincpu->set_input_line(MIPS3_IRQ1, CLEAR_LINE); |
| 394 | 391 | else |
| 395 | | { |
| 396 | | machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); |
| 397 | | } |
| 392 | m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); |
| 393 | |
| 398 | 394 | break; |
| 399 | 395 | case 0xb0/4: |
| 400 | 396 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 401 | | pit8253_w(machine().device("pit8254"), space, 0, data & 0x000000ff); |
| 397 | pit8253_w(m_pit, space, 0, data & 0x000000ff); |
| 402 | 398 | return; |
| 403 | 399 | case 0xb4/4: |
| 404 | 400 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 405 | | pit8253_w(machine().device("pit8254"), space, 1, data & 0x000000ff); |
| 401 | pit8253_w(m_pit, space, 1, data & 0x000000ff); |
| 406 | 402 | return; |
| 407 | 403 | case 0xb8/4: |
| 408 | 404 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 409 | | pit8253_w(machine().device("pit8254"), space, 2, data & 0x000000ff); |
| 405 | pit8253_w(m_pit, space, 2, data & 0x000000ff); |
| 410 | 406 | return; |
| 411 | 407 | case 0xbc/4: |
| 412 | 408 | //verboselog(( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 413 | | pit8253_w(machine().device("pit8254"), space, 3, data & 0x000000ff); |
| 409 | pit8253_w(m_pit, space, 3, data & 0x000000ff); |
| 414 | 410 | return; |
| 415 | 411 | default: |
| 416 | 412 | //verboselog(( machine, 0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask ); |
| r20493 | r20494 | |
| 418 | 414 | } |
| 419 | 415 | } |
| 420 | 416 | |
| 421 | | //UINT32 nHPC3_hd0_register; |
| 422 | | //UINT32 nHPC3_hd0_regs[0x20]; |
| 423 | | //UINT32 nHPC3_hd1_regs[0x20]; |
| 424 | | |
| 425 | 417 | READ32_MEMBER(ip22_state::hpc3_hd_enet_r) |
| 426 | 418 | { |
| 427 | | //running_machine &machine = machine(); |
| 428 | | |
| 429 | 419 | switch( offset ) |
| 430 | 420 | { |
| 431 | 421 | case 0x0004/4: |
| r20493 | r20494 | |
| 449 | 439 | |
| 450 | 440 | WRITE32_MEMBER(ip22_state::hpc3_hd_enet_w) |
| 451 | 441 | { |
| 452 | | //running_machine &machine = machine(); |
| 453 | | |
| 454 | 442 | switch( offset ) |
| 455 | 443 | { |
| 456 | 444 | case 0x0004/4: |
| r20493 | r20494 | |
| 477 | 465 | |
| 478 | 466 | READ32_MEMBER(ip22_state::hpc3_hd0_r) |
| 479 | 467 | { |
| 480 | | //running_machine &machine = machine(); |
| 481 | | |
| 482 | 468 | switch( offset ) |
| 483 | 469 | { |
| 484 | 470 | case 0x0000/4: |
| r20493 | r20494 | |
| 512 | 498 | |
| 513 | 499 | WRITE32_MEMBER(ip22_state::hpc3_hd0_w) |
| 514 | 500 | { |
| 515 | | //running_machine &machine = machine(); |
| 516 | | |
| 517 | 501 | switch( offset ) |
| 518 | 502 | { |
| 519 | 503 | case 0x0000/4: |
| r20493 | r20494 | |
| 541 | 525 | |
| 542 | 526 | READ32_MEMBER(ip22_state::hpc3_pbus4_r) |
| 543 | 527 | { |
| 544 | | //running_machine &machine = machine(); |
| 545 | | |
| 546 | 528 | switch( offset ) |
| 547 | 529 | { |
| 548 | 530 | case 0x0004/4: |
| r20493 | r20494 | |
| 563 | 545 | |
| 564 | 546 | WRITE32_MEMBER(ip22_state::hpc3_pbus4_w) |
| 565 | 547 | { |
| 566 | | //running_machine &machine = machine(); |
| 567 | | |
| 568 | 548 | switch( offset ) |
| 569 | 549 | { |
| 570 | 550 | case 0x0004/4: |
| r20493 | r20494 | |
| 621 | 601 | { |
| 622 | 602 | ip22_state *state = machine().driver_data<ip22_state>(); |
| 623 | 603 | |
| 624 | | // mame_printf_info("RTC_R: offset %x = %x (PC=%x)\n", offset, m_RTC.nRegs[offset], activecpu_get_pc()); |
| 625 | | |
| 626 | 604 | if( offset <= 0x0d ) |
| 627 | 605 | { |
| 628 | 606 | switch( offset ) |
| r20493 | r20494 | |
| 674 | 652 | return 0; |
| 675 | 653 | } |
| 676 | 654 | } |
| 655 | |
| 677 | 656 | if( offset >= 0x0e && offset < 0x40 ) |
| 678 | | { |
| 679 | 657 | return m_RTC.nRegs[offset]; |
| 680 | | } |
| 658 | |
| 681 | 659 | if( offset >= 0x40 && offset < 0x80 && !( RTC_REGISTERA & 0x10 ) ) |
| 682 | | { |
| 683 | 660 | return m_RTC.nUserRAM[offset - 0x40]; |
| 684 | | } |
| 661 | |
| 685 | 662 | if( offset >= 0x40 && offset < 0x80 && ( RTC_REGISTERA & 0x10 ) ) |
| 686 | 663 | { |
| 687 | 664 | switch( offset ) |
| r20493 | r20494 | |
| 743 | 720 | return 0; |
| 744 | 721 | } |
| 745 | 722 | } |
| 723 | |
| 746 | 724 | if( offset >= 0x80 ) |
| 747 | | { |
| 748 | 725 | return m_RTC.nUserRAM[ offset - 0x80 ]; |
| 749 | | } |
| 726 | |
| 750 | 727 | return 0; |
| 751 | 728 | } |
| 752 | 729 | |
| 753 | 730 | WRITE32_MEMBER(ip22_state::rtc_w) |
| 754 | 731 | { |
| 755 | | //running_machine &machine = machine(); |
| 756 | 732 | ip22_state *state = machine().driver_data<ip22_state>(); |
| 757 | 733 | RTC_WRITECNT++; |
| 758 | 734 | |
| r20493 | r20494 | |
| 928 | 904 | |
| 929 | 905 | READ32_MEMBER(ip22_state::hal2_r) |
| 930 | 906 | { |
| 931 | | //running_machine &machine = machine(); |
| 932 | | |
| 933 | 907 | switch( offset ) |
| 934 | 908 | { |
| 935 | 909 | case 0x0010/4: |
| r20493 | r20494 | |
| 945 | 919 | |
| 946 | 920 | WRITE32_MEMBER(ip22_state::hal2_w) |
| 947 | 921 | { |
| 948 | | //running_machine &machine = machine(); |
| 949 | | |
| 950 | 922 | switch( offset ) |
| 951 | 923 | { |
| 952 | 924 | case 0x0010/4: |
| r20493 | r20494 | |
| 1084 | 1056 | UINT16 temp16 = ( m_mainram[(m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; |
| 1085 | 1057 | INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); |
| 1086 | 1058 | |
| 1087 | | machine().device<dac_device>("dac")->write_signed16(stemp16 ^ 0x8000); |
| 1059 | m_dac->write_signed16(stemp16 ^ 0x8000); |
| 1088 | 1060 | |
| 1089 | 1061 | m_PBUS_DMA.nCurPtr += 4; |
| 1090 | 1062 | |
| r20493 | r20494 | |
| 1238 | 1210 | |
| 1239 | 1211 | m_PBUS_DMA.nActive = 0; |
| 1240 | 1212 | |
| 1241 | | mips3drc_set_options(machine().device("maincpu"), MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS); |
| 1213 | mips3drc_set_options(state->m_maincpu, MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS); |
| 1242 | 1214 | } |
| 1243 | 1215 | |
| 1244 | 1216 | static void dump_chain(address_space &space, UINT32 ch_base) |
| r20493 | r20494 | |
| 1261 | 1233 | static void scsi_irq(running_machine &machine, int state) |
| 1262 | 1234 | { |
| 1263 | 1235 | ip22_state *drvstate = machine.driver_data<ip22_state>(); |
| 1264 | | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 1236 | address_space &space = drvstate->m_maincpu->space(AS_PROGRAM); |
| 1265 | 1237 | |
| 1266 | 1238 | if (state) |
| 1267 | 1239 | { |
| r20493 | r20494 | |
| 1508 | 1480 | { |
| 1509 | 1481 | } |
| 1510 | 1482 | |
| 1511 | | static int ip22_get_out2(running_machine &machine) { |
| 1512 | | return pit8253_get_output(machine.device("pit8254"), 2 ); |
| 1483 | static int ip22_get_out2(running_machine &machine) |
| 1484 | { |
| 1485 | ip22_state *state = machine.driver_data<ip22_state>(); |
| 1486 | return pit8253_get_output(state->m_pit, 2 ); |
| 1513 | 1487 | } |
| 1514 | 1488 | |
| 1515 | 1489 | void ip22_state::machine_start() |