Changes

Technical information about Locomotive BASIC

1,158 bytes added, 13:30, 16 April 2012
/* Passing parameters to a RSX (Resident System Extension) command or binary function */
== 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 similar from BASIC and invokes a machine code. Difference: with 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:<pre>CALL &4000,32,34,&5E,&x10101010 |RSX-command,32,34,&5E,&x10101010</pre>The parameters will be stored inside the range of Stack:<pre> A=n -------> MSB PARAM1 LSB PARAM1 MSB PARAM2 LSB PARAM2 ... ... ... MSB PARAMn IX+2 ------> LSB PARAMn</pre>with the help of that assembly code is it possible to find the parameters:<pre>ROUT1: CP "x" ;test register A if "x" parameters were hand-overed, e.g. "x" = 2 RET NZ ; if no > failure and return. LD L,(IX+2) LD H,(IX+3) ; HL = value of last parameter LD E,(IX+4) LD D,(IX+5) ; DE = value of next to last parameter ...</pre>the first two bytes at the end of stack shows the internal return address from BASIC interpreter where it was executed.
<br> A binary function is accessed through BASIC using the "CALL" command.
<br> Passing a string parameter:
BASIC v1.1:
<pre>|DRIVE,"A"
</pre>  
== Additional keywords and variables in BASIC v1.1 ==
205
edits