stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 57 forks source link

-autoboot doesn't boot a -disc or MMB if loaded #137

Closed richard-broadhurst closed 3 years ago

richard-broadhurst commented 3 years ago

I think that it used to work by "holding the shift down", but int autoboot seems to only count down now and not be connected to anything. I used to think that it would be neater to set the keyboard link/*CONFIGURE setting, but don't know how much work that would be.

richard-broadhurst commented 3 years ago

Locally, I have bbcmatrix[0][0] = autoboot = 150; whenever it was autoboot = 150; and bbcmatrix[0][0] = 0; when autoboot = 0; was set and autoboot was not already 0; I have also set autoboot = 0; whenever key_up/key_down is setting bbcmatrix[0][0]. I still think that setting the keyboard links and *CONFIGURE would be neater, but this was a quick hack that worked.

richard-broadhurst commented 3 years ago

The autoboot time of 150 can be annoyingly long if the !BOOT isn't present and DFS works from 15 up. I think it would also be better to automatically auto boot a .SSD etc if it is the only command line argument, even temporarily ejecting a .MMB etc if required as this is what I believe people would expect when double clicking a disc image. You can edit the registry on windows to auto boot, but I don't know if this is desirable in an installer. (Win7) HKEY_CLASSES_ROOT\Applications\B-em.exe\shell\open\command Name:"(Default)" Type:REG_SZ Data:"...\B-em.exe" -autoboot -disc "%1" -autoboot

SteveFosdick commented 3 years ago

I like your idea of changing the option is read by DFS. There is already a hook for reading keyboard options. It's not in the menu but kbdips in the config file allows the options to be set for a B/B+ so autoboot could be integrated with that.

SteveFosdick commented 3 years ago

So this does the trick for the B/B+:

bool key_is_down(void) {
    if (keyrow == 0 && keycol >= 2 && keycol <= 9) {
        if (keycol == 6 && autoboot > 0)
            return true;
        return kbdips & (1 << (9 - keycol));
    }
    else
        return bbcmatrix[keycol][keyrow];
}

this is in keyboard.c where a function of the same name exists. I will do the Master version and then push this to github.

SteveFosdick commented 3 years ago

Implementing autoboot via CMOS settings is now on the Master and Master Compact, see branch sf/issue137. This is merged to master in 7c380e32b94f34c0eb54fbad01590b3ae11b6684