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" |
87,7 → 87,7 |
|
static void clrscr(void) |
{ |
int i; |
unsigned i; |
|
for (i = 0; i < scr_width * scr_height; i++) { |
scr_addr[i * 2] = ' '; |
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; |
|
129,7 → 129,8 |
|
static void scroll(int rows) |
{ |
int i; |
unsigned i; |
|
if (rows > 0) { |
memmove(scr_addr, ((char *) scr_addr) + rows * scr_width * 2, |
scr_width * scr_height * 2 - rows * scr_width * 2); |
144,12 → 145,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 → 242,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, |
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; |
default: |
return INVERTED_COLOR; |
} |
} |
|
312,8 → 317,11 |
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_GET_COLOR_CAP: |
ipc_answer_1(callid, EOK, FB_CCAP_INDEXED); |
continue; |
case FB_CLEAR: |
clrscr(); |
retval = 0; |
320,28 → 328,28 |
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: |
i = IPC_GET_ARG1(call); |
if (i > scr_height || i < -((int) scr_height)) { |
if (i > (int) scr_height || i < -((int) scr_height)) { |
retval = EINVAL; |
break; |
} |