summaryrefslogtreecommitdiff
path: root/payloads/libpayload/curses/PDCurses/dos/pdcutil.c
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-11-10 09:00:41 -0800
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-11-11 21:38:48 +0100
commit4f85a1eb76d1e7109bcc60ba6f3262a5654ac61b (patch)
treee996818c6aa6b6f702a6c805c447c20724eff265 /payloads/libpayload/curses/PDCurses/dos/pdcutil.c
parent2ea24dabd658b8396e0abf79318a538ef0f3a5b8 (diff)
libpayload: Rename PDCurses-3.4 to PDCurses
Change-Id: If881ec130833c7e7e62caa3d31e350a531f5bc8e Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/12398 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/curses/PDCurses/dos/pdcutil.c')
-rw-r--r--payloads/libpayload/curses/PDCurses/dos/pdcutil.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/payloads/libpayload/curses/PDCurses/dos/pdcutil.c b/payloads/libpayload/curses/PDCurses/dos/pdcutil.c
new file mode 100644
index 0000000000..b209352a39
--- /dev/null
+++ b/payloads/libpayload/curses/PDCurses/dos/pdcutil.c
@@ -0,0 +1,105 @@
+/* Public Domain Curses */
+
+#include "pdcdos.h"
+
+RCSID("$Id: pdcutil.c,v 1.24 2008/07/13 16:08:17 wmcbrine Exp $")
+
+void PDC_beep(void)
+{
+ PDCREGS regs;
+
+ PDC_LOG(("PDC_beep() - called\n"));
+
+ regs.W.ax = 0x0e07; /* Write ^G in TTY fashion */
+ regs.W.bx = 0;
+ PDCINT(0x10, regs);
+}
+
+void PDC_napms(int ms)
+{
+ PDCREGS regs;
+ long goal, start, current;
+
+ PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
+
+ goal = DIVROUND((long)ms, 50);
+ if (!goal)
+ goal++;
+
+ start = getdosmemdword(0x46c);
+
+ goal += start;
+
+ while (goal > (current = getdosmemdword(0x46c)))
+ {
+ if (current < start) /* in case of midnight reset */
+ return;
+
+ regs.W.ax = 0x1680;
+ PDCINT(0x2f, regs);
+ PDCINT(0x28, regs);
+ }
+}
+
+const char *PDC_sysname(void)
+{
+ return "DOS";
+}
+
+#ifdef __DJGPP__
+
+unsigned char getdosmembyte(int offset)
+{
+ unsigned char b;
+
+ dosmemget(offset, sizeof(unsigned char), &b);
+ return b;
+}
+
+unsigned short getdosmemword(int offset)
+{
+ unsigned short w;
+
+ dosmemget(offset, sizeof(unsigned short), &w);
+ return w;
+}
+
+unsigned long getdosmemdword(int offset)
+{
+ unsigned long dw;
+
+ dosmemget(offset, sizeof(unsigned long), &dw);
+ return dw;
+}
+
+void setdosmembyte(int offset, unsigned char b)
+{
+ dosmemput(&b, sizeof(unsigned char), offset);
+}
+
+void setdosmemword(int offset, unsigned short w)
+{
+ dosmemput(&w, sizeof(unsigned short), offset);
+}
+
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+
+void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs)
+{
+ union REGPACK regs = {0};
+
+ rmregs->w.ss = 0;
+ rmregs->w.sp = 0;
+ rmregs->w.flags = 0;
+
+ regs.w.ax = 0x300;
+ regs.h.bl = vector;
+ regs.x.edi = FP_OFF(rmregs);
+ regs.x.es = FP_SEG(rmregs);
+
+ intr(0x31, &regs);
+}
+
+#endif