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
7012db9b
authored
Nov 16, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added mroe terminal functionality
parent
fc878126
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
src/term.c
src/term.h
src/term.c
View file @
7012db9b
...
...
@@ -36,6 +36,33 @@ void update_csr()
outb
(
0x3D5
,
temp
);
}
void
terminal_scroll
()
{
for
(
size_t
y
=
0
;
y
<
VGA_HEIGHT
-
1
;
y
++
)
{
for
(
size_t
x
=
0
;
x
<
VGA_WIDTH
;
x
++
)
{
terminal_buffer
[
y
*
VGA_WIDTH
+
x
]
=
terminal_buffer
[(
y
+
1
)
*
VGA_WIDTH
+
x
];
}
}
for
(
size_t
x
=
0
;
x
<
VGA_WIDTH
;
x
++
)
{
terminal_buffer
[(
VGA_HEIGHT
-
1
)
*
VGA_WIDTH
+
x
]
=
make_vgaentry
(
' '
,
terminal_color
);
}
}
void
terminal_clear
()
{
for
(
size_t
y
=
0
;
y
<
VGA_HEIGHT
;
y
++
)
{
for
(
size_t
x
=
0
;
x
<
VGA_WIDTH
;
x
++
)
{
terminal_buffer
[
y
*
VGA_WIDTH
+
x
]
=
make_vgaentry
(
' '
,
terminal_color
);;
}
}
terminal_row
=
terminal_column
=
0
;
}
void
terminal_initialize
()
{
terminal_row
=
0
;
...
...
@@ -79,6 +106,11 @@ void terminal_putchar(char c)
{
terminal_column
=
0
;
terminal_row
++
;
if
(
terminal_row
>=
VGA_HEIGHT
)
{
terminal_scroll
();
terminal_row
=
VGA_HEIGHT
-
1
;
}
}
else
if
(
c
==
'\t'
)
{
...
...
src/term.h
View file @
7012db9b
...
...
@@ -32,6 +32,7 @@ uint8_t make_color(enum vga_color fg, enum vga_color bg);
uint16_t
make_vgaentry
(
char
c
,
uint8_t
color
);
void
terminal_initialize
();
void
terminal_clear
();
void
terminal_setcolor
(
uint8_t
color
);
void
terminal_putentryat
(
char
c
,
uint8_t
color
,
size_t
x
,
size_t
y
);
void
terminal_putchar
(
char
c
);
...
...
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