]>
git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/arch/x86/tty/tty.c
4 char *video_memory
= (char *) 0xB8000; /* VGA VRAM starts at 0xB8000 */
6 static int cursor_x
= 0;
7 static int cursor_y
= 0;
9 void screen_clear(void)
12 for ( y
= 0; y
< VGA_HEIGHT
; y
++ ) {
13 for ( x
= 0; x
< VGA_WIDTH
; x
++ ) {
14 video_memory
[(y
* VGA_WIDTH
+ x
) * 2 + 1] = 0x07;
15 video_memory
[(y
* VGA_WIDTH
+ x
) * 2] = ' ';
26 for ( y
= 1; y
< VGA_HEIGHT
; y
++ ) {
27 for ( x
= 0; x
< VGA_WIDTH
; x
++ ) {
28 video_memory
[((y
- 1) * VGA_WIDTH
+ x
) * 2] = video_memory
[(y
* VGA_WIDTH
+ x
) * 2];
31 for ( x
= 0; x
< VGA_WIDTH
; x
++ ) {
32 video_memory
[((VGA_HEIGHT
- 1) * VGA_WIDTH
+ x
) * 2] = ' ';
34 cursor_y
= VGA_HEIGHT
- 1;
37 void kprint(char *string
)
42 while ( next_char
!= 0 ) {
43 if ( next_char
== '\n') { cursor_x
= 0; cursor_y
++; }
44 else { video_memory
[(cursor_y
* VGA_WIDTH
+ cursor_x
++) * 2] = next_char
; }
45 if ( cursor_x
>= VGA_WIDTH
) { cursor_x
= 0; cursor_y
++; }
46 if ( cursor_y
>= VGA_HEIGHT
) { scroll_up(); }
47 next_char
= *++string
;