Rev 3674 | Rev 4342 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3674 | Rev 4338 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | #include <ipc/fb.h> |
47 | #include <ipc/fb.h> |
48 | #include <ipc/ipc.h> |
48 | #include <ipc/ipc.h> |
49 | #include <ipc/ns.h> |
49 | #include <ipc/ns.h> |
50 | #include <ipc/services.h> |
50 | #include <ipc/services.h> |
51 | #include <libarch/ddi.h> |
51 | #include <libarch/ddi.h> |
- | 52 | #include <console/style.h> |
|
- | 53 | #include <console/color.h> |
|
52 | 54 | ||
53 | #include "ega.h" |
55 | #include "ega.h" |
54 | #include "../console/screenbuffer.h" |
56 | #include "../console/screenbuffer.h" |
55 | #include "main.h" |
57 | #include "main.h" |
56 | 58 | ||
Line 62... | Line 64... | ||
62 | saved_screen saved_screens[MAX_SAVED_SCREENS]; |
64 | saved_screen saved_screens[MAX_SAVED_SCREENS]; |
63 | 65 | ||
64 | #define EGA_IO_ADDRESS 0x3d4 |
66 | #define EGA_IO_ADDRESS 0x3d4 |
65 | #define EGA_IO_SIZE 2 |
67 | #define EGA_IO_SIZE 2 |
66 | 68 | ||
67 | int ega_normal_color=0x0f; |
69 | int ega_normal_color = 0x0f; |
68 | int ega_inverted_color=0xf0; |
70 | int ega_inverted_color = 0xf0; |
69 | 71 | ||
70 | #define NORMAL_COLOR ega_normal_color |
72 | #define NORMAL_COLOR ega_normal_color |
71 | #define INVERTED_COLOR ega_inverted_color |
73 | #define INVERTED_COLOR ega_inverted_color |
72 | 74 | ||
73 | #define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR) |
75 | #define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR) |
Line 125... | Line 127... | ||
125 | 127 | ||
126 | static void scroll(int rows) |
128 | static void scroll(int rows) |
127 | { |
129 | { |
128 | int i; |
130 | int i; |
129 | if (rows > 0) { |
131 | if (rows > 0) { |
130 | memcpy(scr_addr, ((char *) scr_addr) + rows * scr_width * 2, |
132 | memmove(scr_addr, ((char *) scr_addr) + rows * scr_width * 2, |
131 | scr_width * scr_height * 2 - rows * scr_width * 2); |
133 | scr_width * scr_height * 2 - rows * scr_width * 2); |
132 | for (i = 0; i < rows * scr_width; i++) |
134 | for (i = 0; i < rows * scr_width; i++) |
133 | (((short *) scr_addr) + scr_width * scr_height - rows * |
135 | (((short *) scr_addr) + scr_width * scr_height - rows * |
134 | scr_width)[i] = ((style << 8) + ' '); |
136 | scr_width)[i] = ((style << 8) + ' '); |
135 | } else if (rows < 0) { |
137 | } else if (rows < 0) { |
136 | memcpy(((char *)scr_addr) - rows * scr_width * 2, scr_addr, |
138 | memmove(((char *)scr_addr) - rows * scr_width * 2, scr_addr, |
137 | scr_width * scr_height * 2 + rows * scr_width * 2); |
139 | scr_width * scr_height * 2 + rows * scr_width * 2); |
138 | for (i = 0; i < -rows * scr_width; i++) |
140 | for (i = 0; i < -rows * scr_width; i++) |
139 | ((short *)scr_addr)[i] = ((style << 8 ) + ' '); |
141 | ((short *)scr_addr)[i] = ((style << 8 ) + ' '); |
140 | } |
142 | } |
141 | } |
143 | } |
Line 152... | Line 154... | ||
152 | { |
154 | { |
153 | int i; |
155 | int i; |
154 | 156 | ||
155 | for (i = 0; i < scr_width * scr_height; i++) { |
157 | for (i = 0; i < scr_width * scr_height; i++) { |
156 | scr_addr[i * 2] = data[i].character; |
158 | scr_addr[i * 2] = data[i].character; |
- | 159 | /* FIXME |
|
157 | scr_addr[i * 2 + 1] = EGA_STYLE(data[i].style.fg_color, |
160 | scr_addr[i * 2 + 1] = EGA_STYLE(data[i].style.fg_color, |
158 | data[i].style.bg_color); |
161 | data[i].style.bg_color); |
- | 162 | */ |
|
159 | } |
163 | } |
160 | } |
164 | } |
161 | 165 | ||
162 | static int save_screen(void) |
166 | static int save_screen(void) |
163 | { |
167 | { |
Line 273... | Line 277... | ||
273 | else |
277 | else |
274 | cursor_disable(); |
278 | cursor_disable(); |
275 | retval = 0; |
279 | retval = 0; |
276 | break; |
280 | break; |
277 | case FB_SET_STYLE: |
281 | case FB_SET_STYLE: |
- | 282 | retval = 0; |
|
- | 283 | switch (IPC_GET_ARG1(call)) { |
|
- | 284 | case STYLE_NORMAL: style = INVERTED_COLOR; break; |
|
- | 285 | case STYLE_EMPHASIS: style = INVERTED_COLOR | 4; break; |
|
- | 286 | default: retval = EINVAL; |
|
- | 287 | } |
|
- | 288 | break; |
|
- | 289 | case FB_SET_COLOR: |
|
- | 290 | fgcolor = IPC_GET_ARG1(call); |
|
- | 291 | bgcolor = IPC_GET_ARG2(call); |
|
- | 292 | style = (fgcolor & 7) | ((bgcolor & 7) << 4); |
|
- | 293 | if (IPC_GET_ARG3(call) & CATTR_BRIGHT) |
|
- | 294 | style = style | 0x08; |
|
- | 295 | retval = 0; |
|
- | 296 | break; |
|
- | 297 | case FB_SET_RGB_COLOR: |
|
278 | fgcolor = IPC_GET_ARG1(call); |
298 | fgcolor = IPC_GET_ARG1(call); |
279 | bgcolor = IPC_GET_ARG2(call); |
299 | bgcolor = IPC_GET_ARG2(call); |
280 | style = EGA_STYLE(fgcolor, bgcolor); |
300 | style = EGA_STYLE(fgcolor, bgcolor); |
281 | retval = 0; |
301 | retval = 0; |
282 | break; |
302 | break; |
Line 315... | Line 335... | ||
315 | ega_ph_addr = (void *) sysinfo_value("fb.address.physical"); |
335 | ega_ph_addr = (void *) sysinfo_value("fb.address.physical"); |
316 | scr_width = sysinfo_value("fb.width"); |
336 | scr_width = sysinfo_value("fb.width"); |
317 | scr_height = sysinfo_value("fb.height"); |
337 | scr_height = sysinfo_value("fb.height"); |
318 | if(sysinfo_value("fb.blinking")) |
338 | if(sysinfo_value("fb.blinking")) |
319 | { |
339 | { |
320 | ega_normal_color&=0x77; |
340 | ega_normal_color &= 0x77; |
321 | ega_inverted_color&=0x77; |
341 | ega_inverted_color &= 0x77; |
322 | } |
342 | } |
323 | style = NORMAL_COLOR; |
343 | style = NORMAL_COLOR; |
324 | 344 | ||
325 | iospace_enable(task_get_id(), (void *) EGA_IO_ADDRESS, 2); |
345 | iospace_enable(task_get_id(), (void *) EGA_IO_ADDRESS, 2); |
326 | 346 |