Write the standard library. The 11 services your compiled programs call into. By end of week the full computing stack exists, every layer written by you, from logic gates at week 1 through OS services at week 13. The capstone week takes this stack and ships a Virtus Console.
Reading
- Chapter prose (primary). draft-chapters/ch12-virtus-os-prose.md
- Petzold weave anchors. Ch 22 The Operating System p. 330 (sixth-and-absolute-final Ch 22 citation; "Providing a program with easy access to the hardware of the computer is the third major function of an operating system"); Ch 25 The Graphical Revolution p. 370 (returning visit; cross-chapter callback to Ch 11 weave #3, the
swto the framebuffer); Ch 25 The Graphical Revolution p. 382 (sixth-and-absolute-final Ch 25 citation; the very last paragraph of CODE; closes Petzold's ladder and the curriculum's)
The final paragraph of Petzold's CODE lands here, in week 13 of CSA-101. Read it aloud. The book closes; your course closes; the ladder you built closes.
- Cross-chapter handouts. stdlib service reference, the API contract you implement
Lecture
lectures/ch12-virtus-os-lecture.md. 3 hours. Key arc:
- The 9 primary services: Math, Memory, Output, Console, Screen, GamePad, Sound, Sys, GPIO
- The 2 helpers: String, Array
- ~34 service entry points total. Each one is one .vm function the compiler emits calls into
- Service-by-service walk-through. Math is the simplest (multiply, divide, sqrt, min, max). Screen is the densest (drawPixel, drawLine, drawRectangle, drawCircle; uses the VCP for the framebuffer write)
- Where the services live in memory. Each service compiles to its own .vm file; the linker maps them into a fixed OS region at the top of the address space
Sys.init. The entry point. Boots the OS; calls Main.main; returns to a halt loop
Figure 13.1. The OS you implement this week. The amber spine is the boot path: Sys.init walks every other service's init in order, then hands control to your Main.main. The green edges are the runtime calls that compose the API surface; the dashed edges are error paths and self-decompositions. Pin this picture during Labs 12.1-12.5; the order of the boot path is the order your testbench fills as each init lands.
Lab exercises
Five labs in worksheets/ch12/ including the capstone scoping lab.
- lab-12.1-implement-math-lib.md
- lab-12.2-implement-memory-string-array-lib.md
- lab-12.3-implement-screen-lib.md
- lab-12.4-implement-keyboard-sound-vcp-integration.md
- lab-12.5-capstone-ship-the-virtus-console.md, capstone scoping; the deliverable is shipped in week 14
Plan for ~6 hours of lab. The screen and VCP labs are the highest-friction of the course; budget extra time.
Independent practice
- Read Petzold's final paragraph (Ch 25, p. 382) aloud. The closing simile (Morse code, the flashlight from his Ch 4) closes the Petzold thread that opened in your week 1
- Update your Toolchain Diary. Week 13 introduces: the full Virtus OS development workflow, framebuffer poking via the VCP's memory-mapped registers, debouncing GamePad input
Architecture comparison sidebar
Virtus OS exposes ~34 service entry points. POSIX defines ~1,000 system calls and library functions. Win32 exposes ~10,000 API entry points. The Virtus OS roster is intentionally minimal (teaching-scale; one student can hold the whole API in working memory). Real OS APIs grow because real OS users have ever-broader needs (filesystems, networking, GPU, audio, video, IPC, security). CSA-201 introduces a richer OS surface; CON-101 uses Virtus OS as the build target for a retro-game development course.
Reflection prompts
- Petzold's book closed this week at p. 382. CSA-101 closes next week with the capstone. Look back at week 1. What did you not know then that you know now?
- The Virtus OS API has 34 entry points. POSIX has 1,000. Win32 has 10,000. What pressure causes the growth?
- The standard library hides hardware details from application programmers. Compile a program that uses Screen.drawPixel and trace what happens at each layer (compiler → linker → CPU → VCP → framebuffer → HDMI). Which layer surprised you?
What's next
Week 14 is capstone delivery. Ship the Virtus Console. Demo video. Write-up. Bridge talk to CSA-201, CON-101, RE-101. The closing of the ladder.