Espresso 0.0.0f
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
#include <types.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <port_io.h>
|
||||
#include <vga/vga.h>
|
||||
|
||||
#include <tty.h>
|
||||
|
||||
static size_t terminal_row;
|
||||
@ -80,6 +78,28 @@ void terminal_putchar(const char c)
|
||||
|
||||
return;
|
||||
}
|
||||
else if (uc == '\b')
|
||||
{
|
||||
if (terminal_column == 0)
|
||||
{
|
||||
terminal_row -= 1;
|
||||
|
||||
if (terminal_row <= -1)
|
||||
{
|
||||
terminal_row = 0;
|
||||
}
|
||||
|
||||
terminal_column = VGA_WIDTH;
|
||||
|
||||
terminal_putentryat(' ', terminal_getcolor(), (size_t)terminal_column, (size_t)terminal_row);
|
||||
}
|
||||
else
|
||||
{
|
||||
terminal_putentryat(' ', terminal_getcolor(), (size_t)--terminal_column, (size_t)terminal_row);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
terminal_putentryat(uc, terminal_color, terminal_column, terminal_row);
|
||||
|
||||
@ -178,3 +198,51 @@ void terminal_scroll(void)
|
||||
terminal_buffer[index] = (terminal_color << 8) | ' ';
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char terminal_get_shifted(unsigned char uc)
|
||||
{
|
||||
unsigned char lowerc[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\0' };
|
||||
unsigned char upperc[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\0' };
|
||||
unsigned char nums[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\0' };
|
||||
unsigned char nsyms[] = { '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\0' };
|
||||
unsigned char syms1[] = { ',', '.', '/', ';', '\'', '[', ']', '`', '-', '=', '\\', '\0' };
|
||||
unsigned char syms2[] = { '<', '>', '?', ':', '\"', '{', '}', '~', '_', '+', '|', '\0' };
|
||||
|
||||
for (int32_t i = 0; i < (int32_t)(strlen((char*)lowerc) - 1); ++i)
|
||||
{
|
||||
if (uc == lowerc[i])
|
||||
{
|
||||
return upperc[i];
|
||||
}
|
||||
else if (uc == upperc[i])
|
||||
{
|
||||
return lowerc[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < (int32_t)(strlen((char*)nums) - 1); ++i)
|
||||
{
|
||||
if (uc == nums[i])
|
||||
{
|
||||
return nsyms[i];
|
||||
}
|
||||
else if (uc == nsyms[i])
|
||||
{
|
||||
return nums[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < (int32_t)(strlen((char*)syms1) - 1); ++i)
|
||||
{
|
||||
if (uc == syms1[i])
|
||||
{
|
||||
return syms2[i];
|
||||
}
|
||||
else if (uc == syms2[i])
|
||||
{
|
||||
return syms1[i];
|
||||
}
|
||||
}
|
||||
|
||||
return '\0';
|
||||
}
|
||||
|
Reference in New Issue
Block a user