| 1904 | } |
| 1905 | |
| 1906 | static void cdvdWrite04(u8 rt) |
| 1907 | { // NCOMMAND |
| 1908 | CDVD_LOG("cdvdWrite04: NCMD %s (%x) (ParamP = %x)", nCmdName[rt], rt, cdvd.NCMDParamPos); |
| 1909 | |
| 1910 | if (!(cdvd.Ready & CDVD_DRIVE_READY)) |
| 1911 | { |
| 1912 | DevCon.Warning("CDVD: Error drive not ready on command issue"); |
| 1913 | cdvd.Error = 0x13; // Not Ready |
| 1914 | cdvd.Ready |= CDVD_DRIVE_ERROR; |
| 1915 | cdvdSetIrq(); |
| 1916 | cdvd.NCMDParamPos = 0; |
| 1917 | cdvd.NCMDParamCnt = 0; |
| 1918 | return; |
| 1919 | } |
| 1920 | |
| 1921 | cdvd.nCommand = rt; |
| 1922 | cdvd.AbortRequested = false; |
| 1923 | |
| 1924 | if (!cdvdCommandErrorHandler()) |
| 1925 | { |
| 1926 | cdvd.NCMDParamPos = 0; |
| 1927 | cdvd.NCMDParamCnt = 0; |
| 1928 | return; |
| 1929 | } |
| 1930 | |
| 1931 | switch (rt) |
| 1932 | { |
| 1933 | case N_CD_NOP: // CdNop_ |
| 1934 | cdvdUpdateReady(CDVD_DRIVE_READY); |
| 1935 | cdvdSetIrq(); |
| 1936 | break; |
| 1937 | case N_CD_RESET: // CdSync |
| 1938 | Console.WriteLn("CDVD: Reset NCommand"); |
| 1939 | cdvdUpdateReady(CDVD_DRIVE_READY); |
| 1940 | cdvd.SCMDParamPos = 0; |
| 1941 | cdvd.SCMDParamCnt = 0; |
| 1942 | cdvdUpdateStatus(CDVD_STATUS_STOP); |
| 1943 | cdvd.Spinning = false; |
| 1944 | std::memset(&cdvd.SCMDResultBuff[0], 0, sizeof(cdvd.SCMDResultBuff)); |
| 1945 | cdvdSetIrq(); |
| 1946 | break; |
| 1947 | |
| 1948 | case N_CD_STANDBY: // CdStandby |
| 1949 | |
| 1950 | // Seek to sector zero. The cdvdStartSeek function will simulate |
| 1951 | // spinup times if needed. |
| 1952 | DevCon.Warning("CdStandby : %d", rt); |
| 1953 | CDVD_INT(cdvdStartSeek(0, static_cast<CDVD_MODE_TYPE>(cdvdIsDVD()), false)); |
| 1954 | // Might not seek, but makes sense since it does move to the inner most track |
| 1955 | // It's only temporary until the interrupt anyway when it sets itself ready |
| 1956 | cdvdUpdateStatus(CDVD_STATUS_SEEK); |
| 1957 | cdvd.Action = cdvdAction_Standby; |
| 1958 | break; |
| 1959 | |
| 1960 | case N_CD_STOP: // CdStop |
| 1961 | DevCon.Warning("CdStop : %d", rt); |
| 1962 | cdvdUpdateReady(CDVD_DRIVE_BUSY); |
| 1963 | CDVDCancelReadAhead(); |
no test coverage detected