Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ac767117
authored
Nov 02, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added support for certain control characters and hardware cursor
parent
8be723c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
src/term.c
src/term.c
View file @
ac767117
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
*/
*/
#include "term.h"
#include "term.h"
#include "asm.h"
uint8_t
make_color
(
enum
vga_color
fg
,
enum
vga_color
bg
)
uint8_t
make_color
(
enum
vga_color
fg
,
enum
vga_color
bg
)
{
{
...
@@ -26,6 +27,15 @@ size_t terminal_column;
...
@@ -26,6 +27,15 @@ size_t terminal_column;
uint8_t
terminal_color
;
uint8_t
terminal_color
;
uint16_t
*
terminal_buffer
;
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
()
void
terminal_initialize
()
{
{
terminal_row
=
0
;
terminal_row
=
0
;
...
@@ -55,6 +65,27 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
...
@@ -55,6 +65,27 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
void
terminal_putchar
(
char
c
)
void
terminal_putchar
(
char
c
)
{
{
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_putentryat
(
c
,
terminal_color
,
terminal_column
,
terminal_row
);
terminal_putentryat
(
c
,
terminal_color
,
terminal_column
,
terminal_row
);
if
(
++
terminal_column
==
VGA_WIDTH
)
if
(
++
terminal_column
==
VGA_WIDTH
)
{
{
...
@@ -64,6 +95,8 @@ void terminal_putchar(char c)
...
@@ -64,6 +95,8 @@ void terminal_putchar(char c)
terminal_row
=
0
;
terminal_row
=
0
;
}
}
}
}
}
update_csr
();
}
}
void
terminal_writestring
(
const
char
*
data
)
void
terminal_writestring
(
const
char
*
data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment