src/mess/drivers/cdi.c
| r6112 | r6113 | |
| 328 | 328 | { |
| 329 | 329 | case 0: |
| 330 | 330 | compare = 0x10000 - scc68070_regs.timers.timer0; |
| 331 | | period = attotime_mul(ATTOTIME_IN_HZ(CLOCK_A/30), compare); |
| 331 | period = attotime_mul(ATTOTIME_IN_HZ(CLOCK_A/150), compare); |
| 332 | 332 | timer_adjust_oneshot(scc68070_regs.timers.timer0_timer, period, 0); |
| 333 | 333 | break; |
| 334 | 334 | default: |
| r6112 | r6113 | |
| 1317 | 1317 | //printf( "Reading Mode %d sector from MSF location %06x\n", cdic_regs.command - 0x28, cdic_regs.time | 2 ); |
| 1318 | 1318 | verboselog(machine, 0, "Reading Mode %d sector from MSF location %06x\n", cdic_regs.command - 0x28, cdic_regs.time | 2 ); |
| 1319 | 1319 | |
| 1320 | | cdic_regs.z_buffer ^= 0x0001; |
| 1321 | | cdic_regs.data_buffer ^= 0x0001; |
| 1322 | 1320 | |
| 1323 | 1321 | cdrom_read_data(cdic_regs.cd, lba, buffer, CD_TRACK_RAW_DONTCARE); |
| 1324 | | for(index = 6; index < 2352/2; index++) |
| 1325 | | { |
| 1326 | | cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1]; |
| 1327 | | } |
| 1328 | 1322 | |
| 1329 | 1323 | cdic_regs.time += 0x100; |
| 1330 | 1324 | if((cdic_regs.time & 0x00000f00) == 0x00000a00) |
| r6112 | r6113 | |
| 1362 | 1356 | //} |
| 1363 | 1357 | //else |
| 1364 | 1358 | //{ |
| 1359 | cdic_regs.data_buffer |= 0x0004; |
| 1360 | cdic_regs.data_buffer ^= 0x0001; |
| 1361 | for(index = 6; index < 2352/2; index++) |
| 1362 | { |
| 1363 | cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1]; |
| 1364 | } |
| 1365 | |
| 1365 | 1366 | cdic_decode_audio_sector(machine, ((UINT8*)cdram) + ((cdic_regs.data_buffer & 5) * 0xa00 + 4)); |
| 1366 | 1367 | // Ignore the audio sector for now. |
| 1367 | 1368 | cdic_regs.x_buffer |= 0x8000; |
| r6112 | r6113 | |
| 1377 | 1378 | } |
| 1378 | 1379 | else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00) |
| 1379 | 1380 | { |
| 1381 | cdic_regs.data_buffer ^= 0x0001; |
| 1382 | for(index = 6; index < 2352/2; index++) |
| 1383 | { |
| 1384 | cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1]; |
| 1385 | } |
| 1386 | |
| 1380 | 1387 | if(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_TRIG) |
| 1381 | 1388 | { |
| 1382 | 1389 | cdic_regs.x_buffer |= 0x8000; |
| r6112 | r6113 | |
| 1401 | 1408 | cdic_regs.data_buffer |= 0x4000; |
| 1402 | 1409 | cdic_regs.data_buffer &= 0x7fff; |
| 1403 | 1410 | |
| 1411 | cdic_regs.data_buffer &= ~0x0004; |
| 1412 | cdic_regs.data_buffer ^= 0x0001; |
| 1413 | for(index = 6; index < 2352/2; index++) |
| 1414 | { |
| 1415 | cdram[(cdic_regs.data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1]; |
| 1416 | } |
| 1417 | |
| 1404 | 1418 | //printf( "Setting CDIC interrupt line\n" ); |
| 1405 | 1419 | verboselog(machine, 0, "Setting CDIC interrupt line\n" ); |
| 1406 | 1420 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128); |
| 1407 | 1421 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 1408 | 1422 | } |
| 1409 | 1423 | |
| 1410 | | if(!(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF)) |
| 1411 | | { |
| 1424 | //if(!(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF)) |
| 1425 | //{ |
| 1412 | 1426 | timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0); // 75Hz = 1x CD-ROM speed |
| 1413 | | } |
| 1414 | | else |
| 1415 | | { |
| 1416 | | cdic_regs.command = 0; |
| 1417 | | } |
| 1427 | //} |
| 1428 | //else |
| 1429 | //{ |
| 1430 | //cdic_regs.command = 0; |
| 1431 | //} |
| 1418 | 1432 | |
| 1419 | 1433 | break; |
| 1420 | 1434 | } |