Commit ac767117 by malcolm

Added support for certain control characters and hardware cursor

parent 8be723c8
Showing with 38 additions and 5 deletions
......@@ -5,6 +5,7 @@
*/
#include "term.h"
#include "asm.h"
uint8_t make_color(enum vga_color fg, enum vga_color bg)
{
......@@ -26,6 +27,15 @@ size_t terminal_column;
uint8_t terminal_color;
uint16_t* terminal_buffer;
void update_csr()
{
unsigned temp = terminal_row*80+terminal_column;
outb(0x3D4,14);
outb(0x3D5,temp>>8);
outb(0x3D4, 15);
outb(0x3D5, temp);
}
void terminal_initialize()
{
terminal_row = 0;
......@@ -55,15 +65,38 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
void terminal_putchar(char c)
{
terminal_putentryat(c, terminal_color, terminal_column, terminal_row);
if (++terminal_column == VGA_WIDTH)
if(c=='\b')
{
if(terminal_column == 0)
{
terminal_row--;
terminal_column=VGA_WIDTH;
}
terminal_column--;
terminal_putentryat(' ',terminal_color, terminal_column,terminal_row);
}
else if(c=='\n')
{
terminal_column=0;
terminal_row++;
}
else if(c=='\t')
{
terminal_writestring(" ");
}
else
{
terminal_column = 0;
if (++terminal_row == VGA_HEIGHT)
terminal_putentryat(c, terminal_color, terminal_column, terminal_row);
if (++terminal_column == VGA_WIDTH)
{
terminal_row = 0;
terminal_column = 0;
if (++terminal_row == VGA_HEIGHT)
{
terminal_row = 0;
}
}
}
update_csr();
}
void terminal_writestring(const char* data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment