App inst fixed on invalid image file; App zinstall for ZDE works - we've got GUI...
[ZeXOS.git] / kernel / drivers / char / video / vesa.c
blobe43c527c8425776ffffb8fdfc9aab41dee7a797a
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <system.h>
21 #include <arch/io.h>
22 #include <string.h>
23 #include <config.h>
24 #include <task.h>
26 unsigned short *vesafb = 0;
27 extern unsigned char vgagui;
29 typedef struct PMInfoBlock {
30 char Signature[4];
31 unsigned short EntryPoint;
32 unsigned short PMInitialize;
33 unsigned short BIOSDataSel;
34 unsigned short A0000Sel;
35 unsigned short B0000Sel;
36 unsigned short B8000Sel;
37 unsigned short CodeSegSel;
38 char InProtectedMode;
39 char Checksum;
40 } PMInfoBlock;
42 typedef void (*void_fn_void_t)(char *arg, int flags);
43 extern task_t *_curr_task;
45 unsigned init_video_vesa ()
47 #ifdef CONFIG_DRV_VESA
48 if (kernel_attr & KERNEL_NOVESA)
49 return 0;
51 //prot_to_real ();
53 /* get address from hacked grub */
54 unsigned *grub_baseaddr = (unsigned *) 0x60000;
56 vesafb = (unsigned short *) *grub_baseaddr;
58 if (!vesafb)
59 return 0;
61 vgagui = 2;
63 //printf ("vesa: 0x%x\n", vesafb);
65 /* draw "clear" screen first */
66 unsigned p = 0;
67 for (p = 0; p < 800*600; p ++)
68 vesafb[p] = p/32768;
70 #endif
71 return 1;
74 unsigned vesa_16cto16b (unsigned char color)
76 switch (color) {
77 case 0:
78 return 0;
79 case 1:
80 return 0x0000f1; // ok
81 case 2:
82 return 0xee8d00; // ok
83 case 3:
84 return 0x808000; // ok
85 case 4:
86 return 0xffa000; // ok
87 case 5:
88 return 0x018051; // ok
89 case 6:
90 return 0xC3993D; // ??
91 case 7:
92 return 0xf007fd; // ??
93 case 8:
94 return 0xb457fd; // ??
95 case 9:
96 return 0x0a02fa; // ok
97 case 10:
98 return 0xffef00; // ok
99 case 11:
100 return 0x0a05fa; // ok
101 case 12:
102 return 0x4f8800; // ok
103 case 13:
104 return 0xf8faff; // ok
105 case 14:
106 return 0xffffd0; // ok
107 case 15:
108 return 0xffffff; // ok
111 return 0;