| 1694 | } |
| 1695 | |
| 1696 | u8 cdvdRead(u8 key) |
| 1697 | { |
| 1698 | switch (key) |
| 1699 | { |
| 1700 | case 0x04: // NCOMMAND |
| 1701 | CDVD_LOG("cdvdRead04(NCMD) %x", cdvd.nCommand); |
| 1702 | return cdvd.nCommand; |
| 1703 | |
| 1704 | case 0x05: // N-READY |
| 1705 | CDVD_LOG("cdvdRead05(NReady) %x", cdvd.Ready); |
| 1706 | return cdvd.Ready; |
| 1707 | |
| 1708 | case 0x06: // ERROR |
| 1709 | { |
| 1710 | CDVD_LOG("cdvdRead06(Error) %x", cdvd.Error); |
| 1711 | const u8 ret = cdvd.Error; |
| 1712 | cdvd.Error = 0; |
| 1713 | return ret; |
| 1714 | } |
| 1715 | case 0x07: // BREAK |
| 1716 | CDVD_LOG("cdvdRead07(Break) %x", 0); |
| 1717 | return 0; |
| 1718 | |
| 1719 | case 0x08: // INTR_STAT |
| 1720 | CDVD_LOG("cdvdRead08(IntrReason) %x", cdvd.IntrStat); |
| 1721 | return cdvd.IntrStat; |
| 1722 | |
| 1723 | case 0x0A: // STATUS |
| 1724 | CDVD_LOG("cdvdRead0A(Status) %x", cdvd.Status); |
| 1725 | return cdvd.Status; |
| 1726 | |
| 1727 | case 0x0B: // STATUS STICKY |
| 1728 | { |
| 1729 | CDVD_LOG("cdvdRead0B(Status Sticky): %x", cdvd.StatusSticky); |
| 1730 | return cdvd.StatusSticky; |
| 1731 | } |
| 1732 | case 0x0C: // CRT MINUTE |
| 1733 | CDVD_LOG("cdvdRead0C(Min) %x", itob((u8)(cdvd.CurrentSector / (60 * 75)))); |
| 1734 | return itob((u8)(cdvd.CurrentSector / (60 * 75))); |
| 1735 | |
| 1736 | case 0x0D: // CRT SECOND |
| 1737 | CDVD_LOG("cdvdRead0D(Sec) %x", itob((u8)((cdvd.CurrentSector / 75) % 60) + 2)); |
| 1738 | return itob((u8)((cdvd.CurrentSector / 75) % 60) + 2); |
| 1739 | |
| 1740 | case 0x0E: // CRT FRAME |
| 1741 | CDVD_LOG("cdvdRead0E(Frame) %x", itob((u8)(cdvd.CurrentSector % 75))); |
| 1742 | return itob((u8)(cdvd.CurrentSector % 75)); |
| 1743 | |
| 1744 | case 0x0F: // TYPE |
| 1745 | if (cdvd.Tray.trayState == CDVD_DISC_ENGAGED) |
| 1746 | { |
| 1747 | CDVD_LOG("cdvdRead0F(Disc Type) Engaged %x", cdvd.DiscType); |
| 1748 | return cdvd.DiscType; |
| 1749 | } |
| 1750 | else |
| 1751 | { |
| 1752 | CDVD_LOG("cdvdRead0F(Disc Type) Detecting %x", (cdvd.Tray.trayState <= CDVD_DISC_SEEKING) ? cdvdTrayStateDetecting() : 0); |
| 1753 | return (cdvd.Tray.trayState <= CDVD_DISC_SEEKING) ? cdvdTrayStateDetecting() : 0; // Detecting Disc / No Disc |
no test coverage detected