moonshot

technical

punkt

punkt draws directly to a linear region of video memory. on top of that sits a hand-written font renderer that paints moonshot's own characters into that memory.

getting a framebuffer

the kernel's Multiboot header asks the bootloader for a linear graphics mode, 1024×768 at 32 bits per pixel, and GRUB sets the hardware into it before the kernel runs a single instruction. GRUB reports back where the framebuffer lives, and that physical range sits far outside anything the kernel maps by default, so punkt's setup identity-maps it into the kernel's own page tables through jenna. one thing the probe does not trust is GRUB's report of the colour-channel positions, which is wrong under QEMU, so punkt pins the layout it has verified (XRGB)a wrong channel order is invisible for grey pixels, which look the same under any order, and only shows on a strongly coloured screen. instead.

the font

the font is an original 8×8 bitmap. uppercase, lowercase, digits, and punctuation. each glyph is stored as two 32-bit halves rather than one 64-bit value.c0 has no unsigned type and a glyph whose top-left pixel is lit would make a single packed 64-bit value negative, which breaks extracting bytes with division. any 32-bit pattern stays positive, so the split sidesteps the whole problem.

the renderer

above the raw pixels sits a character-cell console. a 128×96 grid of 8×8 cells, with the cursor drawn as a two-pixel underline in the current cell, the same shape VGA text mode's hardware cursor has. it handles newline, wrapping, backspace, tab stops, and scrolling, where the whole screen's pixels shift up one character row. drawing primitives (filled and outlined rectangles, horizontal and vertical lines) started out as groundwork for the windowing layer, which now exists. kakel builds its tiled windows on punkt's primitives, while punkt stays the single owner of the real framebuffer underneath.

the fallback

when no usable framebuffer is granted, the kernel falls back to VGA text mode. the choice is effectively made at build time, whichever video mode the Multiboot header requests is what GRUB commits the hardware to before the kernel starts, so the text path is kept alive by its own test build rather than by runtime switching.