示例#1
0
文件: file.c 项目: 16Bitt/Flat-OS
void fprint(char* filename){
	if(!is_file(filename))
		return;

	unsigned int i;
	for(i = 0; i < get_file_size(filename); i++)
		vga_putc((char) get_file_data(filename)[i]);

	vga_putc('\n');
}
bool keyboard_handler(struct interrupt_cpu_state *unused(r)) {
    static bool shift_held = false;
    uint8_t status_port;
    uint8_t key_code;
    char c = 0;

    status_port = read_port(Keyboard_Status_Port);

    if (status_port & Keyboard_Input_Available) {
        key_code = read_port(Keyboard_Data_Port);
        if (key_code == Keyboard_Right_Shift_Held ||
                key_code == Keyboard_Right_Shift_Held) {
            shift_held = true;
            return true;
        } else if (key_code == Keyboard_Right_Shift_Released ||
                    key_code == Keyboard_Left_Shift_Released) {
            shift_held = false;
            return true;
        } else {
            if (shift_held) {
                c = keyboard_shift_map[key_code];
            } else {
                c = keyboard_map[key_code];
            }
        }
        if (c != 0) {
            vga_putc(c);
        }
    }

    return true;
}
示例#3
0
void vga_puts(const char *s, unsigned int cnt)
{
    while ( *s && cnt-- ) {
        vga_putc(*s);
        s++;
    }
}
示例#4
0
文件: fat16.c 项目: 16Bitt/virtix
void disp_bpb(){
	vga_puts("init_fat(): read FAT12/16 volume\n");
	
	vga_puts("\t* with OEM identifier '");
	int i;
	for(i = 0; i < 8; i++)
		vga_putc(fat_header.oem_ident[i]);
	
	vga_puts("'\n\t* with ");
	vga_puts_hex(fat_header.sectors_per_cluster);
	vga_puts(" sectors per cluster\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_fats);
	vga_puts(" FATs\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_reserved);
	vga_puts(" reserved sectors\n");
	
	vga_puts("\t* with ");
	vga_puts_hex(fat_header.media_type);
	vga_puts(" media type\n");
	
	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_hidden);
	vga_puts(" hidden sectors\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.dir_size);
	vga_puts(" root entries\n");
	
	vga_fmt("\t* with %d sectors per fat\n", fat_header.sectors_per_fat);
}
示例#5
0
文件: shell.c 项目: t00n/YalOS
void shell_wait_cmd()
{
	shell_wait = true;
	shell_index = 0;
	memset((unsigned char*)shell_buffer, 0, SHELL_WIDTH);
	vga_putc('>');
}
示例#6
0
文件: vga.c 项目: tech-projects/kfs
void vga_puts(char const *str)
{
  while (*str) {
    vga_putc(*str);
    ++str;
  }
}
示例#7
0
文件: console.c 项目: jwanglof/TDIU16
/* Writes C to the vga display and serial port.
   The caller has already acquired the console lock if
   appropriate. */
static void
putchar_have_lock (uint8_t c) 
{
  ASSERT (console_locked_by_current_thread ());
  write_cnt++;
  serial_putc (c);
  vga_putc (c);
}
示例#8
0
文件: fs.c 项目: 16Bitt/virtix
void mnt_initrd(unsigned int ptr){
	unsigned int address = *((unsigned int*) ptr);
	size = *((unsigned int*) address);
	
	unsigned int magic_header = *(unsigned int*)(address + 4);
	unsigned int magic_footer = *(unsigned int*)(address + size - 4);

	ASSERT((magic_footer == FFS_MAGIC) && (magic_header == FFS_MAGIC));

	fs_root = (directory_t*) kmalloc(sizeof(directory_t));
	fs_root->start = address;

	unsigned int num_files = *(unsigned int*)(address + 8);
	fs_root->num_files = num_files;

	file_t** files_list = (file_t**) kmalloc(sizeof(file_t*) * num_files);
	
	int i;
	for(i = 0; i < num_files; i++){
		file_t* new_file = (file_t*) kmalloc(sizeof(file_t));
		files_list[i] = new_file;
		
		new_file->name 		= (char*) (address + 12 + (i * FFS_ENTRY_SIZE));

		vga_puts("CREATING: ");
		vga_puts(new_file->name);
		vga_putc('\t');
		

		new_file->offset 	= *((unsigned int*) (address + 12 + (i * FFS_ENTRY_SIZE) + 128));
		vga_puts("OFFSET: ");
		vga_puts_hex(new_file->offset);
		vga_putc('\t');


		new_file->size		= *((unsigned int*) (address + 12 + (i * FFS_ENTRY_SIZE) + 128 + 4));
		vga_puts("SIZE: ");
		vga_puts_hex(new_file->size);
		vga_putc('\n');

		new_file->data		= (unsigned char*) (address + new_file->offset);
	}

	fs_root->files = files_list;
}
示例#9
0
int putchar(int c) {
#ifdef __IS_MOLTAROS
	vga_putc((char) c);
#else
	// TODO: Write syscall
#endif

	return c;
}
示例#10
0
/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
    bool intr_flag;
    local_intr_save(intr_flag);
    {
        serial_putc(c);
		vga_putc(c);
    }
    local_intr_restore(intr_flag);
}
示例#11
0
文件: shell.c 项目: t00n/YalOS
void echo(int argc, char** argv)
{
	int len = argc, i;
	for (i = 1; i < len; ++i)
	{
		vga_puts(argv[i]);
		vga_putc(' ');
	}
	vga_putnl();
}
示例#12
0
文件: shell.c 项目: t00n/YalOS
void shell_char(struct keystate keys)
{
	if (keys.keychar == '\n')
	{
		shell_wait = false;
		vga_putc(keys.keychar);
	}
	else if (keys.keychar == '\b')
	{
		if (shell_index > 0)
		{
			--shell_index;
			shell_buffer[shell_index] = 0;
			vga_putc(keys.keychar);
		}
	}
	else if (shell_index < SHELL_WIDTH)
	{
		shell_buffer[shell_index] = keys.keychar;
		++shell_index;
		vga_putc(keys.keychar);
	}
}
示例#13
0
文件: timer.c 项目: 16Bitt/Flat-OS
static void timer_callback(registers_t regs){
	tick++;
	vga_puts("TICK:");
	vga_puts_hex(tick);
	vga_putc('\n');
}
示例#14
0
文件: vga.c 项目: salvestrini/blink
int vga_putchar(int c)
{
        uint_t row;
        uint_t column;

        int    print_action;
        int    post_action;
        int    move_action;

        if (!initialized) {
                return EOF;
        }

        /* Retrieve the old cursor position */
        row    = vga.row;
        column = vga.column;

        print_action = 1;
        move_action  = 1;
        post_action  = 1;

        /* Pre-print action */
        switch (c) {
                case '\a': /* Bell */
                        /* Missing */
                        break;

                case '\b': /* Back Space */
                        column       = column - 1;
                        c            = ' ';
                        print_action = 1;
                        post_action  = 0;
                        break;

                case '\t': /* Tab */
                        column       = column + 8;
                        print_action = 0;
                        post_action  = 0;
                        break;

                case '\v': /* Vertical Tab ? */
                        /* missing */
                        break;

                case '\n': /* New Line */
                        row          = row    + 1;
                        column       = 0;
                        print_action = 0;
                        post_action  = 0;
                        break;

                case '\f': /* Form Feed */
                        row          = row    + 1;
                        print_action = 0;
                        post_action  = 0;
                        break;

                case '\r': /* Line Feed */
                        column       = 0;
                        print_action = 0;
                        post_action  = 0;
                        break;

                default:
                        print_action = isprint(c);
                        post_action  = print_action;
                        break;
        }

        check_bounds(&column, &row);

        /* Print */
        if (print_action) {
                vga_putc(c, row, column);
        }

        /* Post-print action */
        if (post_action) {
                switch (c) {
                        default:
                                column = column + 1;
                                break;
                }
        }

        check_bounds(&column, &row);

        /* Move */
        if (move_action) {
                vga_move_cursor(row, column);
        }

        /* Save the final cursor position */
        vga.row    = row;
        vga.column = column;

        return (unsigned char) c;
}
示例#15
0
文件: vga.c 项目: ksashtekar/Ganoid
void vga_puts (const char *s)
{

  while(*s)
    vga_putc (*s++);
}
示例#16
0
文件: cons.c 项目: ryo/netbsd-src
void
vgacnputchar(void *dev, register int c)
{

	vga_putc(c);
}
示例#17
0
文件: utils.c 项目: tech-projects/kfs
void putchar(char c)
{
  serial_putc(IO_COM1, c);
  vga_putc(c);
}