drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / dos / pdcutil.c
blobb209352a39a5a892d9b2cadfa9a3e8de6ab11b21
1 /* Public Domain Curses */
3 #include "pdcdos.h"
5 RCSID("$Id: pdcutil.c,v 1.24 2008/07/13 16:08:17 wmcbrine Exp $")
7 void PDC_beep(void)
9 PDCREGS regs;
11 PDC_LOG(("PDC_beep() - called\n"));
13 regs.W.ax = 0x0e07; /* Write ^G in TTY fashion */
14 regs.W.bx = 0;
15 PDCINT(0x10, regs);
18 void PDC_napms(int ms)
20 PDCREGS regs;
21 long goal, start, current;
23 PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
25 goal = DIVROUND((long)ms, 50);
26 if (!goal)
27 goal++;
29 start = getdosmemdword(0x46c);
31 goal += start;
33 while (goal > (current = getdosmemdword(0x46c)))
35 if (current < start) /* in case of midnight reset */
36 return;
38 regs.W.ax = 0x1680;
39 PDCINT(0x2f, regs);
40 PDCINT(0x28, regs);
44 const char *PDC_sysname(void)
46 return "DOS";
49 #ifdef __DJGPP__
51 unsigned char getdosmembyte(int offset)
53 unsigned char b;
55 dosmemget(offset, sizeof(unsigned char), &b);
56 return b;
59 unsigned short getdosmemword(int offset)
61 unsigned short w;
63 dosmemget(offset, sizeof(unsigned short), &w);
64 return w;
67 unsigned long getdosmemdword(int offset)
69 unsigned long dw;
71 dosmemget(offset, sizeof(unsigned long), &dw);
72 return dw;
75 void setdosmembyte(int offset, unsigned char b)
77 dosmemput(&b, sizeof(unsigned char), offset);
80 void setdosmemword(int offset, unsigned short w)
82 dosmemput(&w, sizeof(unsigned short), offset);
85 #endif
87 #if defined(__WATCOMC__) && defined(__386__)
89 void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs)
91 union REGPACK regs = {0};
93 rmregs->w.ss = 0;
94 rmregs->w.sp = 0;
95 rmregs->w.flags = 0;
97 regs.w.ax = 0x300;
98 regs.h.bl = vector;
99 regs.x.edi = FP_OFF(rmregs);
100 regs.x.es = FP_SEG(rmregs);
102 intr(0x31, &regs);
105 #endif