~kernel/kernel.cr
.cr
Crystal
(text/x-crystal)
# require "../prelude"

lib LibBootstrap
  @[Packed]
  struct StartInfo
    multiboot_ptr : UInt32
    end_of_kernel : UInt32
  end
end

fun kearly(info_ptr: LibBootstrap::StartInfo*)

  # Get the startup info
  info = info_ptr.value

  # Initialize stuff
  # GDT.init
  # Heap.init info.end_of_kernel
  # PIC.remap
  # PIC.enable
  # IDT.init
end

fun kmain
  # IDT.enable_interrupts
  # kprint "Hello from Fluorite."

  address = Pointer(UInt8).new(0xb8000)
  string = "[CrystalOS Kernel] Hello from C++"
  string_size = 33_u16

  puts "#{string}\n"

  # clear_screen
  # set_cursor_position(1, 0)
  # hide_cursor

  i = 0_u16
  while i < string_size
    address.value = string[i].to_u8
    address = address + 1
    (address).value = 0xA0_u8
    address = address + 1
    i += 1
  end

  # loop { }
end