kernel.c 368 B

1234567891011121314151617181920
  1. /* Freestanding C: print "Welcome to nebos" via BIOS int 0x10 teletype. */
  2. static void bios_putchar(int c)
  3. {
  4. __asm__ volatile (
  5. "int $0x10"
  6. :
  7. : "a" ((0x0E << 8) | (unsigned char)c),
  8. "b" (0x0000)
  9. );
  10. }
  11. void kernel_main(void)
  12. {
  13. const char msg[] = "Welcome to nebos";
  14. unsigned i;
  15. for (i = 0; msg[i] != '\0'; i++)
  16. bios_putchar((unsigned char)msg[i]);
  17. }