Changes
/* CHR$ () */
==== <code>LOAD ‹file name›[,‹address›] </code>====
==== <code>LOCATE[#‹stream expression›][,] x,y</code> ====
</pre>
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(6562,000500/frequency)'''
: (e.g. the note "A" with the frequency 440 Hz has the period 142 on the CPC)
</pre>
==== <code>SPEED INK <n1,n2> </code> ====: ...in conjunction with the SPEED INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds. ==== <code>SPEED KEY <start,repeat> </code> ====: SPEED KEY command defines the delay after which a key repeat (for keys that do repeat). The first parameter is the delay before the first repeat and the second parameter is the delay between further repeats. Delay is in 1/50th of seconds. :When using it with low values, it is common to associate a key to reset the default speed of 30,2.:For example to associate the key 0 from the numpad:<pre>KEY 0,"SPEED KEY 30,2"+CHR$(13)</pre> ==== <code>SPEED WRITE <n> </code> ====: SPEED WRITE defines the speed at which data is to be saved or written to a cassette unit. n=1 means 2000 baud, n=0 (default) means 1000 baud. When reading from the tape, the correct speed is automatically selected.
==== <code>SQ (channel)</code> ====
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127
==== <code>MOD</code> ====
: ['''MOD''' returns a (rounded) rest (Modulos) after dividen has been devided by the devisor...]::'''Example:'''<pre>32767 mod 256255</pre>: Note: only works with numbers in the range -32768 and 32767 (&8000 < 0 < &7FFF)
==== <code>NOT</code> ====
| 1 | &01 | SOH | 0-255 | PRINTS CHARACTER TO SCREEN |
| 2 | &02 | STX | NONE | TURNS TEXT CURSOR OFF |
| 3 | &03 | ETX | NONE | TURNS TEXT CURSOR ON IN IMMEDIATE || | | | | MODE |
| 4 | &04 | EOT | 0-2 | SET SCREEN MODE |
| 5 | &05 | ENQ | 0-255 | PRINT CHARACTER AT GRAPHICS CURS. |
| 17 | 145 (128+17) | File already exists. |
| 18 | 146 (128+18) | File does not exists. |
| 19 | 147 (128+19) | Direcotry Directory is full. |
| 20 | 148 (128+20) | Disc is full. |
| 21 | 149 (128+21) | Disc changed while file were open. |
</pre>
: '''2. Example''':
<pre>
PRINT STRING(40,42)
****************************************
1.61977519
</pre>
==== <code><big>TEST (<x co-ordinate>,<y co-ordinate>)</big></code> ====
: ''BASIC 1.0 & 1.1''
run
</pre>
==== <code><big>TESTR (<xoffset>,<yoffset>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Moves the graphics cursor by the amount specified in the <x> and <y offset>s relative to its current position, and reports the value of the ink at the new location.
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.'''Associated keywords''': MOVE, MOVER, TEST, XPOS, YPOS
: '''Example''':<pre>10 MODE 0:FOR x=1 TO 15:LOCATE 1,x20 PEN x:PRINT STRING$(10,143);:NEXT30 MOVE 200,400:PEN 140 FOR n=1 TO 23:LOCATE 12,n50 PRINT "pen";TESTR(0,-16):NEXTrun</pre>==== <code><big>TIME</big></code> ====: Returns time ''BASIC 1.0 & 1.1'': '''FUNCTION''': Reports the elapsed time since the computer was last switched -on or reset, (excluding periods when reading or writing to disc).: One Each second of real time is equal to the returned value = TIME/300.
: Returns '''Example''':<pre>10 CLS:REM clock20 INPUT "hour";hour30 INPUT "minute";minute40 INPUT "second";second50 CLS:datum=INT(TIME/300)60 WHILE hour<1370 WHILE minute<6080 WHILE tick<6090 tick=(INT(TIME/300)-datum)+second100 LOCATE 1,1110 PRINT USING "## ";hour,minute,tick120 WEND130 tick=0:second=0:minute=minute+1140 GOTO 50150 WEND160 minute=0:hour=hour+1170 WEND180 hour=1190 GOTO 60run</pre>==== <code><big>UNT (<address expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Return an integer(in the range -32768 to +32767) which is the two's twos-complement equivalent of addthe unsigned value of the <address expression>.
: Example'''Associated keywords''':CINT, FIX, INT, ROUND
: '''Example''':
<pre>
PRINT UNT(&FF66) - prints -154
</pre>
==== <code><big>UPPER$(<string expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns a new string expression which is a copy of the specified <string expression> but in which all alphabetic characters in the range A to Z are converted to upper case. The function is useful for processing input which may come in mixed upper / lower case.
: Gives copy '''Example''':<pre>10 CLS: a$="my, how you've grown!"20 PRINT UPPER$(a$)run</pre>==== <code><big>VAL(<string expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Returns the numeric VALue, (including any negative sign and decimal point) of se with all alphabetic characters the first character(s) in upper casethe specified <string expression>. :If the first character is not a number, then 0 is returned. If the first character is a negative sign or decimal point followed by non-numeric characters, a 'Type mismatch' error (13) will be reported.
:Returns the numeric value (including signs) of first numeric character(s) in se'''1. Returns 0 if se starts with a non-number. :Example''':<pre>PRINT VAL("-12.34x"),VAL("A-12") - prints -12.34 0
</pre>
:'''Exception''': if <se> starts with "&" + character (and it's between "A" and "F") the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a signed integer (16-Bit Word). : '''2. Example''':<pre>PRINT VAL("&A") - returns a 10
PRINT VAL("&7FFF") - returns a 32767
PRINT VAL("&8000") - returns a -32768</pre>: '''3. Example''':<pre>10 CLS: PRINT "I know my times tables!"20 PRINT:PRINT "Press a key (1 to 9)"30 a$=INKEY$:IF a$="" THEN 3040 n=VAL(a$):if n<1 or n>9 then 3050 FOR x=1 to 1260 PRINT n;"X";x;"=";n*x70 NEXT:GOTO 20run</pre>==== <code><big>VPOS (#<stream expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Reports the current vertical POSition of the text cursor relative to the top of the text window. The <stream expression> MUST be specified, and does NOT default to #0.
: '''Example''':<pre>10 MODE 1:BORDER 0:LOCATE 8,220 PRINT "use cursor up/down keys"30 WINDOW 39,39,1,25:CURSOR 1,140 LOCATE 1,350 IF INKEY(0)<>-1 THEN PRINT CHR$(11);60 IF INKEY(2)<>-1 THEN PRINT CHR$(10);70 LOCATE #1,3,2480 PRINT #1,"text cursor ";90 PRINT #1,"vertical position =";100 PRINT #1,VPOS(#0):GOTO 50run</pre>==== <code><big>XPOS</big></code> ====: Returns ''BASIC 1.0 & 1.1'': '''FUNCTION''': Reports the current horizontal (xX) position POSition of the graphics cursor.
: '''Associated keywords''': MOVE, MOVER, ORIGIN, YPOS : '''Example''':<pre>10 MODE 1:DRAW 320,20020 PRINT "graphics cursor X position = ";30 PRINT XPOS</pre>==== <code><big>YPOS</big></code> ====: Returns ''BASIC 1.0 & 1.1'': '''FUNCTION''': Reports the current vertical (yY) position POSition of the graphics graphic cursor. : '''Associated keywords''': MOVE, MOVER, ORIGIN, XPOS : '''Example''':<pre>10 MODE 1:DRAW 320,20020 PRINT "graphics cursor Y position = ";30 PRINT YPOS</pre>
== Other Basic Dialects available for the CPC ==