trunk/src/mess/machine/megacdcd.c
| r245582 | r245583 | |
| 1 | | /* CD controller code from megacd.c, used by Sega Cd / Mega CD */ |
| 1 | /* CD controller code from megacd.c, used by Sega CD / Mega CD */ |
| 2 | 2 | |
| 3 | 3 | /* todo: cleanup(!!), make more generic, unifiy implementation with NeoCD, turn into a device and move to the proper lc89510.c file |
| 4 | 4 | currently this is a bit of a mix of system specific bits, incomplete implementations etc. as well as a rather kludgy combination |
| r245582 | r245583 | |
| 217 | 217 | CLEAR_CDD_RESULT |
| 218 | 218 | UINT32 msf; |
| 219 | 219 | CDD_STATUS &= 0xFF; |
| 220 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 220 | if(segacd.cd == NULL) // no CD is there, bail out |
| 221 | 221 | return; |
| 222 | 222 | CDD_STATUS |= SCD_STATUS; |
| 223 | 223 | msf = lba_to_msf_alt(SCD_CURLBA+150); |
| r245582 | r245583 | |
| 233 | 233 | UINT32 msf; |
| 234 | 234 | CDD_STATUS &= 0xFF; |
| 235 | 235 | // UINT32 end_msf = ; |
| 236 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 236 | if(segacd.cd == NULL) // no CD is there, bail out |
| 237 | 237 | return; |
| 238 | 238 | CDD_STATUS |= SCD_STATUS; |
| 239 | 239 | elapsedlba = SCD_CURLBA - segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) ].logframeofs; |
| r245582 | r245583 | |
| 248 | 248 | { |
| 249 | 249 | CLEAR_CDD_RESULT |
| 250 | 250 | CDD_STATUS &= 0xFF; |
| 251 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 251 | if(segacd.cd == NULL) // no CD is there, bail out |
| 252 | 252 | return; |
| 253 | 253 | CDD_STATUS |= SCD_STATUS; |
| 254 | 254 | SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; |
| r245582 | r245583 | |
| 259 | 259 | { |
| 260 | 260 | CLEAR_CDD_RESULT |
| 261 | 261 | CDD_STATUS &= 0xFF; |
| 262 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 262 | if(segacd.cd == NULL) // no CD is there, bail out |
| 263 | 263 | return; |
| 264 | 264 | CDD_STATUS |= SCD_STATUS; |
| 265 | 265 | |
| r245582 | r245583 | |
| 276 | 276 | { |
| 277 | 277 | CLEAR_CDD_RESULT |
| 278 | 278 | CDD_STATUS &= 0xFF; |
| 279 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 279 | if(segacd.cd == NULL) // no CD is there, bail out |
| 280 | 280 | return; |
| 281 | 281 | CDD_STATUS |= SCD_STATUS; |
| 282 | 282 | CDD_MIN = 1; // first |
| r245582 | r245583 | |
| 291 | 291 | int last_track = cdrom_get_last_track(segacd.cd); |
| 292 | 292 | |
| 293 | 293 | CDD_STATUS &= 0xFF; |
| 294 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 294 | if(segacd.cd == NULL) // no CD is there, bail out |
| 295 | 295 | return; |
| 296 | 296 | CDD_STATUS |= SCD_STATUS; |
| 297 | 297 | |
| r245582 | r245583 | |
| 323 | 323 | int last_track = cdrom_get_last_track(segacd.cd); |
| 324 | 324 | |
| 325 | 325 | CDD_STATUS &= 0xFF; |
| 326 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 326 | if(segacd.cd == NULL) // no CD is there, bail out |
| 327 | 327 | return; |
| 328 | 328 | CDD_STATUS |= SCD_STATUS; |
| 329 | 329 | |
| r245582 | r245583 | |
| 359 | 359 | CLEAR_CDD_RESULT |
| 360 | 360 | UINT32 msf = getmsf_from_regs(); |
| 361 | 361 | SCD_CURLBA = msf_to_lba(msf)-150; |
| 362 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 362 | if(segacd.cd == NULL) // no CD is there, bail out |
| 363 | 363 | return; |
| 364 | 364 | UINT32 end_msf = segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) + 1 ].logframeofs; |
| 365 | 365 | SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; |
| r245582 | r245583 | |
| 384 | 384 | CLEAR_CDD_RESULT |
| 385 | 385 | UINT32 msf = getmsf_from_regs(); |
| 386 | 386 | SCD_CURLBA = msf_to_lba(msf)-150; |
| 387 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 387 | if(segacd.cd == NULL) // no CD is there, bail out |
| 388 | 388 | return; |
| 389 | 389 | SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; |
| 390 | 390 | LC8951UpdateHeader(); |
| r245582 | r245583 | |
| 417 | 417 | { |
| 418 | 418 | CLEAR_CDD_RESULT |
| 419 | 419 | STOP_CDC_READ |
| 420 | | if(segacd.cd == NULL) // no cd is there, bail out |
| 420 | if(segacd.cd == NULL) // no CD is there, bail out |
| 421 | 421 | return; |
| 422 | 422 | SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; |
| 423 | 423 | SCD_STATUS = CDD_PLAYINGCDDA; |