Skip to content

Commit

Permalink
set proper default sector count for cdrom
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeOsborn committed Aug 22, 2023
1 parent 2a8f6db commit 48749a8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
this.sector_count = 0;

/** @type {number} */
this.head_count = this.is_atapi ? 1 : 0;
this.head_count = 0;

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

if(!is_cd)
if(is_cd)
{
// default values: 1/2048
this.head_count = 1;
this.sectors_per_track = 2048;
}
else
{
// "default" values: 16/63
// common: 255, 63
Expand All @@ -510,6 +516,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
//{
// this.cylinder_count = 16383;
//}

var rtc = cpu.devices.rtc;
// master
rtc.cmos_write(CMOS_BIOS_DISKTRANSFLAG,
Expand All @@ -527,6 +534,7 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
rtc.cmos_write(reg + 7, this.cylinder_count >> 8 & 0xFF);
//rtc.cmos_write(CMOS_BIOS_DISKTRANSFLAG,
// rtc.cmos_read(CMOS_BIOS_DISKTRANSFLAG) | 1 << (nr * 4 + 2)

}

/** @const */
Expand Down

0 comments on commit 48749a8

Please sign in to comment.