API reference
The public surface an app or driver codes against. Signatures are quoted from the headers
(unoui/unoui.h, pc64/fb.h, pc64/uno_app.h, uno3d.h).
unoui: windows
void unoui_window_init(unoui_window *win, const char *title,
int x, int y, int w, int h);
void unoui_ui_init (unoui_ui *, const unoui_theme *, int sw, int sh);
void unoui_ui_theme(unoui_ui *, const unoui_theme *); /* live re-skin */
void unoui_ui_add (unoui_ui *, unoui_window *); /* topmost = focus */
void unoui_bring_to_front(unoui_ui *, unoui_window *win);
unoui_action unoui_handle (unoui_ui *, const unoui_event *); /* feed one event */
void unoui_render_ui(unoui_ui *);
void unoui_fullscreen(unoui_ui *, unoui_window *win); /* NULL = restore */
void unoui_reflow_window(const unoui_theme *, unoui_window *);
/* window flags: UI_WIN_BARE UI_WIN_BOTTOM UI_WIN_TOP UI_WIN_RESIZE
limits: UNOUI_MAX_WIDGETS = 64, UNOUI_MAX_WINDOWS = 8 */
unoui: widgets
Every constructor returns a unoui_widget *; set its ->id so you can recognise it in
the returned unoui_action.
/* all return unoui_widget *; set ->id afterwards to identify it in actions */
unoui_widget *unoui_add_label (unoui_window *, int x, int y, const char *text);
unoui_widget *unoui_add_button (unoui_window *, int x, int y, int w, const char *text, int flags);
unoui_widget *unoui_add_check (unoui_window *, int x, int y, const char *text, int on);
unoui_widget *unoui_add_radio (unoui_window *, int x, int y, const char *text, int on);
unoui_widget *unoui_add_field (unoui_window *, int x, int y, int w, const char *text, int focus);
unoui_widget *unoui_add_edit (unoui_window *, int x, int y, int w, unoui_text *t);
unoui_widget *unoui_add_textarea(unoui_window *, int x, int y, int w, int h, unoui_text *t);
unoui_widget *unoui_add_progress(unoui_window *, int x, int y, int w, int v, int vmax);
unoui_widget *unoui_add_vscroll (unoui_window *, int x, int y, int h, int v, int vmax);
unoui_widget *unoui_add_hscroll (unoui_window *, int x, int y, int w, int v, int vmax);
unoui_widget *unoui_add_slider (unoui_window *, int x, int y, int w, int vmin, int vmax, int v);
unoui_widget *unoui_add_spinner (unoui_window *, int x, int y, int w, int vmin, int vmax, int v);
unoui_widget *unoui_add_dropdown(unoui_window *, int x, int y, int w, const char **items, int n, int sel);
unoui_widget *unoui_add_tabs (unoui_window *, int x, int y, int w, const char **items, int n, int sel);
unoui_widget *unoui_add_menubar (unoui_window *, const unoui_menu *menus, int n);
unoui_widget *unoui_add_list (unoui_window *, int x, int y, int w, int h, const char **items, int n, int sel);
unoui_widget *unoui_add_group (unoui_window *, int x, int y, int w, int h, const char *title);
unoui_widget *unoui_add_sep (unoui_window *, int x, int y, int w);
unoui_widget *unoui_add_canvas (unoui_window *, int x, int y, int w, int h, unoui_canvas *c);
/* widget state flags: UI_F_DEFAULT UI_F_PRESSED UI_F_FOCUS UI_F_DISABLED
UI_F_CHECKED UI_F_CARET UI_F_HOT */
unoui: editable text
Fields and text areas edit a buffer the app owns; the toolkit tracks caret and selection in place.
/* editable text: the APP owns the char buffer; the toolkit edits it in place */
typedef struct {
char *buf; int cap; int len; int caret; int sel;
int scroll_x; int scroll_y; int multiline;
} unoui_text;
void unoui_text_init(unoui_text *t, char *buf, int cap, int multiline);
void unoui_text_set (unoui_text *t, const char *s);
unoui: the event model
This is the portability contract. A platform adapter produces unoui_events;
unoui_handle returns an unoui_action describing what changed.
typedef enum {
UI_EV_NONE = 0,
UI_EV_MOUSE_DOWN, UI_EV_MOUSE_UP, UI_EV_MOUSE_MOVE,
UI_EV_KEY, /* virtual key (UI_KEY_*) */
UI_EV_CHAR, /* printable char (.ch) */
UI_EV_WHEEL, /* scroll (.wheel notches) */
UI_EV_TICK /* frame tick, drives caret blink */
} ui_event_kind;
enum { UI_MOD_SHIFT = 1, UI_MOD_CTRL = 2, UI_MOD_ALT = 4 };
enum { /* virtual keys, kept above ASCII so CHAR vs KEY split cleanly */
UI_KEY_LEFT = 0x100, UI_KEY_RIGHT, UI_KEY_UP, UI_KEY_DOWN,
UI_KEY_HOME, UI_KEY_END, UI_KEY_PGUP, UI_KEY_PGDN,
UI_KEY_BACKSPACE, UI_KEY_DELETE, UI_KEY_ENTER, UI_KEY_TAB, UI_KEY_ESC
};
typedef struct { /* one input event */
ui_event_kind kind;
int x, y, button; /* mouse position (screen) + button */
int key; /* UI_KEY_* for UI_EV_KEY */
int ch; /* ASCII for UI_EV_CHAR */
int mods; /* UI_MOD_* bitmask */
int wheel; /* +down / -up */
} unoui_event;
typedef struct { /* result of feeding one event */
int changed; /* nonzero => id/kind/value are meaningful */
int id; /* the widget's app id */
int kind; /* the widget's kind, or UI_ACT_CLOSE */
int value; /* new value / selection / z-index */
} unoui_action;
#define UI_ACT_CLOSE 9999 /* close box clicked; action.value = z-index */
unoui: theming
A theme is a semantic colour palette plus metrics plus an optional vtable of chrome painters; a NULL painter
falls back to the portable default, so the same widgets render on 1-bit through 32-bit targets. Ten themes ship:
theme_aurora_light, theme_aurora_dark, theme_unodos, theme_macos7,
theme_macplus, theme_win31, theme_amiga, theme_c64,
theme_apple2, theme_next. Switch live with unoui_ui_theme(&ui, &theme_c64).
Framebuffer (fb)
The software drawing surface underneath the toolkit; canvas apps draw with it directly.
typedef uint32_t fb_px;
void fb_clear(fb_px c);
void fb_fill_rect(int x,int y,int w,int h,fb_px c);
void fb_frame_rect(int x,int y,int w,int h,fb_px c);
void fb_pixel(int x,int y,fb_px c);
void fb_hline(int x,int y,int w,fb_px c);
void fb_vline(int x,int y,int h,fb_px c);
void fb_invert_rect(int x,int y,int w,int h);
void fb_set_clip(int x,int y,int w,int h); /* confine drawing */
void fb_reset_clip(void);
void fb_blend_pixel(int x,int y,fb_px c,int a); /* alpha 0..255 */
void fb_blend_rect(int x,int y,int w,int h,fb_px c,int a);
void fb_grad_v(int x,int y,int w,int h,fb_px top,fb_px bot);
void fb_round_rect(int x,int y,int w,int h,int rad,fb_px c);
void fb_set_font(const fb_font *f);
int fb_text(int x,int y,const char *s,fb_px fg,long bg); /* bg = -1 => transparent */
int fb_text_w(const char *s);
int fb_text_h(void); /* line height of the active font */
void fb_get_clip(int *x,int *y,int *w,int *h); /* save/restore the clip */
int fb_big_text(int x,int y,const char *s,fb_px fg,long bg,int scale);
/* FB_RGB(r,g,b); named colors UNO_WHITE UNO_BLACK UNO_BLUE UNO_CYAN UNO_MAG
corner masks FB_CORNER_TL/TR/BL/BR/ALL; externs fb[], uno_fb_w, uno_fb_h */
Platform subsystems
Names and roles (see the corresponding .c for exact prototypes):
| Subsystem | Role |
|---|---|
pc64_fs / pc64_io | Unified file namespace: volume 0 is the RAM disk, volumes 1+ are FAT/FAT32 disks mounted by UnoDOS's own FAT stack (read/write) over the native AHCI/NVMe/SDHCI and USB mass-storage drivers, with firmware Simple File System volumes as read/write extras while attached. |
blkdev / unostorage / fat | The storage stack: blkdev is raw 512-byte sector transport (native drivers + a firmware fallback); fat mounts + reads/writes FAT16/32 and formats it (uno_fat_mkfs); unostorage authors a GPT + ESP on a raw disk. The installer and the remote channel both wrap these rather than re-implementing them. |
unosound | Single-voice sequencer; the shared audio path for the games, Music and Tracker (uno_seq_beep / _play / _stop). On pc64 the voice renders into an HD Audio / AC'97 PCM ring when one exists (snd_pcm.c), else the PC speaker. |
pc64_pci | PCI config scan; locates the e1000 NIC, xHCI controllers and the Intel iGPU. |
uno_devmgr (unodevices) | The device manager: enumerates the whole PCI tree once into a registry (location, IDs, class, capabilities, BARs, parent bridge) and reports what is on the machine and which driver, if any, claimed each part. It backs the devices remote verb and the uno.devices()/uno.pci() Python calls. Phase 1 is read-only introspection; driver auto-binding is a later phase. See DEVICES.md. |
net / e1000 / e1000e / igb / r8169 | Intel (8254x, 82571-4/82574, I217-9, I210/I211/I350) and Realtek (RTL8168/8111/8125) drivers, each publishing a uno_nic_t, plus a from-scratch stack: ARP, IPv4, ICMP, UDP, DHCP, DNS, single-connection TCP. |
pc64_http / pc64_browser / js | HTTP/1.0 GET with DNS, the immediate-mode HTML/Markdown/CSS renderer, and the JavaScript interpreter. |
tls / bearssl | Freestanding BearSSL, TLS 1.2, with pinned-key and CA-validated (14 roots) modes; clock from the UEFI RTC. |
xhci / ax88179 / rtl8152 / usbmsc | Opt-in (-DUNO_XHCI) polled xHCI host, ASIX and Realtek USB-gigabit drivers (each publishing a uno_nic_t), and USB mass storage (Bulk-Only Transport). |
iwlwifi / rtwifi / mrvlwifi | Intel (AX201/AX210), Realtek and Marvell Wi-Fi drivers. The Intel driver loads firmware, scans, joins a WPA2 network and holds a DHCP lease on real hardware (one laptop so far); WPA3 authenticates but its handshake does not complete yet. Realtek and Marvell map the device and load its firmware, but do not associate yet. |
pc64_font | Optional TrueType engine; registers as the fb text provider with subpixel smoothing, falling back to the built-in bitmap font. |
unovirt / hv_vmx / hv_svm / unovdev | The hypervisor behind Appliances: a capability gate that says whether this machine can host a guest and why not, a backend seam with Intel VMX and AMD SVM implementations, second-stage paging into a memory carve taken at detach, a budgeted slice run from the shell's frame loop, and virtio-mmio device models (console, block, net) plus the 8250 and 8259 a Linux kernel expects. Proven on VMX; the SVM side builds but has not yet run a guest. See UNOVIRT.md. |
3D (uno3d)
A small write-once 3D pipeline with a software rasteriser (Gouraud shading, no textures). Runner3D drives it directly.
typedef struct { float x, y, z; } u3d_vec3;
typedef struct { float x, y, z; unsigned char r, g, b; } u3d_vert;
void u3d_init(int w, int h);
void u3d_shutdown(void);
void u3d_begin(unsigned char r, unsigned char g, unsigned char b); /* clear */
void u3d_perspective(float fov_deg, float aspect, float znear, float zfar);
void u3d_load_identity(void);
void u3d_translate(float x, float y, float z);
void u3d_scale(float x, float y, float z);
void u3d_rotate_x(float deg);
void u3d_rotate_y(float deg);
void u3d_rotate_z(float deg);
void u3d_triangles(const u3d_vert *verts, int tri_count); /* Gouraud, no textures */
void u3d_end(void);
void u3d_present(void);
uno: the Python app module
The surface a Python app codes against. import uno, subclass
uno.App, and reach the platform through the module and the Canvas passed to your
build/draw. A machine-readable stub ships in SDK\uno.pyi.
import uno
uno.rgb(r, g, b) # pack a colour (0-255 each) -> int
# --- Canvas (passed to build() and draw(); coords are canvas-relative) ---
cv.width(); cv.height() # your drawable size, in pixels
cv.clear(color) # fill the whole canvas
cv.fill_rect(x, y, w, h, color) # filled / outline rectangle
cv.rect(x, y, w, h, color)
cv.pixel(x, y, color)
cv.hline(x, y, w, color); cv.vline(x, y, h, color)
cv.text(x, y, "string", color)
# --- Sound (the shared UnoSound voice) ---
uno.beep(midi, ticks) # square-wave note, ticks ~= 1/60 s
uno.quiet()
# --- Files (vol defaults to 0, the boot volume) ---
uno.read(name) -> bytes # whole (small) file
uno.read_at(vol, name, off, n) -> bytes # stream a big file a slice at a time
uno.size(name) -> int # bytes, or -1 if missing
uno.write(name, data) -> bool # to a writable volume
uno.mkdir(vol, name) -> bool # create one directory (parent must exist)
# --- Devices: what hardware is on this machine (read-only) ---
uno.devices() -> str # the device tree, one line per PCI function:
# "bb:dd.f ven:dev cc/ss class driver|UNCLAIMED"
uno.pci() -> list # the same, parsed for filtering:
# [(loc, ven, dev, cls, subcls, progif, driver_or_None), ...]
This is the app-authoring module. The separate unoauto module below is the
system-automation surface (probe, inject input, drive the machine), present in every build and
gated by privilege. The full per-call contract is in the
Python SDK reference.
unoauto: automation (Python, on the device)
import unoauto from any Python app to observe and drive the system - the automation half of
unoautomate. The surface ships in every build; each call
checks the caller's privilege, and a capability you don't hold makes the call return its inert value
(False, [], None) rather than raise - so
available() answers False on a machine that grants you nothing. In a debug OS
everything is allowed.
| Function | Returns / effect |
|---|---|
available() | True in a debug OS, False in production. |
log(text) | Emit a line on the script log channel (streams to the remote link). |
probe() | System snapshot: a list of (name, kind, state, v1, v2) rows - kind 0 module, 1 window, 2 subsystem. |
key(scan, uni, ctrl=0) | Inject a keypress, processed on the next frame. |
pointer(x, y, btn) | Inject a pointer event. |
apps() | Number of launchable apps. |
launch(i) | Open app i; True on success. The id form over the wire (launch <id>) is the one to prefer in anything durable. |
close_top() | Close the top window. |
uptime() | Milliseconds since boot. |
deadline_left() | Milliseconds left in the current test budget, or -1 if none is armed. |
poweroff() | Shut the machine down (for unattended runs). |
remote_active() | True when the link to the dev PC is up. |
remote_send(text) | Send a message to the dev PC. |
remote_recv() | Next inbound message, or None. |
remote_stop() | Tear the link down. |
UnoAutoLink: driving from your PC (Python)
From pc64/tools/unoauto_remote.py. Construct one, call listen(), and the device dials in
(wait_connected()). Every command method blocks for the reply and raises on a device error or timeout.
| Method | Returns / effect |
|---|---|
listen() / close() | Start / stop the listener. |
wait_connected(timeout) | Block until the device connects. |
on_log(cb) / on_message(cb) | Callbacks for streamed logs and messages. |
on_command(verb, cb) | Handle a command the device sends to your PC. |
message(text) | Send a free-form message to the device. |
command(verb, *args, timeout=5) | Run any command; returns its reply lines. |
probe() | Snapshot as a list of dicts (keys: kind, state, v1, v2, name). |
vols() | Volumes as a list of dicts (keys: vol, kind, writable, name). |
launch(id) / close_top() / apps() | App control. launch takes an app id ("browser") or a slot number; prefer the id, since a number is this boot's ordering of whatever is installed. command("apps", "list") lists them. |
key(scan, uni, ctrl=0) / pointer(x, y, btn=0) | Inject input. |
eval(src) | Run a line of Python on the device; returns its output. |
test(suite="") | Run a conformance suite; returns the report. |
uptime() / poweroff() / reboot() | Read uptime, shut down, or restart. |
push_file(vol, path, local_path) | Push a file (chunk, finalize, verify); True when verified. |
bootnext(n) | Set the next UEFI boot entry. |
disks() | List raw disks (idx / name / sectors / writable / is_boot). |
arm(disk) / disarm() | Arm a disk for a destructive op (auto-disarms after one; refuses the boot disk). |
prepdisk(disk, label) | Partition + format a raw disk as a fresh FAT32 ESP (armed; the "prepare disk B" one-shot). |
mkdir(vol, path) | Create a directory on a volume (parent must exist). |
install(disk, make_default=False) / install_dir(disk, esp_dir) | Clone the running OS onto a prepared disk in one armed step, or lay down a freshly built ESP tree from your PC instead - the headless install. |
devices() | The machine's PCI devices as a list of dicts (keys: loc, vendor, device, cls, name, driver, raw) - what hardware is present and what has no driver yet. |
guard(secs, action="reboot") / pet() / safe() | Arm / keep-alive / stand down the dead-man's switch. with link.guarded(secs): ... arms on entry and stands down on exit, so a wedge inside the block resets the box. |
The C contract underneath (unoauto_log, unoauto_probe,
unoauto_sink_add, unoauto_test_run, the hook taps and unoauto_remote_*) is in
pc64/unoauto.h;
the wire protocol is in REMOTE.md.