Changes

Technical information about Locomotive BASIC

344 bytes added, 14:26, 16 April 2012
/* Passing parameters to a RSX (Resident System Extension) command or binary function */
A RSX (Resident System Extension) command is accessed through BASIC with a "|" character prefix. e.g. The "DIR" RSX, is accessed by "|DIR". A binary function is accessed through BASIC using the "CALL" command.
Both RSX and CALL commands works both (are!) similar from BASIC command line and invokes a machine code. Difference- the only difference is: with the help of a RSX command you don't need to know the exact access address in memory. You can pass up to 32 parameters with a CALL or RSX command. Possible parameters could integer, floating points and strings. Just store the parameter into a variable:For integer:
<pre>
CALL &4000,32,34,&5E,&x10101010
 
|RSX-command,32,34,&5E,&x10101010
</pre>
For floating points
<pre>
@a!=43.375
@b$="test"
CALL or |RSX-command,@a!
CALL or |RSX-command,@b$
</pre>
The parameters will be stored inside the range of Stack:
...
</pre>
 If you hand-over a string than the first two bytes holds the length of the string. Hint: the first two bytes at the end of stack shows the internal return address from BASIC interpreter where it was executed.
205
edits