310 |
|
{ |
311 |
|
DriveInfo *info = first_drive_info, *next; |
312 |
|
while (info != NULL) { |
313 |
+ |
SysAllowRemoval(info->fh); |
314 |
|
Sys_close(info->fh); |
315 |
|
next = info->next; |
316 |
|
delete info; |
602 |
|
break; |
603 |
|
|
604 |
|
case 3: { // Get track starting address |
605 |
< |
uint8 *buf = Mac2HostAddr(ReadMacInt32(pb + csParam + 2)); |
605 |
> |
uint32 buf = ReadMacInt32(pb + csParam + 2); |
606 |
|
uint16 buf_size = ReadMacInt16(pb + csParam + 6); |
607 |
|
int track = bcd2bin[ReadMacInt8(pb + csParam + 8)]; |
608 |
|
|
616 |
|
// Fill buffer |
617 |
|
if (i != 804) |
618 |
|
while (buf_size > 0) { |
619 |
< |
*buf++ = info->toc[i+1] & 0x0f; // Control |
620 |
< |
*buf++ = bin2bcd[info->toc[i+5]]; // M |
621 |
< |
*buf++ = bin2bcd[info->toc[i+6]]; // S |
622 |
< |
*buf++ = bin2bcd[info->toc[i+7]]; // F |
619 |
> |
WriteMacInt8(buf, info->toc[i+1] & 0x0f); buf++; // Control |
620 |
> |
WriteMacInt8(buf, bin2bcd[info->toc[i+5]]); buf++; // M |
621 |
> |
WriteMacInt8(buf, bin2bcd[info->toc[i+6]]); buf++; // S |
622 |
> |
WriteMacInt8(buf, bin2bcd[info->toc[i+7]]); buf++; // F |
623 |
|
|
624 |
|
// Lead-Out? Then stop |
625 |
|
if (info->toc[i+2] == 0xaa) |
650 |
|
|
651 |
|
case 101: { // ReadTheQSubcode |
652 |
|
if (ReadMacInt8(info->status + dsDiskInPlace) == 0) { |
653 |
< |
memset(Mac2HostAddr(pb + csParam), 0, 10); |
653 |
> |
Mac_memset(pb + csParam, 0, 10); |
654 |
|
return offLinErr; |
655 |
|
} |
656 |
|
|
657 |
|
uint8 pos[16]; |
658 |
|
if (SysCDGetPosition(info->fh, pos)) { |
659 |
< |
uint8 *p = Mac2HostAddr(pb + csParam); |
660 |
< |
*p++ = pos[5] & 0x0f; // Control |
661 |
< |
*p++ = bin2bcd[pos[6]]; // Track number |
662 |
< |
*p++ = bin2bcd[pos[7]]; // Index number |
663 |
< |
*p++ = bin2bcd[pos[13]]; // M (rel) |
664 |
< |
*p++ = bin2bcd[pos[14]]; // S (rel) |
665 |
< |
*p++ = bin2bcd[pos[15]]; // F (rel) |
666 |
< |
*p++ = bin2bcd[pos[9]]; // M (abs) |
667 |
< |
*p++ = bin2bcd[pos[10]]; // S (abs) |
668 |
< |
*p++ = bin2bcd[pos[11]]; // F (abs) |
669 |
< |
*p++ = 0; |
659 |
> |
uint32 p = pb + csParam; |
660 |
> |
WriteMacInt8(p, pos[5] & 0x0f); p++; // Control |
661 |
> |
WriteMacInt8(p, bin2bcd[pos[6]]); p++; // Track number |
662 |
> |
WriteMacInt8(p, bin2bcd[pos[7]]); p++; // Index number |
663 |
> |
WriteMacInt8(p, bin2bcd[pos[13]]); p++; // M (rel) |
664 |
> |
WriteMacInt8(p, bin2bcd[pos[14]]); p++; // S (rel) |
665 |
> |
WriteMacInt8(p, bin2bcd[pos[15]]); p++; // F (rel) |
666 |
> |
WriteMacInt8(p, bin2bcd[pos[9]]); p++; // M (abs) |
667 |
> |
WriteMacInt8(p, bin2bcd[pos[10]]); p++; // S (abs) |
668 |
> |
WriteMacInt8(p, bin2bcd[pos[11]]); p++; // F (abs) |
669 |
> |
WriteMacInt8(p, 0); |
670 |
|
return noErr; |
671 |
|
} else |
672 |
|
return ioErr; |
754 |
|
if (!SysCDGetPosition(info->fh, pos)) |
755 |
|
return paramErr; |
756 |
|
|
757 |
< |
uint8 *p = Mac2HostAddr(pb + csParam); |
757 |
> |
uint32 p = pb + csParam; |
758 |
|
switch (pos[1]) { |
759 |
|
case 0x11: |
760 |
< |
*p++ = 0; // Audio play in progress |
760 |
> |
WriteMacInt8(p, 0); // Audio play in progress |
761 |
|
break; |
762 |
|
case 0x12: |
763 |
< |
*p++ = 1; // Audio play paused |
763 |
> |
WriteMacInt8(p, 1); // Audio play paused |
764 |
|
break; |
765 |
|
case 0x13: |
766 |
< |
*p++ = 3; // Audio play completed |
766 |
> |
WriteMacInt8(p, 3); // Audio play completed |
767 |
|
break; |
768 |
|
case 0x14: |
769 |
< |
*p++ = 4; // Error occurred |
769 |
> |
WriteMacInt8(p, 4); // Error occurred |
770 |
|
break; |
771 |
|
default: |
772 |
< |
*p++ = 5; // No audio play operation requested |
772 |
> |
WriteMacInt8(p, 5); // No audio play operation requested |
773 |
|
break; |
774 |
|
} |
775 |
< |
*p++ = info->play_mode; |
776 |
< |
*p++ = pos[5] & 0x0f; // Control |
777 |
< |
*p++ = bin2bcd[pos[9]]; // M (abs) |
778 |
< |
*p++ = bin2bcd[pos[10]]; // S (abs) |
779 |
< |
*p++ = bin2bcd[pos[11]]; // F (abs) |
775 |
> |
p++; |
776 |
> |
WriteMacInt8(p, info->play_mode); p++; |
777 |
> |
WriteMacInt8(p, pos[5] & 0x0f); p++; // Control |
778 |
> |
WriteMacInt8(p, bin2bcd[pos[9]]); p++; // M (abs) |
779 |
> |
WriteMacInt8(p, bin2bcd[pos[10]]); p++; // S (abs) |
780 |
> |
WriteMacInt8(p, bin2bcd[pos[11]]); p++; // F (abs) |
781 |
|
return noErr; |
782 |
|
} |
783 |
|
|
925 |
|
// Drive-specific codes |
926 |
|
switch (code) { |
927 |
|
case 8: // DriveStatus |
928 |
< |
memcpy(Mac2HostAddr(pb + csParam), Mac2HostAddr(info->status), 22); |
928 |
> |
Mac2Mac_memcpy(pb + csParam, info->status, 22); |
929 |
|
return noErr; |
930 |
|
|
931 |
|
case 70: // GetPowerMode |