Skip to content

Commit

Permalink
Infer boot order if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Aug 26, 2023
1 parent eaae139 commit ab0227d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ <h4>Debugger</h4>
<td><label for="boot_order">Boot order</label></td>
<td>
<select id="boot_order">
<option value="0">Auto</option>
<option value="213">CD / Floppy / Hard Disk</option>
<option value="123">CD / Hard Disk / Floppy</option>
<option value="231">Floppy / CD / Hard Disk</option>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ <h4>Setup</h4>
<td><label for="boot_order">Boot order</label></td>
<td>
<select id="boot_order">
<option value="0">Auto</option>
<option value="213">CD / Floppy / Hard Disk</option>
<option value="123">CD / Hard Disk / Floppy</option>
<option value="231">Floppy / CD / Hard Disk</option>
Expand Down
2 changes: 0 additions & 2 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@
size: 8 * 1024 * 1024,
async: false,
},
boot_order: 0x132,
name: "MS-DOS",
},
{
Expand Down Expand Up @@ -605,7 +604,6 @@
fixed_chunk_size: 256 * 1024,
use_parts: !ON_LOCALHOST,
},
boot_order: 0x132,
name: "Windows 2000",
},
{
Expand Down
7 changes: 6 additions & 1 deletion src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,17 @@ V86Starter.prototype.continue_init = async function(emulator, options)
"cdrom": undefined,
};

const boot_order =
options["boot_order"] ? options["boot_order"] :
options["fda"] ? BOOT_ORDER_FD_FIRST :
options["hda"] ? BOOT_ORDER_HD_FIRST : BOOT_ORDER_CD_FIRST;

settings.acpi = options["acpi"];
settings.load_devices = true;
settings.log_level = options["log_level"];
settings.memory_size = options["memory_size"] || 64 * 1024 * 1024;
settings.vga_memory_size = options["vga_memory_size"] || 8 * 1024 * 1024;
settings.boot_order = options["boot_order"] || 0x213;
settings.boot_order = boot_order;
settings.fastboot = options["fastboot"] || false;
settings.fda = undefined;
settings.fdb = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/cpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ CPU.prototype.load_multiboot = function(buffer)

CPU.prototype.fill_cmos = function(rtc, settings)
{
var boot_order = settings.boot_order || 0x213;
var boot_order = settings.boot_order || BOOT_ORDER_CD_FIRST;

// Used by seabios to determine the boot order
// Nibble
Expand Down
4 changes: 4 additions & 0 deletions src/rtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
/** @const */ var CMOS_MEM_HIGHMEM_HIGH = 0x5d;
/** @const */ var CMOS_BIOS_SMP_COUNT = 0x5f;

// see CPU.prototype.fill_cmos
const BOOT_ORDER_CD_FIRST = 0x123;
const BOOT_ORDER_HD_FIRST = 0x312;
const BOOT_ORDER_FD_FIRST = 0x321;

/**
* RTC (real time clock) and CMOS
Expand Down

0 comments on commit ab0227d

Please sign in to comment.