From 55b8990396ead0f9af69d246c651a7a6e1abc023 Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Sat, 23 Mar 2024 13:04:11 -0700 Subject: [PATCH] INT 13 extensions: Function 42h needs to update the block transfer count in the packet if the read fails at any point --- src/ints/bios_disk.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index 675848ef07..8ddedc28ee 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -2233,18 +2233,18 @@ static Bitu INT13_DiskHandler(void) { segat = dap.seg; bufptr = dap.off; for(i=0;i= 2048, "not big enough" ); - diskio_delay(512); - if (killRead || !src_drive->ReadSectorsHost(sectbuf, false, dap.sector+i, 1)) { - // TODO: According to RBIL this should update the number of blocks field to what was successfully transferred - LOG_MSG("Error in CDROM read"); - killRead = false; - reg_ah = 0x04; - CALLBACK_SCF(true); - return CBRET_NONE; - } + static_assert( sizeof(sectbuf) >= 2048, "not big enough" ); + diskio_delay(512); + if (killRead || !src_drive->ReadSectorsHost(sectbuf, false, dap.sector+i, 1)) { + real_writew(SegValue(ds),reg_si+2,i); // According to RBIL this should update the number of blocks field to what was successfully transferred + LOG_MSG("Error in CDROM read"); + killRead = false; + reg_ah = 0x04; + CALLBACK_SCF(true); + return CBRET_NONE; + } - for(t=0;t<2048;t++) { + for(t=0;t<2048;t++) { real_writeb(segat,bufptr,sectbuf[t]); bufptr++; } @@ -2281,7 +2281,7 @@ static Bitu INT13_DiskHandler(void) { IDE_EmuINT13DiskReadByBIOS_LBA(reg_dl,dap.sector+i); if((last_status != 0x00) || killRead) { - // TODO: According to RBIL this should update the number of blocks field to what was successfully transferred + real_writew(SegValue(ds),reg_si+2,i); // According to RBIL this should update the number of blocks field to what was successfully transferred LOG_MSG("Error in disk read"); killRead = false; reg_ah = 0x04;