Example #1
0
void output_char(WINDOW* wnd, unsigned char c)
{
	remove_cursor(wnd);
	switch(c){
		case '\n':
		case 13:
					wnd->cursor_x = 0;
					wnd->cursor_y++;
					break;
		case '\b':
					if(wnd->cursor_x!=0){
						wnd->cursor_x--;
					} else { 
						if(wnd->cursor_y!=0){
							wnd->cursor_x = wnd->width - 1;
							wnd->cursor_y--;
					  }
					}
					break;
		default:
					poke_screen(wnd->x + wnd->cursor_x,wnd->y + wnd->cursor_y,(short unsigned int) c | (default_color << 8));
					wnd->cursor_x++;
					if(wnd->cursor_x == wnd->width){
						wnd->cursor_x = 0;
						wnd->cursor_y++;
					}
					break;
		}
	if(wnd->cursor_y == wnd->height)
		scroll_window(wnd);
	show_cursor(wnd);
}
Example #2
0
void show_cursor(WINDOW* wnd) {
    if (wnd->x + wnd->cursor_x > 79) {
        wnd->cursor_x = 0;
    }
    poke_screen(wnd->x + wnd->cursor_x,
            wnd->y + wnd->cursor_y,
            wnd->cursor_char | (default_color << 8));
}
Example #3
0
void output_char(WINDOW* wnd, unsigned char c) {
    volatile int flag;

    DISABLE_INTR(flag);
    remove_cursor(wnd);
    switch (c) {
        case '\n':
        case 13:
            wnd->cursor_x = 0;
            wnd->cursor_y++;
            break;
        case '\b':
            if (wnd->cursor_x != 0) {
                wnd->cursor_x--;
            } else {
                if (wnd->cursor_y != 0) {
                    wnd->cursor_x = wnd->width - 1;
                    wnd->cursor_y--;
                }
            }
            break;
        case 14:
            poke_screen(wnd->x + wnd->width,
                    wnd->y + wnd->cursor_y,
                    (short unsigned int) 0xB3 | (default_color << 8));
            wnd->cursor_y++;
            break;
        default:
            poke_screen(wnd->x + wnd->cursor_x,
                    wnd->y + wnd->cursor_y,
                    (short unsigned int) c | (default_color << 8));
            wnd->cursor_x++;
            //            if (wnd->cursor_x == wnd->width) {
            //                wnd->cursor_x = 0;
            //                wnd->cursor_y++;
            //            }
            break;
    }
    if (wnd->cursor_y == wnd->height)
        scroll_window(wnd);
    show_cursor(wnd);
    ENABLE_INTR(flag);
}
Example #4
0
void scroll_window(WINDOW* wnd)
{
	int x, y;
	int wx, wy;

	for(y=0;y<wnd->height-1;y++){
		wy = wnd->y + y;
		for(x=0;x<wnd->width;x++){
			wx = wnd->x + x;
			WORD w = peek_screen(wx,wy+1);
			poke_screen(wx,wy,w);
		}
	}
	wy = wnd->y + wnd->height - 1;
	for(x=0;x<wnd->width;x++){
		wx = wnd->x + x;
		poke_screen(wx,wy,0);
	}
	wnd->cursor_x = 0;
	wnd->cursor_y = wnd->height - 1;
}
Example #5
0
void scroll_window(WINDOW* wnd) {
    int x, y;
    int wx, wy;
    volatile int flag;

    DISABLE_INTR(flag);
    for (y = 0; y < wnd->height - 1; y++) {
        wy = wnd->y + y;
        for (x = 0; x < wnd->width; x++) {
            wx = wnd->x + x;
            WORD ch = peek_screen(wx, wy + 1);
            poke_screen(wx, wy, ch);
        }
    }
    wy = wnd->y + wnd->height - 1;
    for (x = 0; x < wnd->width; x++) {
        wx = wnd->x + x;
        poke_screen(wx, wy, 0);
    }
    wnd->cursor_x = 0;
    wnd->cursor_y = wnd->height - 1;
    ENABLE_INTR(flag);
}
Example #6
0
void clear_window(WINDOW* wnd)
{
	int x, y;
	int wx, wy;

	wnd->cursor_x = 0;
	wnd->cursor_y = 0;

	for(y=0;y<wnd->height;y++){
		wy = wnd->y + y;
		for(x=0;x<wnd->width;x++){
			wx = wnd->x + x;
			poke_screen(wx,wy,0);
		}
	}
	show_cursor(wnd);
}
Example #7
0
void clear_window(WINDOW* wnd) {
    int x, y;
    int wx, wy;

    volatile int flag;

    DISABLE_INTR(flag);
    wnd->cursor_x = 0;
    wnd->cursor_y = 0;
    for (y = 0; y < wnd->height; y++) {
        wy = wnd->y + y;
        for (x = 0; x < wnd->width; x++) {
            wx = wnd->x + x;
            poke_screen(wx, wy, 0);
        }
    }
    show_cursor(wnd);
    ENABLE_INTR(flag);
}
Example #8
0
void remove_cursor(WINDOW* wnd)
{
	poke_screen(wnd->x + wnd->cursor_x, wnd->y + wnd->cursor_y,' ');
}
Example #9
0
void remove_cursor(WINDOW* wnd) {
    poke_screen(wnd->x + wnd->cursor_x,
            wnd->y + wnd->cursor_y, ' ' | (default_color << 8));
}