Charges and limits

This page collects in one place what every call costs and every fixed number of the system: the machine, each device, the content device and the network. Each value is explained in the article that owns it; here they are only listed. Values marked provisional are placeholders that may change once weak hosts have been measured (SPEC section 16 lists them all); every other value is fixed for version 0.

The budget, in one line

Each frame adds 125,000 units to the budget and the CPU runs while the budget is above zero; an overshoot carries into the next frame, unused budget never does, and wait_frame throws away the rest of the frame.

Charges

A call's charge is subtracted as the call runs, on top of the ecall instruction itself, and may take the budget below zero.

WhatChargeWhen
An instruction fetched from ROM1as it runs (an ecall too)
An instruction fetched from RAM4, provisionalas it runs (an ecall too)
Any call, also an unknown or failing one: a deferred call, or one of the system device or Machines4, provisionalevery call
Any answered call, also a failing one64, provisionalget_cursor, get_colours, cells_read, content submit, page locate
write: each byte of the buffer2, provisionalthe whole buffer (at most 4,096 bytes) is taken whatever the budget; the scrolls and clears it causes cost nothing more
Sound submit (600h): each byte of the list2, provisionalonly when accepted (1 to 4,096 bytes)
A clear, scroll up or scroll down by command150, provisionalcommands 01h, 02h, 03h
Bytes copied between memory and a device1 per 4 bytes, rounded up, per call; provisionalby the calls of the next table
Content delivered at completion1 per 4 bytes: the frame's completions added up, rounded up once; provisionalsubtracted from the frame's budget before the CPU runs

Bytes counted as copied:

CallBytesWhen
next_event4only when an event is written
randomthe lengthwhen the buffer is valid
controller8when the buffer is valid
cells_read, cells_write4 per cellwhen the call is valid
palette_set3 per entrywhen the call is valid
vector submit (300h, 900h)the list's lengthonly when accepted
page submit (700h)the document's lengthwhen copied: length in range and buffer valid
sound wave (601h)64when the call is valid
sound sample (602h)the lengthwhen the call is valid
content submit (400h)put or save: size; publish: the title; find: the query; set profile or set nickname: the nameonly when accepted
open (107h)33, or 34 + n for a programwhen the request is read, also if the call returns 0
system argument (108h)32only when written
start32when the ID is read, also if no handle is free
start_program33 + nwhen the record is read
info48when written
builtin32when written
identity81when written
request82when written
machines argument (80Ah)32when the ID is read, also if it returns 0
snapshot_info122when written

A device call is **deferred** when its result is one the program could work out without the device (a constant, an argument, or a simple function of the arguments) and its charge depends only on its arguments; it is **answered** when its result or charge depends on the device's state. A host that keeps a device in another process can send deferred calls in batches without waiting for them; an answered call needs a round trip, which the 64 pays for. The calls of the system device and Machines are the machine's own and cost 4 whatever they return. The call table of the article The machine gives every call's class.

Content delivered at completion is what a get, load, find or records-style request (subscriptions, timeline, names, programs, records) writes to its buffer. Nothing else is charged: a rejected submit copies nothing, the fields a completion writes into a request block are free, and laying out the page is free (the host does it outside the frames).

Two examples. A deferred call that copies nothing costs 5 units from ROM (the ecall and 4), an answered one 65. Writing a whole 80-column row costs 165 with one write of 80 bytes, 85 with one cells_write of 80 cells, against at least 560 for 80 one-byte writes.

Machine and image

LimitValueNote
ROM1 to 131,072 bytes, at 0001_0000h
RAM1 to 128 pages of 8,192 bytes, at 0010_0000h8 KiB to 1 MiB
Exit code0 to 255
Image header32 bytes, then 2 per device requirement
Format version, profile0, 1
rom_len field3 bytes, 1 to 131,072
ram_pages field1 to 128
Device requirements0 to 16, each slot at most once
Reserved header bytes5, all zero
Title16 bytes of UTF-8, padded with 00h; not checked by hosts
Largest image131,136 bytes

Frames

LimitValueNote
Budget per frame125,000 unitsprovisional
Frame rate60 per second, nominal
Frame counter32 bits, wraps to 0
terse runstops after 36,000 framesheadless runner only

Events, controllers and random bytes

The event queue's 64 and the 256 random bytes a call are provisional.

LimitValue
Event queue64 events; one that arrives when it is full is dropped
Pointer positionx 0 to 639, y 0 to 479; movement at most once a frame
Wheelat most one event a frame, each value -127 to 127
Feeds updated, page laid outat most one of each a frame
Controllers4, numbered 0 to 3; axes -127 to 127
randomat most 256 bytes a call
Random bytes a frame can takeat most 463,872

Terminal (device 2)

LimitValue
Grid80 columns by 30 rows
Cells2,400 of 4 bytes (9,600 bytes)
Character codes0000h to FFFFh; FFFFh marks a wide character's right half
Palette256 entries of red, green, blue
A cell on the screen8 by 16 screen units, on a screen of 640 by 480

2D vector display (device 3)

LimitValueNote
Display list1 to 16,384 bytes, in RAMprovisional
Coordinatessigned 16 bits, in sixteenths of a unit; screen 10,240 by 7,680
Line width1 byte, in sixteenths; 0 counts as 1
Style, fill mode0 or 1 each
Persistence0 to 255, 160 after reset
Fill cap1,228,800 square units of filled shapes a listprovisional

Sound (device 6)

LimitValueNote
Command list1 to 4,096 bytes, in ROM or RAMprovisional
Output48,000 stereo pairs a second, 800 a frame, 16 bits
Voices16
Wavetables32 of 64 signed bytes
Sample slots4, each 0 to 65,536 signed bytesprovisional
Envelope level0 to FF_FFFFh; rates 0 to 65,535 a pair

3D vector display (device 9)

LimitValueNote
Display list1 to 16,384 bytes, in RAMprovisional
Transform stack8provisional
Line width1 to 255 sixteenths (0 counts as 1)provisional
Length a list draws65,536 screen unitsprovisional
Segments a list draws16,384provisional
Faces256 a list, each Screen and Surface in effect counting as oneprovisional
Surfaces in effect4 a list, each showing a rectangle of the screenprovisional
Faces times segments131,072provisional
Pieces drawn after hiding16,384, counted within 32 units of the screenprovisional
What a face hidespoints more than 2 sixteenths beyond its planeprovisional
Shortest cut piece drawn1/2 unitprovisional
Chords of a circle64provisional
Eye distance from the glass960 unitsprovisional
Eye movementat most 160 units from the reference eye on each axisprovisional
Near planez = -800provisional

Content (device 4)

All but the request block's 52 bytes are provisional.

LimitValue
Blob1 to 1,048,576 bytes
Request block52 bytes, in RAM
Pending requests8 (handles 1 to 8)
length of get, load, records, find1 to 16,384
Publish title0 to 120 bytes
Display name, nickname, find query1 to 48 bytes (a nickname may be 0: removes it)
Find resultsat most 16
Named records per owner256 records, 1,048,576 bytes in all
One named record0 to 65,536 bytes
Record name1 to 32 bytes
Document format name1 to 48 bytes

Page (device 7)

LimitValueNote
Document1 to 65,536 bytesprovisional
Text sizeclamped to 6 to 96 units; 14 at the startprovisional
Figurewidth and height clamped to 1 to 1,024 unitsprovisional
Paths a figure draws256provisional
Figure area8 times the figure's area, at most 1,228,800provisional
Figure path length65,536provisional
Anchor ids1 to 65,535 (0 is no anchor)
locate8 a frame; a host keeps at least the 8 latest waitingprovisional
Table columns1 to 8provisional
Cells1,024 a table, 4,096 a documentprovisional
Cell padding6 units left and right, 3 top and bottomprovisional
Narrowest column48 unitsprovisional
Rule8 units high
Reported height or yat most FFFFFFh

Machines (device 8)

LimitValueNote
Machine handles8 (1 to 8)provisional
Snapshot slots16 (0 to 15)provisional
A view's motion (face, unface)0 to 600 framesprovisional
A view's progress0 to 4,096 stepsprovisional
Screens in effectthe first of each handle, in the shell's 3D list; each counts as a face
Program name1 to 48 bytesprovisional
Records writteninfo 48, identity 81, request 82, snapshot_info 122 bytes

Network

LimitValue
Feed entryat most 293 bytes; title 0 to 120 bytes
Automatic downloadblobs up to 16,384 bytes (the user may change it)
Program images downloadedup to 131,136 bytes
Prefetchthe first 8 article links of an article
Configured relaysat most 8
Relays from a feed's profileat most 2 a feed
Relay connectionsat most 16
Entries a relay keepsat least the 256 newest of a feed, and its latest profile
Search resultsat most 16
Profile documentat most 4,096 bytes; 0 to 4 relay lines
Reconnectingafter 1 s, doubling up to 30 s
Peer getnot found after 3 s without an answer