Rev 1577 | Rev 1649 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1577 | Rev 1640 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | 53 | ||
54 | 54 | ||
55 | #define EGA_IO_ADDRESS 0x3d4 |
55 | #define EGA_IO_ADDRESS 0x3d4 |
56 | #define EGA_IO_SIZE 2 |
56 | #define EGA_IO_SIZE 2 |
57 | 57 | ||
- | 58 | #define NORMAL_COLOR 0x0f |
|
- | 59 | #define INVERTED_COLOR 0xf0 |
|
- | 60 | ||
- | 61 | #define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR) |
|
- | 62 | ||
58 | typedef unsigned char u8; |
63 | typedef unsigned char u8; |
59 | typedef unsigned short u16; |
64 | typedef unsigned short u16; |
60 | typedef unsigned int u32; |
65 | typedef unsigned int u32; |
61 | 66 | ||
62 | 67 | ||
Line 65... | Line 70... | ||
65 | 70 | ||
66 | static unsigned int scr_width; |
71 | static unsigned int scr_width; |
67 | static unsigned int scr_height; |
72 | static unsigned int scr_height; |
68 | static char *scr_addr; |
73 | static char *scr_addr; |
69 | 74 | ||
70 | static unsigned int style = 0x1e; |
75 | static unsigned int style = NORMAL_COLOR; |
71 | 76 | ||
72 | static inline void outb(u16 port, u8 b) |
77 | static inline void outb(u16 port, u8 b) |
73 | { |
78 | { |
74 | asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port)); |
79 | asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port)); |
75 | } |
80 | } |
Line 178... | Line 183... | ||
178 | { |
183 | { |
179 | int i; |
184 | int i; |
180 | 185 | ||
181 | for (i=0; i < scr_width*scr_height; i++) { |
186 | for (i=0; i < scr_width*scr_height; i++) { |
182 | scr_addr[i*2] = data[i].character; |
187 | scr_addr[i*2] = data[i].character; |
183 | if (data[i].style.fg_color > data[i].style.bg_color) |
188 | scr_addr[i*2+1] = EGA_STYLE(data[i].style.fg_color, data[i].style.bg_color); |
184 | scr_addr[i*2+1] = 0x1e; |
- | |
185 | else |
- | |
186 | scr_addr[i*2+1] = 0xe1; |
- | |
187 | } |
189 | } |
188 | } |
190 | } |
189 | 191 | ||
190 | static int save_screen(void) |
192 | static int save_screen(void) |
191 | { |
193 | { |
Line 298... | Line 300... | ||
298 | retval = 0; |
300 | retval = 0; |
299 | break; |
301 | break; |
300 | case FB_SET_STYLE: |
302 | case FB_SET_STYLE: |
301 | fgcolor = IPC_GET_ARG1(call); |
303 | fgcolor = IPC_GET_ARG1(call); |
302 | bgcolor = IPC_GET_ARG2(call); |
304 | bgcolor = IPC_GET_ARG2(call); |
303 | if (fgcolor > bgcolor) |
305 | style = EGA_STYLE(fgcolor, bgcolor); |
304 | style = 0x1e; |
- | |
305 | else |
- | |
306 | style = 0xe1; |
- | |
307 | break; |
306 | break; |
308 | case FB_VP_DRAW_PIXMAP: |
307 | case FB_VP_DRAW_PIXMAP: |
309 | i = IPC_GET_ARG2(call); |
308 | i = IPC_GET_ARG2(call); |
310 | retval = print_screen(i); |
309 | retval = print_screen(i); |
311 | break; |
310 | break; |