cebix / macemu

Basilisk II and SheepShaver Macintosh emulators
1.38k stars 288 forks source link

SheepShaver with NewWorld ROM doesn't boot from CD when specified by bootdriver pref #224

Open rakslice opened 3 years ago

rakslice commented 3 years ago

In a configuration with both a valid bootable disk image via the disk pref and a bootable cdrom (disc autodetected by platform-specific SysAddCDROMPrefs() or file/device specified using cdrom pref), setting the bootdriver pref to the value of CDROMRefNum (-62) is expected to cause B2 and SS to boot from the cdrom instead of the disk. This is what GUIs with an auto/cdrom dropdown use to provide it.

SS puts this setting into XPRAM offset 0x137a, a location that is also updated in the expected way when the startup disk is changed using the Startup Disk control panel. While the PRAM setting works in SheepShaver with any 'old world' ROM and in BasiliskII, in SS with NewWorld ROM the setting has no effect -- the system still boots from the disk volume.

What is the nature of the boot process in NewWorld ROM that SS uses? Is there some internal mechanism that normally provides Startup Disk steering between the OF stuff that SS obviously doesn't implement and whatever part of the ROM we're still running in SS, that we could hook into?

This was first mentioned by @cat7 over at https://github.com/kanjitalk755/macemu/issues/55, but I figure it needs more eyeballs from those who know anything about NewWorld ROM internals.

rakslice commented 3 years ago

As a workaround I just had SS reorder the drive queue itself during the CD-ROM driver Open. https://github.com/rakslice/macemu/commit/561f1dfcde9105e8368cbbc420f0ae8a58393a11

Investigating that further it seems that the name registry's /chosen bootpath property is the mechanism that OF uses to tell the Mac ROM what startup device it has selected, but it would be the path to another device node in the name registry, and I don't know if it's possible to create a device node that would lead the ROM to an already loaded 68k disk driver.

The impression I get from "Designing PCI Cards and Drivers for Power Macintosh Computers" is that the name registry was created to be the configuration mechanism for PCI devices, and PCI devices require "native" (PPC) drivers in their scheme, so maybe it just has no facility to even load a 68K driver directly.