@@ -453,122 +453,6 @@ void fb_console_scroll(int lines) {
453453 scrollback_render ();
454454}
455455
456- void vga_putc (char ch ) {
457- fb_console_putc (ch );
458- }
459-
460- void vga_puts (const char * text ) {
461- fb_console_write (text );
462- }
463-
464- void vga_clear (uint8_t color ) {
465- text_color = color ;
466- fb_clear (0 );
467- }
468-
469- void vga_set_color (uint8_t color ) {
470- text_color = color ;
471- fb_console_set_color ((uint32_t )color );
472- }
473-
474- void vga_scroll (int lines ) {
475- fb_console_scroll (lines );
476- }
477-
478- void vga_set_cursor (uint8_t x , uint8_t y ) {
479- if (framebuffer .type != FB_TYPE_TEXT ) {
480- return ;
481- }
482- if (x >= TEXT_COLS || y >= TEXT_ROWS ) {
483- return ;
484- }
485- text_x = x ;
486- text_y = y ;
487- uint16_t pos = (uint16_t )(y * TEXT_COLS + x );
488- outb (0x3D4 , 0x0F );
489- outb (0x3D5 , (uint8_t )(pos & 0xFF ));
490- outb (0x3D4 , 0x0E );
491- outb (0x3D5 , (uint8_t )((pos >> 8 ) & 0xFF ));
492- }
493-
494- void vga_hide_cursor (void ) {
495- outb (0x3D4 , 0x0A );
496- outb (0x3D5 , 0x20 );
497- }
498-
499- void vga_display_splash (void ) {
500- static const char * logo [] = {
501- " ____ _ _ _ _ _ " ,
502- "| __ ) __ _ ___ (_) ___ __| | ___| (_)_ __ ___| |_ ___ _ __ " ,
503- "| _ \\ / _` / __| | |/ _ \\/ _` |/ _ \\ | | '__/ __| __/ _ \\ '__|" ,
504- "| |_) | (_| \\__ \\ | | __/ (_| | __/ | | | \\__ \\ || __/ | " ,
505- "|____/ \\__,_|___/ |_|\\___|\\__,_|\\___|_|_|_| |___/\\__\\___|_| " ,
506- " BasicallyLinux "
507- };
508- static const char * disclaimer = "(It's definitely not)" ;
509- static const char * messages [] = {
510- "Initializing GDT..." ,
511- "Loading IDT..." ,
512- "Enabling Paging..." ,
513- "Initializing Heap..." ,
514- "Starting Scheduler..." ,
515- "Bringing up Devices..." ,
516- "Launching Shell..."
517- };
518-
519- fb_clear (0 );
520- fb_console_init (0x00FF00 , 0 ); // Green logo
521- for (uint32_t i = 0 ; i < sizeof (logo ) / sizeof (logo [0 ]); ++ i ) {
522- fb_console_write (logo [i ]);
523- fb_console_write ("\n" );
524- }
525- fb_console_init (0xFF0000 , 0 ); // Red disclaimer
526- fb_console_write (disclaimer );
527- fb_console_write ("\n\n" );
528-
529- fb_console_init (0xFFFFFF , 0 ); // White messages
530- for (uint32_t i = 0 ; i < sizeof (messages ) / sizeof (messages [0 ]); ++ i ) {
531- const char * msg = messages [i ];
532- for (uint32_t c = 0 ; msg [c ] != 0 ; ++ c ) {
533- char buf [2 ] = {msg [c ], 0 };
534- fb_console_write (buf );
535- // Simple wait loop since we don't have a reliable wait_ticks here
536- for (volatile int j = 0 ; j < 1000000 ; j ++ );
537- }
538- fb_console_write ("\n" );
539- }
540-
541- fb_console_write ("\n" );
542- fb_console_init (0x00FFFF , 0 ); // Cyan build info
543- fb_console_write ("Build Info: v0.0.1 | i686-linux-gnu\n" );
544-
545- for (volatile int j = 0 ; j < 50000000 ; j ++ );
546- fb_clear (0 );
547- }
548-
549- void vga_print_art (void ) {
550- vga_display_splash ();
551- }
552-
553- void vga_draw_rect (uint16_t x , uint16_t y , uint16_t w , uint16_t h , uint32_t color ) {
554- if (framebuffer .type == FB_TYPE_TEXT ) {
555- uint8_t attr = (uint8_t )color ;
556- for (uint16_t row = 0 ; row < h && (y + row ) < TEXT_ROWS ; ++ row ) {
557- for (uint16_t col = 0 ; col < w && (x + col ) < TEXT_COLS ; ++ col ) {
558- uint32_t idx = (uint32_t )(y + row ) * TEXT_COLS + (x + col );
559- text_buffer [idx ] = text_entry (' ' , attr );
560- }
561- }
562- scrollback_render ();
563- return ;
564- }
565- for (uint32_t row = 0 ; row < h ; ++ row ) {
566- for (uint32_t col = 0 ; col < w ; ++ col ) {
567- fb_put_pixel (x + col , y + row , color );
568- }
569- }
570- }
571-
572456void terminal_set_font (int use_vector ) {
573457 fb_console_set_mode (use_vector );
574458}
@@ -577,16 +461,9 @@ void backspace_handler(void) {
577461 fb_console_backspace ();
578462}
579463
580- uint8_t vga_get_x (void ) {
581- return (uint8_t )text_x ;
582- }
583-
584- uint8_t vga_get_y (void ) {
585- return (uint8_t )text_y ;
586- }
587-
588464void update_vga_buffer (void ) {
589465 if (framebuffer .type == FB_TYPE_TEXT ) {
590466 scrollback_render ();
591467 }
592468}
469+
0 commit comments