src/mess/drivers/fmtowns.c
| r9144 | r9145 | |
| 1098 | 1098 | * bit 4 - DMA transfer |
| 1099 | 1099 | * bit 1 - status read request |
| 1100 | 1100 | * bit 0 - ready |
| 1101 | * Note: IRQ bits are only set high if the IRQ bit in the command byte is NOT set. |
| 1101 | 1102 | * |
| 1102 | 1103 | * 0x4c2 - Command port (R/W) |
| 1103 | 1104 | * On read, returns status byte (4 in total?) |
| r9144 | r9145 | |
| 1134 | 1135 | { |
| 1135 | 1136 | if(tstate->towns_cd.command & 0x40) |
| 1136 | 1137 | { |
| 1137 | | tstate->towns_cd.status |= 0x80; |
| 1138 | | if(tstate->towns_cd.mpu_irq_enable) |
| 1138 | // if(tstate->towns_cd.mpu_irq_enable) |
| 1139 | 1139 | { |
| 1140 | tstate->towns_cd.status |= 0x80; |
| 1140 | 1141 | pic8259_ir1_w(tstate->pic_slave, 1); |
| 1141 | 1142 | logerror("PIC: IRQ9 (CD-ROM) set high\n"); |
| 1142 | 1143 | } |
| 1143 | 1144 | } |
| 1145 | else |
| 1146 | tstate->towns_cd.status |= 0x80; |
| 1144 | 1147 | } |
| 1145 | 1148 | else |
| 1146 | 1149 | { |
| r9144 | r9145 | |
| 1154 | 1157 | { |
| 1155 | 1158 | if(tstate->towns_cd.command & 0x40) |
| 1156 | 1159 | { |
| 1157 | | tstate->towns_cd.status |= 0x40; |
| 1158 | | if(tstate->towns_cd.dma_irq_enable) |
| 1160 | // if(tstate->towns_cd.dma_irq_enable) |
| 1159 | 1161 | { |
| 1162 | tstate->towns_cd.status |= 0x40; |
| 1160 | 1163 | pic8259_ir1_w(tstate->pic_slave, 1); |
| 1161 | 1164 | logerror("PIC: IRQ9 (CD-ROM DMA) set high\n"); |
| 1162 | 1165 | } |
| 1163 | 1166 | } |
| 1167 | else |
| 1168 | tstate->towns_cd.status |= 0x40; |
| 1164 | 1169 | } |
| 1165 | 1170 | else |
| 1166 | 1171 | { |
| r9144 | r9145 | |
| 1288 | 1293 | state->towns_cd.lba_last -= 150; |
| 1289 | 1294 | } |
| 1290 | 1295 | |
| 1296 | // parameter 7 = sector count? |
| 1297 | if(state->towns_cd.parameter[1] != 0) |
| 1298 | state->towns_cd.lba_last += state->towns_cd.parameter[1]; |
| 1299 | |
| 1291 | 1300 | logerror("CD: Mode 1 read from LBA next:%i last:%i track:%i\n",state->towns_cd.lba_current,state->towns_cd.lba_last,track); |
| 1292 | 1301 | |
| 1293 | 1302 | if(state->towns_cd.lba_current > state->towns_cd.lba_last) |
| r9144 | r9145 | |
| 1302 | 1311 | state->towns_cd.status &= ~0x20; // not a software transfer |
| 1303 | 1312 | // state->towns_cd.buffer_ptr = 0; |
| 1304 | 1313 | // timer_adjust_oneshot(state->towns_cd.read_timer,ATTOTIME_IN_HZ(300000),1); |
| 1305 | | state->towns_cd.extra_status = 2; |
| 1306 | | towns_cd_set_status(device->machine,0x00,0x00,0x00,0x00); |
| 1314 | if(state->towns_cd.command & 0x20) |
| 1315 | { |
| 1316 | state->towns_cd.extra_status = 2; |
| 1317 | towns_cd_set_status(device->machine,0x00,0x00,0x00,0x00); |
| 1318 | } |
| 1319 | else |
| 1320 | { |
| 1321 | state->towns_cd.extra_status = 0; |
| 1322 | towns_cd_set_status(device->machine,0x22,0x00,0x00,0x00); |
| 1323 | } |
| 1307 | 1324 | } |
| 1308 | 1325 | } |
| 1309 | 1326 | |
| r9144 | r9145 | |
| 1371 | 1388 | if(state->towns_cd.command & 0x20) |
| 1372 | 1389 | { |
| 1373 | 1390 | state->towns_cd.extra_status = 0; |
| 1374 | | towns_cd_set_status(device->machine,0x00,0x00,0x00,0x00); |
| 1391 | towns_cd_set_status(device->machine,0x00,0xff,0xff,0xff); |
| 1375 | 1392 | } |
| 1376 | 1393 | logerror("CD: Command 0x01: unknown\n"); |
| 1377 | 1394 | break; |