Esempio n. 1
0
void
diag_puts(char *str)
{

	while (*str)
		screen_putc(*str++);

	screen_move_cursor();
}
Esempio n. 2
0
File: screen.c Progetto: csko/yaosp
static void screen_clear( console_t* console ) {
    /* Fill the video memory with spaces */

    memsetw( video_memory, ( screen_color << 8 ) | ' ', console->width * console->height );

    /* Set the cursor position to the top-left corner of the screen */

    console->x = 0;
    console->y = 0;

    /* Move the cursor to the specified position */

    screen_move_cursor( console );
}
Esempio n. 3
0
void screen_init(void)
{
    uint8 i, j;

    screen_move_cursor(0, 0);
    kdata.screen_fg = COLOR_BLACK;
    kdata.screen_bg = COLOR_LIGHT_GREY;
    kdata.screen_ptr = (uint16 *)SCREEN_ADDR;

    for (j = 0; j < SCREEN_HEIGHT-1; ++j)
    {
        for (i = 0; i < SCREEN_WIDTH; ++i)
            _screen_write_char(j, i, ' ', kdata.screen_fg, kdata.screen_bg);
    }

    for (i = 0; i < 16; ++i)
        _screen_write_char(0, i, ' ', i, kdata.screen_fg);
    printf("\nScreen at %p configured\n", kdata.screen_ptr);
}
Esempio n. 4
0
File: screen.c Progetto: csko/yaosp
static void screen_gotoxy( console_t* console, int x, int y ) {
    /* Do a little sanity checking */

    if ( ( x < 0 ) || ( y < 0 ) ) {
        return;
    }

    if ( ( x >= console->width ) || ( y >= console->height ) ) {
        return;
    }

    /* Set the new cursor positions */

    console->x = x;
    console->y = y;

    /* ... and move the cursor */

    screen_move_cursor( console );
}
Esempio n. 5
0
void screen_write_char(char c)
{
    if (c == '\n')
    {
        kdata.screen_x = 0;
        kdata.screen_y ++;
    }
    else if (c == '\t')
    {
        kdata.screen_x += 4 - (kdata.screen_x % 4);
    }
    else if (c == '\r')
    {
        kdata.screen_x = 0;
    }
    else
    {
        _screen_write_char(kdata.screen_y, kdata.screen_x, c, kdata.screen_fg, kdata.screen_bg);

        kdata.screen_x ++;

        if (kdata.screen_x == SCREEN_WIDTH)
        {
            kdata.screen_x = 0;
            kdata.screen_y ++;
        }
    }

    if (kdata.screen_y == SCREEN_HEIGHT)
    {
        _screen_scroll_up();
        kdata.screen_y --;
    }

    screen_move_cursor(kdata.screen_y, kdata.screen_x);

    serial_write_char(c);
}
Esempio n. 6
0
File: screen.c Progetto: csko/yaosp
static void screen_putchar( console_t* console, char c ) {
    uint16_t* p = video_memory;

    /* Get the position in the video memory according
       to the X and Y positions of the cursor */

    p += ( console->y * console->width ) + console->x;

    /* Handle the printed character */

    switch ( c ) {
        case '\r' :
            console->x = 0;

            break;

        case '\n' :
            console->x = 0;
            console->y++;

            break;

        case '\b' :
            if ( console->x == 0 ) {
                if ( console->y > 0 ) {
                    console->y--;
                    console->x = console->width - 1;
                }
            } else {
                console->x--;
            }

            break;

        default :
            *p++ = ( screen_color << 8 ) | c;
            console->x++;

            break;
    }

    /* Check if we reached the end of the line */

    if ( console->x == console->width ) {
        console->y++;
        console->x = 0;
    }

    /* Check if we filled the last line of the screen */

    if ( console->y == console->height ) {
        console->y--;

        /* Scroll the lines up */

        memmove( video_memory, video_memory + console->width, console->width * ( console->height - 1 ) * 2 );

        /* Empty the last line of the screen */

        p = video_memory + console->width * ( console->height - 1 );

        memsetw( p, ( 7 << 8 ) | ' ', console->width );
    }

    /* Move the cursor to the modified position */

    screen_move_cursor( console );
}
Esempio n. 7
0
/* Redraws only the cursor */
void
vt_cursor_redraw()
{
        int rel_cursor = circ_dist(vt_curterm->vt_cursor, vt_curterm->vt_top);
        screen_move_cursor(rel_cursor % DISPLAY_WIDTH, rel_cursor / DISPLAY_WIDTH);
}