diff options
-rw-r--r-- | doc/LINKS.TODO | 5 | ||||
-rw-r--r-- | src/kernel.c | 13 | ||||
-rw-r--r-- | src/vga.c | 16 | ||||
-rw-r--r-- | src/vga.h | 1 |
4 files changed, 31 insertions, 4 deletions
diff --git a/doc/LINKS.TODO b/doc/LINKS.TODO index 76e88a7..65e754f 100644 --- a/doc/LINKS.TODO +++ b/doc/LINKS.TODO @@ -1 +1,6 @@ https://github.com/cs107e/cs107e.github.io +http://wiki.osdev.org/Calling_Conventions +http://wiki.osdev.org/Linker_Scripts +http://wiki.osdev.org/Printing_To_Screen +http://wiki.osdev.org/Exceptions#General_Protection_Fault +https://en.wikipedia.org/wiki/X86_calling_conventions diff --git a/src/kernel.c b/src/kernel.c index de14d8f..60d0dd3 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -13,7 +13,7 @@ void entry( void ) volatile char msg[] = "ABAOS"; vga_put_string_at( &vga, 0, 0, (const char *)msg ); // doesn't work - vga_put_string_at( &vga, 0, 1, "ABAOS2" ); + //~ vga_put_string_at( &vga, 0, 1, "ABAOS2" ); // clang 4.0.0 needs volatile otherwise it takes a random value // from the register in the second vga_put_char_at below??! @@ -26,7 +26,7 @@ void entry( void ) pos++; } vga_put_char_at( &vga, pos, 0, bar[i%4] ); - for( int j = 0; j < 3000; j++ ) { + for( int j = 0; j < 1500; j++ ) { } } vga_put_char_at( &vga, pos, 0, '.' ); @@ -34,4 +34,13 @@ void entry( void ) vga_set_color( &vga, VGA_COLOR_WHITE ); vga_set_background_color( &vga, VGA_COLOR_RED ); vga_clear_screen( &vga ); + + for( int i = 0; i < 50; i++ ) { + for( int j = 0; j < i; j++ ) { + vga_put_char( &vga, '-' ); + } + vga_put_char( &vga, '>' ); + vga_put_string( &vga, (const char *)msg ); + vga_put_newline( &vga ); + } } @@ -30,7 +30,7 @@ void vga_clear_screen( vga_t *vga ) *(VIDEO_MEMORY+i+1) = calculate_color_cell( vga ); } - //~ vga_set_cursor( vga, 0, 0 ); + vga_set_cursor( vga, 0, 0 ); } void vga_set_cursor( vga_t *vga, const int x, const int y ) @@ -102,7 +102,7 @@ void vga_put_char( vga_t *vga, const char c ) vga->cursor_y++; if( vga->cursor_y >= vga->res_y ) { // TODO: implement scrolling - vga->res_y = 0; + vga->cursor_y = 0; } } } @@ -114,3 +114,15 @@ void vga_put_string( vga_t *vga, const char *s ) } } +void vga_put_newline( vga_t *vga ) +{ + vga->cursor_x = 0; + vga->cursor_y++; + if( vga->cursor_y >= vga->res_y ) { + // TODO: implement scrolling + vga->cursor_y = 0; + } +} + + + @@ -43,5 +43,6 @@ void vga_put_char_at( vga_t *vga, const int x, const int y, const char c ); void vga_put_string_at( vga_t *vga, const int x, const int y, const char *s ); void vga_put_char( vga_t *vga, const char c ); void vga_put_string( vga_t *vga, const char *s ); +void vga_put_newline( vga_t *vga ); #endif /* VGA_H */ |