// Code to load disk image and start system boot.
//
-// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008-2013 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2002 MandrakeSoft S.A.
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
}
+/****************************************************************
+ * Keyboard calls
+ ****************************************************************/
+
+// See if a keystroke is pending in the keyboard buffer.
+static int
+check_for_keystroke(void)
+{
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.flags = F_IF|F_ZF;
+ br.ah = 1;
+ call16_int(0x16, &br);
+ return !(br.flags & F_ZF);
+}
+
+// Return a keystroke - waiting forever if necessary.
+static int
+get_raw_keystroke(void)
+{
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.flags = F_IF;
+ call16_int(0x16, &br);
+ return br.ah;
+}
+
+// Read a keystroke - waiting up to 'msec' milliseconds.
+static int
+get_keystroke(int msec)
+{
+ u32 end = irqtimer_calc(msec);
+ for (;;) {
+ if (check_for_keystroke())
+ return get_raw_keystroke();
+ if (irqtimer_check(end))
+ return -1;
+ yield_toirq();
+ }
+}
+
+
/****************************************************************
* Boot menu and BCV execution
****************************************************************/
while (end >= buf && *end <= ' ')
*(end--) = '\0';
}
-
-/****************************************************************
- * Keyboard calls
- ****************************************************************/
-
-// See if a keystroke is pending in the keyboard buffer.
-static int
-check_for_keystroke(void)
-{
- struct bregs br;
- memset(&br, 0, sizeof(br));
- br.flags = F_IF|F_ZF;
- br.ah = 1;
- call16_int(0x16, &br);
- return !(br.flags & F_ZF);
-}
-
-// Return a keystroke - waiting forever if necessary.
-static int
-get_raw_keystroke(void)
-{
- struct bregs br;
- memset(&br, 0, sizeof(br));
- br.flags = F_IF;
- call16_int(0x16, &br);
- return br.ah;
-}
-
-// Read a keystroke - waiting up to 'msec' milliseconds.
-int
-get_keystroke(int msec)
-{
- u32 end = irqtimer_calc(msec);
- for (;;) {
- if (check_for_keystroke())
- return get_raw_keystroke();
- if (irqtimer_check(end))
- return -1;
- yield_toirq();
- }
-}
char *strtcpy(char *dest, const char *src, size_t len);
char *strchr(const char *s, int c);
void nullTrailingSpace(char *buf);
-int get_keystroke(int msec);
// stacks.c
extern u8 ExtraStack[], *StackPos;