Changes

Technical information about Locomotive BASIC

32 bytes added, 18:11, 26 December 2022
/* BASIC tokens */ typo
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-overedgiven, e.g. "x" = 2 RET NZ ; if no > failure and returnnot exactly x parameters then do not execute RSX.
LD L,(IX+0)
LD H,(IX+1) ; HL = value of last parameter
A register holds the number of parameters. IX points to each parameter. IX+0/IX+1 is the last parameter. This happens because each parameter in order is pushed onto the stack and IX then points to the last parameter pushed. Each parameter is a 16-bit value.
If a parameter is a string, then IX holds the 16-bit value is an address of a "the string descriptor which point to a 3 byte block". The first byte of the string descriptor is the length. The next 2 bytes are an address that point to the string in memory.
With the help of the variable container "@" it is also possible to get a result from an invoked mc-code back to basic.
In this case the param parameter contains the address of the integer, floating point or string. You can modify these to give the result.
BASIC allocates the strings, so when you modify a string, do not write more characters than the original string.
<br> <br>
== Entering BASIC programs ==
A maximum of 255 characters can be entered for a single BASIC line.
| INPUT
|-
| &amp;a4
| KEY
|-
|-
| &amp;b5
| ON SQ
|-
| &amp;b6
*The &amp;ff code is used as a prefix for more keywords. See the table below for the list of keywords using this prefix.
*&amp;e2,&amp;e8 and &amp;e9 are not used
*&amp;7c ("|") is a character prefix used to identify a an RSX command. e.g. "|DIR".
An RSX is encoded in a BASIC program using the following structure:
|}
*This token identifies a integer (16-bit) number. The two bytes following this token is the number, stored low byte then high byte. e.g. &amp;191a,&amp;2d,&amp;00 represents the integer number "&amp;002d"="45".
*This token (&amp;0B) is changed at run-time to &amp;0D
*This token identifies a integer variable. 02,00,00,var name offset to number in program setup when program RUN. The variable name is stored directly, with bit 7 of the last character set.
953
edits