trunk/src/mess/machine/ti99/mapper8.c
| r26243 | r26244 | |
| 129 | 129 | #define TRACE_MEM 0 |
| 130 | 130 | #define TRACE_MAP 0 |
| 131 | 131 | #define TRACE_CONFIG 0 |
| 132 | #define TRACE_OSO 0 |
| 132 | 133 | |
| 133 | 134 | #define LOG logerror |
| 134 | 135 | |
| r26243 | r26244 | |
| 711 | 712 | /*************************************************************************** |
| 712 | 713 | |
| 713 | 714 | Custom chips of the TI-99/8 |
| 714 | | OSO: Hexbus interface |
| 715 | 715 | |
| 716 | ===== OSO: Hexbus interface ===== |
| 717 | |
| 718 | The Hexbus is a 4-bit peripheral bus with master/slave coordination. Bytes |
| 719 | are written over the bus in two passes. Hexbus was the designated standard |
| 720 | peripheral bus for TI computers before TI left the home computer market. |
| 721 | |
| 722 | Existing devices are floppy drive, RS232 serial adapter, and |
| 723 | a "Wafertape" drive (kind of tape streamer) |
| 724 | |
| 725 | Registers: Read Write Bits of register |
| 726 | ---------------------------------------------------------------------------- |
| 727 | Data : 5FF8 - ADB3 ADB2 ADB1 ADB0 ADB3 ADB2 ADB1 ADB0 |
| 728 | Status : 5FFA - HSKWT HSKRD BAVIAS BAVAIS SBAV WBUSY RBUSY SHSK |
| 729 | Control : 5FFC 5FFA WIEN RIEN BAVIAEN BAVAIEN BAVC WEN REN CR7 |
| 730 | Xmit : 5FFE 5FF8 XDR0 XDR1 XDR2 XDR3 XDR4 XDR5 XDR6 XDR7 |
| 731 | |
| 732 | ADBx = Hexbus data bit X |
| 733 | HSKWT = Set when a byte has been sent over the bus and HSK has been asserted |
| 734 | HSKRD = Set when a byte has been received |
| 735 | BAVIAS = set when the BAV* signal (bus available) transits to active state |
| 736 | BAVAIS = set when the BAV* signal transits to inactive state (=1) |
| 737 | SBAV = set when BAV* = 0 (active) |
| 738 | WBUSY = set when a write action is in progress (two transfers @ 4 bits) |
| 739 | Reset when HSKWT is set |
| 740 | RBUSY = set when a read action is in progress (two transfers @ 4 bits) |
| 741 | Reset when HSKRD is set |
| 742 | SHSK = set when HSK* is active (0) |
| 743 | |
| 744 | WIEN = Enable interrupt for write completion |
| 745 | RIEN = Enable interrupt for read completion |
| 746 | BAVIAEN = BAVIA enable (slave mode) |
| 747 | BAVAIEN = BAVAI enable (slave mode) |
| 748 | BAVC = set BAV* line (0=active) |
| 749 | WEN = set write enable (byte is written from xmit reg) |
| 750 | REN = set read enable (latch HSK and read byte into data reg) |
| 751 | CR7 = future extension |
| 752 | XDRx = transmit register bit |
| 753 | |
| 754 | Hexbus connector (console) |
| 755 | +---+---+---+---+ |
| 756 | | 4 | 3 | 2 | 1 | 4 = L; 3 = BAV*; 2 = ADB1; 1 = ADB0 |
| 757 | +---+---+---+---+ |
| 758 | | 8 | 7 | 6 | 5 | 8 = ADB3; 7 = ADB2; 6 = nc; 5 = HSK* |
| 759 | +---+---+---+---+ |
| 760 | |
| 761 | TODO: This is just a preliminary implementation to satisfy the operating |
| 762 | system. When completed we can hopefully emulate a Hexbus floppy and |
| 763 | use it in Extended Basic II which refuses to work with the PEB cards. |
| 764 | The Hexbus should then be designed as a slot device. |
| 765 | |
| 716 | 766 | ****************************************************************************/ |
| 717 | 767 | |
| 768 | /* Status register bits */ |
| 718 | 769 | enum |
| 719 | 770 | { |
| 720 | | HSKWT = 0x80 |
| 771 | HSKWT = 0x80, |
| 772 | HSKRD = 0x40, |
| 773 | BAVIAS = 0x20, |
| 774 | BAVAIS = 0x10, |
| 775 | SBAV = 0x08, |
| 776 | WBUSY = 0x04, |
| 777 | RBUSY = 0x02, |
| 778 | SHSK = 0x01 |
| 721 | 779 | }; |
| 722 | 780 | |
| 723 | 781 | ti998_oso_device::ti998_oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 724 | 782 | : device_t(mconfig, OSO, "OSO Hexbus interface", tag, owner, clock, "ti998_oso", __FILE__) |
| 725 | 783 | { |
| 726 | | LOG("ti998/oso: Creating OSO\n"); |
| 784 | if (TRACE_OSO) LOG("ti998/oso: Creating OSO\n"); |
| 727 | 785 | } |
| 728 | 786 | |
| 729 | 787 | READ8_MEMBER( ti998_oso_device::read ) |
| 730 | 788 | { |
| 731 | 789 | int value = 0; |
| 732 | 790 | offset &= 0x03; |
| 733 | | LOG("ti998/oso: OSO chip read access %04x -> %02x\n", (offset<<1) | 0x5ff0, value); |
| 734 | 791 | switch (offset) |
| 735 | 792 | { |
| 736 | 793 | case 0: |
| 737 | 794 | // read 5FF8: read data register |
| 795 | if (TRACE_OSO) LOG("ti998/oso: Read data register = %02x\n", value); |
| 796 | value = m_data; |
| 738 | 797 | break; |
| 739 | 798 | case 1: |
| 740 | 799 | // read 5FFA: read status register |
| 741 | | // We return handshake_write=1 to prevent lock-ups (until the hexbus is properly implemented) |
| 742 | | value = HSKWT; |
| 800 | value = m_status; |
| 801 | if (TRACE_OSO) LOG("ti998/oso: Read status %02x\n", value); |
| 743 | 802 | break; |
| 744 | 803 | case 2: |
| 745 | 804 | // read 5FFC: read control register |
| 805 | value = m_control; |
| 806 | if (TRACE_OSO) LOG("ti998/oso: Read control register = %02x\n", value); |
| 746 | 807 | break; |
| 747 | 808 | case 3: |
| 748 | 809 | // read 5FFE: read transmit register |
| 810 | value = m_xmit; |
| 811 | if (TRACE_OSO) LOG("ti998/oso: Read transmit register = %02x\n", value); |
| 749 | 812 | break; |
| 750 | 813 | } |
| 751 | | |
| 752 | 814 | return value; |
| 753 | 815 | } |
| 754 | 816 | |
| 755 | 817 | WRITE8_MEMBER( ti998_oso_device::write ) |
| 756 | 818 | { |
| 757 | 819 | offset &= 0x03; |
| 758 | | LOG("ti998/oso: OSO chip write access %04x <- %02x\n", (offset<<1) | 0x5ff0, data); |
| 820 | switch (offset) |
| 821 | { |
| 822 | case 0: |
| 823 | // write 5FF8: write transmit register |
| 824 | if (TRACE_OSO) LOG("ti998/oso: Write transmit register %02x\n", data); |
| 825 | m_xmit = data; |
| 826 | // We set the status register directly in order to prevent lock-ups |
| 827 | // until we have a complete Hexbus implementation |
| 828 | m_status |= HSKWT; |
| 829 | break; |
| 830 | case 1: |
| 831 | // write 5FFA: write control register |
| 832 | if (TRACE_OSO) LOG("ti998/oso: Write control register %02x\n", data); |
| 833 | m_control = data; |
| 834 | break; |
| 835 | default: |
| 836 | // write 5FFC, 5FFE: undefined |
| 837 | if (TRACE_OSO) LOG("ti998/oso: Invalid write on %04x: %02x\n", (offset<<1) | 0x5ff0, data); |
| 838 | break; |
| 839 | } |
| 759 | 840 | } |
| 760 | 841 | |
| 761 | 842 | void ti998_oso_device::device_start() |
| 762 | 843 | { |
| 844 | m_status = m_xmit = m_control = m_data = 0; |
| 763 | 845 | } |
| 764 | 846 | |
| 765 | 847 | const device_type OSO = &device_creator<ti998_oso_device>; |