20 static void store_cursor_position(
void)
34 if ((oreg.ch & 0x1f) > (oreg.cl & 0x1f))
38 static void store_video_mode(
void)
59 static void store_mode_params(
void)
69 store_cursor_position();
81 font_size = rdfs16(0x485);
111 }
else if ((key >=
'0' && key <=
'9') ||
112 (key >=
'A' && key <=
'Z') ||
113 (key >=
'a' && key <=
'z')) {
114 if (len <
sizeof entry_buf) {
115 entry_buf[len++] =
key;
119 }
while (key !=
'\r');
126 for (i = 0; i < len; i++) {
128 key = entry_buf[
i] | 0x20;
129 v += (key >
'9') ? key-
'a'+10 : key-
'0';
135 static void display_menu(
void)
153 for (col = 0; col < modes_per_line; col++)
154 puts(
"Mode: Resolution: Type: ");
159 for (card = video_cards; card < video_cards_end; card++) {
161 for (i = 0; i < card->
nmodes; i++, mi++) {
163 int visible = mi->
x && mi->
y;
175 printf(
"%c %03X %4dx%-7s %-6s",
178 if (col >= modes_per_line) {
185 else if (ch ==
'z' || ch ==
' ')
195 #define H(x) ((x)-'a'+10)
196 #define SCAN ((H('s')<<12)+(H('c')<<8)+(H('a')<<4)+H('n'))
198 static unsigned int mode_menu(
void)
203 puts(
"Press <ENTER> to see video modes available, "
204 "<SPACE> to continue, or wait 30 sec\n");
209 if (key ==
' ' || key == 0)
220 puts(
"Enter a video mode or \"scan\" to scan for "
221 "additional modes: ");
231 static struct saved_screen {
237 static void save_screen(
void)
254 static void restore_screen(
void)
273 for (y = 0; y <
ys; y++) {
277 int copy = (xs < saved.x) ? xs : saved.x;
279 dst += copy*
sizeof(
u16);
281 npad = (xs < saved.x) ? 0 : xs-saved.x;
288 asm volatile(
"pushw %%es ; "
295 :
"+D" (
dst),
"+c" (npad)
301 if (saved.curx >= xs)
303 if (saved.cury >= ys)
308 ireg.dh = saved.cury;
309 ireg.dl = saved.curx;
312 store_cursor_position();
332 printf(
"Undefined video mode number: %x\n", mode);