Skip to content

Commit

Permalink
tweaks to ordering in initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeOsborn committed Sep 1, 2023
1 parent 2ce5d16 commit 60a2f9d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
21 changes: 21 additions & 0 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,27 @@
},
name: "FreeDOS",
},
{
id: "freedos13",
hda: {
url: host + "freedos13.img",
async: true,
},
wants_cdrom: true,
name: "FreeDOS 13",
},
{
id: "freedos13-with-cd",
hda: {
url: host + "freedos13.img",
async: true,
},
cdrom: {
url: host + "FD13LIVE.iso",
async: true
},
name: "FreeDOS 13 (with CD)",
},
{
id: "psychdos",
hda: {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ V86Starter.prototype.set_cdrom = async function(file)
*/
V86Starter.prototype.eject_cdrom = function()
{
this.v86.cpu.devices.cdrom.master.eject_cdrom();
this.v86.cpu.devices.cdrom.master.eject();
};

/**
Expand Down
14 changes: 9 additions & 5 deletions src/ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,6 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
/** @type {number} */
this.cylinder_count = 0;

if(buffer)
{
this.set_cdrom(buffer);
}

/** @const */
this.stats = {
sectors_read: 0,
Expand Down Expand Up @@ -554,6 +549,11 @@ function IDEInterface(device, cpu, buffer, is_cd, device_nr, interface_nr, bus)
this.in_progress_io_ids = new Set();
this.cancelled_io_ids = new Set();

if(buffer)
{
this.set_cdrom(buffer);
}

Object.seal(this);
}

Expand All @@ -564,6 +564,7 @@ IDEInterface.prototype.eject = function()
{
this.status = 0x59;
this.error = 0x60;
this.push_irq();
}
}

Expand Down Expand Up @@ -633,6 +634,9 @@ IDEInterface.prototype.set_cdrom = function(buffer)
rtc.cmos_write(reg + 8, this.sectors_per_track & 0xFF);
//rtc.cmos_write(CMOS_BIOS_DISKTRANSFLAG,
// rtc.cmos_read(CMOS_BIOS_DISKTRANSFLAG) | 1 << (nr * 4 + 2)
if(this.device.cpu) {
this.push_irq();
}
}
}

Expand Down

0 comments on commit 60a2f9d

Please sign in to comment.