3 /* The primary purpose of this function is to provide CONSOLE_*
4 reotines that immediately call the appropiate driver handler.
5 This cleans up code in the individual modules considerably.
6 This could be done using a macro, but additional functionality
7 may be provided here in the future. */
13 void CONSOLE_Write(char out
, int fg_color
, int bg_color
, int attribute
)
17 driver
.write(out
, fg_color
, bg_color
, attribute
);
18 if (!driver
.norefresh
)
25 /* Eventually, this will be a command-line choice */
43 void CONSOLE_MoveCursor(char row
, char col
)
45 if (driver
.moveCursor
)
47 driver
.moveCursor(row
, col
);
48 if (!driver
.norefresh
)
53 void CONSOLE_ClearWindow(char row1
, char col1
, char row2
, char col2
,
54 int bg_color
, int attribute
)
56 if (driver
.clearWindow
)
58 driver
.clearWindow(row1
, col1
, row2
, col2
, bg_color
, attribute
);
59 if (!driver
.norefresh
)
64 void CONSOLE_ScrollUpWindow(char row1
, char col1
, char row2
, char col2
,
65 char lines
, int bg_color
, int attribute
)
67 if (driver
.scrollUpWindow
)
69 driver
.scrollUpWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,
71 if (!driver
.norefresh
)
76 void CONSOLE_ScrollDownWindow(char row1
, char col1
, char row2
, char col2
,
77 char lines
, int bg_color
, int attribute
)
79 if (driver
.scrollDownWindow
)
81 driver
.scrollDownWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,
83 if (!driver
.norefresh
)
88 int CONSOLE_CheckForKeystroke(char *scan
, char *ascii
)
89 /* These functions need to go through a conversion layer. Scancodes
90 should *not* be determined by the driver, rather they should have
91 a conv_* function in int16.c. Yuck. */
93 if (driver
.checkForKeystroke
)
94 return driver
.checkForKeystroke(scan
, ascii
);
99 void CONSOLE_GetKeystroke(char *scan
, char *ascii
)
101 if (driver
.getKeystroke
)
102 return driver
.getKeystroke(scan
, ascii
);
105 void CONSOLE_GetCursorPosition(char *row
, char *col
)
107 if (driver
.getCursorPosition
)
108 return driver
.getCursorPosition(row
, col
);
111 void CONSOLE_GetCharacterAtCursor(char *ch
, int *fg
, int *bg
, int *a
)
113 if (driver
.getCharacterAtCursor
)
114 return driver
.getCharacterAtCursor(ch
, fg
, bg
, a
);
117 void CONSOLE_Refresh()
120 return driver
.refresh();
123 /* This function is only at the CONSOLE level. */
124 /* Admittably, calling the variable norefresh might be a bit dumb...*/
125 void CONSOLE_SetRefresh(int setting
)
128 driver
.norefresh
= FALSE
;
130 driver
.norefresh
= TRUE
;
133 /* This function is only at the CONSOLE level. */
134 int CONSOLE_GetRefresh()
136 if (driver
.norefresh
)
142 void CONSOLE_ClearScreen()
144 if (driver
.clearScreen
)
145 return driver
.clearScreen();
148 char CONSOLE_GetCharacter()
150 /* I'm not sure if we need this really. This is a function that can be
151 accelerated that returns the next *non extended* keystroke */
152 if (driver
.getCharacter
)
153 return driver
.getCharacter();
155 return (char) 0; /* Sure, this will probably break programs... */