67,16 → 67,16 |
*/ |
static void ega_check_cursor(void) |
{ |
if (ega_cursor < SCREEN) |
if (ega_cursor < EGA_SCREEN) |
return; |
|
memmove((void *) videoram, (void *) (videoram + ROW * 2), |
(SCREEN - ROW) * 2); |
memmove((void *) backbuf, (void *) (backbuf + ROW * 2), |
(SCREEN - ROW) * 2); |
memsetw(videoram + (SCREEN - ROW) * 2, ROW, 0x0720); |
memsetw(backbuf + (SCREEN - ROW) * 2, ROW, 0x0720); |
ega_cursor = ega_cursor - ROW; |
memmove((void *) videoram, (void *) (videoram + EGA_COLS * 2), |
(EGA_SCREEN - EGA_COLS) * 2); |
memmove((void *) backbuf, (void *) (backbuf + EGA_COLS * 2), |
(EGA_SCREEN - EGA_COLS) * 2); |
memsetw(videoram + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720); |
memsetw(backbuf + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720); |
ega_cursor = ega_cursor - EGA_COLS; |
} |
|
static void ega_move_cursor(void) |
104,13 → 104,13 |
|
switch (ch) { |
case '\n': |
ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW; |
ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS; |
break; |
case '\t': |
ega_cursor = (ega_cursor + 8) - ega_cursor % 8; |
break; |
case '\b': |
if (ega_cursor % ROW) |
if (ega_cursor % EGA_COLS) |
ega_cursor--; |
break; |
default: |
136,15 → 136,15 |
/* Initialize the software structure. */ |
ega_base = base; |
|
backbuf = (uint8_t *) malloc(SCREEN * 2, 0); |
backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0); |
if (!backbuf) |
panic("Unable to allocate backbuffer."); |
|
videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2); |
videoram = (uint8_t *) hw_map(videoram_phys, EGA_VRAM_SIZE); |
|
/* Clear the screen and set the cursor position. */ |
memsetw(videoram, SCREEN, 0x0720); |
memsetw(backbuf, SCREEN, 0x0720); |
memsetw(videoram, EGA_SCREEN, 0x0720); |
memsetw(backbuf, EGA_SCREEN, 0x0720); |
ega_move_cursor(); |
|
chardev_initialize("ega_out", &ega_console, &ega_ops); |
152,8 → 152,8 |
|
sysinfo_set_item_val("fb", NULL, true); |
sysinfo_set_item_val("fb.kind", NULL, 2); |
sysinfo_set_item_val("fb.width", NULL, ROW); |
sysinfo_set_item_val("fb.height", NULL, ROWS); |
sysinfo_set_item_val("fb.width", NULL, EGA_COLS); |
sysinfo_set_item_val("fb.height", NULL, EGA_ROWS); |
sysinfo_set_item_val("fb.blinking", NULL, true); |
sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys); |
} |
160,7 → 160,7 |
|
void ega_redraw(void) |
{ |
memcpy(videoram, backbuf, SCREEN * 2); |
memcpy(videoram, backbuf, EGA_VRAM_SIZE); |
ega_move_cursor(); |
} |
|