updates to boot source selection process

this is i suppose a fairly subjective change, but basically:
- i did not like the timeout to default selection at all. possibly i
  might want to make it so that the timeout is disabled only when the
  "boot from ram" dip switch is enabled?
- i wanted a bit more feedback from the UI when keys are hit, even if
  there is no valid boot source. kind of reassuring to know that things
  are working, even if there's nothing to boot from.
- having the ability to manually trigger a boot source detection
  refresh (even if it is, for now, implemented in a slightly-hacky way
  by just resetting the device) is really nice

i also didn't like that after you made a selection, it either worked
and booted from whatever you picked, or it told you "no bootable device
is present" and then just blocked at that point, forcing you to reset
manually. calling `boot_from` inside the while-loop seems nicer to me
just in case you fat-finger the boot device and choose an invalid one.
This commit is contained in:
Gered 2025-02-02 16:49:36 -05:00
parent 337da365c0
commit e45a899c43

View file

@ -25,6 +25,7 @@
#include "vicky_general.h"
#include "rsrc/sprites/boot_sprites.h"
#include "rsrc/tiles/boot_tiles.h"
#include "syscalls.h"
#include <stdio.h>
#include <string.h>
@ -562,34 +563,36 @@ void boot_screen() {
}
}
sprintf(message, "\nPress \e[93mSPACE\e[37m to boot from default source.\n");
sprintf(message, "\nPress \e[93mSPACE\e[37m to boot from default source.\nPress \e[93m<=\e[37m to rescan for boot sources.\n");
chan_write(0, (uint8_t *)message, strlen(message));
// Give the user time to press a key to select a boot source
// If the time expires, boot the default source (earliest in the boot chain)
// Let the user select a boot source
jiffies_target = timers_jiffies() + 60 * 15;
while (jiffies_target > timers_jiffies()) {
while (true) {
unsigned short scancode = kbd_get_scancode();
if (scancode > 0) {
if (scancode == 1) {
printf("Rebooting ...\n");
sys_reboot();
}
short selected = sc_to_function(scancode);
if (selected == 0x20) {
printf("Booting from default ...\n");
// SPACE was pressed... just boot the default
break;
boot_from(boot_source, boot_record[0]);
} else if (selected > 0) {
printf("Booting from %d ...\n", selected);
if (bootable[selected - 1]) {
boot_position = selected - 1;
boot_source = boot_chain[boot_position];
break;
boot_from(boot_source, boot_record[boot_position]);
} else {
printf("Nothing bootable at device %d.\n", selected);
}
}
}
}
// And launch the system
boot_from(boot_source, boot_record[boot_position]);
}