From e1610ff1a957a812c7b282730f0d2b98fc92b58e Mon Sep 17 00:00:00 2001 From: Christian Schnell Date: Fri, 23 May 2025 16:54:24 +0200 Subject: [PATCH] abort any ATA READ command called on ejected device (W95) --- src/ide.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ide.js b/src/ide.js index 413ab30f..12b03936 100644 --- a/src/ide.js +++ b/src/ide.js @@ -1856,7 +1856,14 @@ IDEInterface.prototype.ata_read_sectors = function(cmd) " lbacount=" + h(count) + " bytecount=" + h(byte_count), LOG_DISK); - if(start + byte_count > this.buffer.byteLength) + if(!this.buffer) + { + // TODO: Windows 95 treats our (empty) CD-ROM device as an ATA device, maybe a driver issue? + this.error_reg = ATA_ER_ABRT; + this.status_reg = ATA_SR_DRDY|ATA_SR_ERR; + this.push_irq(); + } + else if(start + byte_count > this.buffer.byteLength) { dbg_assert(false, this.name + ": ATA read: Outside of disk", LOG_DISK);