2 * PC/HW routine collection v1.4 for DOS/DJGPP
4 * Copyright (C) 2002 - Daniel Borca
5 * Email : dborca@yahoo.com
6 * Web : http://www.geocities.com/dborca
10 #ifndef PC_HW_H_included
11 #define PC_HW_H_included
22 #define SQR(x) ((x) * (x))
24 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
25 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
26 #define MID(x,y,z) MAX((x), MIN((y), (z)))
28 typedef void (*VFUNC
) (void);
29 typedef void (*PFUNC
) (void *);
30 typedef void (*MFUNC
) (int x
, int y
, int z
, int b
);
35 int pc_atexit (VFUNC f
);
36 int pc_clexit (VFUNC f
);
41 #define ENDOFUNC(x) static void x##_end() { }
42 #define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x)
43 #define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x))
44 #define LOCKBUFF(x, l) _go32_dpmi_lock_data((void *)x, l)
46 void *pc_malloc (size_t size
);
51 #define ENABLE() __asm __volatile ("sti")
52 #define DISABLE() __asm __volatile ("cli")
54 extern int pc_install_irq (int i
, int (*handler
) ());
55 extern int pc_remove_irq (int i
);
60 #define KB_SHIFT_FLAG 0x0001
61 #define KB_CTRL_FLAG 0x0002
62 #define KB_ALT_FLAG 0x0004
63 #define KB_LWIN_FLAG 0x0008
64 #define KB_RWIN_FLAG 0x0010
65 #define KB_MENU_FLAG 0x0020
66 #define KB_SCROLOCK_FLAG 0x0100
67 #define KB_NUMLOCK_FLAG 0x0200
68 #define KB_CAPSLOCK_FLAG 0x0400
69 #define KB_INALTSEQ_FLAG 0x0800
70 #define KB_ACCENT1_FLAG 0x1000
71 #define KB_ACCENT2_FLAG 0x2000
72 #define KB_ACCENT3_FLAG 0x4000
73 #define KB_ACCENT4_FLAG 0x8000
136 #define KEY_EQUALS 62
137 #define KEY_BACKSPACE 63
139 #define KEY_OPENBRACE 65
140 #define KEY_CLOSEBRACE 66
144 #define KEY_BACKSLASH 70
145 #define KEY_BACKSLASH2 71
150 #define KEY_INSERT 76
160 #define KEY_SLASH_PAD 86
161 #define KEY_ASTERISK 87
162 #define KEY_MINUS_PAD 88
163 #define KEY_PLUS_PAD 89
164 #define KEY_DEL_PAD 90
165 #define KEY_ENTER_PAD 91
166 #define KEY_PRTSCR 92
168 #define KEY_ABNT_C1 94
171 #define KEY_CONVERT 97
172 #define KEY_NOCONVERT 98
174 #define KEY_CIRCUMFLEX 100
175 #define KEY_COLON2 101
176 #define KEY_KANJI 102
178 #define KEY_MODIFIERS 103
180 #define KEY_LSHIFT 103
181 #define KEY_RSHIFT 104
182 #define KEY_LCONTROL 105
183 #define KEY_RCONTROL 106
185 #define KEY_ALTGR 108
189 #define KEY_SCRLOCK 112
190 #define KEY_NUMLOCK 113
191 #define KEY_CAPSLOCK 114
195 int pc_install_keyb (void);
196 void pc_remove_keyb (void);
197 int pc_keypressed (void);
198 int pc_readkey (void);
199 int pc_keydown (int code
);
200 int pc_keyshifts (void);
205 int pc_install_int (PFUNC func
, void *parm
, unsigned int freq
);
206 int pc_remove_int (int fid
);
207 int pc_adjust_int (int fid
, unsigned int freq
);
208 void pc_remove_timer (void);
213 int pc_install_mouse (void);
214 void pc_remove_mouse (void);
215 MFUNC
pc_install_mouse_handler (MFUNC handler
);
216 void pc_mouse_area (int x1
, int y1
, int x2
, int y2
);
217 void pc_mouse_speed (int xspeed
, int yspeed
);
218 int pc_query_mouse (int *x
, int *y
, int *z
);
219 void pc_warp_mouse (int x
, int y
);
222 * standard redirection
224 int pc_open_stdout (void);
225 int pc_open_stderr (void);
226 void pc_close_stdout (void);
227 void pc_close_stderr (void);