Changes

Jump to: navigation, search

Locomotive BASIC

1,470 bytes added, 13:12, 12 March 2019
/* Functions */
3
</pre>
==== <code><big>STR$(n<numeric expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': Returns '''FUNCTION''': Converts the string <numeric expression> to a decimal STRing representation of number n.
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.
 : '''Associated keywords''': BIN$, DEC$, HEX$, VAL : '''1. Example''':
<pre>
10 FIGURE=-1599
30 PRINT FIGURE$
-1599
</pre>: '''2. Example''':<pre>
10 FIGURE=1769
20 FIGURE$=STR$(FIGURE)
1769
</pre>
: '''NOTE''': (there's a blank on the left-hand of the number "1769")
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.
: '''3. Example''':<pre>10 a=&FF:REM 255 hex20 b=&x1111:REM 15 binary30 c$="***"40 PRINT c$+SR$(a+b)+c$run*** 270***</pre>==== <code><big>STRING$(<length>,<character specifier>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Returns a string expression consisting of the <character specifier> repeated the number of time (in the range 0 to 255) specified in the <length>.
: Returns i copies of the string character specified by s. : Example'''Associated keywords''':SPACE$
: '''1. Example''':
<pre>
PRINT STRING$(340,"*") - prints ****************************************
</pre>
: '''2. Example''':
<pre
PRINT STRING(40,42)
****************************************
</pre>
: '''NOTE''': the <character specifier> 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))
==== <code><big>TAN (<numeric expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates the TANgent of the <numeric expression>, which must be in the range -200,000 to +200,000.
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.
==== <code>TAN (n)</code> ====: '''Associated keywords''': ATN, COS, DEG, RAD, SIN
: Returns the tangent of n'''Example''': <pre>PRINT TAN(45) 1. The DEG and RAD commands can be used to force 61977519</pre>==== <code><big>TEST (<x co-ordinate>,<y co-ordinate>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Moves the result graphics cursor to either modethe absolute position specified by the <x> and <y co-ordinate>s, and reports the value of the ink at the new location.
==== <code>TEST (x,y)</code> ==== : Moves the graphics cursor by x and y and returns the value of the ink at that position.'''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS
: '''Example''':
<pre>
10 CLS
20 PRINT "Your are using pen number";
30 PRINT TEST(10,386)
40 PRINT "Try changing PENs and MODEs";
50 PRINT "....then RUN again."
run
</pre>
==== <code>TESTR (x,y)</code> ====
205
edits