src/mess/machine/compis.c
| r2637 | r2638 | |
| 1043 | 1043 | |
| 1044 | 1044 | READ16_HANDLER( i186_internal_port_r ) |
| 1045 | 1045 | { |
| 1046 | | int shift = 8 * (offset & 1); |
| 1047 | 1046 | int temp, which; |
| 1048 | 1047 | |
| 1049 | | switch (offset & ~1) |
| 1048 | switch (offset) |
| 1050 | 1049 | { |
| 1051 | 1050 | case 0x11: |
| 1052 | 1051 | logerror("%05X:ERROR - read from 80186 EOI\n", activecpu_get_pc()); |
| 1053 | 1052 | break; |
| 1054 | 1053 | |
| 1055 | 1054 | case 0x12: |
| 1056 | | if (LOG_PORTS) |
| 1057 | | logerror("%05X:read 80186 interrupt poll\n", activecpu_get_pc()); |
| 1055 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", activecpu_get_pc()); |
| 1058 | 1056 | if (i186.intr.poll_status & 0x8000) |
| 1059 | 1057 | int_callback(machine, 0); |
| 1060 | | return (i186.intr.poll_status >> shift) & 0xff; |
| 1058 | return i186.intr.poll_status; |
| 1061 | 1059 | |
| 1062 | 1060 | case 0x13: |
| 1063 | | if (LOG_PORTS) |
| 1064 | | logerror("%05X:read 80186 interrupt poll status\n", |
| 1065 | | activecpu_get_pc()); |
| 1066 | | return (i186.intr.poll_status >> shift) & 0xff; |
| 1061 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", activecpu_get_pc()); |
| 1062 | return i186.intr.poll_status; |
| 1067 | 1063 | |
| 1068 | 1064 | case 0x14: |
| 1069 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", |
| 1070 | | activecpu_get_pc()); |
| 1065 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", activecpu_get_pc()); |
| 1071 | 1066 | temp = (i186.intr.timer >> 3) & 0x01; |
| 1072 | 1067 | temp |= (i186.intr.dma[0] >> 1) & 0x04; |
| 1073 | 1068 | temp |= (i186.intr.dma[1] >> 0) & 0x08; |
| r2637 | r2638 | |
| 1075 | 1070 | temp |= (i186.intr.ext[1] << 2) & 0x20; |
| 1076 | 1071 | temp |= (i186.intr.ext[2] << 3) & 0x40; |
| 1077 | 1072 | temp |= (i186.intr.ext[3] << 4) & 0x80; |
| 1078 | | return (temp >> shift) & 0xff; |
| 1073 | return temp; |
| 1079 | 1074 | |
| 1080 | 1075 | case 0x15: |
| 1081 | | if (LOG_PORTS) |
| 1082 | | logerror("%05X:read 80186 interrupt priority mask\n", |
| 1083 | | activecpu_get_pc()); |
| 1084 | | return (i186.intr.priority_mask >> shift) & 0xff; |
| 1076 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", activecpu_get_pc()); |
| 1077 | return i186.intr.priority_mask; |
| 1085 | 1078 | |
| 1086 | 1079 | case 0x16: |
| 1087 | | if (LOG_PORTS) |
| 1088 | | logerror("%05X:read 80186 interrupt in-service\n", |
| 1089 | | activecpu_get_pc()); |
| 1090 | | return (i186.intr.in_service >> shift) & 0xff; |
| 1080 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", activecpu_get_pc()); |
| 1081 | return i186.intr.in_service; |
| 1091 | 1082 | |
| 1092 | 1083 | case 0x17: |
| 1093 | | if (LOG_PORTS) |
| 1094 | | logerror("%05X:read 80186 interrupt request\n", |
| 1095 | | activecpu_get_pc()); |
| 1084 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", activecpu_get_pc()); |
| 1096 | 1085 | temp = i186.intr.request & ~0x0001; |
| 1097 | 1086 | if (i186.intr.status & 0x0007) |
| 1098 | 1087 | temp |= 1; |
| 1099 | | return (temp >> shift) & 0xff; |
| 1088 | return temp; |
| 1100 | 1089 | |
| 1101 | 1090 | case 0x18: |
| 1102 | | if (LOG_PORTS) |
| 1103 | | logerror("%05X:read 80186 interrupt status\n", activecpu_get_pc()); |
| 1104 | | return (i186.intr.status >> shift) & 0xff; |
| 1091 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", activecpu_get_pc()); |
| 1092 | return i186.intr.status; |
| 1105 | 1093 | |
| 1106 | 1094 | case 0x19: |
| 1107 | | if (LOG_PORTS) |
| 1108 | | logerror("%05X:read 80186 timer interrupt control\n", |
| 1109 | | activecpu_get_pc()); |
| 1110 | | return (i186.intr.timer >> shift) & 0xff; |
| 1095 | if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", activecpu_get_pc()); |
| 1096 | return i186.intr.timer; |
| 1111 | 1097 | |
| 1112 | 1098 | case 0x1a: |
| 1113 | | if (LOG_PORTS) |
| 1114 | | logerror("%05X:read 80186 DMA 0 interrupt control\n", |
| 1115 | | activecpu_get_pc()); |
| 1116 | | return (i186.intr.dma[0] >> shift) & 0xff; |
| 1099 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", activecpu_get_pc()); |
| 1100 | return i186.intr.dma[0]; |
| 1117 | 1101 | |
| 1118 | 1102 | case 0x1b: |
| 1119 | | if (LOG_PORTS) |
| 1120 | | logerror("%05X:read 80186 DMA 1 interrupt control\n", |
| 1121 | | activecpu_get_pc()); |
| 1122 | | return (i186.intr.dma[1] >> shift) & 0xff; |
| 1103 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", activecpu_get_pc()); |
| 1104 | return i186.intr.dma[1]; |
| 1123 | 1105 | |
| 1124 | 1106 | case 0x1c: |
| 1125 | | if (LOG_PORTS) |
| 1126 | | logerror("%05X:read 80186 INT 0 interrupt control\n", |
| 1127 | | activecpu_get_pc()); |
| 1128 | | return (i186.intr.ext[0] >> shift) & 0xff; |
| 1107 | if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", activecpu_get_pc()); |
| 1108 | return i186.intr.ext[0]; |
| 1129 | 1109 | |
| 1130 | 1110 | case 0x1d: |
| 1131 | | if (LOG_PORTS) |
| 1132 | | logerror("%05X:read 80186 INT 1 interrupt control\n", |
| 1133 | | activecpu_get_pc()); |
| 1134 | | return (i186.intr.ext[1] >> shift) & 0xff; |
| 1111 | if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", activecpu_get_pc()); |
| 1112 | return i186.intr.ext[1]; |
| 1135 | 1113 | |
| 1136 | 1114 | case 0x1e: |
| 1137 | | if (LOG_PORTS) |
| 1138 | | logerror("%05X:read 80186 INT 2 interrupt control\n", |
| 1139 | | activecpu_get_pc()); |
| 1140 | | return (i186.intr.ext[2] >> shift) & 0xff; |
| 1115 | if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", activecpu_get_pc()); |
| 1116 | return i186.intr.ext[2]; |
| 1141 | 1117 | |
| 1142 | 1118 | case 0x1f: |
| 1143 | | if (LOG_PORTS) |
| 1144 | | logerror("%05X:read 80186 INT 3 interrupt control\n", |
| 1145 | | activecpu_get_pc()); |
| 1146 | | return (i186.intr.ext[3] >> shift) & 0xff; |
| 1119 | if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", activecpu_get_pc()); |
| 1120 | return i186.intr.ext[3]; |
| 1147 | 1121 | |
| 1148 | 1122 | case 0x28: |
| 1149 | 1123 | case 0x2c: |
| 1150 | 1124 | case 0x30: |
| 1151 | | if (LOG_PORTS) |
| 1152 | | logerror("%05X:read 80186 Timer %d count\n", |
| 1153 | | activecpu_get_pc(), (offset - 0x50) / 8); |
| 1154 | | which = (offset - 0x50) / 8; |
| 1125 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", activecpu_get_pc(), (offset - 0x28) / 4); |
| 1126 | which = (offset - 0x28) / 4; |
| 1155 | 1127 | if (!(offset & 1)) |
| 1156 | 1128 | internal_timer_sync(which); |
| 1157 | | return (i186.timer[which].count >> shift) & 0xff; |
| 1129 | return i186.timer[which].count; |
| 1158 | 1130 | |
| 1159 | 1131 | case 0x29: |
| 1160 | 1132 | case 0x2d: |
| 1161 | 1133 | case 0x31: |
| 1162 | | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", |
| 1163 | | activecpu_get_pc(), (offset - 0x50) / 8); |
| 1164 | | which = (offset - 0x50) / 8; |
| 1165 | | return (i186.timer[which].maxA >> shift) & 0xff; |
| 1134 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", activecpu_get_pc(), (offset - 0x29) / 4); |
| 1135 | which = (offset - 0x29) / 4; |
| 1136 | return i186.timer[which].maxA; |
| 1166 | 1137 | |
| 1167 | 1138 | case 0x2a: |
| 1168 | 1139 | case 0x2e: |
| 1169 | | logerror("%05X:read 80186 Timer %d max B\n", |
| 1170 | | activecpu_get_pc(), (offset - 0x50) / 8); |
| 1171 | | which = (offset - 0x50) / 8; |
| 1172 | | return (i186.timer[which].maxB >> shift) & 0xff; |
| 1140 | logerror("%05X:read 80186 Timer %d max B\n", activecpu_get_pc(), (offset - 0x2a) / 4); |
| 1141 | which = (offset - 0x2a) / 4; |
| 1142 | return i186.timer[which].maxB; |
| 1173 | 1143 | |
| 1174 | 1144 | case 0x2b: |
| 1175 | 1145 | case 0x2f: |
| 1176 | 1146 | case 0x33: |
| 1177 | | if (LOG_PORTS) |
| 1178 | | logerror("%05X:read 80186 Timer %d control\n", |
| 1179 | | activecpu_get_pc(), (offset - 0x50) / 8); |
| 1180 | | which = (offset - 0x50) / 8; |
| 1181 | | return (i186.timer[which].control >> shift) & 0xff; |
| 1147 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", activecpu_get_pc(), (offset - 0x2b) / 4); |
| 1148 | which = (offset - 0x2b) / 4; |
| 1149 | return i186.timer[which].control; |
| 1182 | 1150 | |
| 1183 | 1151 | case 0x50: |
| 1184 | | if (LOG_PORTS) |
| 1185 | | logerror("%05X:read 80186 upper chip select\n", |
| 1186 | | activecpu_get_pc()); |
| 1187 | | return (i186.mem.upper >> shift) & 0xff; |
| 1152 | if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", activecpu_get_pc()); |
| 1153 | return i186.mem.upper; |
| 1188 | 1154 | |
| 1189 | 1155 | case 0x51: |
| 1190 | | if (LOG_PORTS) |
| 1191 | | logerror("%05X:read 80186 lower chip select\n", |
| 1192 | | activecpu_get_pc()); |
| 1193 | | return (i186.mem.lower >> shift) & 0xff; |
| 1156 | if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", activecpu_get_pc()); |
| 1157 | return i186.mem.lower; |
| 1194 | 1158 | |
| 1195 | 1159 | case 0x52: |
| 1196 | | if (LOG_PORTS) |
| 1197 | | logerror("%05X:read 80186 peripheral chip select\n", |
| 1198 | | activecpu_get_pc()); |
| 1199 | | return (i186.mem.peripheral >> shift) & 0xff; |
| 1160 | if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", activecpu_get_pc()); |
| 1161 | return i186.mem.peripheral; |
| 1200 | 1162 | |
| 1201 | 1163 | case 0x53: |
| 1202 | | if (LOG_PORTS) |
| 1203 | | logerror("%05X:read 80186 middle chip select\n", |
| 1204 | | activecpu_get_pc()); |
| 1205 | | return (i186.mem.middle >> shift) & 0xff; |
| 1164 | if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", activecpu_get_pc()); |
| 1165 | return i186.mem.middle; |
| 1206 | 1166 | |
| 1207 | 1167 | case 0x54: |
| 1208 | | if (LOG_PORTS) |
| 1209 | | logerror("%05X:read 80186 middle P chip select\n", |
| 1210 | | activecpu_get_pc()); |
| 1211 | | return (i186.mem.middle_size >> shift) & 0xff; |
| 1168 | if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", activecpu_get_pc()); |
| 1169 | return i186.mem.middle_size; |
| 1212 | 1170 | |
| 1213 | 1171 | case 0x60: |
| 1214 | 1172 | case 0x68: |
| 1215 | | if (LOG_PORTS) |
| 1216 | | logerror("%05X:read 80186 DMA%d lower source address\n", |
| 1217 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1218 | | which = (offset - 0xc0) / 0x10; |
| 1173 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", activecpu_get_pc(), (offset - 0x60) / 8); |
| 1174 | which = (offset - 0x60) / 8; |
| 1219 | 1175 | // stream_update(dma_stream, 0); |
| 1220 | | return (i186.dma[which].source >> shift) & 0xff; |
| 1176 | return i186.dma[which].source; |
| 1221 | 1177 | |
| 1222 | 1178 | case 0x61: |
| 1223 | 1179 | case 0x69: |
| 1224 | | if (LOG_PORTS) |
| 1225 | | logerror("%05X:read 80186 DMA%d upper source address\n", |
| 1226 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1227 | | which = (offset - 0xc0) / 0x10; |
| 1180 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", activecpu_get_pc(), (offset - 0x61) / 8); |
| 1181 | which = (offset - 0x61) / 8; |
| 1228 | 1182 | // stream_update(dma_stream, 0); |
| 1229 | | return (i186.dma[which].source >> (shift + 16)) & 0xff; |
| 1183 | return i186.dma[which].source >> 16; |
| 1230 | 1184 | |
| 1231 | 1185 | case 0x62: |
| 1232 | 1186 | case 0x6a: |
| 1233 | | if (LOG_PORTS) |
| 1234 | | logerror("%05X:read 80186 DMA%d lower dest address\n", |
| 1235 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1236 | | which = (offset - 0xc0) / 0x10; |
| 1187 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", activecpu_get_pc(), (offset - 0x62) / 8); |
| 1188 | which = (offset - 0x62) / 8; |
| 1237 | 1189 | // stream_update(dma_stream, 0); |
| 1238 | | return (i186.dma[which].dest >> shift) & 0xff; |
| 1190 | return i186.dma[which].dest; |
| 1239 | 1191 | |
| 1240 | 1192 | case 0x63: |
| 1241 | 1193 | case 0x6b: |
| 1242 | | if (LOG_PORTS) |
| 1243 | | logerror("%05X:read 80186 DMA%d upper dest address\n", |
| 1244 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1245 | | which = (offset - 0xc0) / 0x10; |
| 1194 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", activecpu_get_pc(), (offset - 0x63) / 8); |
| 1195 | which = (offset - 0x63) / 8; |
| 1246 | 1196 | // stream_update(dma_stream, 0); |
| 1247 | | return (i186.dma[which].dest >> (shift + 16)) & 0xff; |
| 1197 | return i186.dma[which].dest >> 16; |
| 1248 | 1198 | |
| 1249 | 1199 | case 0x64: |
| 1250 | 1200 | case 0x6c: |
| 1251 | | if (LOG_PORTS) |
| 1252 | | logerror("%05X:read 80186 DMA%d transfer count\n", |
| 1253 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1254 | | which = (offset - 0xc0) / 0x10; |
| 1201 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", activecpu_get_pc(), (offset - 0x64) / 8); |
| 1202 | which = (offset - 0x64) / 8; |
| 1255 | 1203 | // stream_update(dma_stream, 0); |
| 1256 | | return (i186.dma[which].count >> shift) & 0xff; |
| 1204 | return i186.dma[which].count; |
| 1257 | 1205 | |
| 1258 | 1206 | case 0x65: |
| 1259 | 1207 | case 0x6d: |
| 1260 | | if (LOG_PORTS) |
| 1261 | | logerror("%05X:read 80186 DMA%d control\n", |
| 1262 | | activecpu_get_pc(), (offset - 0xc0) / 0x10); |
| 1263 | | which = (offset - 0xc0) / 0x10; |
| 1208 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", activecpu_get_pc(), (offset - 0x65) / 8); |
| 1209 | which = (offset - 0x65) / 8; |
| 1264 | 1210 | // stream_update(dma_stream, 0); |
| 1265 | | return (i186.dma[which].control >> shift) & 0xff; |
| 1211 | return i186.dma[which].control; |
| 1266 | 1212 | |
| 1267 | 1213 | default: |
| 1268 | | logerror("%05X:read 80186 port %02X\n", |
| 1269 | | activecpu_get_pc(), offset); |
| 1214 | logerror("%05X:read 80186 port %02X\n", activecpu_get_pc(), offset); |
| 1270 | 1215 | break; |
| 1271 | 1216 | } |
| 1272 | 1217 | return 0x00; |
| r2637 | r2638 | |
| 1282 | 1227 | { |
| 1283 | 1228 | int temp, which, data16 = data; |
| 1284 | 1229 | |
| 1285 | | switch (offset & ~1) |
| 1230 | switch (offset) |
| 1286 | 1231 | { |
| 1287 | | case 0x22: |
| 1288 | | if (LOG_PORTS) |
| 1289 | | logerror("%05X:80186 EOI = %04X\n", activecpu_get_pc(), data16); |
| 1232 | case 0x11: |
| 1233 | if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", activecpu_get_pc(), data16); |
| 1290 | 1234 | handle_eoi(0x8000); |
| 1291 | 1235 | update_interrupt_state(machine); |
| 1292 | 1236 | break; |
| 1293 | 1237 | |
| 1294 | | case 0x24: |
| 1295 | | logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", |
| 1296 | | activecpu_get_pc(), data16); |
| 1238 | case 0x12: |
| 1239 | logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", activecpu_get_pc(), data16); |
| 1297 | 1240 | break; |
| 1298 | 1241 | |
| 1299 | | case 0x26: |
| 1300 | | logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", |
| 1301 | | activecpu_get_pc(), data16); |
| 1242 | case 0x13: |
| 1243 | logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", activecpu_get_pc(), data16); |
| 1302 | 1244 | break; |
| 1303 | 1245 | |
| 1304 | | case 0x28: |
| 1305 | | if (LOG_PORTS) |
| 1306 | | logerror("%05X:80186 interrupt mask = %04X\n", |
| 1307 | | activecpu_get_pc(), data16); |
| 1246 | case 0x14: |
| 1247 | if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", activecpu_get_pc(), data16); |
| 1308 | 1248 | i186.intr.timer = (i186.intr.timer & ~0x08) | ((data16 << 3) & 0x08); |
| 1309 | 1249 | i186.intr.dma[0] = (i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08); |
| 1310 | 1250 | i186.intr.dma[1] = (i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08); |
| r2637 | r2638 | |
| 1315 | 1255 | update_interrupt_state(machine); |
| 1316 | 1256 | break; |
| 1317 | 1257 | |
| 1318 | | case 0x2a: |
| 1258 | case 0x15: |
| 1319 | 1259 | if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", activecpu_get_pc(), data16); |
| 1320 | 1260 | i186.intr.priority_mask = data16 & 0x0007; |
| 1321 | 1261 | update_interrupt_state(machine); |
| 1322 | 1262 | break; |
| 1323 | 1263 | |
| 1324 | | case 0x2c: |
| 1264 | case 0x16: |
| 1325 | 1265 | if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", activecpu_get_pc(), data16); |
| 1326 | 1266 | i186.intr.in_service = data16 & 0x00ff; |
| 1327 | 1267 | update_interrupt_state(machine); |
| 1328 | 1268 | break; |
| 1329 | 1269 | |
| 1330 | | case 0x2e: |
| 1270 | case 0x17: |
| 1331 | 1271 | if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", activecpu_get_pc(), data16); |
| 1332 | 1272 | i186.intr.request = (i186.intr.request & ~0x00c0) | (data16 & 0x00c0); |
| 1333 | 1273 | update_interrupt_state(machine); |
| 1334 | 1274 | break; |
| 1335 | 1275 | |
| 1336 | | case 0x30: |
| 1276 | case 0x18: |
| 1337 | 1277 | if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", activecpu_get_pc(), data16); |
| 1338 | 1278 | i186.intr.status = (i186.intr.status & ~0x8007) | (data16 & 0x8007); |
| 1339 | 1279 | update_interrupt_state(machine); |
| 1340 | 1280 | break; |
| 1341 | 1281 | |
| 1342 | | case 0x32: |
| 1282 | case 0x19: |
| 1343 | 1283 | if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", activecpu_get_pc(), data16); |
| 1344 | 1284 | i186.intr.timer = data16 & 0x000f; |
| 1345 | 1285 | break; |
| 1346 | 1286 | |
| 1347 | | case 0x34: |
| 1287 | case 0x1a: |
| 1348 | 1288 | if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1349 | 1289 | i186.intr.dma[0] = data16 & 0x000f; |
| 1350 | 1290 | break; |
| 1351 | 1291 | |
| 1352 | | case 0x36: |
| 1292 | case 0x1b: |
| 1353 | 1293 | if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1354 | 1294 | i186.intr.dma[1] = data16 & 0x000f; |
| 1355 | 1295 | break; |
| 1356 | 1296 | |
| 1357 | | case 0x38: |
| 1297 | case 0x1c: |
| 1358 | 1298 | if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1359 | 1299 | i186.intr.ext[0] = data16 & 0x007f; |
| 1360 | 1300 | break; |
| 1361 | 1301 | |
| 1362 | | case 0x3a: |
| 1302 | case 0x1d: |
| 1363 | 1303 | if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1364 | 1304 | i186.intr.ext[1] = data16 & 0x007f; |
| 1365 | 1305 | break; |
| 1366 | 1306 | |
| 1367 | | case 0x3c: |
| 1307 | case 0x1e: |
| 1368 | 1308 | if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1369 | 1309 | i186.intr.ext[2] = data16 & 0x001f; |
| 1370 | 1310 | break; |
| 1371 | 1311 | |
| 1372 | | case 0x3e: |
| 1312 | case 0x1f: |
| 1373 | 1313 | if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1374 | 1314 | i186.intr.ext[3] = data16 & 0x001f; |
| 1375 | 1315 | break; |
| 1376 | 1316 | |
| 1377 | | case 0x50: |
| 1378 | | case 0x58: |
| 1379 | | case 0x60: |
| 1380 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16); |
| 1381 | | which = (offset - 0x50) / 8; |
| 1317 | case 0x28: |
| 1318 | case 0x2c: |
| 1319 | case 0x30: |
| 1320 | if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", activecpu_get_pc(), (offset - 0x28) / 4, data16); |
| 1321 | which = (offset - 0x28) / 4; |
| 1382 | 1322 | internal_timer_update(which, data16, -1, -1, -1); |
| 1383 | 1323 | break; |
| 1384 | 1324 | |
| 1385 | | case 0x52: |
| 1386 | | case 0x5a: |
| 1387 | | case 0x62: |
| 1388 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16); |
| 1389 | | which = (offset - 0x50) / 8; |
| 1325 | case 0x29: |
| 1326 | case 0x2d: |
| 1327 | case 0x31: |
| 1328 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", activecpu_get_pc(), (offset - 0x29) / 4, data16); |
| 1329 | which = (offset - 0x29) / 4; |
| 1390 | 1330 | internal_timer_update(which, -1, data16, -1, -1); |
| 1391 | 1331 | break; |
| 1392 | 1332 | |
| 1393 | | case 0x54: |
| 1394 | | case 0x5c: |
| 1395 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16); |
| 1396 | | which = (offset - 0x50) / 8; |
| 1333 | case 0x2a: |
| 1334 | case 0x2e: |
| 1335 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", activecpu_get_pc(), (offset - 0x2a) / 4, data16); |
| 1336 | which = (offset - 0x2a) / 4; |
| 1397 | 1337 | internal_timer_update(which, -1, -1, data16, -1); |
| 1398 | 1338 | break; |
| 1399 | 1339 | |
| 1400 | | case 0x56: |
| 1401 | | case 0x5e: |
| 1402 | | case 0x66: |
| 1403 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", activecpu_get_pc(), (offset - 0x50) / 8, data16); |
| 1404 | | which = (offset - 0x50) / 8; |
| 1340 | case 0x2b: |
| 1341 | case 0x2f: |
| 1342 | case 0x33: |
| 1343 | if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", activecpu_get_pc(), (offset - 0x2b) / 4, data16); |
| 1344 | which = (offset - 0x2b) / 4; |
| 1405 | 1345 | internal_timer_update(which, -1, -1, -1, data16); |
| 1406 | 1346 | break; |
| 1407 | 1347 | |
| 1408 | | case 0xa0: |
| 1348 | case 0x50: |
| 1409 | 1349 | if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", activecpu_get_pc(), data16); |
| 1410 | 1350 | i186.mem.upper = data16 | 0xc038; |
| 1411 | 1351 | break; |
| 1412 | 1352 | |
| 1413 | | case 0xa2: |
| 1353 | case 0x51: |
| 1414 | 1354 | if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", activecpu_get_pc(), data16); |
| 1415 | | i186.mem.lower = (data16 & 0x3fff) | 0x0038; |
| 1355 | i186.mem.lower = (data16 & 0x3fff) | 0x0038; printf("%X",i186.mem.lower); |
| 1416 | 1356 | break; |
| 1417 | 1357 | |
| 1418 | | case 0xa4: |
| 1419 | | if (LOG_PORTS) |
| 1420 | | logerror("%05X:80186 peripheral chip select = %04X\n", |
| 1421 | | activecpu_get_pc(), data16); |
| 1358 | case 0x52: |
| 1359 | if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", activecpu_get_pc(), data16); |
| 1422 | 1360 | i186.mem.peripheral = data16 | 0x0038; |
| 1423 | 1361 | break; |
| 1424 | 1362 | |
| 1425 | | case 0xa6: |
| 1363 | case 0x53: |
| 1426 | 1364 | if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", activecpu_get_pc(), data16); |
| 1427 | 1365 | i186.mem.middle = data16 | 0x01f8; |
| 1428 | 1366 | break; |
| 1429 | 1367 | |
| 1430 | | case 0xa8: |
| 1368 | case 0x54: |
| 1431 | 1369 | if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", activecpu_get_pc(), data16); |
| 1432 | 1370 | i186.mem.middle_size = data16 | 0x8038; |
| 1433 | 1371 | |
| r2637 | r2638 | |
| 1450 | 1388 | cpunum_set_irq_callback(0, int_callback); |
| 1451 | 1389 | break; |
| 1452 | 1390 | |
| 1453 | | case 0xc0: |
| 1454 | | case 0xd0: |
| 1455 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1456 | | which = (offset - 0xc0) / 0x10; |
| 1391 | case 0x60: |
| 1392 | case 0x68: |
| 1393 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", activecpu_get_pc(), (offset - 0x60) / 8, data16); |
| 1394 | which = (offset - 0x60) / 8; |
| 1457 | 1395 | // stream_update(dma_stream, 0); |
| 1458 | 1396 | i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff); |
| 1459 | 1397 | break; |
| 1460 | 1398 | |
| 1461 | | case 0xc2: |
| 1462 | | case 0xd2: |
| 1463 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1464 | | which = (offset - 0xc0) / 0x10; |
| 1399 | case 0x61: |
| 1400 | case 0x69: |
| 1401 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", activecpu_get_pc(), (offset - 0x61) / 8, data16); |
| 1402 | which = (offset - 0x61) / 8; |
| 1465 | 1403 | // stream_update(dma_stream, 0); |
| 1466 | 1404 | i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| 1467 | 1405 | break; |
| 1468 | 1406 | |
| 1469 | | case 0xc4: |
| 1470 | | case 0xd4: |
| 1471 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1472 | | which = (offset - 0xc0) / 0x10; |
| 1407 | case 0x62: |
| 1408 | case 0x6a: |
| 1409 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", activecpu_get_pc(), (offset - 0x62) / 8, data16); |
| 1410 | which = (offset - 0x62) / 8; |
| 1473 | 1411 | // stream_update(dma_stream, 0); |
| 1474 | 1412 | i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff); |
| 1475 | 1413 | break; |
| 1476 | 1414 | |
| 1477 | | case 0xc6: |
| 1478 | | case 0xd6: |
| 1479 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1480 | | which = (offset - 0xc0) / 0x10; |
| 1415 | case 0x63: |
| 1416 | case 0x6b: |
| 1417 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", activecpu_get_pc(), (offset - 0x63) / 8, data16); |
| 1418 | which = (offset - 0x63) / 8; |
| 1481 | 1419 | // stream_update(dma_stream, 0); |
| 1482 | 1420 | i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| 1483 | 1421 | break; |
| 1484 | 1422 | |
| 1485 | | case 0xc8: |
| 1486 | | case 0xd8: |
| 1487 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1488 | | which = (offset - 0xc0) / 0x10; |
| 1423 | case 0x64: |
| 1424 | case 0x6c: |
| 1425 | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", activecpu_get_pc(), (offset - 0x64) / 8, data16); |
| 1426 | which = (offset - 0x64) / 8; |
| 1489 | 1427 | // stream_update(dma_stream, 0); |
| 1490 | 1428 | i186.dma[which].count = data16; |
| 1491 | 1429 | break; |
| 1492 | 1430 | |
| 1493 | | case 0xca: |
| 1494 | | case 0xda: |
| 1495 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", activecpu_get_pc(), (offset - 0xc0) / 0x10, data16); |
| 1496 | | which = (offset - 0xc0) / 0x10; |
| 1431 | case 0x65: |
| 1432 | case 0x6d: |
| 1433 | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", activecpu_get_pc(), (offset - 0x65) / 8, data16); |
| 1434 | which = (offset - 0x65) / 8; |
| 1497 | 1435 | // stream_update(dma_stream, 0); |
| 1498 | 1436 | update_dma_control(which, data16); |
| 1499 | 1437 | break; |
| 1500 | 1438 | |
| 1501 | | case 0xfe: |
| 1439 | case 0x7f: |
| 1502 | 1440 | if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", activecpu_get_pc(), data16); |
| 1503 | 1441 | |
| 1504 | 1442 | /* we assume here there that this doesn't happen too often */ |