示例#1
0
文件: kmain.c 项目: elijaheac/osdev
int kmain()
{
	fb_write_cell(0, 'A', FB_GREEN, FB_DARK_GRAY);
	char *hello = "Hello, World!";
	write_out(hello, 13);
	return 0xDEADBABE;
}
示例#2
0
/** fb_write_word:
 *  Writes out word
 */
void fb_write_word() {
	// prints out 'ABCDE' in white on black font
	unsigned char black = 0x7;
	unsigned char grey = 0x0;
	unsigned int addr = 0;

	fb_write_cell(addr, 'T', grey, black);
	addr += 2;
	fb_write_cell(addr, 'O', grey, black);
	addr += 2;
	fb_write_cell(addr, 'N', grey, black);
	addr += 2;
	fb_write_cell(addr, 'Y', grey, black);
	addr += 2;
	fb_write_cell(addr, '!', grey, black);
	addr += 2;
}
示例#3
0
int fb_write(char *buf) {
	while(*buf != 0) {
		fb_move_cursor(currPos);
		fb_write_cell(2 * currPos++, *buf, FB_GREEN, FB_DARK_GREY);
		buf++;
	}
	return currPos;
}
示例#4
0
// Write the contents of a buffer of length len to the screen. Should 
// automatically advance the cursor after a character has been written, and 
// scroll if necessary.
void fb_puts(char *buf, unsigned int len) {
	unsigned int i;
	for (i = 0; i < len; ++i) {
		fb_write_cell(cursor_pos, buf[i], curr_color & 0xF0, curr_color & 0x0F);
		cursor_pos = (cursor_pos + 1) % FB_NUM_CELLS;
	}
	fb_move_cursor();
}
示例#5
0
/** write:
*  Writes a character buffer
*
*  @param buf The character buffer
*  @param len The length of the buffer
*/
void write(char *buf, unsigned int len)
{
    unsigned short i;
    for(i = 0; i < len; i++)
    {
        fb_write_cell(fb_current_pos, buf[i], 0, 15);
        fb_current_pos += 2;
    }
}
示例#6
0
// Write a null-terminated string to the monitor.
void fb_write(char *str) {
	unsigned int i;
	i = 0;
	while (str[i] != '\0') {
		fb_write_cell(cursor_pos, str[i++], curr_color & 0xF0, curr_color & 0x0F);
		cursor_pos = (cursor_pos + 1) % FB_NUM_CELLS;
	}
	fb_move_cursor();
}
示例#7
0
void fb_write_char(const char c) {
    if (c == '\n') {
        fb_curr_pos += (ROW_WIDTH-(fb_curr_pos%ROW_WIDTH));
    } else {
        fb_write_cell(fb_curr_pos, c, FB_LIGHTGREY, FB_BLACK);
        fb_curr_pos+=2;
    }
    fb_set_cursor_pos(fb_curr_pos/2);
}
示例#8
0
void fb_clear() {
    unsigned int i, k;
    for (i = 0; i < ROW_HEIGHT; ++i) {
        for (k = 0; k < ROW_WIDTH; k+=2) {
            fb_write_cell((i*ROW_HEIGHT)+k, '\0', FB_LIGHTGREY, FB_BLACK);
        }
    }
    fb_set_cursor_pos(0);
    fb_curr_pos = 0;
}
示例#9
0
/** fb_clear:
 *  Clears the framebuffer
 */
void fb_clear() {

	unsigned char black = 0x0;

	unsigned int addr = 0;
	unsigned int addr_max = 80 * 50;
	
	unsigned int i = 0;
	for (i = addr; i < addr_max; i += 2) {
		fb_write_cell(i, ' ', black, black);
	}
}
示例#10
0
文件: tty.c 项目: bowlofeggs/dros
/* Write a single character to the terminal */
void fb_write_char(char c)
{
    if (c == '\t') {
        if (fb_cursor_column > 72) {
            c = '\n';
        } else {
            fb_cursor_column += 8 - (fb_cursor_column % 8);
            return;
        }
    }

    /* Handle newline characters */
	if (c == '\n') {
		fb_cursor_column = 0;
		fb_cursor_row++;
		return;
	}

    /* Wrap text by bumping the row when the column hits maximum width */
	if (fb_cursor_column == VGA_WIDTH) {
		fb_cursor_column = 0;
		fb_cursor_row++;
	}

	if (fb_cursor_row == VGA_HEIGHT) {
		// Shift everyone up to make a new row available
		for (size_t row = 1; row < VGA_HEIGHT; row++) {
			for (size_t column = 0; column < VGA_WIDTH; column++) {
				const size_t entry = row * VGA_WIDTH + column;
				framebuffer[entry - VGA_WIDTH] = framebuffer[entry];
				framebuffer[entry] = make_vga_entry(' ', COLOR_LIGHT_GREY, COLOR_BLACK);
			}
		}

		fb_cursor_column = 0;
		fb_cursor_row--;
    }

	fb_write_cell(c, COLOR_LIGHT_GREY, COLOR_BLACK, fb_cursor_row, fb_cursor_column);
    fb_cursor_column++;
}
示例#11
0
int fb_write(char *buf, unsigned int len) {
	
	unsigned int i;
	for(i=0; i<len; i++) {
		
		/* Write character at position i */
		fb_write_cell(2*__fb_present_pos, buf[i], (unsigned char)0, (unsigned char)15);
		fb_move_cursor(__fb_present_pos + 1);
		
		/* If __fb_present_pos goes off the screen, move everything one line up */
		if(__fb_present_pos == FRAMEBUFFER_WIDTH * FRAMEBUFFER_HEIGHT) {
			fb_move_cursor((FRAMEBUFFER_HEIGHT-1)*FRAMEBUFFER_WIDTH);
			
			int j;
			for(j=0; j<2*FRAMEBUFFER_WIDTH*(FRAMEBUFFER_HEIGHT-1); j++) { 
				__fb[j] = __fb[j + FRAMEBUFFER_WIDTH*2];
			}
			for(j=j; j<2*FRAMEBUFFER_WIDTH*FRAMEBUFFER_HEIGHT; j++) {
				__fb[j] = 0;
			}
		}		
	}
	return len;
}
示例#12
0
// Write a single character to the screen from wherever the cursor is.
void fb_putc(char c) {
	fb_write_cell(cursor_pos, c, curr_color & 0xF0, curr_color & 0x0F);
	cursor_pos = (cursor_pos + 1) % FB_NUM_CELLS;
	fb_move_cursor();
}