Code in the (v1) robot programming environment interacts with the robot hardware via a varvara-style device at range #d0-#df. Programmers are not obligated to interact with the device directly, and OCI provides the robot.tal convenience library for standard operations, but developers wishing even more control over the interface can interact with it as follows:
| robot | d0 | vector* | d8 | actuate |
|---|---|---|---|---|
| d1 | d9 | detected | ||
| d2 | status | da | distance | |
| d3 | -- | db | -- | |
| d4 | -- | dc | -- | |
| d5 | -- | dd | -- | |
| d6 | -- | de | -- | |
| d7 | -- | df | -- |
The vector* is evaluated when the robot completes an actuation or encounters an error. On complete actuations, the status register will be set to #00 before vector is evaluated.
The status register is readable, and reads #00 if and only if the robot is idle and can accept a new actuation command.
The actuate port receives a single byte instruction, and initiates that operation for the robot. Operation codes are
forward: #02 - move the robot one tile forwardbackward: #03 - move the robot one tile backwardsleft: #08 - turn the robot 90 degrees to the left, in placeright: #0c - turn the robot 90 degrees to the right, in placeset mark: #10 - mark the tile that the robot is standing onerase mark: #11 - remove any mark on the tile the robot is standing on
The robot performs only one actuation at a time, and will ignore commands that overlap.
The detected register is readable, and contains a code usable to identify the nearest object along the robot's line of sight.
treasure#01hazard#02wall#04door#08mark#10
If no object is present within the robot's detection range, detected will contain #ff.
The distance register contains the detected object's distance away from the robot, in tiles, as an unsigned byte. A distance of #00 indicates the detected object shares the same tile as the robot. If no object is detected, distance will contain #ff.
detected and distance are only safe to read when status is zero and the robot is idle.
