trunk/src/mess/drivers/pc88va.c
| r19078 | r19079 | |
| 28 | 28 | #include "machine/upd765.h" |
| 29 | 29 | #include "sound/2203intf.h" |
| 30 | 30 | #include "formats/mfi_dsk.h" |
| 31 | | #include "formats/pc_dsk.h" |
| 32 | 31 | #include "formats/xdf_dsk.h" |
| 32 | #include "formats/d88_dsk.h" |
| 33 | 33 | |
| 34 | 34 | /* Note: for the time being, just disable FDC CPU, it's for PC-8801 compatibility mode anyway ... */ |
| 35 | 35 | #define TEST_SUBFDC 0 |
| r19078 | r19079 | |
| 128 | 128 | DECLARE_READ8_MEMBER(get_slave_ack); |
| 129 | 129 | DECLARE_WRITE_LINE_MEMBER(pc88va_pit_out0_changed); |
| 130 | 130 | DECLARE_WRITE_LINE_MEMBER(pc88va_upd765_interrupt); |
| 131 | UINT8 m_fdc_ctrl_2; |
| 132 | TIMER_CALLBACK_MEMBER(pc88va_fdc_timer); |
| 131 | 133 | |
| 132 | 134 | void upd765_interrupt(bool state); |
| 133 | 135 | }; |
| r19078 | r19079 | |
| 987 | 989 | return 0xff; |
| 988 | 990 | } |
| 989 | 991 | |
| 992 | TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_timer) |
| 993 | { |
| 994 | if(m_fdc_ctrl_2 & 4) // XTMASK |
| 995 | { |
| 996 | pic8259_ir3_w(machine().device( "pic8259_slave"), 0); |
| 997 | pic8259_ir3_w(machine().device( "pic8259_slave"), 1); |
| 998 | } |
| 999 | } |
| 1000 | |
| 990 | 1001 | WRITE8_MEMBER(pc88va_state::pc88va_fdc_w) |
| 991 | 1002 | { |
| 992 | | printf("%08x %02x\n",offset,data); |
| 993 | | switch(offset*2) |
| 1003 | printf("%08x %02x\n",offset<<1,data); |
| 1004 | switch(offset<<1) |
| 994 | 1005 | { |
| 995 | 1006 | /* |
| 996 | 1007 | ---- ---x MODE: FDC op mode (0) Intelligent (1) DMA |
| r19078 | r19079 | |
| 1022 | 1033 | ---- ---x TTRG: FDC timer trigger (0) FDC timer clearing (1) FDC timer start |
| 1023 | 1034 | */ |
| 1024 | 1035 | case 0x06: |
| 1025 | | printf("%02x\n",data); |
| 1036 | //printf("%02x\n",data); |
| 1037 | m_fdc_ctrl_2 = data; |
| 1038 | |
| 1039 | if(data & 1) |
| 1040 | machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(pc88va_state::pc88va_fdc_timer),this)); |
| 1041 | |
| 1042 | if(data & 0x80) // correct? |
| 1043 | machine().device<upd765a_device>("upd765")->reset(); |
| 1044 | |
| 1026 | 1045 | break; // FDC control port 2 |
| 1027 | 1046 | } |
| 1028 | 1047 | } |
| r19078 | r19079 | |
| 1051 | 1070 | { |
| 1052 | 1071 | if(m_timer3_io_reg & 0x80) |
| 1053 | 1072 | { |
| 1073 | pic8259_ir5_w(machine().device("pic8259_slave"), 0); |
| 1054 | 1074 | pic8259_ir5_w(machine().device("pic8259_slave"), 1); |
| 1055 | 1075 | m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); |
| 1056 | 1076 | } |
| r19078 | r19079 | |
| 1560 | 1580 | m_t3_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc88va_state::t3_mouse_callback),this)); |
| 1561 | 1581 | m_t3_mouse_timer->adjust(attotime::never); |
| 1562 | 1582 | machine().device<upd765a_device>("upd765")->setup_intrq_cb(upd765a_device::line_cb(FUNC(pc88va_state::upd765_interrupt), this)); |
| 1583 | |
| 1584 | machine().device<floppy_connector>("upd765:0")->get_device()->set_rpm(300); |
| 1585 | machine().device<floppy_connector>("upd765:1")->get_device()->set_rpm(300); |
| 1586 | machine().device<upd765a_device>("upd765")->set_rate(250000); |
| 1563 | 1587 | } |
| 1564 | 1588 | |
| 1565 | 1589 | void pc88va_state::machine_reset() |
| r19078 | r19079 | |
| 1592 | 1616 | |
| 1593 | 1617 | INTERRUPT_GEN_MEMBER(pc88va_state::pc88va_vrtc_irq) |
| 1594 | 1618 | { |
| 1619 | pic8259_ir2_w(machine().device("pic8259_master"), 0); |
| 1595 | 1620 | pic8259_ir2_w(machine().device("pic8259_master"), 1); |
| 1596 | 1621 | } |
| 1597 | 1622 | |
| 1598 | 1623 | WRITE_LINE_MEMBER(pc88va_state::pc88va_pit_out0_changed) |
| 1599 | 1624 | { |
| 1600 | | pic8259_ir0_w(machine().device("pic8259_master"), 1); |
| 1625 | if(state) |
| 1626 | { |
| 1627 | pic8259_ir0_w(machine().device("pic8259_master"), 0); |
| 1628 | pic8259_ir0_w(machine().device("pic8259_master"), 1); |
| 1629 | } |
| 1601 | 1630 | } |
| 1602 | 1631 | |
| 1603 | 1632 | static const struct pit8253_config pc88va_pit8253_config = |
| r19078 | r19079 | |
| 1627 | 1656 | |
| 1628 | 1657 | void pc88va_state::upd765_interrupt(bool state) |
| 1629 | 1658 | { |
| 1630 | | if(m_fdc_mode) |
| 1631 | | pic8259_ir3_w(machine().device( "pic8259_slave"), state); |
| 1659 | if(m_fdc_mode && state) |
| 1660 | { |
| 1661 | //printf("%d\n",state); |
| 1662 | pic8259_ir3_w(machine().device( "pic8259_slave"), 0); |
| 1663 | pic8259_ir3_w(machine().device( "pic8259_slave"), 1); |
| 1664 | } |
| 1665 | #if TEST_SUBFDC |
| 1632 | 1666 | else |
| 1633 | 1667 | machine().device("fdccpu")->execute().set_input_line(0, HOLD_LINE); |
| 1668 | #endif |
| 1634 | 1669 | } |
| 1635 | 1670 | |
| 1636 | 1671 | |
| r19078 | r19079 | |
| 1648 | 1683 | }; |
| 1649 | 1684 | |
| 1650 | 1685 | static const floppy_format_type pc88va_floppy_formats[] = { |
| 1651 | | FLOPPY_PC_FORMAT, |
| 1652 | 1686 | FLOPPY_XDF_FORMAT, |
| 1653 | 1687 | FLOPPY_MFI_FORMAT, |
| 1688 | FLOPPY_D88_FORMAT, |
| 1654 | 1689 | NULL |
| 1655 | 1690 | }; |
| 1656 | 1691 | |
| r19078 | r19079 | |
| 1691 | 1726 | MCFG_PIC8259_ADD( "pic8259_master", pc88va_pic8259_master_config ) |
| 1692 | 1727 | MCFG_PIC8259_ADD( "pic8259_slave", pc88va_pic8259_slave_config ) |
| 1693 | 1728 | |
| 1694 | | MCFG_UPD765A_ADD("upd765", true, true) |
| 1729 | MCFG_UPD765A_ADD("upd765", false, true) |
| 1695 | 1730 | MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88va_floppies, "525hd", 0, pc88va_floppy_formats) |
| 1696 | 1731 | MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88va_floppies, "525hd", 0, pc88va_floppy_formats) |
| 1697 | 1732 | MCFG_SOFTWARE_LIST_ADD("disk_list","pc88va") |