c1ad0fc5/1/2026, 8:41:11 PM
~kernel/kernel.cr
.cr
Crystal
(text/x-crystal)
# require "../minrt/src/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 = 0xb800 # Pointer(UInt8).reinterpret(0xb8000)

  string = "[CrystalOS Kernel] Hello from Crystal"
  string_size = 33 # string.size

  # Loop over each character in the string
  # [0...string_size];each do |i|
  #   # Write the character
  #   address.value = string[i].to_u8
  #   address += 1
  #   # Write the attribute byte
  #   address.value = 0xA0.to_u8
  #   address += 1
  # end
end