Subversion Repositories HelenOS

Rev

Rev 2012 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2012 Rev 2015
Line 32... Line 32...
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
 
36
 
37
 
-
 
38
#include <stdlib.h>
37
#include <stdlib.h>
39
#include <unistd.h>
38
#include <unistd.h>
40
#include <align.h>
39
#include <align.h>
41
#include <async.h>
40
#include <async.h>
42
#include <ipc/ipc.h>
41
#include <ipc/ipc.h>
Line 60... Line 59...
60
    short *data;
59
    short *data;
61
} saved_screen;
60
} saved_screen;
62
 
61
 
63
saved_screen saved_screens[MAX_SAVED_SCREENS];
62
saved_screen saved_screens[MAX_SAVED_SCREENS];
64
 
63
 
65
 
-
 
66
#define EGA_IO_ADDRESS 0x3d4
64
#define EGA_IO_ADDRESS 0x3d4
67
#define EGA_IO_SIZE 2
65
#define EGA_IO_SIZE 2
68
 
66
 
69
#define NORMAL_COLOR       0x0f
67
#define NORMAL_COLOR       0x0f
70
#define INVERTED_COLOR     0xf0
68
#define INVERTED_COLOR     0xf0
Line 124... Line 122...
124
 
122
 
125
static void scroll(int rows)
123
static void scroll(int rows)
126
{
124
{
127
    int i;
125
    int i;
128
    if (rows > 0) {
126
    if (rows > 0) {
129
        memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2);
127
        memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2,
-
 
128
            scr_width * scr_height * 2 - rows * scr_width * 2);
130
        for (i = 0; i < rows * scr_width ; i ++)
129
        for (i = 0; i < rows * scr_width ; i ++)
131
            (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' ');
130
            (((short *)scr_addr) + scr_width * scr_height - rows *
-
 
131
                scr_width) [i] = ((style << 8) + ' ');
132
    } else if (rows < 0) {
132
    } else if (rows < 0) {
133
 
-
 
134
        memcpy (((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2);
133
        memcpy (((char *)scr_addr) - rows * scr_width * 2, scr_addr,
-
 
134
            scr_width * scr_height * 2 + rows * scr_width * 2);
135
        for (i = 0; i < - rows * scr_width ; i++)
135
        for (i = 0; i < - rows * scr_width ; i++)
136
            ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
136
            ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
137
    }
137
    }
138
}
138
}
139
 
139
 
Line 306... Line 306...
306
 
306
 
307
 
307
 
308
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
308
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
309
    scr_width=sysinfo_value("fb.width");
309
    scr_width=sysinfo_value("fb.width");
310
    scr_height=sysinfo_value("fb.height");
310
    scr_height=sysinfo_value("fb.height");
311
    iospace_enable(task_get_id(),(void *)EGA_IO_ADDRESS,2);
311
    iospace_enable(task_get_id(), (void *) EGA_IO_ADDRESS, 2);
312
 
312
 
313
    sz = scr_width*scr_height*2;
313
    sz = scr_width * scr_height * 2;
314
    scr_addr = as_get_mappable_page(sz);
314
    scr_addr = as_get_mappable_page(sz, (int)
-
 
315
        sysinfo_value("fb.address.color"));
315
 
316
 
316
    physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >> PAGE_WIDTH,
317
    physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >>
317
            AS_AREA_READ | AS_AREA_WRITE);
318
        PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
318
 
319
 
319
    async_set_client_connection(ega_client_connection);
320
    async_set_client_connection(ega_client_connection);
320
 
321
 
321
    return 0;
322
    return 0;
322
}
323
}