Subversion Repositories HelenOS

Rev

Rev 3674 | Rev 4342 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3674 Rev 4338
1
/*
1
/*
2
 * Copyright (c) 2006 Ondrej Palkovsky
2
 * Copyright (c) 2006 Ondrej Palkovsky
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @defgroup egafb EGA framebuffer
29
/** @defgroup egafb EGA framebuffer
30
 * @brief   HelenOS EGA framebuffer.
30
 * @brief   HelenOS EGA framebuffer.
31
 * @ingroup fbs
31
 * @ingroup fbs
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
 
36
 
37
#include <stdlib.h>
37
#include <stdlib.h>
38
#include <unistd.h>
38
#include <unistd.h>
39
#include <align.h>
39
#include <align.h>
40
#include <async.h>
40
#include <async.h>
41
#include <ipc/ipc.h>
41
#include <ipc/ipc.h>
42
#include <errno.h>
42
#include <errno.h>
43
#include <stdio.h>
43
#include <stdio.h>
44
#include <ddi.h>
44
#include <ddi.h>
45
#include <sysinfo.h>
45
#include <sysinfo.h>
46
#include <as.h>
46
#include <as.h>
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
 
57
#define MAX_SAVED_SCREENS 256
59
#define MAX_SAVED_SCREENS 256
58
typedef struct saved_screen {
60
typedef struct saved_screen {
59
    short *data;
61
    short *data;
60
} saved_screen;
62
} saved_screen;
61
 
63
 
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)
74
 
76
 
75
/* Allow only 1 connection */
77
/* Allow only 1 connection */
76
static int client_connected = 0;
78
static int client_connected = 0;
77
 
79
 
78
static unsigned int scr_width;
80
static unsigned int scr_width;
79
static unsigned int scr_height;
81
static unsigned int scr_height;
80
static char *scr_addr;
82
static char *scr_addr;
81
 
83
 
82
static unsigned int style;
84
static unsigned int style;
83
 
85
 
84
static void clrscr(void)
86
static void clrscr(void)
85
{
87
{
86
    int i;
88
    int i;
87
   
89
   
88
    for (i = 0; i < scr_width * scr_height; i++) {
90
    for (i = 0; i < scr_width * scr_height; i++) {
89
        scr_addr[i * 2] = ' ';
91
        scr_addr[i * 2] = ' ';
90
        scr_addr[i * 2 + 1] = style;
92
        scr_addr[i * 2 + 1] = style;
91
    }
93
    }
92
}
94
}
93
 
95
 
94
static void cursor_goto(unsigned int row, unsigned int col)
96
static void cursor_goto(unsigned int row, unsigned int col)
95
{
97
{
96
    int ega_cursor;
98
    int ega_cursor;
97
 
99
 
98
    ega_cursor = col + scr_width * row;
100
    ega_cursor = col + scr_width * row;
99
   
101
   
100
    outb(EGA_IO_ADDRESS, 0xe);
102
    outb(EGA_IO_ADDRESS, 0xe);
101
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >> 8) & 0xff);
103
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >> 8) & 0xff);
102
    outb(EGA_IO_ADDRESS, 0xf);
104
    outb(EGA_IO_ADDRESS, 0xf);
103
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
105
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
104
}
106
}
105
 
107
 
106
static void cursor_disable(void)
108
static void cursor_disable(void)
107
{
109
{
108
    uint8_t stat;
110
    uint8_t stat;
109
 
111
 
110
    outb(EGA_IO_ADDRESS, 0xa);
112
    outb(EGA_IO_ADDRESS, 0xa);
111
    stat=inb(EGA_IO_ADDRESS + 1);
113
    stat=inb(EGA_IO_ADDRESS + 1);
112
    outb(EGA_IO_ADDRESS, 0xa);
114
    outb(EGA_IO_ADDRESS, 0xa);
113
    outb(EGA_IO_ADDRESS + 1, stat | (1 << 5));
115
    outb(EGA_IO_ADDRESS + 1, stat | (1 << 5));
114
}
116
}
115
 
117
 
116
static void cursor_enable(void)
118
static void cursor_enable(void)
117
{
119
{
118
    uint8_t stat;
120
    uint8_t stat;
119
 
121
 
120
    outb(EGA_IO_ADDRESS, 0xa);
122
    outb(EGA_IO_ADDRESS, 0xa);
121
    stat=inb(EGA_IO_ADDRESS + 1);
123
    stat=inb(EGA_IO_ADDRESS + 1);
122
    outb(EGA_IO_ADDRESS, 0xa);
124
    outb(EGA_IO_ADDRESS, 0xa);
123
    outb(EGA_IO_ADDRESS + 1, stat & (~(1 << 5)));
125
    outb(EGA_IO_ADDRESS + 1, stat & (~(1 << 5)));
124
}
126
}
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
}
142
 
144
 
143
static void printchar(char c, unsigned int row, unsigned int col)
145
static void printchar(char c, unsigned int row, unsigned int col)
144
{
146
{
145
    scr_addr[(row * scr_width + col) * 2] = c;
147
    scr_addr[(row * scr_width + col) * 2] = c;
146
    scr_addr[(row * scr_width + col) * 2 + 1] = style;
148
    scr_addr[(row * scr_width + col) * 2 + 1] = style;
147
   
149
   
148
    cursor_goto(row, col + 1);
150
    cursor_goto(row, col + 1);
149
}
151
}
150
 
152
 
151
static void draw_text_data(keyfield_t *data)
153
static void draw_text_data(keyfield_t *data)
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
{
164
    int i;
168
    int i;
165
 
169
 
166
    for (i = 0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++)
170
    for (i = 0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++)
167
        ;
171
        ;
168
    if (i == MAX_SAVED_SCREENS)
172
    if (i == MAX_SAVED_SCREENS)
169
        return EINVAL;
173
        return EINVAL;
170
    if (!(saved_screens[i].data = malloc(2 * scr_width * scr_height)))
174
    if (!(saved_screens[i].data = malloc(2 * scr_width * scr_height)))
171
        return ENOMEM;
175
        return ENOMEM;
172
    memcpy(saved_screens[i].data, scr_addr, 2 * scr_width * scr_height);
176
    memcpy(saved_screens[i].data, scr_addr, 2 * scr_width * scr_height);
173
 
177
 
174
    return i;
178
    return i;
175
}
179
}
176
 
180
 
177
static int print_screen(int i)
181
static int print_screen(int i)
178
{
182
{
179
    if (saved_screens[i].data)
183
    if (saved_screens[i].data)
180
        memcpy(scr_addr, saved_screens[i].data, 2 * scr_width *
184
        memcpy(scr_addr, saved_screens[i].data, 2 * scr_width *
181
            scr_height);
185
            scr_height);
182
    else
186
    else
183
        return EINVAL;
187
        return EINVAL;
184
    return i;
188
    return i;
185
}
189
}
186
 
190
 
187
 
191
 
188
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
192
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
189
{
193
{
190
    int retval;
194
    int retval;
191
    ipc_callid_t callid;
195
    ipc_callid_t callid;
192
    ipc_call_t call;
196
    ipc_call_t call;
193
    char c;
197
    char c;
194
    unsigned int row, col;
198
    unsigned int row, col;
195
    int bgcolor,fgcolor;
199
    int bgcolor,fgcolor;
196
    keyfield_t *interbuf = NULL;
200
    keyfield_t *interbuf = NULL;
197
    size_t intersize = 0;
201
    size_t intersize = 0;
198
    int i;
202
    int i;
199
 
203
 
200
    if (client_connected) {
204
    if (client_connected) {
201
        ipc_answer_0(iid, ELIMIT);
205
        ipc_answer_0(iid, ELIMIT);
202
        return;
206
        return;
203
    }
207
    }
204
    client_connected = 1;
208
    client_connected = 1;
205
    ipc_answer_0(iid, EOK); /* Accept connection */
209
    ipc_answer_0(iid, EOK); /* Accept connection */
206
 
210
 
207
    while (1) {
211
    while (1) {
208
        callid = async_get_call(&call);
212
        callid = async_get_call(&call);
209
        switch (IPC_GET_METHOD(call)) {
213
        switch (IPC_GET_METHOD(call)) {
210
        case IPC_M_PHONE_HUNGUP:
214
        case IPC_M_PHONE_HUNGUP:
211
            client_connected = 0;
215
            client_connected = 0;
212
            ipc_answer_0(callid, EOK);
216
            ipc_answer_0(callid, EOK);
213
            return; /* Exit thread */
217
            return; /* Exit thread */
214
        case IPC_M_SHARE_OUT:
218
        case IPC_M_SHARE_OUT:
215
            /* We accept one area for data interchange */
219
            /* We accept one area for data interchange */
216
            intersize = IPC_GET_ARG2(call);
220
            intersize = IPC_GET_ARG2(call);
217
            if (intersize >= scr_width * scr_height *
221
            if (intersize >= scr_width * scr_height *
218
                sizeof(*interbuf)) {
222
                sizeof(*interbuf)) {
219
                receive_comm_area(callid, &call,
223
                receive_comm_area(callid, &call,
220
                    (void *) &interbuf);
224
                    (void *) &interbuf);
221
                continue;
225
                continue;
222
            }
226
            }
223
            retval = EINVAL;
227
            retval = EINVAL;
224
            break;
228
            break;
225
        case FB_DRAW_TEXT_DATA:
229
        case FB_DRAW_TEXT_DATA:
226
            if (!interbuf) {
230
            if (!interbuf) {
227
                retval = EINVAL;
231
                retval = EINVAL;
228
                break;
232
                break;
229
            }
233
            }
230
            draw_text_data(interbuf);
234
            draw_text_data(interbuf);
231
            retval = 0;
235
            retval = 0;
232
            break;
236
            break;
233
        case FB_GET_CSIZE:
237
        case FB_GET_CSIZE:
234
            ipc_answer_2(callid, EOK, scr_height, scr_width);
238
            ipc_answer_2(callid, EOK, scr_height, scr_width);
235
            continue;
239
            continue;
236
        case FB_CLEAR:
240
        case FB_CLEAR:
237
            clrscr();
241
            clrscr();
238
            retval = 0;
242
            retval = 0;
239
            break;
243
            break;
240
        case FB_PUTCHAR:
244
        case FB_PUTCHAR:
241
            c = IPC_GET_ARG1(call);
245
            c = IPC_GET_ARG1(call);
242
            row = IPC_GET_ARG2(call);
246
            row = IPC_GET_ARG2(call);
243
            col = IPC_GET_ARG3(call);
247
            col = IPC_GET_ARG3(call);
244
            if (col >= scr_width || row >= scr_height) {
248
            if (col >= scr_width || row >= scr_height) {
245
                retval = EINVAL;
249
                retval = EINVAL;
246
                break;
250
                break;
247
            }
251
            }
248
            printchar(c, row, col);
252
            printchar(c, row, col);
249
            retval = 0;
253
            retval = 0;
250
            break;
254
            break;
251
        case FB_CURSOR_GOTO:
255
        case FB_CURSOR_GOTO:
252
            row = IPC_GET_ARG1(call);
256
            row = IPC_GET_ARG1(call);
253
            col = IPC_GET_ARG2(call);
257
            col = IPC_GET_ARG2(call);
254
            if (row >= scr_height || col >= scr_width) {
258
            if (row >= scr_height || col >= scr_width) {
255
                retval = EINVAL;
259
                retval = EINVAL;
256
                break;
260
                break;
257
            }
261
            }
258
            cursor_goto(row, col);
262
            cursor_goto(row, col);
259
            retval = 0;
263
            retval = 0;
260
            break;
264
            break;
261
        case FB_SCROLL:
265
        case FB_SCROLL:
262
            i = IPC_GET_ARG1(call);
266
            i = IPC_GET_ARG1(call);
263
            if (i > scr_height || i < -((int) scr_height)) {
267
            if (i > scr_height || i < -((int) scr_height)) {
264
                retval = EINVAL;
268
                retval = EINVAL;
265
                break;
269
                break;
266
            }
270
            }
267
            scroll(i);
271
            scroll(i);
268
            retval = 0;
272
            retval = 0;
269
            break;
273
            break;
270
        case FB_CURSOR_VISIBILITY:
274
        case FB_CURSOR_VISIBILITY:
271
            if(IPC_GET_ARG1(call))
275
            if(IPC_GET_ARG1(call))
272
                cursor_enable();
276
                cursor_enable();
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;
283
        case FB_VP_DRAW_PIXMAP:
303
        case FB_VP_DRAW_PIXMAP:
284
            i = IPC_GET_ARG2(call);
304
            i = IPC_GET_ARG2(call);
285
            retval = print_screen(i);
305
            retval = print_screen(i);
286
            break;
306
            break;
287
        case FB_VP2PIXMAP:
307
        case FB_VP2PIXMAP:
288
            retval = save_screen();
308
            retval = save_screen();
289
            break;
309
            break;
290
        case FB_DROP_PIXMAP:
310
        case FB_DROP_PIXMAP:
291
            i = IPC_GET_ARG1(call);
311
            i = IPC_GET_ARG1(call);
292
            if (i >= MAX_SAVED_SCREENS) {
312
            if (i >= MAX_SAVED_SCREENS) {
293
                retval = EINVAL;
313
                retval = EINVAL;
294
                break;
314
                break;
295
            }
315
            }
296
            if (saved_screens[i].data) {
316
            if (saved_screens[i].data) {
297
                free(saved_screens[i].data);
317
                free(saved_screens[i].data);
298
                saved_screens[i].data = NULL;
318
                saved_screens[i].data = NULL;
299
            }
319
            }
300
            retval = 0;
320
            retval = 0;
301
            break;
321
            break;
302
 
322
 
303
        default:
323
        default:
304
            retval = ENOENT;
324
            retval = ENOENT;
305
        }
325
        }
306
        ipc_answer_0(callid, retval);
326
        ipc_answer_0(callid, retval);
307
    }
327
    }
308
}
328
}
309
 
329
 
310
int ega_init(void)
330
int ega_init(void)
311
{
331
{
312
    void *ega_ph_addr;
332
    void *ega_ph_addr;
313
    size_t sz;
333
    size_t sz;
314
 
334
 
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
 
327
    sz = scr_width * scr_height * 2;
347
    sz = scr_width * scr_height * 2;
328
    scr_addr = as_get_mappable_page(sz);
348
    scr_addr = as_get_mappable_page(sz);
329
 
349
 
330
    physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >>
350
    physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >>
331
        PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
351
        PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
332
 
352
 
333
    async_set_client_connection(ega_client_connection);
353
    async_set_client_connection(ega_client_connection);
334
 
354
 
335
    return 0;
355
    return 0;
336
}
356
}
337
 
357
 
338
 
358
 
339
/**
359
/**
340
 * @}
360
 * @}
341
 */
361
 */
342
 
362