FreeBASIC  0.91.0
fb_dos.h
Go to the documentation of this file.
1 #define FBCALL
2 
3 /* newline for console/file I/O */
4 #define FB_NEWLINE "\r\n"
5 #define FB_NEWLINE_WSTR _LC("\r\n")
6 
7 /* newline for printer I/O */
8 #define FB_BINARY_NEWLINE "\r\n"
9 #define FB_BINARY_NEWLINE_WSTR _LC("\r\n")
10 
11 #define FB_LL_FMTMOD "ll"
12 
13 #define FB_CONSOLE_MAXPAGES 8
14 
15 #define FB_DYLIB void*
16 
17 /* In DJGPP we don't use fseeko() at all, the DJGPP semi-2.04 setup used for
18  FB doesn't even seem to have it. */
19 typedef long fb_off_t;
20 #define fseeko(stream, offset, whence) fseek(stream, offset, whence)
21 #define ftello(stream) ftell(stream)
22 
23 #define FB_COLOR_BLACK (0)
24 #define FB_COLOR_BLUE (1)
25 #define FB_COLOR_GREEN (2)
26 #define FB_COLOR_CYAN (3)
27 #define FB_COLOR_RED (4)
28 #define FB_COLOR_MAGENTA (5)
29 #define FB_COLOR_BROWN (6)
30 #define FB_COLOR_WHITE (7)
31 #define FB_COLOR_GREY (8)
32 #define FB_COLOR_LBLUE (9)
33 #define FB_COLOR_LGREEN (10)
34 #define FB_COLOR_LCYAN (11)
35 #define FB_COLOR_LRED (12)
36 #define FB_COLOR_LMAGENTA (13)
37 #define FB_COLOR_YELLOW (14)
38 #define FB_COLOR_BWHITE (15)
39 
40 typedef struct {
41  unsigned long edi;
42  unsigned long esi;
43  unsigned long ebp;
44  unsigned long res;
45  unsigned long ebx;
46  unsigned long edx;
47  unsigned long ecx;
48  unsigned long eax;
50 
51 extern char *__fb_startup_cwd;
52 
53 typedef int (*FnIntHandler)(unsigned irq_number);
54 
55 unsigned long fb_hGetPageAddr( int pg, int cols, int rows );
56 int fb_isr_set( unsigned irq_number,
57  FnIntHandler pfnIntHandler,
58  size_t fn_size,
59  size_t stack_size );
60 int fb_isr_reset( unsigned irq_number );
61 FnIntHandler fb_isr_get( unsigned irq_number );
62 /* To allow recursive CLI/STI */
63 int fb_dos_cli( void );
64 int fb_dos_sti( void );
65 int fb_dos_lock_data(const void *address, size_t size);
66 int fb_dos_lock_code(const void *address, size_t size);
67 int fb_dos_unlock_data(const void *address, size_t size);
68 int fb_dos_unlock_code(const void *address, size_t size);
69 
70 #define lock_var(var) fb_dos_lock_data( (void *)&(var), sizeof(var) )
71 #define lock_array(array) fb_dos_lock_data( (void *)(array), sizeof(array) )
72 #define lock_proc(proc) fb_dos_lock_code( proc, (unsigned) end_##proc - (unsigned) proc )
73 #define lock_data(start, end) fb_dos_lock_data( (&start), (const char *)(&end) - (const char *)(&start) )
74 #define lock_code(start, end) fb_dos_lock_code( (start), (const char *)(end) - (const char *)(start) )
75 
76 #define unlock_var(var) fb_dos_unlock_data( (void *)&(var), sizeof(var) )
77 #define unlock_array(array) fb_dos_unlock_data( (void *)(array), sizeof(array) )
78 #define unlock_proc(proc) fb_dos_unlock_code( proc, (unsigned) end_##proc - (unsigned) proc )
79 #define unlock_data(start, end) fb_dos_unlock_data( (&start), (const char *)(&end) - (const char *)(&start) )
80 #define unlock_code(start, end) fb_dos_unlock_code( (start), (const char *)(end) - (const char *)(start) )
81 
82 /* multikey() declarations also used by gfxlib2 */
83 #define END_OF_FUNCTION(proc) void end_##proc (void) { }
84 #define END_OF_STATIC_FUNCTION(proc) static void end_##proc (void) { }
85 void (*__fb_dos_multikey_hook)(int scancode, int flags);
86 #define KB_PRESS 0x00000001
87 #define KB_REPEAT 0x00000002
88 #define KB_SHIFT 0x00000004
89 #define KB_CTRL 0x00000008
90 #define KB_ALT 0x00000010
91 #define KB_CAPSLOCK 0x00000020
92 #define KB_NUMLOCK 0x00000040
93 #define KB_EXTENDED 0x00000080
94 
95 void fb_hFarMemSet ( unsigned short selector, unsigned long dest, unsigned char char_to_set, size_t bytes );
96 void fb_hFarMemSetW( unsigned short selector, unsigned long dest, unsigned short word_to_set, size_t words );