The computer's screen is drawn by each player's own client from short messages. The client keeps the whole picture, and moves, sizes and stacks windows, opens menus and edits text itself, telling the computer afterwards. So nothing the hand does waits for the server, even across an ocean. The Janet library speaks it for you (see Drawing your own screen). This page is for programs that speak it themselves, such as your own system booted from a floppy.
The screen's channel is a device at 0x10007000 with the console's registers: +0 send a byte, +4 read one (−1:
none), +8 status (1: input waiting, 2: room to send), +0xC interrupt enables (the same bits). Both ways it
carries one message per line: a Janet form such as (text 2 5 0 0 :lime "Hello"), ended by a newline. Messages
it doesn't understand are ignored. Strings use Janet's escapes (\n, \", \\). Colours are dye names (:white,
:orange, :magenta, :light-blue, :yellow, :lime, :pink, :gray, :light-gray, :cyan, :purple,
:blue, :brown, :green, :red, :black).
The screen is 80 by 25 character cells until the computer sends another size. Row 0 is the menu bar: the system menu "Dynamo" (drawn by the screen itself:
the windows, to bring one back), then the active window's menus, the screen's title and a clock. Below it is the
desk, and windows over it, numbered 1 to 255 (the machine keeps window 0, Kernel, for what it prints at
0x10002000). w below is a window and id an element (0 to 65535).
A window has a content area of cw by ch cells at (x, y). Around it is a frame of one cell: the title row above
with the close box at its left end and the minimise and depth boxes at its right, and the size handle at the bottom
right corner. Flags choose which it has: :close, :iconify, :depth, :size, :drag (the usual five),
:borderless (no frame), :backdrop (the desk itself: no frame, filling it, behind everything, its icons on the
desk's picture) and :full (filling the desk). A minimised window waits as an icon on the desk's bottom row.
Players move windows, not programs. Once a window is open its place and size belong to the players. Each player's screen moves, sizes, raises and activates windows at once, then reports it. The computer passes the report on to every other screen, and the last report wins.
Each element's position is in the window's content. A negative x or y counts from the right or bottom edge (-1:
the last row). A width or height of :fill, or [:fill n], reaches the window's edge, less n cells, so a window a
player sizes lays itself out again on their own screen. Sending an element again with the same id changes it in
place; a different kind replaces it. Elements are drawn in the order they were first made, so make backgrounds first.
Pictures (pixmaps) are up to 256 by 128 dots in up to 36 colours, numbered 1 to 4095 for the whole screen, 256
at most. A palette entry is a dye or "#rrggbb"; the data has one character a dot, 0 to 9 then a to z into
the palette, . for clear, and must be exactly pw × ph long (else the picture is ignored). A picture stretches
over the cells it is given.
| message | does |
|---|---|
(screen w h), (reset w h) |
the screen's size (20 to 200 by 8 to 100; the Janet ROM uses 80 by 25 and 120 by 40), windows kept and made smaller if they must be; reset instead closes every window and forgets the title and pictures |
(title "text") |
the screen bar's title |
(window w x y cw ch "title" [flags]) |
opens a window. Sent again for an open window, it changes only the title and flags |
(place w x y cw ch) |
moves or sizes a window on purpose (it wins over a drag in progress) |
(unwindow w), (front w), (back w), (activate w) |
closes, raises, lowers, or gives it the keyboard |
(minimize w), (restore w), (icon w pic) |
minimises it to an icon, brings it back; the picture its icon shows |
(pixmap pic pw ph [palette] "data"), (unpixmap pic) |
makes a picture, or forgets it |
(backdrop pic) |
the desk's picture (0: none) |
(image w id x y cw ch pic) |
a picture stretched over cells |
(icon w id x y "label" pic) |
an icon (a picture of 4 by 3 cells over its label), as on the desk: a double-click sends open. Unlike the window's (icon w pic), it has six arguments |
(menus w [["Project" ["Open" "o"] nil ["Quit" "q"]]]) |
its menus (nil: a line between items; "o": Alt+O picks it) |
(enable w "Project" "Open" false) |
greys a menu item out, or back with true |
(ask w id "title" "body" ["OK" "Cancel"]), (unask w) |
a requester over the window, which takes nothing else until answered; and its removal |
(clear w), (remove w id) |
empties a window, or removes an element |
(box w id x y cw ch colour) |
a filled rectangle |
(text w id x y colour "text" bg) |
a line of text (bg is optional) |
(log w id x y cw ch), (append w id colour "text") |
a log keeping its last 1000 lines, and text added to it (it may hold newlines) |
(button w id x y cw "label") |
a button |
(list w id x y cw ch ["row" ...] chosen) |
rows of text the player can scroll and click; chosen (optional) shows a row inverted |
(line w id x y cw "prompt") |
a line the player types in, on their own client |
(busy w id seq true), (busy w id seq false) |
a line's submission seq is taken and running, or done |
(editor w id x y cw ch :janet path rev "text") |
a text editor (:plain for no colours) holding a file at revision rev (any string) |
(saved w id seq rev), (conflict w id seq rev "text") |
the answer to a save: the new revision, or a refusal with the file as it is now |
(raw w id x y cw ch) |
an area that takes the keyboard once clicked (or when its window has no line) |
(dict w ["name" ...]) |
names Tab may complete in window w (0: every window) |
| message | when |
|---|---|
(moved w x y cw ch) |
a player let go of a window they dragged or sized |
(active w), (lowered w) |
a window clicked, which raises it and gives it the keyboard; a window lowered by its depth box. The screen also takes (raised w), though the game's own client never sends it |
(minimized w), (restored w) |
a window minimised by its box, or brought back from its icon or the system menu |
(open w id) |
an icon double-clicked |
(closed w) |
its close box. Closing is the program's choice: send unwindow |
(pick w "Project" "Open") |
a menu item, from the menus or its Alt key ((pick 0 "Dynamo" "About Dynamo"): the system menu's) |
(answer w id i) |
a requester's button i (from 0) |
(submit w id seq "text") |
Enter on a line. seq counts up; the line shows the text grey until a busy for it comes |
(press w id), (select w id row) |
a button clicked, a list's row clicked (from 0) |
(save w id seq rev [[start deleted ["line" ...]] ...]) |
Ctrl+S in an editor: at line start (from 0) of revision rev, deleted lines replaced by the new ones. Answer with saved or conflict |
(key w id "key" mods), (click w id x y) |
in a raw area: a character or a key's name, and Shift 1 + Ctrl 2 + Alt 4; a click in cells from its corner |
(break w) |
Ctrl+C in window w. The Break interrupt is raised as well |
A message is at most 64 KB. A player's message is at most 256 bytes (a submitted line 8 KB, a save 40 KB), and at most 20 a tick. A screen has at most 32 windows and 256 pictures, and a window 256 elements. The server keeps what the screen shows, windows where the players left them, so a player who opens it later sees it all, and it is saved with the world.