TJ
2009-Mar-30 19:08 UTC
[syslinux] [PATCH] mbr: Ctrl-key press forces load from first hard disk
--- mbr/mbr.S | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/mbr/mbr.S b/mbr/mbr.S index 722d90d..e22c840 100644 --- a/mbr/mbr.S +++ b/mbr/mbr.S @@ -51,6 +51,7 @@ _start: movw %ax, %ss movw $stack, %sp movw %sp, %si + movw %sp, %bp /* needed later if drive number is to be forced due to Ctrl key being pressed */ pushw %es /* es:di -> $PnP header */ pushw %di pushw %dx /* dl -> drive number */ @@ -66,7 +67,18 @@ _start: ljmpw $0, $next next: + /* Provide a way for the user to force boot from first hard-disk by pressing a Ctrl key */ +get_shift_keys: + movb $0x02, %ah /* function: get keyboard shift flags */ + int $0x16 /* read keys; shift flags returned in AL */ + testb $0x04, %al /* control key pressed? */ + jz detect_bios_type +force_first_hard_disk: + movb $0x80, -6(%bp) /* offset from top-of-stack to drive number; force it to be first hard disk */ + +detect_bios_type: /* Check to see if we have EBIOS */ + movw (driveno), %dx pushw %dx /* drive number */ movb $0x41, %ah /* %al == 0 already */ movw $0x55aa, %bx -- 1.6.0.4