Devices & Vectors
Uxn can communicate with a maximum of 16 devices, each device has 16 ports, each port handles a specific I/O message. Ports are mapped to the devices memory page, which is located outside of the main addressable memory.
Uxn is non-interruptible, vectors are locations in programs that are evaluated when certain events occur. A vector is evaluated until a BRK opcode is encountered, no new events will be triggered while a vector is evaluated, but events may be queued. All programs begin by executing the reset vector located at
0x100. Only one vector is executed at a time. The content of the stacks are preserved between vectors.
|0100 ( set a vector ) ;on-mouse .Mouse/vector DEO2 BRK @on-mouse ( -> ) ( read mouse state ) .Mouse/state DEI ?&on-touch BRK &on-touch ( -> ) ( A mouse button was pressed ) BRK
For example, the address stored in the
Mouse/vector port points to a part of the program to be evaluated when the cursor is moved, or a button state has changed.
Incoming: uxntal reference