From 027214595514a6354dc6af128b6219ffb056bf06 Mon Sep 17 00:00:00 2001 From: krcroft Date: Wed, 5 Feb 2020 23:29:20 -0800 Subject: [PATCH] Make the MSCDEX Audio Disk Info return compliant track-ranges The specification says that legal track values range from 1 to 99, where as the prior code would return 0 if any issue was encountered. The spec has no allowance for issues in this function, and therefore we're bound to simply return 1 instead. --- src/dos/dos_mscdex.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 3daa9c9b..060f55d9 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -920,7 +920,16 @@ static Bit16u MSCDEX_IOCTL_Input(PhysPt buffer,Bit8u drive_unit) { break; case 0x0A : /* Get Audio Disk info */ Bit8u tr1,tr2; TMSF leadOut; - if (!mscdex->GetCDInfo(drive_unit,tr1,tr2,leadOut)) return 0x05; + if (!mscdex->GetCDInfo(drive_unit,tr1,tr2,leadOut)) { + // The MSCDEX spec says that tracks return values + // must be bounded inclusively between 1 and 99, so + // set acceptable defaults if GetCDInfo fails. + tr1 = 1; + tr2 = 1; + leadOut.min = 0; + leadOut.sec = 0; + leadOut.fr = 0; + } mem_writeb(buffer+1,tr1); mem_writeb(buffer+2,tr2); mem_writeb(buffer+3,leadOut.fr);