# core/rumpk/npl/glyph/glyph.nim # Phase 35c: The Glyph - Surface Manager Test Client import ../../libs/membrane/libc proc main() = # 1. Create Surface let sid = sys_surface_create(640, 480) if sid < 0: return # 2. Get buffer pointer (directly mapped) # In Sv39, this would be a userland address. # For now, it's a physical address (identity mapped). let fb_ptr = cast[ptr UncheckedArray[uint32]](sys_surface_get_ptr(sid)) var frame = 0 while true: # 3. Draw something: Color Cycle let color = uint32(0xFF000000'u32) or (uint32(frame and 0xFF) shl 8) for i in 0 ..< (640 * 480): fb_ptr[i] = color # 4. Flip (Notify compositor) sys_surface_flip(sid) frame += 1 # Yield to let compositor blit # libc.yield()? We'll use the syscall directly if needed or just loop # The kernel scheduler will preempt us anyway. main()