📚 AOS Docs

Screen/Video Driver

Framebuffer Output and Display Management

Overview

The screen driver manages video output through the graphics framebuffer provided by the bootloader. AOS supports both text mode (16x16 fixed font) and graphical pixel output.

Framebuffer Basics

A framebuffer is a memory region where each byte or pixel represents displayed content. The bootloader (GRUB) sets up the initial framebuffer and passes information via Multiboot tags.

Framebuffer Information

Property Example
Address 0xFC000000 (physical)
Width 1024 pixels
Height 768 pixels
Pitch Bytes per scanline
BPP (Bits Per Pixel) 24 or 32

Drawing Pixels

// Draw a pixel at (x, y) with RGB color
void put_pixel(int x, int y, uint32_t color) {
    uint32_t *framebuf = (uint32_t *)fb_addr;
    uint32_t index = (y * pitch / 4) + x;
    framebuf[index] = color;
}

Text Output

For text, AOS uses a 8x8 bitmap font embedded in the kernel. Each character is drawn by iterating through font bitmaps and placing pixels.

Key Takeaways

  • ✓ Framebuffer address from bootloader
  • ✓ Linear pixel addressing: (y * pitch) + x
  • ✓ 24-bit or 32-bit color per pixel
  • ✓ Text uses embedded bitmap fonts
  • ✓ Double buffering prevents flicker