Skip to content

Commit 48749a8

Browse files
committed
set proper default sector count for cdrom
1 parent 2a8f6db commit 48749a8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ide.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
469469
this.sector_count = 0;
470470

471471
/** @type {number} */
472-
this.head_count = this.is_atapi ? 1 : 0;
472+
this.head_count = 0;
473473

474474
/** @type {number} */
475475
this.sectors_per_track = 0;
@@ -487,7 +487,13 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
487487
this.sector_count = Math.ceil(this.sector_count);
488488
}
489489

490-
if(!is_cd)
490+
if(is_cd)
491+
{
492+
// default values: 1/2048
493+
this.head_count = 1;
494+
this.sectors_per_track = 2048;
495+
}
496+
else
491497
{
492498
// "default" values: 16/63
493499
// common: 255, 63
@@ -510,6 +516,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
510516
//{
511517
// this.cylinder_count = 16383;
512518
//}
519+
513520
var rtc = cpu.devices.rtc;
514521
// master
515522
rtc.cmos_write(CMOS_BIOS_DISKTRANSFLAG,
@@ -527,6 +534,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
527534
rtc.cmos_write(reg + 7, this.cylinder_count >> 8 & 0xFF);
528535
//rtc.cmos_write(CMOS_BIOS_DISKTRANSFLAG,
529536
// rtc.cmos_read(CMOS_BIOS_DISKTRANSFLAG) | 1 << (nr * 4 + 2)
537+
530538
}
531539

532540
/** @const */

0 commit comments

Comments
 (0)