trunk/src/mess/drivers/fmtowns.c
| r21845 | r21846 | |
| 810 | 810 | //logerror("PIT: wrote 0x%02x to port 0x60\n",data); |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | | READ32_MEMBER(towns_state::towns_sys5e8_r) |
| 813 | READ8_MEMBER(towns_state::towns_sys5e8_r) |
| 814 | 814 | { |
| 815 | 815 | switch(offset) |
| 816 | 816 | { |
| 817 | 817 | case 0x00: |
| 818 | | if(ACCESSING_BITS_0_7) |
| 819 | | { |
| 820 | | logerror("SYS: read RAM size port (%i)\n",m_ram->size()); |
| 821 | | return m_ram->size()/1048576; |
| 822 | | } |
| 823 | | break; |
| 824 | | case 0x01: |
| 825 | | if(ACCESSING_BITS_0_7) |
| 826 | | { |
| 827 | | logerror("SYS: read port 5ec\n"); |
| 828 | | return m_compat_mode & 0x01; |
| 829 | | } |
| 830 | | break; |
| 818 | logerror("SYS: read RAM size port (%i)\n",m_ram->size()); |
| 819 | return m_ram->size()/1048576; |
| 820 | case 0x02: |
| 821 | logerror("SYS: read port 5ec\n"); |
| 822 | return m_compat_mode & 0x01; |
| 831 | 823 | } |
| 832 | 824 | return 0x00; |
| 833 | 825 | } |
| 834 | 826 | |
| 835 | | WRITE32_MEMBER(towns_state::towns_sys5e8_w) |
| 827 | WRITE8_MEMBER(towns_state::towns_sys5e8_w) |
| 836 | 828 | { |
| 837 | 829 | switch(offset) |
| 838 | 830 | { |
| 839 | 831 | case 0x00: |
| 840 | | if(ACCESSING_BITS_0_7) |
| 841 | | { |
| 842 | | logerror("SYS: wrote 0x%02x to port 5e8\n",data); |
| 843 | | } |
| 832 | logerror("SYS: wrote 0x%02x to port 5e8\n",data); |
| 844 | 833 | break; |
| 845 | | case 0x01: |
| 846 | | if(ACCESSING_BITS_0_7) |
| 847 | | { |
| 848 | | logerror("SYS: wrote 0x%02x to port 5ec\n",data); |
| 849 | | m_compat_mode = data & 0x01; |
| 850 | | } |
| 834 | case 0x02: |
| 835 | logerror("SYS: wrote 0x%02x to port 5ec\n",data); |
| 836 | m_compat_mode = data & 0x01; |
| 851 | 837 | break; |
| 852 | 838 | } |
| 853 | 839 | } |
| r21845 | r21846 | |
| 904 | 890 | m_towns_mouse_output = MOUSE_START; // reset mouse data |
| 905 | 891 | } |
| 906 | 892 | |
| 907 | | READ32_MEMBER(towns_state::towns_padport_r) |
| 893 | READ8_MEMBER(towns_state::towns_padport_r) |
| 908 | 894 | { |
| 909 | | UINT32 ret = 0; |
| 895 | UINT8 ret = 0x00; |
| 910 | 896 | UINT32 porttype = space.machine().root_device().ioport("ctrltype")->read(); |
| 911 | 897 | UINT8 extra1; |
| 912 | 898 | UINT8 extra2; |
| 913 | 899 | UINT32 state; |
| 914 | 900 | |
| 915 | | if((porttype & 0x0f) == 0x00) |
| 916 | | ret |= 0x000000ff; |
| 917 | | if((porttype & 0xf0) == 0x00) |
| 918 | | ret |= 0x00ff0000; |
| 919 | | if((porttype & 0x0f) == 0x01) |
| 901 | if(offset == 0) |
| 920 | 902 | { |
| 921 | | extra1 = space.machine().root_device().ioport("joy1_ex")->read(); |
| 903 | if((porttype & 0x0f) == 0x01) |
| 904 | { |
| 905 | extra1 = space.machine().root_device().ioport("joy1_ex")->read(); |
| 922 | 906 | |
| 923 | | if(m_towns_pad_mask & 0x10) |
| 924 | | ret |= (space.machine().root_device().ioport("joy1")->read() & 0x3f) | 0x00000040; |
| 925 | | else |
| 926 | | ret |= (space.machine().root_device().ioport("joy1")->read() & 0x0f) | 0x00000030; |
| 907 | if(m_towns_pad_mask & 0x10) |
| 908 | ret |= (space.machine().root_device().ioport("joy1")->read() & 0x3f) | 0x40; |
| 909 | else |
| 910 | ret |= (space.machine().root_device().ioport("joy1")->read() & 0x0f) | 0x30; |
| 927 | 911 | |
| 928 | | if(extra1 & 0x01) // Run button = left+right |
| 929 | | ret &= ~0x0000000c; |
| 930 | | if(extra1 & 0x02) // Select button = up+down |
| 931 | | ret &= ~0x00000003; |
| 912 | if(extra1 & 0x01) // Run button = left+right |
| 913 | ret &= ~0x0c; |
| 914 | if(extra1 & 0x02) // Select button = up+down |
| 915 | ret &= ~0x03; |
| 932 | 916 | |
| 933 | | if((extra1 & 0x10) && (m_towns_pad_mask & 0x01)) |
| 934 | | ret &= ~0x00000010; |
| 935 | | if((extra1 & 0x20) && (m_towns_pad_mask & 0x02)) |
| 936 | | ret &= ~0x00000020; |
| 937 | | } |
| 938 | | if((porttype & 0xf0) == 0x10) |
| 939 | | { |
| 940 | | extra2 = space.machine().root_device().ioport("joy2_ex")->read(); |
| 917 | if((extra1 & 0x10) && (m_towns_pad_mask & 0x01)) |
| 918 | ret &= ~0x10; |
| 919 | if((extra1 & 0x20) && (m_towns_pad_mask & 0x02)) |
| 920 | ret &= ~0x20; |
| 921 | } |
| 922 | if((porttype & 0x0f) == 0x04) // 6-button joystick |
| 923 | { |
| 924 | extra1 = space.machine().root_device().ioport("6b_joy1_ex")->read(); |
| 941 | 925 | |
| 942 | | if(m_towns_pad_mask & 0x20) |
| 943 | | ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x3f) << 16) | 0x00400000; |
| 944 | | else |
| 945 | | ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x0f) << 16) | 0x00300000; |
| 926 | if(m_towns_pad_mask & 0x10) |
| 927 | ret |= 0x7f; |
| 928 | else |
| 929 | ret |= (space.machine().root_device().ioport("6b_joy1")->read() & 0x0f) | 0x70; |
| 946 | 930 | |
| 947 | | if(extra2 & 0x01) |
| 948 | | ret &= ~0x000c0000; |
| 949 | | if(extra2 & 0x02) |
| 950 | | ret &= ~0x00030000; |
| 951 | | |
| 952 | | if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) |
| 953 | | ret &= ~0x00100000; |
| 954 | | if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) |
| 955 | | ret &= ~0x00200000; |
| 956 | | } |
| 957 | | if((porttype & 0x0f) == 0x04) // 6-button joystick |
| 958 | | { |
| 959 | | extra1 = space.machine().root_device().ioport("6b_joy1_ex")->read(); |
| 960 | | |
| 961 | | if(m_towns_pad_mask & 0x10) |
| 962 | | ret |= 0x0000007f; |
| 963 | | else |
| 964 | | ret |= (space.machine().root_device().ioport("6b_joy1")->read() & 0x0f) | 0x00000070; |
| 965 | | |
| 966 | | if(!(m_towns_pad_mask & 0x10)) |
| 967 | | { |
| 968 | | if(extra1 & 0x01) // Run button = left+right |
| 969 | | ret &= ~0x0000000c; |
| 970 | | if(extra1 & 0x02) // Select button = up+down |
| 971 | | ret &= ~0x00000003; |
| 972 | | if((extra1 & 0x04) && (m_towns_pad_mask & 0x01)) |
| 973 | | ret &= ~0x00000010; |
| 974 | | if((extra1 & 0x08) && (m_towns_pad_mask & 0x02)) |
| 975 | | ret &= ~0x00000020; |
| 931 | if(!(m_towns_pad_mask & 0x10)) |
| 932 | { |
| 933 | if(extra1 & 0x01) // Run button = left+right |
| 934 | ret &= ~0x0c; |
| 935 | if(extra1 & 0x02) // Select button = up+down |
| 936 | ret &= ~0x03; |
| 937 | if((extra1 & 0x04) && (m_towns_pad_mask & 0x01)) |
| 938 | ret &= ~0x10; |
| 939 | if((extra1 & 0x08) && (m_towns_pad_mask & 0x02)) |
| 940 | ret &= ~0x20; |
| 941 | } |
| 942 | if(m_towns_pad_mask & 0x10) |
| 943 | { |
| 944 | if(extra1 & 0x10) |
| 945 | ret &= ~0x08; |
| 946 | if(extra1 & 0x20) |
| 947 | ret &= ~0x04; |
| 948 | if(extra1 & 0x40) |
| 949 | ret &= ~0x02; |
| 950 | if(extra1 & 0x80) |
| 951 | ret &= ~0x01; |
| 952 | } |
| 976 | 953 | } |
| 977 | | if(m_towns_pad_mask & 0x10) |
| 954 | if((porttype & 0x0f) == 0x02) // mouse |
| 978 | 955 | { |
| 979 | | if(extra1 & 0x10) |
| 980 | | ret &= ~0x00000008; |
| 981 | | if(extra1 & 0x20) |
| 982 | | ret &= ~0x00000004; |
| 983 | | if(extra1 & 0x40) |
| 984 | | ret &= ~0x00000002; |
| 985 | | if(extra1 & 0x80) |
| 986 | | ret &= ~0x00000001; |
| 956 | switch(m_towns_mouse_output) |
| 957 | { |
| 958 | case MOUSE_X_HIGH: |
| 959 | ret |= ((m_towns_mouse_x & 0xf0) >> 4); |
| 960 | break; |
| 961 | case MOUSE_X_LOW: |
| 962 | ret |= (m_towns_mouse_x & 0x0f); |
| 963 | break; |
| 964 | case MOUSE_Y_HIGH: |
| 965 | ret |= ((m_towns_mouse_y & 0xf0) >> 4); |
| 966 | break; |
| 967 | case MOUSE_Y_LOW: |
| 968 | ret |= (m_towns_mouse_y & 0x0f); |
| 969 | break; |
| 970 | case MOUSE_START: |
| 971 | case MOUSE_SYNC: |
| 972 | default: |
| 973 | if(m_towns_mouse_output < MOUSE_Y_LOW) |
| 974 | ret |= 0x0f; |
| 975 | } |
| 976 | |
| 977 | // button states are always visible |
| 978 | state = space.machine().root_device().ioport("mouse1")->read(); |
| 979 | if(!(state & 0x01)) |
| 980 | ret |= 0x10; |
| 981 | if(!(state & 0x02)) |
| 982 | ret |= 0x20; |
| 983 | if(m_towns_pad_mask & 0x10) |
| 984 | ret |= 0x40; |
| 987 | 985 | } |
| 986 | |
| 988 | 987 | } |
| 989 | | if((porttype & 0xf0) == 0x40) // 6-button joystick |
| 988 | if(offset == 1) // second joystick port |
| 990 | 989 | { |
| 991 | | extra2 = space.machine().root_device().ioport("6b_joy2_ex")->read(); |
| 990 | if((porttype & 0xf0) == 0x10) |
| 991 | { |
| 992 | extra2 = space.machine().root_device().ioport("joy2_ex")->read(); |
| 992 | 993 | |
| 993 | | if(m_towns_pad_mask & 0x20) |
| 994 | | ret |= 0x007f0000; |
| 995 | | else |
| 996 | | ret |= ((space.machine().root_device().ioport("6b_joy2")->read() & 0x0f) << 16) | 0x00700000; |
| 994 | if(m_towns_pad_mask & 0x20) |
| 995 | ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x3f)) | 0x40; |
| 996 | else |
| 997 | ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x0f)) | 0x30; |
| 997 | 998 | |
| 998 | | if(!(m_towns_pad_mask & 0x10)) |
| 999 | | { |
| 1000 | 999 | if(extra2 & 0x01) |
| 1001 | | ret &= ~0x000c0000; |
| 1000 | ret &= ~0x0c; |
| 1002 | 1001 | if(extra2 & 0x02) |
| 1003 | | ret &= ~0x00030000; |
| 1002 | ret &= ~0x03; |
| 1003 | |
| 1004 | 1004 | if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) |
| 1005 | | ret &= ~0x00100000; |
| 1005 | ret &= ~0x10; |
| 1006 | 1006 | if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) |
| 1007 | | ret &= ~0x00200000; |
| 1007 | ret &= ~0x20; |
| 1008 | 1008 | } |
| 1009 | | if(m_towns_pad_mask & 0x20) |
| 1009 | if((porttype & 0xf0) == 0x40) // 6-button joystick |
| 1010 | 1010 | { |
| 1011 | | if(extra2 & 0x10) |
| 1012 | | ret &= ~0x00080000; |
| 1013 | | if(extra2 & 0x20) |
| 1014 | | ret &= ~0x00040000; |
| 1015 | | if(extra2 & 0x40) |
| 1016 | | ret &= ~0x00020000; |
| 1017 | | if(extra2 & 0x80) |
| 1018 | | ret &= ~0x00010000; |
| 1011 | extra2 = space.machine().root_device().ioport("6b_joy2_ex")->read(); |
| 1012 | |
| 1013 | if(m_towns_pad_mask & 0x20) |
| 1014 | ret |= 0x7f; |
| 1015 | else |
| 1016 | ret |= ((space.machine().root_device().ioport("6b_joy2")->read() & 0x0f)) | 0x70; |
| 1017 | |
| 1018 | if(!(m_towns_pad_mask & 0x10)) |
| 1019 | { |
| 1020 | if(extra2 & 0x01) |
| 1021 | ret &= ~0x0c; |
| 1022 | if(extra2 & 0x02) |
| 1023 | ret &= ~0x03; |
| 1024 | if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) |
| 1025 | ret &= ~0x10; |
| 1026 | if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) |
| 1027 | ret &= ~0x20; |
| 1028 | } |
| 1029 | if(m_towns_pad_mask & 0x20) |
| 1030 | { |
| 1031 | if(extra2 & 0x10) |
| 1032 | ret &= ~0x08; |
| 1033 | if(extra2 & 0x20) |
| 1034 | ret &= ~0x04; |
| 1035 | if(extra2 & 0x40) |
| 1036 | ret &= ~0x02; |
| 1037 | if(extra2 & 0x80) |
| 1038 | ret &= ~0x01; |
| 1039 | } |
| 1019 | 1040 | } |
| 1020 | | } |
| 1021 | | if((porttype & 0x0f) == 0x02) // mouse |
| 1022 | | { |
| 1023 | | switch(m_towns_mouse_output) |
| 1041 | if((porttype & 0xf0) == 0x20) // mouse |
| 1024 | 1042 | { |
| 1025 | | case MOUSE_X_HIGH: |
| 1026 | | ret |= ((m_towns_mouse_x & 0xf0) >> 4); |
| 1027 | | break; |
| 1028 | | case MOUSE_X_LOW: |
| 1029 | | ret |= (m_towns_mouse_x & 0x0f); |
| 1030 | | break; |
| 1031 | | case MOUSE_Y_HIGH: |
| 1032 | | ret |= ((m_towns_mouse_y & 0xf0) >> 4); |
| 1033 | | break; |
| 1034 | | case MOUSE_Y_LOW: |
| 1035 | | ret |= (m_towns_mouse_y & 0x0f); |
| 1036 | | break; |
| 1037 | | case MOUSE_START: |
| 1038 | | case MOUSE_SYNC: |
| 1039 | | default: |
| 1040 | | if(m_towns_mouse_output < MOUSE_Y_LOW) |
| 1041 | | ret |= 0x0000000f; |
| 1042 | | } |
| 1043 | switch(m_towns_mouse_output) |
| 1044 | { |
| 1045 | case MOUSE_X_HIGH: |
| 1046 | ret |= ((m_towns_mouse_x & 0xf0)); |
| 1047 | break; |
| 1048 | case MOUSE_X_LOW: |
| 1049 | ret |= ((m_towns_mouse_x & 0x0f)); |
| 1050 | break; |
| 1051 | case MOUSE_Y_HIGH: |
| 1052 | ret |= ((m_towns_mouse_y & 0xf0)); |
| 1053 | break; |
| 1054 | case MOUSE_Y_LOW: |
| 1055 | ret |= ((m_towns_mouse_y & 0x0f)); |
| 1056 | break; |
| 1057 | case MOUSE_START: |
| 1058 | case MOUSE_SYNC: |
| 1059 | default: |
| 1060 | if(m_towns_mouse_output < MOUSE_Y_LOW) |
| 1061 | ret |= 0x0f; |
| 1062 | } |
| 1043 | 1063 | |
| 1044 | | // button states are always visible |
| 1045 | | state = space.machine().root_device().ioport("mouse1")->read(); |
| 1046 | | if(!(state & 0x01)) |
| 1047 | | ret |= 0x00000010; |
| 1048 | | if(!(state & 0x02)) |
| 1049 | | ret |= 0x00000020; |
| 1050 | | if(m_towns_pad_mask & 0x10) |
| 1051 | | ret |= 0x00000040; |
| 1052 | | } |
| 1053 | | if((porttype & 0xf0) == 0x20) // mouse |
| 1054 | | { |
| 1055 | | switch(m_towns_mouse_output) |
| 1056 | | { |
| 1057 | | case MOUSE_X_HIGH: |
| 1058 | | ret |= ((m_towns_mouse_x & 0xf0) << 12); |
| 1059 | | break; |
| 1060 | | case MOUSE_X_LOW: |
| 1061 | | ret |= ((m_towns_mouse_x & 0x0f) << 16); |
| 1062 | | break; |
| 1063 | | case MOUSE_Y_HIGH: |
| 1064 | | ret |= ((m_towns_mouse_y & 0xf0) << 12); |
| 1065 | | break; |
| 1066 | | case MOUSE_Y_LOW: |
| 1067 | | ret |= ((m_towns_mouse_y & 0x0f) << 16); |
| 1068 | | break; |
| 1069 | | case MOUSE_START: |
| 1070 | | case MOUSE_SYNC: |
| 1071 | | default: |
| 1072 | | if(m_towns_mouse_output < MOUSE_Y_LOW) |
| 1073 | | ret |= 0x000f0000; |
| 1064 | // button states are always visible |
| 1065 | state = space.machine().root_device().ioport("mouse1")->read(); |
| 1066 | if(!(state & 0x01)) |
| 1067 | ret |= 0x10; |
| 1068 | if(!(state & 0x02)) |
| 1069 | ret |= 0x20; |
| 1070 | if(m_towns_pad_mask & 0x20) |
| 1071 | ret |= 0x40; |
| 1074 | 1072 | } |
| 1075 | | |
| 1076 | | // button states are always visible |
| 1077 | | state = space.machine().root_device().ioport("mouse1")->read(); |
| 1078 | | if(!(state & 0x01)) |
| 1079 | | ret |= 0x00100000; |
| 1080 | | if(!(state & 0x02)) |
| 1081 | | ret |= 0x00200000; |
| 1082 | | if(m_towns_pad_mask & 0x20) |
| 1083 | | ret |= 0x00400000; |
| 1084 | 1073 | } |
| 1085 | 1074 | |
| 1086 | 1075 | return ret; |
| 1087 | 1076 | } |
| 1088 | 1077 | |
| 1089 | | WRITE32_MEMBER(towns_state::towns_pad_mask_w) |
| 1078 | WRITE8_MEMBER(towns_state::towns_pad_mask_w) |
| 1090 | 1079 | { |
| 1091 | 1080 | UINT8 current_x,current_y; |
| 1092 | 1081 | UINT32 type = space.machine().root_device().ioport("ctrltype")->read(); |
| 1093 | 1082 | |
| 1094 | | if(ACCESSING_BITS_16_23) |
| 1083 | m_towns_pad_mask = (data & 0xff); |
| 1084 | if((type & 0x0f) == 0x02) // mouse |
| 1095 | 1085 | { |
| 1096 | | m_towns_pad_mask = (data & 0x00ff0000) >> 16; |
| 1097 | | if((type & 0x0f) == 0x02) // mouse |
| 1086 | if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0) |
| 1098 | 1087 | { |
| 1099 | | if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0) |
| 1088 | if(m_towns_mouse_output == MOUSE_START) |
| 1100 | 1089 | { |
| 1101 | | if(m_towns_mouse_output == MOUSE_START) |
| 1102 | | { |
| 1103 | | m_towns_mouse_output = MOUSE_X_HIGH; |
| 1104 | | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1105 | | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1106 | | m_towns_mouse_x = m_prev_x - current_x; |
| 1107 | | m_towns_mouse_y = m_prev_y - current_y; |
| 1108 | | m_prev_x = current_x; |
| 1109 | | m_prev_y = current_y; |
| 1110 | | } |
| 1111 | | else |
| 1112 | | m_towns_mouse_output++; |
| 1113 | | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1090 | m_towns_mouse_output = MOUSE_X_HIGH; |
| 1091 | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1092 | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1093 | m_towns_mouse_x = m_prev_x - current_x; |
| 1094 | m_towns_mouse_y = m_prev_y - current_y; |
| 1095 | m_prev_x = current_x; |
| 1096 | m_prev_y = current_y; |
| 1114 | 1097 | } |
| 1115 | | if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0) |
| 1098 | else |
| 1099 | m_towns_mouse_output++; |
| 1100 | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1101 | } |
| 1102 | if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0) |
| 1103 | { |
| 1104 | if(m_towns_mouse_output == MOUSE_START) |
| 1116 | 1105 | { |
| 1117 | | if(m_towns_mouse_output == MOUSE_START) |
| 1118 | | { |
| 1119 | | m_towns_mouse_output = MOUSE_SYNC; |
| 1120 | | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1121 | | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1122 | | m_towns_mouse_x = m_prev_x - current_x; |
| 1123 | | m_towns_mouse_y = m_prev_y - current_y; |
| 1124 | | m_prev_x = current_x; |
| 1125 | | m_prev_y = current_y; |
| 1126 | | } |
| 1127 | | else |
| 1128 | | m_towns_mouse_output++; |
| 1129 | | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1106 | m_towns_mouse_output = MOUSE_SYNC; |
| 1107 | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1108 | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1109 | m_towns_mouse_x = m_prev_x - current_x; |
| 1110 | m_towns_mouse_y = m_prev_y - current_y; |
| 1111 | m_prev_x = current_x; |
| 1112 | m_prev_y = current_y; |
| 1130 | 1113 | } |
| 1131 | | m_prev_pad_mask = m_towns_pad_mask; |
| 1114 | else |
| 1115 | m_towns_mouse_output++; |
| 1116 | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1132 | 1117 | } |
| 1133 | | if((type & 0xf0) == 0x20) // mouse |
| 1118 | m_prev_pad_mask = m_towns_pad_mask; |
| 1119 | } |
| 1120 | if((type & 0xf0) == 0x20) // mouse |
| 1121 | { |
| 1122 | if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0) |
| 1134 | 1123 | { |
| 1135 | | if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0) |
| 1124 | if(m_towns_mouse_output == MOUSE_START) |
| 1136 | 1125 | { |
| 1137 | | if(m_towns_mouse_output == MOUSE_START) |
| 1138 | | { |
| 1139 | | m_towns_mouse_output = MOUSE_X_HIGH; |
| 1140 | | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1141 | | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1142 | | m_towns_mouse_x = m_prev_x - current_x; |
| 1143 | | m_towns_mouse_y = m_prev_y - current_y; |
| 1144 | | m_prev_x = current_x; |
| 1145 | | m_prev_y = current_y; |
| 1146 | | } |
| 1147 | | else |
| 1148 | | m_towns_mouse_output++; |
| 1149 | | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1126 | m_towns_mouse_output = MOUSE_X_HIGH; |
| 1127 | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1128 | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1129 | m_towns_mouse_x = m_prev_x - current_x; |
| 1130 | m_towns_mouse_y = m_prev_y - current_y; |
| 1131 | m_prev_x = current_x; |
| 1132 | m_prev_y = current_y; |
| 1150 | 1133 | } |
| 1151 | | if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0) |
| 1134 | else |
| 1135 | m_towns_mouse_output++; |
| 1136 | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1137 | } |
| 1138 | if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0) |
| 1139 | { |
| 1140 | if(m_towns_mouse_output == MOUSE_START) |
| 1152 | 1141 | { |
| 1153 | | if(m_towns_mouse_output == MOUSE_START) |
| 1154 | | { |
| 1155 | | m_towns_mouse_output = MOUSE_SYNC; |
| 1156 | | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1157 | | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1158 | | m_towns_mouse_x = m_prev_x - current_x; |
| 1159 | | m_towns_mouse_y = m_prev_y - current_y; |
| 1160 | | m_prev_x = current_x; |
| 1161 | | m_prev_y = current_y; |
| 1162 | | } |
| 1163 | | else |
| 1164 | | m_towns_mouse_output++; |
| 1165 | | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1142 | m_towns_mouse_output = MOUSE_SYNC; |
| 1143 | current_x = space.machine().root_device().ioport("mouse2")->read(); |
| 1144 | current_y = space.machine().root_device().ioport("mouse3")->read(); |
| 1145 | m_towns_mouse_x = m_prev_x - current_x; |
| 1146 | m_towns_mouse_y = m_prev_y - current_y; |
| 1147 | m_prev_x = current_x; |
| 1148 | m_prev_y = current_y; |
| 1166 | 1149 | } |
| 1167 | | m_prev_pad_mask = m_towns_pad_mask; |
| 1150 | else |
| 1151 | m_towns_mouse_output++; |
| 1152 | m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); |
| 1168 | 1153 | } |
| 1154 | m_prev_pad_mask = m_towns_pad_mask; |
| 1169 | 1155 | } |
| 1170 | 1156 | } |
| 1171 | 1157 | |
| r21845 | r21846 | |
| 1174 | 1160 | if(m_towns_mainmem_enable != 0) |
| 1175 | 1161 | return m_messram->pointer()[offset + 0xd8000]; |
| 1176 | 1162 | |
| 1177 | | return m_nvram[offset]; |
| 1163 | if(m_nvram) |
| 1164 | return m_nvram[offset]; |
| 1165 | else |
| 1166 | return m_nvram16[offset]; |
| 1178 | 1167 | } |
| 1179 | 1168 | |
| 1180 | 1169 | WRITE8_MEMBER( towns_state::towns_cmos_low_w ) |
| r21845 | r21846 | |
| 1182 | 1171 | if(m_towns_mainmem_enable != 0) |
| 1183 | 1172 | m_messram->pointer()[offset+0xd8000] = data; |
| 1184 | 1173 | else |
| 1185 | | m_nvram[offset] = data; |
| 1174 | if(m_nvram) |
| 1175 | m_nvram[offset] = data; |
| 1176 | else |
| 1177 | m_nvram16[offset] = data; |
| 1186 | 1178 | } |
| 1187 | 1179 | |
| 1188 | 1180 | READ8_MEMBER( towns_state::towns_cmos_r ) |
| 1189 | 1181 | { |
| 1190 | | return m_nvram[offset]; |
| 1182 | if(m_nvram) |
| 1183 | return m_nvram[offset]; |
| 1184 | else |
| 1185 | return m_nvram16[offset]; |
| 1191 | 1186 | } |
| 1192 | 1187 | |
| 1193 | 1188 | WRITE8_MEMBER( towns_state::towns_cmos_w ) |
| 1194 | 1189 | { |
| 1195 | | m_nvram[offset] = data; |
| 1190 | if(m_nvram) |
| 1191 | m_nvram[offset] = data; |
| 1192 | else |
| 1193 | m_nvram16[offset] = data; |
| 1196 | 1194 | } |
| 1197 | 1195 | |
| 1198 | 1196 | void towns_state::towns_update_video_banks(address_space& space) |
| r21845 | r21846 | |
| 1261 | 1259 | towns_update_video_banks(space); |
| 1262 | 1260 | } |
| 1263 | 1261 | |
| 1264 | | WRITE32_MEMBER( towns_state::towns_video_404_w ) |
| 1262 | WRITE8_MEMBER( towns_state::towns_video_404_w ) |
| 1265 | 1263 | { |
| 1266 | | if(ACCESSING_BITS_0_7) |
| 1267 | | { |
| 1268 | | m_towns_mainmem_enable = data & 0x80; |
| 1269 | | towns_update_video_banks(space); |
| 1270 | | } |
| 1264 | m_towns_mainmem_enable = data & 0x80; |
| 1265 | towns_update_video_banks(space); |
| 1271 | 1266 | } |
| 1272 | 1267 | |
| 1273 | | READ32_MEMBER( towns_state::towns_video_404_r ) |
| 1268 | READ8_MEMBER( towns_state::towns_video_404_r ) |
| 1274 | 1269 | { |
| 1275 | | if(ACCESSING_BITS_0_7) |
| 1276 | | { |
| 1277 | | if(m_towns_mainmem_enable != 0) |
| 1278 | | return 0x00000080; |
| 1279 | | } |
| 1280 | | return 0; |
| 1270 | if(m_towns_mainmem_enable != 0) |
| 1271 | return 0x80; |
| 1272 | else |
| 1273 | return 0x00; |
| 1281 | 1274 | } |
| 1282 | 1275 | |
| 1283 | 1276 | /* |
| r21845 | r21846 | |
| 1921 | 1914 | * 0x70: Data port |
| 1922 | 1915 | * 0x80: Register select |
| 1923 | 1916 | */ |
| 1924 | | READ32_MEMBER(towns_state::towns_rtc_r) |
| 1917 | READ8_MEMBER(towns_state::towns_rtc_r) |
| 1925 | 1918 | { |
| 1926 | | if(ACCESSING_BITS_0_7) |
| 1927 | | return 0x80 | m_towns_rtc_reg[m_towns_rtc_select]; |
| 1928 | | |
| 1929 | | return 0x00; |
| 1919 | return 0x80 | m_towns_rtc_reg[m_towns_rtc_select]; |
| 1930 | 1920 | } |
| 1931 | 1921 | |
| 1932 | | WRITE32_MEMBER(towns_state::towns_rtc_w) |
| 1922 | WRITE8_MEMBER(towns_state::towns_rtc_w) |
| 1933 | 1923 | { |
| 1934 | | if(ACCESSING_BITS_0_7) |
| 1935 | | m_towns_rtc_data = data; |
| 1924 | m_towns_rtc_data = data; |
| 1936 | 1925 | } |
| 1937 | 1926 | |
| 1938 | | WRITE32_MEMBER(towns_state::towns_rtc_select_w) |
| 1927 | WRITE8_MEMBER(towns_state::towns_rtc_select_w) |
| 1939 | 1928 | { |
| 1940 | | if(ACCESSING_BITS_0_7) |
| 1929 | if(data & 0x80) |
| 1941 | 1930 | { |
| 1942 | | if(data & 0x80) |
| 1943 | | { |
| 1944 | | if(data & 0x01) |
| 1945 | | m_towns_rtc_select = m_towns_rtc_data & 0x0f; |
| 1946 | | } |
| 1931 | if(data & 0x01) |
| 1932 | m_towns_rtc_select = m_towns_rtc_data & 0x0f; |
| 1947 | 1933 | } |
| 1948 | 1934 | } |
| 1949 | 1935 | |
| r21845 | r21846 | |
| 2186 | 2172 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 2187 | 2173 | ADDRESS_MAP_END |
| 2188 | 2174 | |
| 2189 | | static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 32, towns_state) |
| 2190 | | ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) // 386SX has only a 24-bit address range |
| 2175 | static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 16, towns_state) |
| 2191 | 2176 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 2192 | | AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff) |
| 2193 | | AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff) |
| 2177 | AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) |
| 2178 | AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) |
| 2194 | 2179 | AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") |
| 2195 | 2180 | AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM |
| 2196 | | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff) |
| 2181 | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) |
| 2197 | 2182 | AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM |
| 2198 | | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM |
| 2183 | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM |
| 2199 | 2184 | AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) |
| 2200 | 2185 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) |
| 2201 | 2186 | AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") |
| 2202 | 2187 | // AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - the Marty has 6MB RAM (not upgradable) |
| 2203 | 2188 | AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000) // OS |
| 2204 | 2189 | AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM |
| 2205 | | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 2190 | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM |
| 2206 | 2191 | AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 2207 | | AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM |
| 2192 | AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM |
| 2208 | 2193 | AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card (is this usable on the Marty?) |
| 2209 | 2194 | AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 2210 | 2195 | AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 2211 | | AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff) // WAVE RAM |
| 2196 | AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM |
| 2212 | 2197 | AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 2213 | 2198 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 2214 | 2199 | ADDRESS_MAP_END |
| 2215 | 2200 | |
| 2216 | | static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 32, towns_state) |
| 2217 | | ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) // 386SX has only a 24-bit address range |
| 2201 | static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 16, towns_state) |
| 2218 | 2202 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 2219 | | AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff) |
| 2220 | | AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff) |
| 2203 | AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) |
| 2204 | AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) |
| 2221 | 2205 | AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") |
| 2222 | 2206 | AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM |
| 2223 | | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff) |
| 2207 | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) |
| 2224 | 2208 | AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM |
| 2225 | | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM |
| 2209 | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM |
| 2226 | 2210 | AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) |
| 2227 | 2211 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) |
| 2228 | 2212 | AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") |
| 2229 | | // AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - the Marty has 6MB RAM (not upgradable) |
| 2230 | 2213 | // AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM |
| 2231 | | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 2214 | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM |
| 2232 | 2215 | AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 2233 | | AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM |
| 2216 | AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM |
| 2234 | 2217 | AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card |
| 2235 | 2218 | AM_RANGE(0x00e00000, 0x00e7ffff) AM_ROM AM_REGION("user",0x000000) // OS |
| 2236 | 2219 | AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 2237 | 2220 | AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 2238 | | AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff) // WAVE RAM |
| 2221 | AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM |
| 2239 | 2222 | AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 2240 | 2223 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 2241 | 2224 | ADDRESS_MAP_END |
| r21845 | r21846 | |
| 2253 | 2236 | AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffffffff) |
| 2254 | 2237 | AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) |
| 2255 | 2238 | // 0x0070/0x0080 - CMOS RTC |
| 2256 | | AM_RANGE(0x0070,0x0073) AM_READWRITE(towns_rtc_r,towns_rtc_w) |
| 2257 | | AM_RANGE(0x0080,0x0083) AM_WRITE(towns_rtc_select_w) |
| 2239 | AM_RANGE(0x0070,0x0073) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x000000ff) |
| 2240 | AM_RANGE(0x0080,0x0083) AM_WRITE8(towns_rtc_select_w,0x000000ff) |
| 2258 | 2241 | // DMA controllers (uPD71071) |
| 2259 | 2242 | AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) |
| 2260 | 2243 | AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff) |
| 2261 | 2244 | // Floppy controller |
| 2262 | 2245 | AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffffffff) |
| 2263 | 2246 | // CRTC / Video |
| 2264 | | AM_RANGE(0x0400,0x0403) AM_READ(towns_video_unknown_r) // R/O (0x400) |
| 2265 | | AM_RANGE(0x0404,0x0407) AM_READWRITE(towns_video_404_r, towns_video_404_w) // R/W (0x404) |
| 2247 | AM_RANGE(0x0400,0x0403) AM_READ8(towns_video_unknown_r, 0x000000ff) // R/O (0x400) |
| 2248 | AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0x000000ff) // R/W (0x404) |
| 2266 | 2249 | AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff) |
| 2267 | 2250 | // System port |
| 2268 | 2251 | AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x000000ff) // R/W (0x480) |
| 2269 | 2252 | // CD-ROM |
| 2270 | 2253 | AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff00ff) |
| 2271 | 2254 | // Joystick / Mouse ports |
| 2272 | | AM_RANGE(0x04d0,0x04d3) AM_READ(towns_padport_r) |
| 2273 | | AM_RANGE(0x04d4,0x04d7) AM_WRITE(towns_pad_mask_w) |
| 2255 | AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff00ff) |
| 2256 | AM_RANGE(0x04d4,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff0000) |
| 2274 | 2257 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| 2275 | 2258 | AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8_LEGACY("fm",ym3438_r,ym3438_w,0x00ff00ff) |
| 2276 | 2259 | AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffffffff) // R/W -- volume ports |
| r21845 | r21846 | |
| 2279 | 2262 | // CRTC / Video |
| 2280 | 2263 | AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff) |
| 2281 | 2264 | // System ports |
| 2282 | | AM_RANGE(0x05e8,0x05ef) AM_READWRITE(towns_sys5e8_r, towns_sys5e8_w) |
| 2265 | AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff00ff) |
| 2283 | 2266 | // Keyboard (8042 MCU) |
| 2284 | 2267 | AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff) |
| 2285 | 2268 | // SCSI controller |
| r21845 | r21846 | |
| 2291 | 2274 | // CRTC / Video (again) |
| 2292 | 2275 | AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff) |
| 2293 | 2276 | AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff) |
| 2277 | ADDRESS_MAP_END |
| 2294 | 2278 | |
| 2279 | static ADDRESS_MAP_START( towns16_io , AS_IO, 16, towns_state) // for the 386SX based systems |
| 2280 | // System ports |
| 2281 | ADDRESS_MAP_UNMAP_HIGH |
| 2282 | AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff) |
| 2283 | AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff) |
| 2284 | AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffff) |
| 2285 | AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8_LEGACY("pit",pit8253_r, pit8253_w, 0x00ff) |
| 2286 | AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8_LEGACY("pit2",pit8253_r, pit8253_w, 0x00ff) |
| 2287 | AM_RANGE(0x0060,0x0061) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x00ff) |
| 2288 | AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffff) |
| 2289 | AM_RANGE(0x006c,0x006d) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x00ff) |
| 2290 | // 0x0070/0x0080 - CMOS RTC |
| 2291 | AM_RANGE(0x0070,0x0071) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x00ff) |
| 2292 | AM_RANGE(0x0080,0x0081) AM_WRITE8(towns_rtc_select_w,0x00ff) |
| 2293 | // DMA controllers (uPD71071) |
| 2294 | AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffff) |
| 2295 | AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffff) |
| 2296 | // Floppy controller |
| 2297 | AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffff) |
| 2298 | // CRTC / Video |
| 2299 | AM_RANGE(0x0400,0x0401) AM_READ8(towns_video_unknown_r, 0x00ff) // R/O (0x400) |
| 2300 | AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0xffff) // R/W (0x404) |
| 2301 | AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffff) |
| 2302 | // System port |
| 2303 | AM_RANGE(0x0480,0x0481) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x00ff) // R/W (0x480) |
| 2304 | // CD-ROM |
| 2305 | AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff) |
| 2306 | // Joystick / Mouse ports |
| 2307 | AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff) |
| 2308 | AM_RANGE(0x04d6,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff) |
| 2309 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| 2310 | AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8_LEGACY("fm",ym3438_r,ym3438_w,0x00ff) |
| 2311 | AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffff) // R/W -- volume ports |
| 2312 | AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffff) |
| 2313 | AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffff) |
| 2314 | // CRTC / Video |
| 2315 | AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffff) |
| 2316 | // System ports |
| 2317 | AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff) |
| 2318 | // Keyboard (8042 MCU) |
| 2319 | AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff) |
| 2320 | // SCSI controller |
| 2321 | AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("scsi:fm",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff) |
| 2322 | // CMOS |
| 2323 | AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff) |
| 2324 | // Something (MS-DOS wants this 0x41ff to be 1) |
| 2325 | //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000) |
| 2326 | // CRTC / Video (again) |
| 2327 | AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffff) |
| 2328 | AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffff) |
| 2295 | 2329 | ADDRESS_MAP_END |
| 2296 | 2330 | |
| 2297 | 2331 | /* Input ports */ |
| r21845 | r21846 | |
| 2830 | 2864 | MCFG_UPD71071_ADD("dma_1",towns_dma_config) |
| 2831 | 2865 | MCFG_UPD71071_ADD("dma_2",towns_dma_config) |
| 2832 | 2866 | |
| 2833 | | MCFG_NVRAM_ADD_0FILL("nvram") |
| 2834 | | |
| 2835 | 2867 | //MCFG_VIDEO_START_OVERRIDE(towns_state,towns) |
| 2836 | 2868 | |
| 2837 | 2869 | /* internal ram */ |
| r21845 | r21846 | |
| 2841 | 2873 | MACHINE_CONFIG_END |
| 2842 | 2874 | |
| 2843 | 2875 | static MACHINE_CONFIG_START( towns, towns_state ) |
| 2844 | | |
| 2845 | 2876 | MCFG_FRAGMENT_ADD(towns_base) |
| 2846 | | |
| 2877 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 2847 | 2878 | MACHINE_CONFIG_END |
| 2848 | 2879 | |
| 2849 | | static MACHINE_CONFIG_DERIVED( townsux, towns ) |
| 2880 | static MACHINE_CONFIG_START( townsux, towns16_state ) |
| 2881 | MCFG_FRAGMENT_ADD(towns_base) |
| 2850 | 2882 | |
| 2851 | | MCFG_CPU_REPLACE("maincpu",I386, 16000000) |
| 2883 | MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) |
| 2852 | 2884 | MCFG_CPU_PROGRAM_MAP(ux_mem) |
| 2853 | | MCFG_CPU_IO_MAP(towns_io) |
| 2885 | MCFG_CPU_IO_MAP(towns16_io) |
| 2854 | 2886 | MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) |
| 2855 | 2887 | |
| 2856 | 2888 | MCFG_RAM_MODIFY(RAM_TAG) |
| 2857 | 2889 | MCFG_RAM_DEFAULT_SIZE("2M") |
| 2858 | 2890 | MCFG_RAM_EXTRA_OPTIONS("10M") |
| 2891 | |
| 2892 | MCFG_NVRAM_ADD_0FILL("nvram16") |
| 2859 | 2893 | MACHINE_CONFIG_END |
| 2860 | 2894 | |
| 2861 | 2895 | static MACHINE_CONFIG_DERIVED( townssj, towns ) |
| r21845 | r21846 | |
| 2871 | 2905 | MACHINE_CONFIG_END |
| 2872 | 2906 | |
| 2873 | 2907 | static MACHINE_CONFIG_DERIVED( townshr, towns ) |
| 2874 | | |
| 2875 | 2908 | MCFG_CPU_REPLACE("maincpu",I486, 20000000) |
| 2876 | 2909 | MCFG_CPU_PROGRAM_MAP(towns_mem) |
| 2877 | 2910 | MCFG_CPU_IO_MAP(towns_io) |
| r21845 | r21846 | |
| 2885 | 2918 | static MACHINE_CONFIG_START( marty, marty_state ) |
| 2886 | 2919 | MCFG_FRAGMENT_ADD(towns_base) |
| 2887 | 2920 | |
| 2888 | | MCFG_CPU_REPLACE("maincpu",I386, 16000000) |
| 2921 | MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) |
| 2889 | 2922 | MCFG_CPU_PROGRAM_MAP(marty_mem) |
| 2890 | | MCFG_CPU_IO_MAP(towns_io) |
| 2923 | MCFG_CPU_IO_MAP(towns16_io) |
| 2891 | 2924 | MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) |
| 2892 | 2925 | |
| 2893 | 2926 | MCFG_RAM_MODIFY(RAM_TAG) |
| 2894 | 2927 | MCFG_RAM_DEFAULT_SIZE("6M") |
| 2928 | |
| 2929 | MCFG_NVRAM_ADD_0FILL("nvram16") |
| 2895 | 2930 | MACHINE_CONFIG_END |
| 2896 | 2931 | |
| 2897 | 2932 | /* ROM definitions */ |