Standard library
The standard library has three layers:
Layer |
Location |
Import |
|---|---|---|
Intrinsics |
Compiler and |
Built in |
Standard modules |
|
|
Drivers |
|
Explicit import |
Each module is an ordinary Niblick source file. The compiler removes functions and globals that are not reachable, so an unused module contributes no code or RAM.
Module index
Module |
Purpose |
|---|---|
Compiler builtins and runtime-backed operations |
|
Compile-time |
|
UART setup, byte I/O, formatting, hex input |
|
GPIO port reads and writes |
|
Voja4 pin and default SPI constants |
|
Display pages, framebuffer, pixels, lines, rectangles |
|
Front-panel key state and key codes |
|
Clock, Sync, and delays |
|
Auto-off and sleep |
|
Raw status and control SFR access |
|
Hardware PRNG helpers |
|
Nibble and byte memory operations |
|
RAM and flash string operations, number formatting |
|
Integer helpers, square roots, mapping |
|
Q4.4 fixed-point helpers |
|
Q4.4 sine and cosine table |
|
Square-wave output |
|
PDM sample playback |
|
Bit-banged SPI mode-0 master |
|
5x8 font glyphs |
|
Horizontal text scroller |
|
W5500 Ethernet register and socket access |
Public and internal modules
The pages above document the public library. lib/wide.nbl,
lib/float16.nbl, and lib/float32.nbl are compiler implementation modules.
They are loaded automatically when a program uses 64-bit arithmetic or a float
type. Their interfaces are documented in 64-bit arithmetic
and Soft float.
Import resolution
Imports resolve relative to the importing file, then the repository root,
installed data directory, and NIBLICK_PATH entries. See Imports.
Calling conventions
All module functions use the normal Niblick calling convention. Argument and return types follow Types. Stack costs for intrinsics and runtime helpers are listed in Runtime ABI.