kernel/vga.c
void screen_putc(char c, vga_color_t back, vga_color_t front) {
    /*
    The VGA buffer put from the address 0xB8000.
    Then read the memory above, each two bytes represented as a character.
    The color (back, front) puts on the higher 8 bits, and the ASCII code puts on the lower 8 bits.    
    */
    uint8_t color_byte = (back << 4) | (front & 0x0f);

    switch(c) {
        case '\n':
            cursor_x = 0;
            cursor_y++;
            cursor();
            return;
        default:
            if (c >= ' ') {
                vga_memory[cursor_y*80 + cursor_x] = c | (color_byte << 8);
                cursor_x++;
            }
    }

    /* newline */
    if (cursor_x >= 80) {
        cursor_x = 0;
        cursor_y++;
    }

    cursor();
}
/* Put a character on the screen */
Put a character on the screen
Put a character on the screen
void screen_putc(char c, vga_color_t back, vga_color_t front) {
    uint8_t color_byte = (back << 4) | (front & 0x0f);
    switch(c) {
        case '\n':
            cursor_x = 0;
            cursor_y++;
            cursor();
            return;
        default:
            if (c >= ' ') {
                vga_memory[cursor_y*80 + cursor_x] = c | (color_byte << 8);
                cursor_x++;
            }
    }
    if (cursor_x >= 80) {
        cursor_x = 0;
        cursor_y++;
    }
    cursor();
}
void screen_putc ( char c , vga_color_t back , vga_color_t front ) { uint8_t color_byte = ( back << 4 ) | ( front & 0x0f ) ; switch ( c ) { case ' \n ' : cursor_x = 0 ; cursor_y ++ ; cursor ( ) ; return ; default : if ( c >= ' ' ) { vga_memory [ cursor_y * 80 + cursor_x ] = c | ( color_byte << 8 ) ; cursor_x ++ ; } } if ( cursor_x >= 80 ) { cursor_x = 0 ; cursor_y ++ ; } cursor ( ) ; }
Put a character on the screen
Put a character on the screen
/*
    The VGA buffer put from the address 0xB8000.
    Then read the memory above, each two bytes represented as a character.
    The color (back, front) puts on the higher 8 bits, and the ASCII code puts on the lower 8 bits.    
    */ /* newline */