-
Notifications
You must be signed in to change notification settings - Fork 2
Buildin functions
The system function enables system functions to be called outside of the CPU. System calls are mod/computer dependent and thus can't be explained here. The function accepts 2 or 3 parameters.
num
is the system call number. Depending on the system call number, additional parameters have to be passed.
Number 0
is reserved for character outputs on the programmer's status line.
system(num, param1)
system(num, param1, param2)
Example:
system(0, 'AB'); // output the characters 'AB' on the programmer's status line.
Suspends the execution of the program until the time-out interval elapses.
sleep(ticks)
ticks
is the time interval for which execution is to be suspended, in 100 milliseconds (or more, depending on the server time interval).
Example:
sleep(10); // sleep one second
Output a value to an external device, specified by the port number.
output(port, value)
port
port number. This value is mod/computer dependent.
value
is the value to be output. Valid range is 0..65535
Example:
output(1, 123); // output the value `123` on port #1 (whatever it is)
Read a value from an external device, specified by the port number.
input(port)
port
is the port number. This value is mod/computer dependent.
The function returns the read input value
.
Example:
val = input(3); // Read an input value from port #3.
The sizeof operator returns the number of words occupied by an array.
sizeof(arr)
arr
is the array to get the size of. The operator returns the number of words (1..n).
Example:
var buff[8];
addr = recv_msg(buff, sizeof(buff));