49,8 → 49,8 |
#include <ipc/ns.h> |
#include <ipc/services.h> |
#include <libarch/ddi.h> |
#include <console/style.h> |
#include <console/color.h> |
#include <io/style.h> |
#include <io/color.h> |
#include <sys/types.h> |
|
#include "ega.h" |
70,7 → 70,7 |
int ega_normal_color = 0x0f; |
int ega_inverted_color = 0xf0; |
|
#define NORMAL_COLOR ega_normal_color |
#define NORMAL_COLOR ega_normal_color |
#define INVERTED_COLOR ega_inverted_color |
|
/* Allow only 1 connection */ |
95,7 → 95,7 |
} |
} |
|
static void cursor_goto(unsigned int row, unsigned int col) |
static void cursor_goto(unsigned int col, unsigned int row) |
{ |
int ega_cursor; |
|
144,12 → 144,12 |
} |
} |
|
static void printchar(wchar_t c, unsigned int row, unsigned int col) |
static void printchar(wchar_t c, unsigned int col, unsigned int row) |
{ |
scr_addr[(row * scr_width + col) * 2] = ega_glyph(c); |
scr_addr[(row * scr_width + col) * 2 + 1] = style; |
|
cursor_goto(row, col + 1); |
cursor_goto(col + 1, row); |
} |
|
/** Draw text data to viewport. |
241,11 → 241,15 |
static unsigned attr_to_ega_style(const attrs_t *a) |
{ |
switch (a->t) { |
case at_style: return style_to_ega_style(a->a.s.style); |
case at_rgb: return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color); |
case at_idx: return color_to_ega_style(a->a.i.fg_color, |
a->a.i.bg_color, a->a.i.flags); |
default: return INVERTED_COLOR; |
case at_style: |
return style_to_ega_style(a->a.s.style); |
case at_rgb: |
return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color); |
case at_idx: |
return color_to_ega_style(a->a.i.fg_color, |
a->a.i.bg_color, a->a.i.flags); |
default: |
return INVERTED_COLOR; |
} |
} |
|
312,7 → 316,7 |
retval = 0; |
break; |
case FB_GET_CSIZE: |
ipc_answer_2(callid, EOK, scr_height, scr_width); |
ipc_answer_2(callid, EOK, scr_width, scr_height); |
continue; |
case FB_CLEAR: |
clrscr(); |
320,23 → 324,23 |
break; |
case FB_PUTCHAR: |
c = IPC_GET_ARG1(call); |
row = IPC_GET_ARG2(call); |
col = IPC_GET_ARG3(call); |
col = IPC_GET_ARG2(call); |
row = IPC_GET_ARG3(call); |
if (col >= scr_width || row >= scr_height) { |
retval = EINVAL; |
break; |
} |
printchar(c, row, col); |
printchar(c, col, row); |
retval = 0; |
break; |
case FB_CURSOR_GOTO: |
row = IPC_GET_ARG1(call); |
col = IPC_GET_ARG2(call); |
col = IPC_GET_ARG1(call); |
row = IPC_GET_ARG2(call); |
if (row >= scr_height || col >= scr_width) { |
retval = EINVAL; |
break; |
} |
cursor_goto(row, col); |
cursor_goto(col, row); |
retval = 0; |
break; |
case FB_SCROLL: |