CpcAlive is a
programming
environment
Amstrad CPC
compatible
for graphics
 animations
creation.







256 colors with the CpcAlive emulator

Cpc Online

The memory

The Cpc system vectors

Diskettes management

Cpc basic error messages
Z80 processor opcodes and
operation

CpcAlive installer for
Windows and DosBox


CpcAlive Documentation





































































Français         Español

 
Last review: (DosBox version)
V1.17 - 07/01/2024 - New screen mode 1024*768*256colors(MODE 3)
V1.16 - 16/12/2014 - Z80 assembler correction
V1.15 - 30/11/2014 - corrections
V1.14 - 20/11/2014 - display ASM sources in Z80 debugger
V1.13 - 20/9/2014 - BASIC command TRON(BASIC debugger) improvement and corrections


BASIC AMSTRAD CPC6128

(translate from french manual)





(Click in the margin left to come back here)

ABS, AFTER, AND, ASC, ATN, AUTO

BIN$, BORDER, BREAK

CALL, CAT , CHAIN, CHAIN MERGE, CHR$, CINT, CLEAR, CLEAR INPUT, CLG, CLOSEIN, CLOSEOUT,  CLS, CONT, COPYCHR$, COS, CREAL, CURSOR

DATA, DEC$, DEF FN, DEFINT, DEFREAL, DEFSRT, DEG, DELETE, DERR, DI, DIM, DRAW, DRAWR

EDIT, EI, ELSE, END, ENT, ENV, EOF, ERASE, ERL, ERR, ERROR, EVERY, EXP

FILL, FIX, FN, FOR, FRAME, FRE

GOSUB, GOTO, GRAPHICS PAPER, GRAPHICS PEN

HEX$, HIMEM

IF, INK, INKEY, INKEY$, INP, INPUT, INSTR, INT

JOY

KEY, KEY DEF

LEFT$, LEN, LET, LINE INPUT, LIST, LOAD, LOCATE, LOG, LOG10, LOWER$

MASK, MAX, MEMORY, MERGE, MID$, MID$, MIN, MOD, MODE, MOVE, MOVER

NEW, NEXT, NOT

ON BREAK CONT, ON BREAK GOSUB, ON BREAK STOP, ON ERROR GOTO, ON <expression> GOSUB,  ON <expression> GOTO, ON SQ GOSUB, OPENIN, OPENOUT, OR, ORIGIN, OUT

PAPER, PEEK, PEN, PI, PLOT, PLOTR, POKE, POS, PRINT, PRINT SPC, PRINT TAB, PRINT USING

RADRANDOMIZE, READ, RELEASE, REM, REMAIN, RENUM, RESTORE, RESUME, RESUME NEXTRETURN, RIGHT$, RND, ROUND, RUN", RUN
SAVE, SGN, SIN, SOUND, SPACE$, SPC, SPEED INK, SPEED KEY, SPEED WRITE, SQ, SQR, STEP, STOP, STR$, STRING$SWAPSYMBOL, SYMBOL AFTER

TAB, TAG, TAGOFF, TAN, TEST, TESTR, THEN, TIME, TO, TROFF, TRON

UNT, UPPER$, USING

VAL, VPOS
WAIT, WEND, WHILE, WIDTH, WINDOW, WINDOW SWAP, WRITE

XOR, XPOS

YPOS

ZONE


INTRODUCTION

The assimilation of the terminology and the notation adopted in this chapter is essential. Various types of brackets explain the entry of the commands; thus start with you to familiarize with the significance of each one.

The commands without hooks must stay just as they are. It is the case, for example, about the command:


    END

When an element appears between angular brackets, < > like:

    <line number>

... these brackets should neither be typed, nor what they contain. The example above indicates the type of data necessary for the command. For example:

    EDIT <line number>

... mean that you must type:

    EDIT 100

The brackets ( ) MUST be typed just as they are. In the example:


    COS(<numeric expression>)

... the numerical expression must be between brackets. For example:


    PRINT COS(45)

To finish, the hooks contain the optional elements about a command or a function. 


    RUN [<line number>]

For example, the command can then be entered in two manners:

    RUN  ... or ... RUN 100


Specials characters

& or &H   
Prefixes for a hexadecimal number
&X            Prefixes for a binary number
#               
Prefixes for an inputs/outputs chanel

Types of data

Alphanumeric chains can contain from 0 to 255 characters and are indicated by <alphanumeric chain>. You can associate a chain with another one with the sign + so much that the size result does not exceed 255 characters.

The wholes numbers vary from -32768 to + 32767 and the real numbers from -1.7E+38 to +1.7E+38, the smallest number higher than zero being 2.9E-39 and each number having 9 to 10 significant figures.

A <numerical expression> is an expression which leads to a numerical value. That can be numbers, or a numeric variable, or numbers operating with numeric variables, about all that is not <alphanumeric chain>.

A <chanel number> is referred to a <numerical expression> to indicate a screen window, a printer, a cassette or a diskette to which the text must be forwarded.

A <list of element> describes a parameter including a list of elements separated by commas. This list, being able to contain one or more elements, is limited by the line lengh.

Various indicators of data type:


% Whoole
!   Reals (by defect)
$  Alphanumeric an numeric (alphanumeric) chain

We will give the key words of BASIC AMSTRAD in the following form:


KEY WORD

Syntax

Example

Description

Associated key words


Key words ares:

COMMANDS     : operations executed direcly
FUNCTIONS      : 
operations intervening in an expression
OPERATORS     : act with mathematical arguments

At the time of the listing of a program, the BASIC transforms in capital letters all the key words typed in small letters. The examples of this chapter are in capital letters such as they appear after a listing. It will be however preferable that you type them with small letters because the key words containing an error will remain LISTing witht small letters, thus revealing you your typing errors.




Key words...



ABS

ABS(<numerical expression
>)

    PRINT ABS(-67,98)
        67.98

FUNCTION: 
Give the ABSolute value of the expression between brackets. The negative numbers thus lose their minus sign.

Associated key words: SGN




AFTER

AFTER <chronometer time>[,<chronometer number>] GOSUB <line number>

    10 AFTER 250 GOSUB 60:CLS
    20 PRINT"Guess a letter in 5 seconds
"
    30 a$=INKEY$:IF flag=1 THEN END
    40 IF a$<>CHR$(INT(RND*26+97)) THEN 30
    50 PRINT a$;"  is exact, you win
!"
    55 SOUND 1,478:SOUND 1,358:END
    60 PRINT "Too late. I win !"
    70 SOUND 1,2000:flag=1:RETURN
    run

COMMAND: Call a subroutine AFTER a delay. The
<chronometer time> indicates the duration of waiting in multiples of 0,02 second. The <chronometer number> (which can be 0,1,2 or 3) precise one which of the four chronometers it is necessary to use. Each 4 chronometers can be associated with a subroutine.

Associated key words: EVERY, REMAIN, RETURN




AND

<argument> AND <argument>

    IF "alan" < "bernard" AND "dog" > "cat" THEN PRINT "true" ELSE PRINT "
false"
    true
    IF "bernard" < "alan" AND "cat" > "dog" THEN PRINT "
true" ELSE PRINT "false"
    false
    IF "alan" < "bernard" AND "cat" > "dog" THEN PRINT "
true" ELSE PRINT "false"
    
false
    ....
    PRINT 1 AND 1
    1
    PRINT 0 AND 0
    0
    PRINT 1 AND 0
    0

OPERATOR: Carry out Boolean operations by bits on the whole numbers. Is equal to 0 except when the two bits of arguments are equal to 1.


Associated key words: OR, NOT, XOR.




ASC

ASC(<alphanumeric chain
>)

    PRINT ASC("x")
        120

FUNCTION: Give the numerical value of the first character of a character string
.


Associated key words: CHR$




ATN

ATN(
<numerical expression>)

    PRINT ATN(1)
        0.785398163

FUNCTION: Calculate the Arc TaNgent (reducing the
<numerical expression> to a real number in radians ranging between - PI/2 and + PI/2) of the value given.
Note that the commands DEG and RAD can beings used to specify explicitly that the result will be expressed respectively in degrees or radians


Associated key words: COS, DEG, RAD, SIN, TAN




AUTO

AUTO [<line number>][,<increment>]

    AUTO 100,50

COMMANDE:
Generate AUTOmatically the line numbers. The optional parameter <line number> gives the first line number to be generated. If you do not specify it, the lines are generated from 10.

The 
<increment>, also optional, fixes the interval between the line numbers. It will be equal to 10 if not specified. If a line number already used is generated, the contents of this line appear on the screen and can be modified. The posted line is then replaced in memory after activation of the [RETURN] key. To stop the automatic classification of the lines, activate the key [ESC].

Associated key words: Nothing



BIN$

BIN$ ( <whole number without sign>[,<whole number>] )

    PRINT BIN$(64,8)
    01000000

FUNCTION:
Product a BINary string representing the value of the <whole number without sign>, using the number of binary digits indicated by the second <whole number> (between 0 and 16). If this number is too large, the result starts with as many zero as necessary. If it is too small, the result is not truncated but converted into as many digits as necessary.

The
<whole number without sign> to convert into binary must lie between -32768 and 65535.

Associated key words:  DEC$, HEX$, STR$




BORDER

BORDER <color number>[,<color number>]

    10 REM 729 border
combinations
    20 SPEED INK 5,5

    30 FOR a=0 TO 26
    40 FOR b=0 TO 26
    50 BORDER a,b:CLS:LOCATE 14,13
    60 PRINT"border";a;",";b
    70 FOR t=1 TO 500
    80 NEXT t,b,a
    run

COMMAND: Change the border screen color. If two colors are indicated, they alternate at the speed determined by the command SPEED INK, if necessary. The values go from 0 to 26.

Associated key words:  SPEED INK




BREAK

(See ON BREAK CONT, ON BREAK GOSUB, ON BREAK STOP)




CALL

CALL <adress>[,<list of:<parameter>]

    CALL 0

COMMAND: Allows an external subroutine to be called starting from the BASIC. The example above initialize completely the computer.

Associated key words: UNT




CAT

CAT

    CAT

COMMAND:
Ask to read the diskette CATalogue. Post in alphanumeric order the names of all the files present with their length (rounding with the higher Kbyte). The number of bytes available is also posted.

Associated key words:  LOAD, RUN, SAVE




CHAIN

CHAIN <filename>[,<line number>]

    CHAIN "progtest.bas",350

COMMAND:
Load a program in memory from a diskette, replacing the existing program. The new program starts at the beginning or starting from the line specified by <line number>.

The protected files (safeguarded by the command SAVE, p) can be loaded and launched by CHAIN.


Associated key words: CHAIN MERGE, LOAD, MERGE




CHAIN MERGE

CHAIN MERGE <filename>[,<line number>]
                        [,DELETE <unit of lines>]

    CHAIN MERGE "part2.bas",750,DELETE 400-680

COMMAND:
Load in memory a program on diskette by amalgamating it with the existing program, then launch the resulting program, since the beginning or starting from the line specified by the option parameter, <line number>. If you wish to erase a part of the initial program before using this command, you can specify the parameter <unit of lines> of the command DELETE. The numbers of line of the initial program identical to those of the program to be amalgamated will be crushed on the new lines. The protected files (safeguarded with the command SAVE, p) cannot be amalgamated then launched by this command.

Associated key words:  LOAD, MERGE, DELETE, CHAIN




CHR$

CHR$
(<whole number>)

    10 FOR x=32 TO 255
    20 PRINT x;CHR$(x),
    30 NEXT
    run

FUNCTION: 
Converts a <whole number> ranging between 0 and 255 in a character ASCII. Characters 0 to 31 are control characters. This is why the example above posts the entireties ranging between 32 and 255.

Associated key words: ASC



CINT

CINT(<numerical expression>)

    10 n=1.9999
    20 PRINT CINT(n)
    run
     2

FUNCTION: Converts a numerical value into a round entirety ranging between -32768 and 32767.


Associated key words: CREAL, FIX, INT, ROUND, UNT




CLEAR

CLEAR

    CLEAR

COMMAND: Erase all the variables,
opened files, tables and user functions, the mode of calculation in BASIC is carried out in radians.

Associated key words:  Nothing



CLEAR INPUT

CLEAR INPUT

    10 CLS
    20 PRINT" 
type several letters now !"
    30 FOR  T=1 TO 3000
    40 NEXT
    50 CLEAR INPUT
    run

COMMAND: Erase all the data entered from the keyboard, being in the buffer.

To try out this command, launch the program above and type the letters when you are invited. Remove then the line 50 of the program, start again it and see the difference.


Associated key words:  INKEY, INKEY$, JOY



CLG

CLG [<inks>]

    LOCATE 1,20
    CLG 3

COMMAND:
Erase the graphic screen and brings back it to its prime coat. If <ink> is specified, the prime coat has the color fixed in agreement.

Associated key words: CLS, GRAPHICS PAPER, INK, ORIGIN



CLOSEIN

CLOSEIN

    CLOSEIN

COMMAND: Close any input file open on the diskette (see OPENIN).


Associated key words: EOF, OPENIN



CLOSEOUT

CLOSEOUT

    CLOSEOUT

COMMAND:
Close any output file open on the diskette (see OPENOUT).

Associated key words: OPENOUT



CLS

CLS [# <channel number>]

    10 PAPER #2,3
    20 CLS #2
    run

COMMAND: 
Erase the screen window specified by the <channel number> and gives him its paper color. In the absence of <channel number>, 0 is taken by defect.

Associated key words: CLG, INK, PAPER, WINDOW


CONT

CONT

    CONT

COMMAND:
CONTinue the execution of the program after a STOP, or two activations of  the [ESC] key , if the program neither were modified nor protected. Direct commands can beings typed before continue the program.

Associated key words: STOP


COPYCHR$

COPYCHR$
(# <channel number>)

    10 CLS
    20 PRINT"
higher angle left"
    30 LOCATE 1,1
    40 a$=COPYCHR$(#0)
    50 LOCATE 1,20
    60 PRINT a$
    run

FUNCTION:
Copy a character starting from the position of the cursor in the channel (which MUST be specified). The program above copies a character of site 1,1 (higher angle left) and reproduces it in 1,20. If the character read is not recognized, a null chain is returned.

Associated key words:  LOCATE



COS

COS
(<numerical expression>)

    DEG
    PRINT COS(45)
       0.707106781

FUNCTION:
Calculate the COSinus of the <numerical expression>.

DEG and RAD can be used to express the argument in degrees or radians, respectively.

Associated key words:  ATN, DEG, RAD, SIN



CREAL

CREAL 
(<numerical expression>)

    10 a=PI
    20  PRINT CINT(a)
    30 PRINT CREAL(a)
    run
       3
       3.14159265

FUNCTION:
Converts the <numerical expression> into a real number.

Associated key words:  CINT



CURSOR

CURSOR
[<system indicator>)][ , <user indicator>]

    10 CURSOR 1
    20 PRINT "question ?";
    30 a$=INKEY$:IF a$="" THEN 30
    40 PRINT a$
    50 CURSOR 0
    run


COMMAND:
Activate or desactivate the system or user indicator. The parameters <system indicator> and <user indicator> must be 0 (inactive) or 1 (active). In the command INKEY$ above, the cursor was made visible with fixing the system indicator on 1 (in line 10).

The cursor is posted when the two indicators are equal to 1. The cursor system is automatically activated for the command INPUT and is desactivate for INKEY$.

It is preferable to desactivate the cursor to post text to the screen.

You can omit one of the indicators but not both. If a parameter is omitted, its state is unchanged.

Associated key words::  LOCATE



DATA

DATA
 <list of:<constant>

    10 FOR x=1 TO 4
    20 READ name$,firstname$
    30 PRINT "Mr. ";name$;" ";firstname$
    40 NEXT
    50 DATA DUPONT,Oliver,DURAND,John
    60 DATA LAMIE,Mark,MOULIN,Alan
    run

COMMAND:
Declare data constant inside a program. These data can be assigned to a variable by the command READ, after which the pointer go to the following element of the DATA list. The command RESTORE can be used to move the pointer to a DATA specified position.

Associated key words:  READRESTORE




DEC$

DEC$
(<numerical expression>,<form model>)

    PRINT DEC$(10^ 7,"££########,.##")
       £10,000,000.00

FUNCTION:
Give a DECimale representation of the numerical expression, using the <form model> indicated.

The form model can contain ONLY the characters: + - £ $ * # , .
^

The use of these "form indicators" is described to the key word PRINT USING.


Associated key words:  BIN$, HEX$, PRINT USING, STR$



DEF FN

DEF FN <name>[(<parameters>)]=<expression>

    10 t=TIME/300
    20 DEF FNchrono=INT(TIME/300-t)
    30 EVERY 100 GOSUB 50
    40 GOTO 40
    50 PRINT"The program run since";
    60 PRINT FNchrono;"secondes"
    70 RETURN
    run

COMMAND:
The BASIC permit to the program to DEFine a FuNction returning a single value and to use it. DEF FN is the definition part of the creation mechanism of a specific function, working in a similar way than the BASIC functions existing (COS, SIN, ATN, etc).

In the example above the value of the FNchrono function is constantly updated, even if the program is suspended by [ESC] or is stopped by double [ESC], then started again with CONT.


Associated key words:  Nothing



DEFINT

DEFINT <list of: <letters concerned
>

    10 DEFINT n
    20 number=123.456
    30 PRINT number
    run
       123

COMMAND:
Defines the variable type by DEFect, the type being whole. When a variable intervenes without marker (! % $), the type by defect is automatically implemented. This command defines the type by defect of the variables according to the first letter of the name of the variable. It can be followed by a list of initials letters. For example:

      DEFINT a,b,c

...or a unit of 
initials letters:

    DEFINT a-z

Associated key words: DEFREAL, DEFSTR



DEFREAL

DEFREAL <list of: <
letters concerned>

    DEFREAL x,a-f

COMMAND: Defines the variable type by DEFect, the type being real. When a variable intervenes without marker (! % $), the type by defect is automatically implemented. This command defines the type by defect of the variables according to the first letter of the name of the variable. It can be followed by a list of initials letters. For example:

  DEFINT a,b,c

...or a unit of 
initials letters:

    DEFINT a-z

Associated key words: DEFINT, DEFSTR



DEFSRT

DEFSTR
<list of: <letters concerned>

    10 DEFSTR n
    20 name="Amstrad"
    30 PRINT name
    run
    Amstrad

COMMAND: Defines the variable type by DEFect, the type being a string. When a variable intervenes without marker (! % $), the type by defect is automatically implemented. This command defines the type by defect of the variables according to the first letter of the name of the variable. It can be followed by a list of initials letters. For example:

  DEFINT a,b,c

...or a unit of 
initials letters:

    DEFINT a-z

Associated key words: DEFINT, DEFREAL



DEG

DEG

    DEG

COMMAND: Set the DEGrees calculation mode. By defect, functions SIN, COS, TAN and ATN consider that the argument which is transmitted to them is expressed in radians. The command remains valid until one uses the commands RAD or NEW, CLEAR, LOAD, RUN, etc.

Associated key words: ATN, COS, RAD, SIN, TAN



DELETE

DELETE <unit of lines>

    DELETE 100-200

COMMAND: Erase a part of the program defined in
<unit of lines>.

It is not necessary to indicate the starting line or the finishing line to erase the program "since the beginning" or "until the end".


    DELETE -200

...or:

    DELETE 50-

...or:

    DELETE

... erase all the program.

Associated key words:  CHAIN MERGE, RENUM



DERR

DERR

    LOAD "xyz.abc"
    XYZ .ABC not found
    Ready
    PRINT DERR
       146

FUNCTION: 
Bring back the last ERRor code sent by the Diskette management system. The value of DERR can be used to confirm the detected error. Consult the list of the Diskette errors for more information.

Associated key words: ERL, ERR, ERROR, ON ERROR GOTO, RESUME



DI

DI

    10 CLS:TAG:EVERY 10 GOSUB 90
    20 x1=RND*320:x2=RND*320
    30 y=200+RND*200:c$=CHR$(RND*255)
    40 FOR x=320-x1 TO 320*x2 STEP 4
    50 DI
    60 MOVE 320,0,1:MOVE x-2,y:MOVE x,y
    70 PRINT" ";c$:FRAME
    80 EI:NEXT:GOTO 20
    90 MOVE 320,0:DRAW x+8,y-16,1:RETURN
    run

COMMAND:
Desactivate an interruption (other that [ESC] until it is reactivated directly by a command EI or indirectly by one [RETURN] at the end of an interruption subroutine GOSUB.

The entry in an
interruption subroutine desactivate automatically the equal or lower priority interruptions.

It is used when the program must be executed without interruption, for example when two subroutines are in competition to use the computer resources (graphic resources in the program above, for example).

Associated key words: AFTER, EI, EVERY, REMAIN



DIM

DIM <list of: <
subscripted variable>

    10 CLS
    20 DIM friend$(5),phone$(5)
    30 FOR n=1 TO 5
    40 PRINT "phone number ";n
    50 INPUT"input the name ";ami$(n)
    60 INPUT"input the phone number ";tel$(n)
    70 PRINT
    80 NEXT
    90 FOR n=1 TO 5
    100 PRINT n;friend$(n),phone$(n)
    110 NEXT
    run

COMMAND:
Dimension a table. This command allocates necessary space in the tables and specifies the maximum values of indexes. The BASIC must know the space reserved for a table, in the absence of specification it takes the default value 10.

A table is identified by a
<subscripted variable>, namely a variable name accompanied by an indexes unit so that each "element" of the table has its own index value.

A loop FOR...NEXT can be used to control the table by treating each element of the table.

The minimal value of an index is zero (it is the first element of the table).

The tables can be multi-dimensionals and each element is referred by its position. For example, in a table dimensioned by:

    DIM position$(20,20,20)

... an element of the table will be referred in the following way:

    position$(4,5,6)


Associated key words: ERASE



DRAW

DRAW <coordinate x>,<coordinate y> [,[<ink>][,<ink mode>]]

    10 MODE 0:BORDER 0:PAPER 0:INK 0,0
    20 x=RND*640:y=RND*400:z=RND*15
    30 DRAW x,y,z
    40 GOTO 20
    run

COMMAND: Trace a line on the screen between the cursor graphic position and an absolute position specified by the <coordinates> x and y. The tracing <ink> can be specified (between 0 and 15)

The optional <ink mode> determines the ink interaction on the screen. The four <inks modes> are as follows:


0: Normal
1: XOR
2: AND
3: OR

Associated key words:  DRAWR, GRAPHICS PEN, MASK



DRAWR

DRAWR
<interval x>,<interval y> [,[<ink>][,<ink mode>]]

    10 CLS:PRINT"
you go up to the first floor !?"
    20 MOVE 0,350:FOR n=1 to 8
    30 DRAWR 50,0
    40 DRAWR 0,-50
    50 NEXT:MOVE 348,0:FILL 3
    60 GOTO 60
    run

COMMAND: Trace a line on the screen between the cursor graphic position until the position specified by the <intervals> x and y.

The optional <ink mode> determines the ink interaction on the screen. The four <inks modes> are as follows:

0: Normal
1: XOR

2: AND
3: OR

Associated key words:  DRAW, GRAPHICS PEN, MASK



EDIT

EDIT
<line number>

    EDIT 20

COMMAND:
Post the program line with the cursor, ready for edition.

Associated key words: AUTO, LIST



EI

EI

    EI

COMMAND: Enables an interruption desactivated by a command DI.

Interruptions desactivated by an 
interruption subroutine are automatically restored by the command  RETURN, at the end of the program.

Associated key words: AFTER, DI, EVERY, REMAIN



ELSE

(see IF)



END

END

    END

COMMAND: 
Puts an end to a program execution and restores the direct mode. A program can contain an unspecified number of commands END (it is implicit at the end of any program BASIC AMSTRAD).

Associated key words: STOP



ENT

ENT <envelope number> [,<envelope section>]
[,<envelope section>]
                                        
[,<envelope section>] [,<envelope section>]
                                                                                                 [,<envelope section>]

    10 ENT 1,10,-50,10,10,50,10
    20 SOUND 1,500,200,10,,1
    run

COMMAND:
Defines the Tonality ENveloppe specified by the <envelope number> (between 1 and 15) used with the command SOUND.  If the <envelope number> is negative (between -1 and -15) the envelope is repeated until the end of the sound duration fixed by the command SOUND.

Each
<envelope section> can contain 2 or 3 parameters.

In the case of three parameters, those are:


<number of steps> , <step amplitude> , <step duration>.

Parameter 1
<number of steps>

Specify the <number of steps> of tonality variation inside the <envelope section>. For example, in a note section during 10 seconds, you can fix 10 steps of 1 second each one. In this case, the <number of steps> will be 10.

The <number of steps> can vary from 0 to 239.

Parameter 2: <step amplitude>

Must be between -128 and +127. The negative steps increase the height of the note, the positive steps lower it. The minimal sound period is 0.


Parameter 3: <step duration>

Specify the duration of a step, by 0.01 second units. It can vary from 0 to 255 (0 has the value 256), the maximum step duration is thus 2,56 seconds. If you only use two parameters, they are:

<sound period>,
<step duration>


Parameter 1
:
<sound period>

Give the new period value. (see parameter 2 of the SOUND command)


Parameter 2<step duration>

Specify the 
single step duration in units of 0,01 seconds. Can vary between 0 and 255 (0 having value 256), so 2,56 seconds.


GENERALITIES


The total steps duration should not exceed the parameter <duration> of command SOUND, because the sound finishes before to have crossed the totality of the steps. (the remainder of the tonality envelope is then ignored). In the same way, if the <duration> of the SOUND command exceeds the total duration of the steps, the sound continues after having crossed all the steps and stay constant to the final tonality.

The command ENT can be accompanied by 5 different <enveloppe sections> (each one constituted with the 2 or 3 parameters above).

The first step of a tonality envelope is executed immediately.

Each time that a new envelope is allocated to a determined enveloppe number, the preceding definition is lost.

An <envelope number> without <envelope section> cancels all the preceding specifications. .

Associated key words: ENV, SOUND



ENV

ENV <envelope number> [,<envelope section>]
[,<envelope section>]
                                        
[,<envelope section>] [,<envelope section>]
                                                                                                 [,<envelope section>]

    10 ENV 1,15,-1,10,15,,10
    20 SOUND 1,200,300,15,1
    run

COMMAND:

Defines the ENveloppe of Volume to the <envelope number> (between 1 and 15), used with the command SOUND.

It can contain 2 or 3 parameters:

For 3 parameters:

<number of steps> , <step amplitude> , <step duration>.


Parameter 1:
<number of steps>

Specify the <number of steps> of volume than a sound must cross in the <envelope section>. For example, in a 10 seconds section, you can fix 10 volume steps of one second. In this case, the <number of steps> is equal to 10.


The <number of steps> can vary from 0 to 127.

Parameter 2: <step amplitude>

Can vary the volume from 0 to 15 compared to the preceding step. The 16 different volumes are the same ones as those of the SOUND command. The parameter <step amplitude> can however vary from -128 to +127. The volume come back to  0 after having reached 15.

Parameter 3: <step duration>

Specify the duration of a step, by 0.01 second units. Can vary from 0 to 255 (0 has the  value 256), that is to say 2,56 seconds.


For 2 parameters:

<hardware envelope>,<envelope period>

Parameter 1
<hardware envelope>

Specify the value to be sent to the envelope register contained in the sound generator.

Parameter 2<envelope period>

Specify the value to be sent to the envelope period registers contained in the sound generator.

The use of hardware envelopes supposes the knowledge of the hardware. If you do not have it, it is better to use a software envelope integrating a
adequate <step duration> parameter.


GENERALITIES

The steps total duration should not exceed the parameter <duration> of the SOUND command, the sound then finishes before to have crossed all the volume steps (the remainder of the envelope is ignored).

In the same way, if the parameter of <duration> of the SOUND command exceeds the total duration of the steps, the sound continues after having crossed all the steps of volume and remains constant to the final volume.

The command ENV can contain 5 different <envelope sections> (constituted of the 2 or 3 parameters above).

The first step of a <tonality envelope> is executed immediately.

Each time that a new envelope is allotted to a determined envelope number, the preceding definition is lost.

The specification of an <envelope number> without <envelope section> cancels all the preceding values.

Associated key words: ENT, SOUND



EOF

EOF

    10 OPENIN"ex1.bas"
    20 WHILE NOT EOF
    30 LINE INPUT,#9,a$
    40 PRINT a$
    50 WEND
    60 CLOSEIN
    run

FUNCTION:
To test the state of an open file. Give -1 (truth) if one is at the end of the file (End Of File) or if no file is open, otherwise gives 0 (false).

Associated key words: OPENIN, CLOSEIN



ERASE

ERASE <list of:<variable name>

    DIM a(100),b$(100)
    ERASE a,b$

COMMAND:
When a table is not necessary any more, it can be ERASEd to release the memory for other uses.

Associated key words: DIM



ERL

ERL

    10 ON ERROR GOTO 30
    20 GOTO 1000
    30 PRINT"The error is in line ";ERL
    40 END
    run

FUNCTION:
Give the line number of the last error met. In the example above, the error of Line 20 is indicated by the function ERL.

Associated key words: DERR, ERR, ERROR, ON ERROR GOTO, RESUME



ERR

ERR

    GOTO 500
    Line does not exist
    Ready
    PRINT ERR
       8

FUNCTION:
Give the ERRor number last detected. See the list of the error messages. In the example above, the error number 8 corresponds to "Line does not exist".

Associated key words: DERR, ERL, ERROR, ON ERROR GOTO, RESUME


ERROR

ERROR <whole number>

    10 IF INKEY$="" THEN 10 ELSE ERROR 17
    run

COMMAND:
Decide a consecutive action with a numbered error. See list of the error messages 1 to 32. The action is the same one as that envisaged by the BASIC in the event of real error, making call with error treatment subroutines, in the defeating case, and bringing back the ERR and ERL appropriated values.

ERROR accompanied by a <whole number> ranging between 33 and 255 can be used to create error messages personalized such as:


    10 ON ERROR GOTO 100
    20 INPUT"input a character ";a$
    30 IF LEN(a$)<>1 THEN ERROR 100
    40 GOTO 20
    100 IF ERR=100 THEN 110 ELSE 130
    110 PRINT CHR$(7)
    120 PRINT"only ONE character !"
    130 RESUME 20
    run

Associated key words: ERL, ERR, ON ERROR GOTO, RESUME



EVERY

EVERY <chronometer period>[,<chronometer number>] GOSUB <line number>

    10 EVERY 50,1 GOSUB 30
    20 GOTO 20
    30 SOUND 1,20
    40 RETURN
    run

COMMAND:
Call a BASIC subroutine with regular intervals. The <chronometer period> specifies the interval per units of 0,02 second. The <chronometer number> (ranging between 0 and 3) specifies which of the four chronometers to use.
The 
chronometers 3 corresponds to the higher priority and the 0 one to the lower priority. Each chronometer can be associated to a subroutine.

Associated key words: AFTER, REMAIN



EXP

EXP
(<numerical expression>)

    PRINT EXP(6.876)
       968.743625

FUNCTION:
Calculate "e" with the power given by the <numerical expression> where "e" is equal to approximately 2,7182818, the number whose natural logarithm is 1.

Associated key words: LOG



FILL

FILL <ink>

    10 MODE 0
    20 FOR n=1 TO 500
    30 PRINT "O";
    40 NEXT
    50 inkpen=2+RND*13
    60 FILL inkpen
    70 GOTO 50
    run

COMMAND:
Fills an arbitrary zone of the graphic screen. The zone borders are delimited by the lines drawn with the ink of the pen in progress or the ink of the bottom (ranging between 0 and 15). The filling leaves the position of the graphic cursor. If this one is on a border, nothing is filled.

Associated key words: GRAPHICS PEN



FIX

FIX 
(<numerical expression>)

    PRINT FIX(9.99999)
       9

FUNCTION:
Remove the decimal part of a <numerical expression> and always rounding by defect.

Associated key words: CINT, INT, ROUND



FN

(see DEF FN)



FOR

FOR <simple variable>=<beginning> TO <end> [STEP <increment>]

    10 FOR n=2 TO 8 STEP 2
    20 PRINT n;
    30 NEXT n
    40 PRINT",wich go incremented !"
    run

COMMAND:
Execute  part of the program being between the key words FOR and NEXT, as many time as one can add the <increment> to the <simple variable> going from the <beginning> to the <end>. If the <increment> is omitted, it takes value 1 implicitly.

The value of the <increment> can be negative. In this case the value of the parameter <beginning> must be higher than thoose the <end> parameter, else the variable cannot be incremented.

The loops FOR...NEXT can be overlapping.

The NEXT
variable name assignment is optional because the BASIC automatically determines the command FOR associated.

Associated key words: NEXT, STEP, TO



FRAME

FRAME

    10 MODE 0
    20 PRINT "without FRAME"
    30 TAG
    40 MOVE 0,200
    50 FOR x=0 TO 500 STEP 4
    60 IF f=1 THEN FRAME
    70 MOVE x,200
    80 PRINT" ";CHR$(143);
    90 NEXT
    100 IF f=1 THEN RUN
    110 CLS
    120 TAGOFF
    130 PRINT"with FRAME"
    140 f=1
    150 GOTO 30
    run

COMMAND:
Synchronize the writing of the graphs with video frames. It results a more harmonious movement from the characters or graphs on the screen without distortion and flutter.

Associated key words: TAG, TAGOFF



FRE

FRE
(<numerical expression>)
FRE
(<alphanumeric chain>)

    PRINT FRE(0)
    PRINT FRE(" ")

FUNCTION:
Indicate the space available in memory. The form FRE ("") force the computer to put order before giving the value of the space available.

NOTE: The BASIC exploits only the BANK 0 of the memory


Associated key words: HIMEM, MEMORY



GOSUB

GOSUB
<line number>

    GOSUB 210

COMMAND:
Call a BASIC subroutine with connecting to the indicated line. The end of the subroutine is marked by the command RETURN.

Associated key words: RETURN



GOTO

GOTO
<line number>

    GOTO 90

COMMAND: GO TO the indicated line number.

Associated key words: Nothing



GRAPHICS PAPER

GRAPHICS PAPER <ink>

    10 MODE 0
    20 MASK 15
    30
GRAPHICS PAPER 3
    40 DRAW 640,0
    run

COMMAND:
Determinate the <ink> of the graphic paper. At the lines tracing time, the paper is not visible. In the example above, the command MASK allows the tracing of a line with indents and the visualization of the graphic paper.

The paper ink (between 0 and 15) is used for the zone "paper" where the characters are posted, when TAG functions, and acted as default value when the graphics windows are cleared using CLG.

Associated key words: CLG, GRAPHICS PEN, INK, MASK, TAG, TAGOFF



GRAPHICS PEN

GRAPHICS PEN [<ink>][,<paper mode>]

    10 MODE 0
    20 GRAPHICS PEN 15
    30 MOVE 200,0
    40 DRAW 200,400
    50 MOVE 639,0
    60 FILL 15
    run

COMMAND:

Fix the <ink> (between 0 and 15) for the lines drawing and the points positioning. The <paper mode> can also be fixed:

 0: Opaque mode
 1: Transparent  mode

(The transparent mode has an influence with the graphic paper of the characters written with TAG and spaces in dotted lines).

You can omit one of the parameters but not both. If one of the parameters is omitted, the specified value remains unchanged.

Associated key words: GRAPHICS PAPER, INK, MASK, TAG, TAGOFF



HEX$

HEX$ (<whole number without sign>[,<zone with>])

    PRINT HEX$(255,4)
    00FF

FUNCTION:
Change a whole number into a HEXadecimal number equivalent in agreement with the number of hexadecimal digits indicated with the <zone width> (between 0 and 16). If this number is too large, the final expression is supplemented with zeros to the left of the number. If it is too small, it will not be truncated but the number of digits produced will be equal to the necessary number.

The <whole number without sign> converted in hexadecimal must produce a value ranging between -32768 and 65535.


Associated key words: BIN$, DEC$, STR$, UNT



HIMEM

HIMEM

    PRINT HIMEM
    42619

FUNCTION:
Give the higher byte address in the Memory used by the BASIC. This address can be changed with the command MEMORY.

NOTE: The BASIC exploits only the bank 0 of the memory.

Associated key words: FRE, MEMORY, SYMBOL, SYMBOL AFTER



IF

IF
(<logical expression>) THEN <option> [ELSE <option>]

    10 MODE 1
    20 x=CINT(RND*100)
    30 PRINT"guess a figure (0 a 100)"
    40 INPUT n
    50 IF n<x THEN PRINT n;" is too small..."
    60 IF n>x  THEN
PRINT n;" is too large..."
    70 IF n=x THEN 80 ELSE c=c+1:GOTO 40
    80 PRINT"All right! Finded in ";c+1;" times !"
    run

COMMAND:
Determine if the <logical expression> is true to executed the first <option>. If the <logical expression> is false, the <option> placed after ELSE is executed. In absense of second <option>, the BASIC go to the following line.

The commands IF...THEN can be overlapping but finish at the end of the line. One cannot thus have declarations independent of IF...THEN in the same line. When the result of the <logical expression> requires a line jump, the command can, for example, to be formulated:


    IF a=1 THEN 100

...or:

    IF a=1 GOTO 100

...or:

    IF a=1 THEN GOTO 100

Associated key words: ELSE, GOTOTHEN



INK

INK <ink>,<color number> [,<color number>]

    10 MODE 1:PAPER 0:PEN 1
    20 FOR p=0 TO 1
    30 FOR i=0 TO 26
    40 INK p,i
    50 LOCATE 16,12:PRINT"INK";p;",";i
    60 FOR t=1 TO 400:NEXT t,i,p
    70 INK 0,1:INK 1,24:CLS
    run

COMMAND:
Assign the colors to a given ink. The parameter <ink> provides the reference of the ink (by a whole number ranging between 0 and 15), for the corresponding commands PEN or PAPER. The first parameter <ink number> (whole) gives a color value ranging between 0 and 26. If the second optional color parameter is specified, the ink go from one color to the other one, according  with the speed defined by the command SPEED INK.

Associated key words: GRAPHICS PAPER, GRAPHICS PEN, PAPER, PEN, SPEED INK



INKEY

note : preferably use INKEY$

INKEY (<whole number>)

    10 IF INKEY(55)<>32 THEN 10
    20 PRINT"you have pressed the [SHIFT] and V keys"
    30 CLEAR INPUT
    run

FUNCTION:
Question the keyboard to indicate the keys wich are activated. The keyboard is analyzed all the fiftieth ones of second. This function is used to detect the high or low key position by detection of value -1 (independent of the keys state [SHIFT] and [CONTROL]).

In the example above, the system detects the simultaneous actuation of [SHIFT] and V (key number 55) before stopping the program. The key numbers are given in the diagram located on the body of the computer and in chapter "
Cpc 6128 - Documentation"

[SHIFT] and [CONTROL] are identified by the following values:


        Valeur         [SHIFT]                 [CONTROL]         touche spécifiée
         -1               INDIFFERENT     
INDIFFERENT     HIGH
         0                HIGH                     HIGH                   LOW
         32              LOW                      HIGH                   LOW
         128            HIGH                      LOW                   LOW
         160            LOW                       LOW                   LOW

Associated key words: CLEAR INPUT, INKEY$, JOY




INKEY$

INKEY$

    10 CLS
    20 PRINT"choose YES or NO (Y/N)"
    30 a$=INKEY$
    40 IF a$="" THEN 30
    50 IF a$="y" OR a$="Y" THEN 80
    60 IF a$="n" OR a$="N" THEN 90
    70 GOTO 30
    80 PRINT"You have choose YES":END
    90 PRINT"You have choose NO"
    run

FUNCTION:
Question the keyboard to introduce into the program any character string entered. If there is no keyboard key activated, INKEY$ returns a null string. In the example above the lines 40 and 70 command the program to return to the line 30 after keyboard interrogation by the function INKEY$.

Associated key words: CLEAR INPUT, INKEY



INP

INP(<port number>)

    PRINT INP(&FF77)
       255

FUNCTION:
Reads the value contained in the inputs-outputs port whose address is transmitted by the argument of this function.

Associated key words: OUT, WAIT



INPUT

INPUT [#<channel number>,][;][<chain> <separator>]
                                                                <list of:<variable>
    10 MODE 1
    20 INPUT "
give me two numbers to multiply (separated by a comma) ";a,b
    30 PRINT a;"time";b;"give";a*b
    40 GOTO 20
    run

COMMAND:
Receives the data coming from the specified channel (channel #0 if no specification).

A semicolon after INPUT removes the carriage return after the execution of the command.

The <separator> can be a semicolon or a comma. A semicolon placed after the chain reveals a question mark; a comma removes it.

If an erroneous entry is carried out, an O for one 0 (zero) for example, the BASIC answers:

    ?Redo from start

... or any other error message than you can programmed.

Any keyboard response must end with [RETURN].

Associated key words: LINE INPUT



INSTR

INSTR ( [<starting position>,]<chain containing>,<chain contained> )

    10 CLS:FOR n=1 TO 26
    20 alphabet$=alphabet$+CHR$(n+64)
    30 NEXT
    40 INPUT "input a letter ";a$
    50 b$=UPPER$(a$)
    60 PRINT b$;" is in position";
    70 PRINT INSTR(alphabet$,b$);
    80 PRINT"in the alphabet.":PRINT
    90 GOTO 40
    run

FUNCTION:
Seek in the <chain containing> the <chains contained> and indicates the position of the first character of the required chain. In its absence, the function indicates value 0.

The position of the beginning 
research is optional, it is specified by the parameter <starting position> wich must be a woole number ranging between 1 and 255.

Associated key words: Nothing



INT

INT
(<numerical expression>)

    PRINT INT(-1.995)
       -2

FUNCTION:
Rounds to the first lower woole number, removing the fractional part. Identical than FIX for the positive numbers, it gives 1 less than FIX for the negative numbers which are not whole.

Associated key words: CINT, FIX, ROUND



JOY

JOY
(<whole number>)

    10 PRINT"To stop the program -";
    20 PRINT"action the joystick"
    30 IF JOY(0)<>0 THEN END
    40 GOTO 10
    run

FUNCTION: The JOY function reads the joystick state specified by the <woole number> (0 or 1). The result has significance only with binary values.


                                    Bit                Décimal
                                    0:High                 1
                                    1:Low                 2
                                    2:Left                 4
                                    3:Right                8
                                    4:Fire 2              16
                                    5:Fire 1              32

Thus, when you press on the "fire" button (Fire 2) of the first joystick by moving this one towards the left, the function JOY(0) sends a decimal value equalizes to 20, that is to say 16 (Fire 2) + 4 (Left).


Associated key words: CLEAR INPUT, INKEY



KEY

KEY <logical key number>,<alphanumeric chain>

    KEY 11,"border 13:paper 0:pen 1:ink 0,13:ink 1,0:mode 2:list"+CHR$(13)

Press the [ENTER] key

COMMAND:
Associate a chain to the KEY corresponding to the <logical key number> specified. There are 32 logical key numbers (from 0 to 31) occupying the keys 128 to 159. Keys 128 (0 on the digital keyboard) to 140 ([CONTROL][ENTER] on the digital keyboard) are associated by defect to the figures 0 to 9, to the decimal point, to [RETURN] and to RUN"[RETURN] - (for the tape), but can be associated to other chains if necessary. The logical key numbers 13 to 31 (keys 141 to 159) are assigned to null strings by defect but can be extended and associated to the keys, using the KEY DEF command.

The
<logical key number> provided in the KEY command must ranging between 0 and 31 or 128 and 159 to correspond to the keys physical numbers located in chapter "Cpc 6128 - Documentation"

The specified chain should not exceed 120 characters. The going beyond of this limit involves an error (5) "Improper argument".

Associated key words: KEY DEF



KEY DEF

KEY DEF <key number>,<repetition>[,<normal>[,<with shift>[,with control]]]

    KEY 159,"it is the key TAB"
    KEY DEF 68,1,159

Press the [TAB] key

COMMAND: Defines the logical KEY value DEFines by its physical number, ranging between 0 and 79 (see the illustration in chapter "Cpc 6128 - Documentation"). The parameters <normal>, <with shift> and <with control> must contain the values to be sent when the key is pressed, alone, with [SHIFT] or with [CONTROL]. These parameters are optional.

The parameter <repetition> makes it possible to activate and desactivate the auto
-repetition function (1 or 0). The speed of this one is adjustable by the command SPEED KEY.

In the example above, the KEY 159 (corresponding to the logical number 31) is initially associated with a chain. The command KEY DEF defines then the KEY 68 ([TAB]) to activate the auto-repetition (1) and send the value <normal> 159 when the key is pressed.

To return to the normal mode:

    KEY DEF 68,0,9

...9 being the normal ASCII value of [TAB]


Associated key words: KEY, SPEED KEY



LEFT$

LEFT$(<alphanumeric chain>,<necessary length
>)

    10 CLS
    20 a$="AMSTRAD"
    30 FOR n=1 TO 7
    40 PRINT LEFT$(a$,n)
    50 NEXT
    run

FUNCTION:
Extract some characters (between 0 and 255) on the left of an <alphanumeric chain>. If the chain is shorter than the required length, it is entirely used.

Associated key words: MID$, RIGHT$



LEN

LEN
(<alphanumeric chain>)

    10 LINE INPUT "enter a sentence ";a$
    20 PRINT"the sentence is long of";
    30 PRINT LEN(a$);"characters."
    run

FUNCTION:
Give the number of characters of the <alphanumeric chain>, spaces included.

Associated key words: Nothing



LET

LET <variable>=<expression>

    LET x=100

COMMAND:
A remainder of the historical BASICS. It's function is to announce variables. Only useful for compatibility with old programs. In AMSTRAD BASIC, it is enough to write:

    x=100

Associated key words: Nothing



LINE INPUT

LINE INPUT [
#<channel number>,][;][<chain> <separator>] <variable alphanumeric>

    10 LINE INPUT "
type a punctuated text line. ";a$
    20 CLS
    30 PRINT"the variable a$ is equal to :"
    40 PRINT a$
    run

COMMAND:
Receives a whole line coming from the channel indicated (# 0 in the absence of specification). The first [;] optional semicolon removes the carriage return which intervenes normally after the command execution.

The <separator> can be a semicolon or a comma. The semicolon involves the posting of a question mark; the comma removes it.

The entry of LINE INPUT to the keyboard ends by the activation of the key [RETURN].

LINE INPUT coming from the channel #9 of the diskette (or the tape) ends by a carriage return or the assignment of more than 255 characters to the 
<variable in chain>.

Associated key words: INPUT



LIST

LIST [<unit of lines>][, #<channel number>]

    LIST 100-1000,#1

COMMAND:
List the program on the wanted channel. #0 is the screen, #8 is the printer. The LISTing can be temporarily stopped if you press one time on [ESC] key, and can continue with [SPACE] key. If you press 2 times on [ESC], you stop the listing and come back to the direct mode.

You can omit the first or the last number of the parameter 
<unit of lines> to list the program since the beginning, or until the end.

Examples:

    LIST -200

...or:

    LIST 50-

...list all the program:

    LIST
  
Associated key words: Nothing



LOAD

LOAD <filename>[,<adress>]

    LOAD"fichdisc.xyz",&2AF8

COMMAND:
Load a BASIC program in memory, and crunch any other one in place. With the adress option, load a binary file with the address indicated instead the address where it was at the time of the safeguard.

A protected program cannot be loaded by the command LOAD because it is immediately unobtrusive from memory. In this case, use RUN or CHAIN.

Associated key words: CHAIN, CHAIN MERGE, MERGE, RUN, SAVE



LOCATE

LOCATE [#<channel number>,]<coordinate x>,
<coordinate y>

    10 MODE 1
    20 FOR n=1 TO 20
    30 LOCATE n,n
    40 PRINT CHR$(143);"position";
    50 PRINT n;",";n
    60 NEXT
    run

COMMAND:
Move the text cursor towards a new relating position to the window left higher corner. #0 represents the channel by defect.

Associated key words: WINDOW



LOG

LOG (<numerical expression>)

    PRINT LOG(9999)
        9.21024037

FUNCTION:
Calculate the natural LOGarithm of a <numerical expression> (higher than zero)

Associated key words: EXP, LOG10



LOG10

LOG10 (<numerical expression>)

    PRINT LOG10(9999)
       3.99995657

FUNCTION: Calculate the LOGarithm (base 10) of the <numerical expression> (higher than zero)

Associated key words: EXP, LOG



LOWER$

LOWER$
(<alphanumeric chain>)

    10 a$="SEE HOW LETTERS HAVE CHANGE "
    20 PRINT LOWER$(a$+"IN SMALL LETTERS")
    run

FUNCTION:
Change all the capital letters of an alphanumeric chain in small letters. Useful when one awaits answers made up of a mixture of capital letters and small letters.

Associated key words: UPPER$



MASK

MASK [<whole number>][,<
layout of the first point>]

    10 MODE 0:INK 5,21:INK 8,16
    20 MOVE -100*RND,400*RND
    30 WHILE XPOS<640
    40 FOR x=1 TO 8
    50 MASK 2^ (8-x)
    60 DRAWR 32,0,x,1:MOVER -32,0
    70 NEXT
    80 MOVER 34,0
    90 WEND:GOTO 20
    run

COMMAND:
Defines the model to use for the layout of the lines. The binary value of the <whole number> ranging between 0 and 255 activates (1) or desactivate (0) the bits in each adjacent group of 8 pixels.

The parameter
<layout of the first point> determines if the first point of the line must be traced (1) or not (0).

You can put one of the parameters but not both. If you omit one of them, its specification remains unchanged.

Associated key words: DRAW, DRAWR, GRAPHICS PAPER, GRAPHICS PEN



MAX

MAX
(<list of:<numerical expression>)

    10 n=66
    20 PRINT MAX(1,n,3,6,4,3)
    run
       66

FUNCTION: Give the largest value (MAXimum) of the list.


Associated key words: MIN



MEMORY

MEMORY <adress>

    MEMORY &20AA

COMMAND:
Defines the quantity of BASIC memory available by fixing the highest byte address.

Associated key words: FRE, HIMEM, SYMBOL, SYMBOL AFTER



MERGE

MERGE <filename>

    MERGE "nouversi.bas"

COMMAND:
Load a program from the diskette and additions it with the program already in memory.

The line numbers of the program in place being found in the new program are automatically crushed.

The protected files (safeguarded by SAVE, p) cannot be MERGEd with another program in place.

Associated key words: CHAIN, CHAIN MERGE, LOAD



MID$

MID$ (<
alphanumeric chain>,<starting position>[,<length of under chain>])

    10 MODE 1:ZONE 3
    20 a$="ENCYCLOPAEDIA"
    30 PRINT"
Look at how to spell ";a$
    40 PRINT
    50 FOR n=1 TO LEN(a$)
    60 PRINT MID$(a$,n,1),
    70 FOR t=1 TO 700:NEXT t,n
    80 PRINT:PRINT
    90 INPUT "input a new word ";a$
    100 GOTO 50
    run

FUNCTION: Return a new under-chain starting to the alphanumeric chain <starting position> and containing the number of characters corresponding to the <length of the under-chain>. If the parameter <length of the under-chain> is not specified, the function returns the remainder of the <alphanumeric chain> starting from the <starting position>.

If the
<starting position> is greater than the total length, a null strings is returned. The <starting position> must ranging between 1 and 255, the <length of the under-chain> between 0 and 255.

Associated key words: LEFT$, RIGHT$



MID$

MID$ (<chain variable>,<insertion position>[,<lenght of the new chain>])
                                                                       = <new alphanumeric chain>

    10 a$="hello"
    20 MID$(a$,3,2)="XX"
    30 PRINT a$
    run
    boXXour

COMMAND:
Insert in the specified chain a <new alphanumeric chain> with a number of characters given, to the <insertion position>.

When you use MID$ as a COMMAND, you must use a <variable chain>, for example like A$, and not with a constant like "hello".

Associated key words: LEFT$, RIGHT$



MIN

MIN (
<list of:<numerical expression>)

    PRINT MIN(3,6,2.999,8,9,)
    2.999

FUNCTION:
Give the smallest value (MINimal) of the <list of:<numerical expression>

Associated key words: MAX



MOD

<argument 1> MOD <argument 2>

    PRINT 10 MOD 3
       1
    PRINT 10 MOD 5
       0

OPERATOR:
Give the remainder of the whole division of <argument 1> by <argument 2>

Associated key words: Nothing



MODE

MODE <whole number>

    10 m=m+1: IF m>2 THEN m=0
    20 MODE m
    30 PRINT"This is the mode";m
    40 PRINT"Press a key"
    50 IF INKEY$="" THEN GOTO 50 ELSE 10
    run

COMMAND:
Modify the screen mode (0,1 or 2) and restores on the screen the INK 0, even if the ink currently used by the paper is different. All windows and cursors are re-initialized.

Associated key words: WINDOW, ORIGIN



MOVE

MOVE <coordinate x>,
<coordinate y>[,[<ink>][,<ink mode>]]

    10 MODE 1:TAG
    20 x=RND*800-100:y=RND*430
    30 MOVE x,y
    40 PRINT"je suis ici";
    50 GOTO 20
    run

COMMAND:
Position the graphic cursor to the specified absolute point. The optional parameter <ink> (ranging between 0 and 15) makes it possible to change the graphic pen color.

The optional parameter <ink mode> determines the ink interaction on posting in place on the screen. There are 4 ink modes:


0:Normal
1:XOR
2:AND
3:OR

Associated key words: MOVER, ORIGIN, XPOS, YPOS



MOVER

MOVER <interval x>,<interval y>[,[<ink>][,<ink mode>]]

    10 MODE 1:TAG:MOVE 0,16
    20 PRINT"the life has its";
    30 FOR n=1 TO 10
    40 MOVER -45,16
    50 PRINT"tops";:NEXT:PRINT" and";
    60 FOR n=1 TO 10
    70 MOVER -64,-16
    80 PRINT"bottoms";:NEXT
    run

COMMAND:
Position the graphic cursor in relative co-ordinates (compared to the current position). The optional parameter <ink> (ranging between 0 and 15) makes it possible to change the graphic pen color.

The optional parameter <ink mode> determines the ink interaction on posting in place on the screen. There are 4 ink modes:

0:Normal
1:XOR
2:AND
3:OR

Associated key words: MOVE, ORIGIN, XPOS, YPOS



NEW

NEW

    NEW

COMMAND:
Erase the program and the variables in memory. The definitions of keys are not erased and the screen stay what it was (MODE, PEN, PAPER, INK etc.).

Associated key words: Nothing



NEXT

NEXT [<list of: <variable>]

    10 FOR a=1 TO 3
    20 FOR b=0 TO 26
    30 MODE 1
    40 PEN a:BORDER b
    50 PRINT"PEN";a;"BORDER";b
    60 FOR c=1 TO 500
    70 NEXT c,b,a
    run

COMMAND:
Mark the end of a loop started with FOR. The command NEXT can be anonymous or can referred to the concerned FOR. In the example above, the <list of variable> must appear with opposite direction than commands FOR.

Associated key words: FOR, STEP, TO



NOT

NOT <argument>

    IF NOT "alan"  < "bernard" THEN PRINT "true" ELSE PRINT "false"
    false
    IF NOT "cat"  > "dog" THEN PRINT "true" ELSE PRINT "false"
    true
    ......
    PRINT NOT -1
    0
    PRINT NOT 0
    -1

OPERATOR:
Execute operations by bit with woole numbers. Opposite each bit of the argument.

Associated key words: AND, OR, XOR



ON BREAK CONT

ON BREAK CONT

    10 ON BREAK CONT
    20 PRINT"The program will CONTinue if you try"
    25 PRINT "to do
*Break* with the [ESC] key":PRINT
    30 FOR t=1 TO 1000:NEXT:GOTO 20
    run

COMMAND:
Cancel the action of key [ESC], preventing the program stop. This command is to be used with precaution because the program can be so stopped only by complete rebootstrapping of the computer (you must thus safeguard the program before launching it).

You can desactivate 
ON BREAK CONT by ON BREAK STOP inside a program.

Associated key words: ON BREAK GOSUB, ON BREAK STOP



ON BREAK GOSUB

ON BREAK GOSUB <line number>

    10
ON BREAK GOSUB 40
    20 PRINT"the program run"
    30 GOTO 20
    40 CLS::PRINT"Type twice [ESC],";
    50 PRINT"call the subroutine"
    60 FOR t=1 TO 2000:NEXT
    70 RETURN
    run

COMMAND: Ask the BASIC to go to the subroutine specified by the <line number> when you push twice on [ESC].

Associated key words: ON BREAK CONT, ON BREAK STOP, RETURN



ON BREAK STOP

ON BREAK STOP

    10 ON BREAK GOSUB 40
    20 PRINT"the program run"
    30 GOTO 20
    40 CLS:PRINT"Type twice on [ESC],";
    50 PRINT"call the subroutine"
    60 FOR t=1 TO 20000:NEXT
    65 ON BREAK STOP
    70 RETURN
    run

COMMAND:

Desactivate the commands ON BREAK CONT and ON BREAK GOSUB to allow the program stop on activation of [ESC] key. In the example above, the command ON BREAK GOSUB functions only once because it is desactivated with line 65 in the subroutine ON BREAK.

Associated key words: ON BREAK CONT, ON BREAK GOSUB


ON ERROR GOTO

ON ERROR GOTO
<line number>

    10 ON ERROR GOTO 60
    20 CLS:PRINT"If an error is found, ";
    30 PRINT"then LIST the program"
    40 FOR t=1 TO 4000:NEXT
    50 GOTO 100
    60 PRINT"Error detected to the line";
    70 PRINT ERL:PRINT:LIST
    run

COMMAND: Go to the line specified at once that an error is detected.

The command ON ERROR GOTO 0 desactivate the diversion of the program with error and restores the normal treatment of the errors by the BASIC.

See also the command
RESUME.

Associated key words: DERR, ERL, ERR, ERROR, RESUME



ON <expression> GOSUB

ON <selector> GOSUB <list of:
<line number>

    10 PAPER 0:PEN 1:INK 0,1
    20 CLS:PRINT" MENU":PRINT
    30 PRINT"1 - Change border":PRINT
    40 PRINT"2 - Change pen":PRINT
    50 PRINT"3 - Change  mode":PRINT
    60 INPUT"Your choice";x
    70 ON x GOSUB 90,110,130
    80 GOTO 20
    90 b=b-1:IF b<0 THEN b=26
    100 BORDER b:RETURN
    110 p=p-1:IF p<2 THEN p=26
    120 INK 1,p:RETURN
    130 m=m-1:IF m<0 THEN m=2
    140 MODE m:RETURN
    run
   
COMMAND:
Select a line of subroutine according to the value of <selector> (whole number ranging between 0 and 255). The order of the values of <selectors> determines the line number to extract from <list of: <line number>. In the example above:

1 causes the passage to the line 90
2 causes the passage to the line 110
3 causes the passage to line 130

If this expression is equal to zero, or if it is higher than the number of lines of the list specified in the order, the selection does not take place.

Associated key words: RETURN



ON <expression> GOTO

ON <selector> GOTO <list of:
<line number>

    10 CLS:PRINT" MENU":PRINT
    20 PRINT"1 - LIST the program":PRINT
    30 PRINT"2 - EDIT to correct":PRINT
    40 PRINT"3 - Print the CATalogue":PRINT
    50 INPUT"Your choice";n
    60 ON n GOTO 80,90,100
    80 LIST
    90 AUTO
    100 CAT
    run

COMMAND: Select a line of subroutine according to the value of <selector> (whole number ranging between 0 and 255). The order of the values of <selectors> determines the line number to extract from <list of: <line number>. In the example above:

1 causes the passage to the line 80
2 causes the passage to the line 90
3 causes the passage to line 100

If this expression is equal to zero, or if it is higher than the number of lines of the list specified in the order, the selection does not take place.

Associated key words: Nothing



ON SQ GOSUB

ON SQ (<channel number>) GOSUB <line number>

    10 ENV 1,15,-1,1
    20 ON SQ(1) GOSUB 60
    30 MODE 0:ORIGIN 0,0,200,440,100,300
    40 FOR x=1 TO 13:FRAME:MOVE 330,200,x
    50 FILL x:NEXT:GOTO 40
    60 READ s:IF s=0 THEN RESTORE:GOTO 60
    70 SOUND 1,s,25,15,1
    80 ON SQ(1) GOSUB 60:RETURN
    90 DATA 50,60,90,100,35,200,24,500,0
    run

COMMAND:
Cause a diversion if there is some place in a sound queue. The <channel number> is a whole number indicating one of the values:

1: for channel A
2: for channel B
4: for channel C


Associated key words: RETURN, SOUND, SQ



OPENIN

OPENIN <filename>

    10 REM Open and receive the file coming from the diskette
    20 OPENIN "NOMFICH":INPUT#9,a,a$
    30 CLOSEIN:PRINT"the 2 values are:"
    40 PRINT:PRINT a,a$
    run

COMMAND:
Open an existing file on the diskette to read there data intended to the program in memory. The file to be opened must be an ASCII file. This example functions only if you have created the file according to the command OPENOUT example.

Associated key words: CLOSEIN, EOF



OPENOUT

OPENOUT <filename>

    10 REM 
Open and output the file on the diskette
    20 INPUT"Give me a number";a
    30 INPUT"Give me a word";a$
    40 OPENOUT "FILENAME"
    50 WRITE#9,a,a$
    60 CLOSEOUT:PRINT"Data are saved on the diskette"
    run

COMMAND:
Open on the diskette an output file usable by the program in memory.

Associated key words: CLOSEOUT


OR

<argument> OR <argument>

    IF "alan" < "bernard" OR "dog" > "cat" THEN PRINT "true" ELSE PRINT "false"
    true
    IF "bernard" < "alan" OR "cat" > "dog" THEN PRINT "truei" ELSE PRINT "
false"
    
false
    IF "alan" < "bernard" OR "cat" > "dog" THEN PRINT "true" ELSE PRINT "false"
    true
    .....
    PRINT 1 OR 1
    1
    PRINT 0 OR 0
    0
    PRINT 1 OR 0
    1

OPERATOR: Execute in machine language booleans operations with woole numbers. Give 1 in all the cases except if the two arguments are equal to 0.

Associated key words: AND, NOT, XOR



ORIGIN

ORIGIN <x>,<y>[,<left>,<right>,<top>,<bottom>]

    10 MODE 1:BORDER 13:TAG
    20 ORIGIN 0,0,100,540,300,100
    30 GRAPHICS PAPER 3:CLG
    40 FOR x=550 TO -340 STEP -10
    50 MOVE x,206
    60 PRINT"Here is a graphic window";
    70 FRAME:NEXT:GOTO 40
    run

COMMAND: Establish
the graphic origin point of the cursor to the co-ordinates <x>,<y> specified. You can also fix dimensions of the graphic window by specification of the four last optional parameters. If the specified co-ordinates for the graphic window are apart from the screen, the screen borders are then regarded as the window limits.

Associated key words: CLG



OUT

OUT <port number>,<whole number>

    OUT &F8F4,&FF

COMMAND:
Send the value of the <whole number> (between 0 and 255) towards the output port specified by its address.

To disadvise to the no informed users.


Associated key words: INP, WAIT



PAPER

PAPER[#
<channel number>,]<ink>

    10 MODE 0:PEN 0:INK 0,13
    20 FOR p=1 TO 15
    30 PAPER p:CLS
    40 LOCATE 7,12:PRINT"PAPER";p
    50 FOR t=1 TO 5000:NEXT t,p
    60 PAPER 5:CLS
    run

COMMAND:
Establishes the fill color for the characters. At the posting time of the characters on the screen, its matrix (the grid) is filled with the <ink> corresponding to the paper (PAPER INK) before it posted itself (except in the event of transparent mode).

If the <channel number> is not specified, the channel #0 is taken by defect.

The number of colors available depends about the selected mode.


Associated key words: INK, GRAPHICS PAPER, PEN



PEEK

PEEK (<adress>)

    10 MODE 1:ZONE 7
    20 WINDOW 1,40,1,2:WINDOW#1,1,40,3,25
    30 PRINT"Memory adress"
    40 LOCATE 20,1:PRINT"Memory contents"
    50 FOR n=0 TO 65535
    60 p=PEEK(n)
    70 PRINT#1,n,"(&";HEX$(n);")";
    80 PRINT#1,TAB(20);p,"(&";HEX$(p);")"
    90 NEXT
    run

FUNCTION:
Reads the contents of the Z80 memory <adress> which is indicated between brackets. This address must ranging between &0000 and &FFFF (0 and 65535). PEEK operates only on the read-write memory (RAM), never on the read-only memory (ROM), and provides values ranging between &00 and &FF (0 and 255).

Associated key words: POKE



PEN

PEN [#
<channel number>,][<ink>][,<paper mode>]

    10 MODE 0:PAPER 0:INK 0,13
    20 FOR p=1 TO 15
    30 PEN p:PRINT SPACE$(47);"PEN";p
    40 FOR t=1 TO 5000:NEXT t,p:GOTO 20
    run

COMMAND:
Select the <ink> to be used (from 0 to 15) to write on the indicated channel (by defect # 0). The parameter <ink mode> can be either transparent (1), or opaque (0).

At least one of the last two parameters must appear. If one of them is omitted, its old value remains unchanged.


Associated key words: PAPER



PI

PI

    PRINT PI
     3.14159265

FUNCTION:
Provides the value of the circumference-diameter ratio of a circle.

Associated key words: DEG, RAD



PLOT

PLOT <coordinate x>,<coordinate y>[,[<ink>][,<ink mode>]]

    10 MODE 1:BORDER 0:PAPER 0:PEN 1
    20 INK 0,0:INK 1,26:INK 2,13,26:DEG
    30 FOR x=1 TO 360:ORIGIN 320,200
    40 DRAW 50*COS(x),50*SIN(x),1
    50 PLOT 100*COS(x),25*SIN(x):NEXT
    60 ORIGIN 0,0:t=TIME+700:WHILE TIME<t
    70 PLOT RND*640,RND*400:WEND
    80 PLOT
RND*640,RND*400,2
    90 GOTO 90
    run

COMMAND:
Post, in graphic mode, the point of coordinates x and y. One defines the <ink> of this point with a scale from 0 to 15.

The optional parameter <ink mode> determines the interaction mode between the color used and these of the screen. Here is the fours possible modes:


0: Normal
1: XOR
2: AND
3: OR


Associated key words: GRAPHICS PEN, PLOTR


PLOTR

PLOTR <interval x>,<interval y>[,[<ink>][,<ink mode>]]

     20 BORDER 0:GRAPHICS PEN 1
    30 MODE 1:PLOT 320,200
    35 PRINT "utilisez le pave curseur pour dessiner"
    40 IF INKEY(0)=0 THEN PLOTR 0,1
    50 IF INKEY(1)=0 THEN PLOTR 1,0
    60 IF INKEY(2)=0 THEN PLOTR 0,-1
    70 IF INKEY(8)=0 THEN PLOTR -1,0
    80 IF INKEY(9)=0 THEN 30:REM [COPY]=CLS
    90 GOTO 40
    run

COMMAND:
In graphic mode, posts on the screen the point of co-ordinates x and y relating to the cursor position at this time. One defines the <ink> of this point with a scale from 0 to 15.

The optional parameter <ink mode> determines the interaction mode between the color used and these of the screen. Here is the fours possible modes:

0: Normal
1: XOR
2: AND
3: OR

Associated key words: GRAPHICS PEN, PLOT



POKE

POKE <adress>,<whole number>

    10 FOR m=49152 TO 65535
    20 POKE m,100
    30 NEXT
    run

COMMAND:
Output the value corresponding to the <whole number> (ranging between 0 and 255) directly in the Z80 RAM memory with indicated <address>.

Command to use with precaution!

Associated key words: PEEK



POS

POS (#<channel number>)

    10 MODE 1:BORDER 0:LOCATE 8,2
    20 PRINT"use the direction keys left/right "
    30 WINDOW 1,40,12,12:CURSOR 1,1
    40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT
    50 IF INKEY(1)<>-1 THEN PRINT CHR$(9);
    60 IF INKEY(8)<>-1 THEN PRINT CHR$(8);
    70 LOCATE #1,2,24
    80 PRINT #1,"cursor text,";
    90 PRINT #1,"horizontal
position=";
    100 PRINT #1,POS(#0):GOTO 50
    run

FUNCTION:
Calculate the text cursor POSition on the horizontal axis, starting from the left border of the window. The <channel number> must obligatorily be specified; it does not take the value #0 by defect.

POS(#8)
calculates the horizontal position of the printer carriage compared to the left margin  (coordinate 1).

POS(#9) 
calculates the logical position of the diskette drive channel , i.e. the number of characters transmitted since the last «carriage return».

Associated key words: VPOS, WINDOW



PRINT

PRINT [#
<channel number>,][<list of: <article to print>]

    10 a$="small"
    20 b$="This is a long characters chain"
    30 PRINT a$;a$
    40 PRINT a$,a$
    50 PRINT
    60 PRINT b$;b$
    70 PRINT b$,b$
    run

COMMAND:
Transmits the <list of: <article to print> or to post on the indicated channel, (# 0 per defect).

The semicolon indicates to the computer that an article must be immediately printed following the precedent. However, if it is too long to be on the same line, the computer go to the line anyway.

The comma indicates that an article must be positioned with the following tabulation. However, if the print or the posting of the preceding article overflows on the indicated tabulation, the computer shifts the new article with an additional tabulation.



PRINT SPC
PRINT TAB

PRINT [#<channel number>,][<list of: <article to print>][;]
            [SPC(<whole number>)]
[<list of: <article to print>]

PRINT [#<channel number>,][<list of: <article to print>][;]
            [TAB(<whole number>)]
[<list of: <article to print>]

    10 PRINT"This a SPC instruction"
    20 FOR x=6 TO 15
    30 PRINT SPC(5) "a";SPC(x);"b"
    40 NEXT
    50 PRINT"This is the TAB instruction"
    60 FOR x=6 TO 15
    70 PRINT TAB(5) "a";TAB(x);"b"
    80 NEXT
    run

SPC print the number of empty spaces indicated by the <whole number> before printing or posting the article indicated, provided that this one can be put completely on the line. It is thus useless to use the semicolon with the command SPC.

TAB print, starting from the left margin, the number of empty spaces indicated before printing or posting the indicated article, provided that this one can be put on the line. The semicolon is thus useless after TAB. If the cursor has already exceeded the required position, a 
carriage return is executed before the tabulation.



PRINT USING

PRINT [#<
channel number>][<list of:<article to print>][;]
[USING<format model>][<separator> <expression>]

    10 FOR x=1 TO 10
    20 n=100000*(RND^ 5)
    30 PRINT"goods";USING"########,##";n
    40 NEXT
    run

PRINT USING makes it possible to define the print format of an expression transmitted by the command PRINT. One defines for that the <format model> with which one wishes to appear the expression. One uses as <separator> either a comma, or a semicolon. The <format model> is a character string made up with the following « field indicators »:


Numericals formats

In a number:

#  Each sign # indicate the site of a figure.
    Example: ######

.  
Indicate the site of the decimal point (equivalent with our comma).
    Example:######.##

,  
(Reserve a space). This sign, being able to appear only immediately before the decimal point, indicates that the figures located on the left of the decimal point will be laid out by groups of three (corresponding to the thousands) separate between them by a comma
    Example:######,.##

Framing of a number:


££   
(Reserve two spaces). Indicate that the sign £ will appear immediately before the first digit or the decimal point, i.e. on one of the sites reserved for digits.
       Example: ££######,.##

**   (Reserve two spaces). Indicate that all the empty spaces located before the number will be filled by asterisks.
       Example: **######,.##

**£   
(Reserve three spaces). Add the options ** and ££, i.e. the asterisks at the head and the sign £ preceding immediately the number.
         Example: **£######,.##

$$
    (Reserve two spaces). Indicate that the sign $ will appear immediately on the left than the first digit or decimal point, i.e. on sites reserved to digits.
        Example:$$######,.##

**$
  (Reserve three spaces). Add the options ** and $$, i.e. the asterisks at the head and the sign $ preceding immediately the number.
        Example: **$######,.##

+     
Indicate that one wishes to see appearing the sign of the number. This sign will appear before the number if the + is located at the beginning of the <model of format> and after the number if it is located to the end.
        Example: +####.####

-      
The sign - can appear only TO THE END of the mask. It asks the presence of the sign - after any negative number or any negative exponent. In the absence of this specification, the sign - appears by defect before the negative number.
        Example:####.####-

^^^^ 
Indicate that the number must appear with exponent. The signs ^^^^ are placed AFTER the last site of digits, but BEFORE any final sign + or -
         Example: #.####^^^^+

The maximum length of the <model of format> of a number is 20 characters. The numbers are rounded with the number of signs indicated.

If a format is too small to contain the expression:


    PRINT USING "####";12345678

... this one is not truncated, but appears in its entirety, preceded by the sign % indicating a «erroneous format».


Format of an alphanumeric chain

    10 CLS:a$="abcdefghijklmnopqrst"
    20 PRINT"alphanumeric chain= ";a$
    30 PRINT:PRINT"With  !  =  ";
    40 PRINT USING "!";a$
    50 PRINT:PRINT"With  \espaces\  =  ";
    60 PRINT USING "\           \";a$
    70 PRINT:PRINT
"With  &  =  ";
    80 PRINT USING "&";a$
    90 GOTO 90
    run

!  
indicate that only the first character of the chain must appear.
    Example: !

\<espaces>\
   
Indicate that only the x first characters of the chain must appear, x being equal to the length of the format (bars included).
    Example:\            \

&   Indicate that the chain must appear
«just as it is».
      Example: &


The <model of format> of a chain cannot exceed 255 characters.

Any <model of format > can be represented by an alphanumeric variable, as shows it the following example:


    10 a$="FF######,.##"
    20 b$="!"
    30 PRINT USING a$;12345.6789;
    40 PRINT USING b$;"cents"
    run


Associated key words: SPC, TAB, USING, ZONE



RAD

RAD

    RAD

COMMAND:
Establishes the RADians calculation mode. In BASIC, it is adopted by defect.

Associated key words: ATN, COS, DEG, SIN, TAN



RANDOMIZE

RANDOMIZE [<numerical expression>]

    RANDOMIZE 123.456
    PRINT RND
       0.258852139

COMMAND:
Give a random value calculated from indicated <numerical expression>. The random numbers generator provides a pseudo-random sequence in which each number depends about the precedent. The sequence itself is predetermined. If the initial value is not specified in the command, it is the user who will enter it in the course of execution. RANDOMIZE TIME provides a practically unforeseeable sequence.

Associated key words: RND



READ

READ <list of:<variable>

    10 FOR n=1 TO 8
    20 READ a$,c
    30 PRINT a$;" ";:SOUND 1,c:NEXT
    40 DATA this are,478,the,426,8,379,notes
    50 DATA 358,from,319,the,284,range,253,.,239
    run

COMMAND:
Reads data contained in a DATA instruction and assigns them with variables. READ goes automatically from a data to the following one. The command RESTORE makes it possible to return to a former DATA command.

Associated key words: DATA, RESTORE



RELEASE

RELEASE <sound channels>

    10 SOUND 65,1000,100
    20 PRINT"push [R] to release the note"
    30 IF INKEY(50)=-1 THEN 30
    40 RELEASE 1
    run

COMMAND:
Release the sound channels blocked by the command SOUND.

The parameter <sound channels> takes the following values:

    1: 
Release channel A
    2: Release channel B
    3: Release channels A et B
    4: Release channel C
    5: Release channels A et C
    6: Release channels B et C
    7: Release channels A,B et C

Associated key words: SOUND



REM

REM <text>

    10 REM 
DRIVE OUT WITH INVADERS IN THE INTERGALACTIC HYPERSPACE
    20 REM         COPYRIGHT by AMSOFT

COMMAND:
Insert a Remark in the program. BASIC is unaware about <text> located after REM, even if this one includes a separator of instructions ":" or any other code.

One can replace REM by an apostrophe ' in all the cases, EXCEPT inside a DATA instruction.

Associated key words: Nothing



REMAIN

REMAIN (<chronometer number>)

    10 AFTER 500,1 GOSUB 40
    20 AFTER 100,2 GOSUB 50
    30 PRINT"The program run":GOTO 30
    40 REM this subroutine will not be called anymore if
    45 REM 
it was made inoperative in line 70
    50 PRINT:PRINT "The chronometer 1 will ";
    60 PRINT"be removed by REMAIN."
    70 PRINT"
there remained ";REMAIN(1);" unit of time to the chrono 1"
    run

FUNCTION:
Reads the remaining time to deduct by the indicated chronometer (from 0 to 3), before desactivated it.

Associated key words: AFTER, DI, EI, EVERY



RENUM

RENUM [<new line number>][,[<old line number>][,<increment>]]

    10 CLS
    20 REM this line will become: line 123
    30 REM this line will become: line 124
    40 REM this line will become: line 125
    RENUM 123,20,1
    LIST

COMMAND:
RENUMber the lines of a program.

The <old line number> is a parameter indicating the line of the program to which one wishes to begin classification. In the absence of this parameter, all the lines of the program will be renumbered. The <new line number> indicates the new number of the first renumbered line (10 per defect). The <increment> indicates 
the spacing wished between two lines (10 per defect). RENUM operates the necessary readjustments inside the call instructions such as GOTO and GOSUB. On the other hand, it leaves unchanged the numbers of lines contained in the character strings appearing in commands KEY, REM, CHAIN and CHAIN MERGE. The lines numbers must lie between 1 and 65535.

Associated key words: DELETE, LIST



RESTORE

RESTORE [
<line number>]

    10 READ a$:PRINT a$;" ";
    20 RESTORE 50
    30 FOR t=1 TO 500:NEXT:GOTO 10
    40 DATA data can be reads more
    50 DATA and more
    run

COMMAND:
Bring back the pointer on the DATA instruction indicated. In the absence of parameter, the pointer return to the first DATA instruction of the program.
   
Associated key words: DATA, READ



RESUME

RESUME
[<line number>]

    10 ON ERROR GOTO 60
    20 FOR x=10 TO 0 STEP-1:PRINT 1/x:NEXT
    30 END
    40 PRINT"I come here in case of error"
    50 END
    60 PRINT"error No.";ERR;"to the line";ERL
    70 RESUME 40
    run

COMMAND: Begins again
the execution of a program after the detection and the treatment of an error by the command ON ERROR GOTO. If no <line number> is indicated, the execution of the program begins again with the line containing the detected error. Remove this parameter in the example above, then run the program.

    70 RESUME
    run

Associated key words: DERL, ERL, ERR, ERROR, ON ERROR GOTO, RESUME NEXT



RESUME NEXT

RESUME NEXT

    10 ON ERROR GOTO 90
    20 PRINT"type [ENTER] each time"
    30 INPUT "1";a
    40 INPUT "2";a
    50 inpot "3";a:REM syntax error
    60 INPUT "4";a
    70 INPUT "5";a
    80 END
    90 PRINT"error No.";ERR;"to the line";ERL
    100 RESUME NEXT
    run

COMMAND:
Begin again the execution of a program after the detection and the treatment of an error by the command ON ERROR GOTO.

The execution of the program begins again starting from the line
immediately following the erroneous line.

Associated key words: DERR, ERR, ERROR, ON ERROR GOTO, RESUME



RETURN

RETURN

    10 GOSUB 50:PRINT "After the GOSUB":END
    50 FOR n=1 TO 20
    60 PRINT"subroutine"
    70 NEXT:PRINT
    80 RETURN
    run

COMMAND:
Indicate the end of a subroutine. After the execution of a subroutine, BASIC returns to the instruction following immediately the corresponding GOSUB.

Associated key words: GOSUB



RIGHT$

RIGHT$
(<alphanumeric chain>,<required length>)

    10 MODE 1:a$="computer CPC 6128"
    20 FOR n=1 TO 17:LOCATE 41-n,n
    30 PRINT RIGHT$(a$,n)
    40 NEXT
    run

FUNCTION:
Extract some characters (<required length> between 0 and 255) on the right of an <alphanumeric chain>. If the chain is shorter than the <required length>, it is entirely used.

Associated key words: LEFT$, MID$



RND

RND [
(<numerical expression>)]

    10 RANDOMIZE
    20 FOR x=1 TO -1 STEP-1
    30 PRINT"parameter RND=";x
    40 FOR n=1 TO 6
    50 PRINT RND(x)
    60 NEXT n,x
    run

FUNCTION:
Provides the next number of the pseudo random sequence in progress when the <numerical expression> is positive or when it does not appear in the command.

When the <numerical expression> is null, RND returns the last generated number.

A negative value of the <numerical expression> launches a new random sequence, whose RND provides the first element.

Associated key words: RANDOMIZE



ROUND

ROUND
(<numerical expression>[,<number of decimals>])

    10 FOR n=4 TO -4 STEP -1
    20 PRINT ROUND(1234.5678,n),
    30 PRINT "round to";n;"decimals"
    40 NEXT
    run

FUNCTION:
Rounds the <numerical expression> to the number of figures after the comma or of powers of ten indicated by the parameter <number of decimals>. If this parameter is negative, the expression is round to an absolute entirety, followed by a number of zero equal to its absolute value.

Associated key words: ABS, CINT, FIX, INT



RUN

RUN
<alphanumeric chain>

    RUN "disc"

COMMAND:
Load and run a program BASIC or a program-object located on the diskette. Any program present in memory is automatically crushed.

This command makes it possible to reach directly the protected programs BASIC.


Associated key words: LOAD



RUN

RUN [
<line number>]

    RUN 200

COMMAND:
Run the program BASIC present in memory, starting with the indicated <line number> or, failing this, at the beginning of the program. RUN reboot all variables.

This command can not give access to the
protected programs loaded in memory.

Associated key words: CONT, END, STOP



SAVE

SAVE <filename>[,<type of file>][,<binary parameters>]

    SAVE "fichdisc.xyz"

...safeguard the file in
not protected BASIC mode.

    SAVE "fichdisc.xyz",P

...
safeguard the file in protected BASIC mode.

    SAVE "fichdisc.xyz",A

...
safeguard the file in ASCII mode.

    SAVE "fichdisc.xyz",B,8000,3000,8001

...
safeguard the file in binary mode. In our example, the program will be stored in memory starting from address 8000 and will occupy 3000 bytes. The entrance point address (optional) is 8001.

COMMAND: Safeguard on diskette the program currently being in memory. A memory zone loaded on diskette is called a Binary file. Here which are the various Binary parameters:

    <starting address>,<file lenght>[,<entrance point>]

It is possible to safeguard the screen memory in a Binary form file. This operation, called 
« emptying of screen », is carried out with the following command:

    SAVE "screen", B, &C000, &4000

One obtains his reloading to the screen with the command:

    LOAD "screen"

Associated key words: CHAIN, CHAIN MERGE, LOAD, MERGE, RUN



SGN

SGN
(<numerical expression>)

    10 FOR n=200 TO -200 STEP -20
    20 PRINT" SGN give";
    30 PRINT SGN(n);"for the value:";n
    40 NEXT
    run

FUNCTION:
Establishes the SiGN of the <numerical expression>. SGN returns the values:-1 (if the expression is negative), 0 (if it is null) and 1 (if it is positive).

Associated key words: ABS



SIN

SIN
(<numerical expression>)

    10 CLS:DEG:ORIGIN 0,200
    20 FOR n=0 TO 720
    30 y=SIN(n)
    40 PLOT n*640/720,198*y:NEXT
    50 GOTO 50
run

FUNCTION:
 Calculate the SINe of the <numerical expression> indicated.

One can express the argument in degrees or radians 
using the functions DEG and RAD.

Associated key words: ATN, COS, DEG, RAD, TAN



SOUND

SOUND <channel state>,<sound period>[,<duration>[,<volume>[,<volume envelope>,[<tonality envelope>[,<noise period>]]]]]

    10 FOR z=0 TO 4095
    20 SOUND 1,z,1,12
    30 NEXT
    run

COMMAND:
Allows the sound programming, using the following parameters:

Parameter 1: <channel state>

The <channel state> must be a whole number ranging between 1 and 255. The binary conversion of this parameter gives the significance of each bit according to the table of following correspondence:

Bit 0 (1 in decimal): output the sound on channel A
Bit 1 (2 in decimal): output the sound on channel B
Bit 2 (4 in decimal): output the sound on channel C
Bit 3 (8 in decimal): appointment with channel A
Bit 4 (16 in decimal): appointment with channel B
Bit 5 (32 in decimal): appointment with channel C
Bit 6 (64 in decimal): block a sound channel
Bit 7 (128 in decimal): empty a sound channel

The <channel state> 68, for example, will have the following effect:

Output on channel C (4), to the blocked state (64).


Parameter 2: <sound period>

This parameter establishes the height of the sound, i.e. the produced 
«note» (for example C, C#, D, D#, E). Each note is defined by a numerical value representing its <sound period>

Parameter 3: <duration>

This parameter establishes the length, or 
«duration», of the sound. A unit corresponds to a hundredth of second. The sound <duration> takes value 20 by defect, i.e. a fifth of second.

In the event of null
<duration> parameter, the length of the sound will be that of the envelope of volume indicated.

If the <duration> parameter is negative, the volume envelope will be repeated during a number of times equal to the absolute value of the parameter.

Parameter 4: <volume>

This parameter establishes the initial sound volume of a note. It can take a value between 0 (null volume) and 15 (maximum volume). The computer chooses by defect value 12.

Parameter 5: <volume envelope>

It is possible to modulate the volume of a note during its execution using the command ENV. This command makes it possible to define in advance a maximum of fifteen
different envelopes, coded from 1 to 15. The parameter <volume envelope> of the command SOUND then makes it possible to select one of these preset envelopes.

See ENV command

Parameter 6: <tonality envelope>

Period variations, therefore height, can be obtained during the execution of a note via the command ENT. This command enables you to define in advance a maximum of 15
different envelopes of tonalities, coded from 1 to 15. The parameter <tonality envelope> of the command SOUND then makes it possible to select one of these preset envelopes. If, in the command ENT, you used a negative number of envelope, the absolute value of this number will then be taken as parameter of the command SOUND.

See ENT command

Parameter 7: <noise period>

You have a choice of white noises which can be added or removed from the signal using the parameter <noise period> (value ranging between 0 and 31).


Associated key words: ENT, ENV,ON SQ GOSUB, RELEASE, SQ



SPACE$

SPACE$
(<whole number>)

    10 MODE 1
    20 PRINT"put 9 spaces between you";
    30 PRINT SPACE$(9);
    40 PRINT"and me!"
    run

FUNCTION:
Create a chain of spaces with the indicated length (from 0 to 255)

Associated key words: SPC, STRING$, TAB



SPC

(Voir PRINT SPC)



SPEED INK

SPEED INK <period 1>,<period 2>

    10 BORDER 7,18
    20 FOR i=30 TO 1 STEP -1
    30 SPEED INK i,i
    40 FOR t=1 TO 700:NEXT t,i
    run

COMMAND:
Allows to establish the period of alternation when an instruction INK or BORDER prescribed the use of two intermittent colors. The respective durations of the first and the second color are indicated in fiftieth seconds by the parameters <period 1> and <period 2>.

When you choose parameters, think about
hypnotic effects risks !!!

Associated key words: BORDER, INK



SPEED KEY

SPEED KEY <initial delay>,<inter-repetitions interval>

    10 CLS:FOR K=7 TO 1 STEP -2
    20 PRINT"Input your name, and [RETURN]"
    30 SPEED KEY k,k
    40 LINE INPUT a$:NEXT
    50 PRINT"what funny name !"
    run

COMMAND:
Establishes the keyboard automatic repetition speed. The parameter <initial delay> fixes the reaction time (measured into fiftieth of seconds) between the depression of the key and the beginning of the automatic repetition. The <inter-repetitions interval> establishes the lapse of time separating the repetitions.

The command SPEED KEY relates to only the keys for which the automatic repetition exists implicitly or those for which this function was programmed with the command KEY DEF.

Before defining an automatic repetition with a very short <initial delay>, it is advisable to program one of the numerical keys in order to be able to restore the default settings of the function SPEED KEY (30,2). Here how to proceed:

     KEY 0, "SPEED KEY 30,2"+CHR$(13)

To return to the initial state, actuate key 0 of the numeric keypad.


Associated key words: KEY DEF



SPEED WRITE

SPEED WRITE <whole number>

    SPEED WRITE 1

COMMAND:
Indicate the transmission speed of the data towards a cassette player, if necessary. This speed is equal to 2000 bauds (bits per seconds) if the parameter is equal to 1, that is to say, by defect, 1000 bauds if this one is equal to 0. At the time of the loading of a file recorded on cassette, the computer automatically chooses the good reading rate.

SPEED WRITE 0 is the flow ensuring the best reliability of transfer.

The command SPEED WRITE does not apply to the diskette drives


Associated key words: OPENOUT, SAVE



SQ

SQ
(<channel number>)

    10 SOUND 65,100,100
    20 PRINT SQ(1)
    run
       67

FUNCTION:
Indicate the state of the Sound Queue in a given sound channel. The <channel number> must be a whole numerical expression taking the values:

1: channel A
2: channel B
4: channel C

This function provides a whole number corresponding to the following significance
bits:

Bits 0, 1 et 2 : number of free inputs in the queue
Bits 3, 4 et 5 : appointment state at the beginning of the queue
Bit 6 : the head of the queue is blocked
Bit 7 : the channel is activated

One can note that if Bit 6 is ON, Bit 7 cannot be ON. Identically if Bits 3, 4 or 5 are ON, Bits 6 and 7 cannot be ON.


Associated key words: ON SQ GOSUB, SOUND



SQR

SQR
(<numerical expression>)

    PRINT SQR(9)
       3

FUNCTION:
Provides the SQuare Root of the numerical expression indicated.

Associated key words: Nothing


STEP

(Voir FOR)


STOP

STOP

    10 FOR n=1 TO 30:PRINT n:NEXT
    20 STOP
    30 FOR n=31 TO 60:PRINT n:NEXT
    run
    cont

COMMAND:
Stops a program, while leaving to the user the possibility to continue it with the command CONT. (for programs development)

Associated key words: CONT, END



STR$

STR$
(<numerical expression>)

    10 a=&FF:REM 255 hexadecimal
    20 b=&X1111:REM 15 binary
    30 c$="$$$"
    40 PRINT c$+STR$(a+b)+c$
    run
    $$$ 270$$$

FUNCTION:
Provides with the form of alphanumeric chain the decimal representation of the <numerical expression> indicated.

Associated key words: BIN$, DEC$, HEX$, VAL



STRING$

STRING$ (<lenght>,<character>)

    PRINT STRING$(40,"$")
    $$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$

FUNCTION:
Provides a character string with the length indicated (between 0 and 255) consisted with the repetition of the same character. The example above can be also written:

    PRINT STRING$(40,42)
    $$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$

where the <character> 42 corresponds to the ASCII value of "$". This notation is thus equivalent to PRINT STRING$(40,CHR$(42)).

Associated key words:  SPACE$


SWAP

(Voir WINDOW SWAP)


SYMBOL

SYMBOL <character number>,<list of:<line>

    10 MODE 1:SYMBOL AFTER 105
    20 line1=255:REM 11111111 in binary
    30 line2=129:REM 10000001 in binary
    40 line3=189:REM 10111101 in binary
    50 line4=153:REM 10011001 in binary
    60 line5=153:REM 10011001 in binary
    70 line6=189:REM 10111101 in binary
    80 line7=129:REM 10000001 in binary
    90 line8=255:REM 11111111 in binary
    100 PRINT"The line 110 redefined the letter i (105)"
    105 PRINT"Type some 'i' and look !"
    110 SYMBOL 105,line1,
line2,line3,line4,line5,line6,line7,line8
    run

COMMAND: Redefines the form of a character posted to the screen. Each parameter takes a whole value located between 0 and 255.

In order to be in measurement to allot a place in memory to a redefined character, the computer must be prepared by the command:

    SYMBOL AFTER x

...where x is lower or equal to the character number to redefine.

One enters then the command SYMBOL, followed immediately by the
character number x.

One can always reveal to the screen the character corresponding to the x value, even if it is not accessible from the keyboard. One uses for that the command:


    PRINT CHR$(x)

After SYMBOL x come the eight parameters defining one by one the eight lines constituting the character, starting from the top. Each parameter takes a value ranging between 0 and 255. It is the binary representation of the parameter which defines the corresponding line in the new character.

If, for example, one gives to the first parameter the value 1, the binary representation of the first line will be then: 00000001. The point corresponding to the 1 will appear in the character and will be color defined in the command PEN. On the other hand, the points corresponding to the 0 will be posted with the color PAPER, i.e. they will not appear. One can thus note that the character redefined in our example will comprise a point in the corner higher right. If one allots to the septs other parameters the values: 3, 7, 15, 31, 63, 0, 0, one obtain the following binary representation:

parameter (line) 1: 00000001 (1 in decimal)
parameter (line) 2: 00000011 (3 in decimal)
parameter (line) 3: 00000111 (7 in decimal)
parameter (line) 4: 00001111 (15 in decimal)
parameter (line) 5: 00011111 (31 in decimal)
parameter (line) 6: 00111111 (63 in decimal)
parameter (line) 7: 00000000 (0 in decimal)
parameter (line) 8: 00000000 (0 in decimal)

This layout of the parameters transcribed into binary makes it possible to visualize the form of the new character. One can assign these parameters to the character number 255, for example, by the command:

    SYMBOL 255,1,3,7,15,63,0,0

It is noticed that it is useless to make appear the last two parameters insofar as they are null.


    SYMBOL 255,1,3,7,15,63

One can avoid to convert with decimal notation the binary symbols constituting the "drawing" of the character. It is enough for that to introduce the parameters directly in binary, without forgetting the prefix &X. In our case:


    SYMBOL 255,&X00000001,&X00000011,&X00000111,&X00001111
   
&X00011111,&X00111111

Here now the command allowing to reveal the character.


    PRINT CHR$(255)

If parameters above are assigned with one of the keyboard characters, the redefined character will appear each time that the corresponding key will be actuated, just as at each command PRINT relating to it. This new character will be accepted by the BASIC like the equivalent of the replaced character.

Associated key words: HIMEM, MEMORY, SYMBOL AFTER



SYMBOL AFTER

SYMBOL AFTER <whole number>

    10 CLS
    20
SYMBOL AFTER 115
    30 PRINT"The line 40 redefined the letter s ";
    40 SYMBOL 115,0,56,64,64,48,8,8,112
    50 PRINT"in s"
    60 PRINT"one returns in a normal state while typing:
"
    70 PRINT"
SYMBOL AFTER 240"
    run

COMMAND:
Fix the lower limit of the redefinable characters numbers (from 0 to 255). The default value of the whole number is 240, one has then 16 redefinable characters (between 240 and 255). When the <whole number> has for value 32, all the characters located between 32 and 255 are redefinable.The command SYMBOL AFTER 256 interdict thus any redefinition of character.

The command SYMBOL AFTER restores the default value of all the characters previously redefined.

The command SYMBOL AFTER canNOT work if the value of HIMEM were previously modified by a command MEMORY or by the opening of a file with OPENIN or OPENOUT. The computer posts in this case the error message «Improper argument», (unless the preceding state is SYMBOL AFTER 256).

Associated key words: HIMEM, MEMORY, SYMBOL


TAB

(See PRINT TAB)


TAG

TAG [#
(<channel number>)]

    10 INPUT "input your name";a$:CLS
    20 PRINT"What comings and goings
";a$;" !!"
    30 TAG
    40 x=LEN(a$)*17:y=50+RND*300:MOVE -x,y
    50 FOR f=-x TO 640 STEP RND*7+3
    60 MOVE f,y:PRINT" ";a$;:FRAME:NEXT
    70 FOR b=640 TO -x STEP -RND*7+3
    80 MOVE b,y:PRINT a$;" ";:FRAME:NEXT
    90 GOTO 40
    run

COMMAND:
Write the text specified to the position of the graphic cursor. This command makes it possible to input text and symbols into a graph and to move them rather pixel by pixel than character by character. The channel number takes by defect value 0.

The left beginning of the character strings positions on the graphic cursor (Text At Graphics). The control characters not visualized such as change of line or carriage return will not have any effect if instruction PRINT is finished by a semicolon; in the contrary case, they will appear in their graphic form.

If the channel indicator is #0 (by defect), BASIC cancels the command TAG when it come back in direct mode.

Associated key words: TAGOFF



TAGOFF

TAGOFF
[#(<channel number>)]

    10 MODE 2:TAG:REM 
text with graphic coordonnees
    20 year=1984:FOR x=1 TO 640 STEP 60
    30 MOVE x,400:DRAWR 0,-350
    40 
year=year+1:PRINT year;:NEXT
    50 TAGOFF:REM
come back to the text coordinates
    60 LOCATE 28,25:PRINT"annual figures"
    70 GOTO 70
    run

COMMAND:
Cancel the command TAG concerning the channel indicated (# 0 per defect). The text is thus again directed on the text cursor position.

Associated key words: TAG



TAN

TAN
(<numerical expression>)

    PRINT TAN(45)
       1.61977519

FUNCTION:
Calculate the TANgent of the (<numerical expression>), which must lie between -200000 and +200000.

One can express the argument in degrees or radians by the intermediary of the functions DEG and RAD, respectively.


Associated key words: ATN, COS, DEG, RAD, SIN



TEST

TEST (<coordinate x>,
<coordinate y>)

    10 CLS
    20 PRINT"You use the pen number:";
    30 PRINT TEST(12,394)
    40 PRINT"Change mode and pen";
    50 PRINT"... and do RUN."
    run

FUNCTION:
Place the graphic cursor at the position defined by x and y (in absolute coordinates) and indicates the value of the parameter <ink> to this place.

Associated key words: MOVE, MOVER, TESTR, XPOS, YPOS



TESTR

TESTR (<interval x>,<interval y>)

    10 MODE 0:FOR x=1 TO 15:LOCATE 1,x
    20 PEN x:PRINT STRING$(10,143);:NEXT
    30 MOVE 200,400:PEN 1
    40 FOR n=1 TO 23:LOCATE 12,n
    50 PRINT"pen";TESTR(0,-16):NEXT
    run

FUNCTION:
Place the cursor on a position of coordinates x and y compared to its current position and indicates the value of the parameter <ink> to this place.

Associated key words: MOVE, MOVER, TEST, XPOS, YPOS



THEN

(See IF)


TIME

TIME

    10 CLS:REM clock
    20 INPUT "hour";hour
    30 INPUT "minute";minute
    40 INPUT "second";second
    50 CLS:x=INT(TIME/300)
    60 WHILE hour<13
    70 WHILE minute<60
    80 WHILE tic<60
    90 tic=(INT(TIME/300)-x)+second
    100 LOCATE 1,1
    110 PRINT USING "## ";hour;minute;tic
    120 WEND
    130 tic=0:second=0:minute=minute+1
    140 GOTO 50
    150 WEND
    160 minute=0:hour=hour+1
    170 WEND
    180 hour=1
    190 GOTO 60
    run

FUNCTION:
Indicate the time passed since the powering of the computer or the last command RESET (the transfer times between the computer and the diskette drive are not counted).

At each second once corresponds the value: TIME/300.


Associated key words: AFTER, EVERY, WEND, WHILE


TO

(See FOR)


TROFF
TRON

TROFF
TRON

    10 TROFF:PRINT:PRINT"TROFF"
    20 FOR n=1 TO 8
    30 PRINT"The program run":NEXT
    40 IF f=1 THEN END
    50 TRON:PRINT:PRINT"TRON"
    60 f=1:GOTO 20
    run

COMMAND:
Allows to follow the execution of a program by the posting of each number of line when the program run. This number is posted between hooks [ ]. This function is obtained with the command TRON. The command TROFF restores the normal execution mode. The command TRON is particularly interesting when one wishes to follow line by line the course of a program in order to correct an error.

Associated key words: Nothing



UNT

UNT (<adress>)

    PRINT UNT(&FF66)
       -154

COMMAND:
Converts the argument  into a signed whole number ranging between -32768 and 32767.

Associated key words: CINT, FIX, INT, ROUND



UPPER$

UPPER$
(<alphanumeric chain>)

    10 CLS:a$="
you were small but now you are tall !"
    20 PRINT UPPER$(a$)
    run

FUNCTION:
Recopy the <alphanumeric chain> indicated by replacing with capital letters the alphabetical characters (A to Z) appearing in small letters. This function is used in particular for the treatment of entries where which are mixed capital letters and the tiny ones.

Associated key words: LOWER$


USING

(See PRINT USING)


VAL

VAL (<
character string>)

    10 CLS:PRINT "I know my tables !"
    20 PRINT:PRINT"press a key (1-9)"
    30 a$=INKEY$:IF a$="" THEN 30
    40 n=VAL(a$):IF n<1 OR n>9 THEN 30
    50 FOR x=1 TO 12
    60 PRINT n;"X";x;"=";n*x
    70 NEXT:GOTO 20
    run

FUNCTION:
Provides the numerical VALue of characters (including the negative sign and the decimal point) of the <alphanumeric chain> indicated.

Value 0 is obtained when the first character of the chain is not a figure. If the sign 
«-» appears in first character or if this one is a decimal point followed by a nonnumerical character, the error message «Type mismatch» (typing error) (13) is posted to the screen.

Associated key words: STR$


VPOS

VPOS
( # <channel number>)

    10 MODE 1:BORDER 0:LOCATE 8,2
    20 PRINT"
use the keys with arrows (high/low)"
    30 WINDOW 39,39,1,25:CURSOR 1,1
    40 LOCATE 1,13
    50 IF INKEY(0)<>-1 THEN PRINT CHR$(11);
    60 IF INKEY(2)<>-1 THEN PRINT CHR$(10);
    70 LOCATE #1,3,24
    80 PRINT#1,"text cursor ";
    90 PRINT#1,"vertical position =";
    100 PRINT#1,VPOS(#0):GOTO 50
    run

FUNCTION:
Indicate, on the Vertical axis, the text cursor POSition, starting from the higher edge of the text window. The channel indicator must obligatorily appear; it does not take the value #0 by defect.

Associated key words: POS, WINDOW



WAIT

WAIT <I/O port number>,<mask>[,<inversion>]

    WAIT &FF34,20,25

COMMAND:
Cause waiting until the input-outputs port indicated transmits a value ranging between 0 and 255; so that after having operated a XOR (OR exclusive) with the <mask>, then a AND with the <inversion> parameter, one obtains not a nil result.

The BASIC waits until the condition is checked.

This command is to be used with precaution.

Associated key words: INP, OUT



WEND

WEND

    WEND

COMMAND:
Indicate the end of a program section executed inside a loop WHILE. The BASIC automatically recognizes the command WHILE with the WEND associated.

Associated key words: TIME, WHILE



WHILE

WHILE
<logical expression>

    10 CLS:PRINT "10 seconds stop watch":t=TIME
    20 WHILE TIME<t*3000
    30 SOUND 1,0,100,15
    40 WEND:SOUND 129,40,30,15

COMMAND:
Repeat a program section as long as a given condition is checked. The word WHILE indicates the beginning of the section to be executed and the <logical expression> defines the condition to check.

Associated key words: TIME, WEND



WIDTH

WIDTH <whole number>

    WIDTH 40

COMMAND:
Indicate the maximum number of characters per line for a printout. The BASIC send automatically the carriage returns and the jumps of line necessary during the impression.

In the absence of a command WIDTH, the computer adopts by defect value 132. The command WIDTH 255 removes all the carriage returns and additional jumps of line leaving the printer the care to generate itself these characters. However, the carriage returns and normal jumps of line from the instruction PRINT continue to be sent unless the command PRINT is finished by one 
«;» or a comma.

Associated key words: POS



WINDOW

WINDOW
[ # <channel number>,]<left>,<right>,<high>,<low>

    10 MODE 0:BORDER 0:REM tv
    20 INK 0,0:INK 1,25:INK 2,23:INK 3,21
    30 INK 4,17:INK 5,6:INK 6,2:INK 7,26
    40 PAPER 0:CLS
    50 PAPER 1:WINDOW 2,4,1,18:CLS
    60 PAPER 2:WINDOW 5,7,1,18:CLS
    70 PAPER 3:WINDOW 8,10,1,18:CLS
    80 PAPER 4:WINDOW 11,13,1,18:CLS
    90 PAPER 5:WINDOW 14,16,1,18:CLS
    100 PAPER 6:WINDOW 17,19,1,18:CLS
    110 PAPER 7:WINDOW 2,19,19,25:CLS
    120 GOTO 120
    run

COMMAND: In text mode, indicates the dimensions of a channel to the screen display (one speaks in this case about window). One will take care that the values of the parameters <left>, <right>, <high> and <low> correspond to the coordinates in the screen MODE used.

The
<channel number> will take by defect the value #0

Associated key words: WINDOW SWAP



WINDOW SWAP

WINDOW SWAP <channel number>,<channel number>

    10 MODE 1:INK 1,24:INK 2,9:INK 3,6
    20 WINDOW 21,40,13,25:PAPER 3
    30 WINDOW #1,1,20,1,12:PAPER #1,2
    40 CLS:PRINT" Fenetre No 0"
    50 CLS #1:PRINT #1," Fenetre No 1"
    60 LOCATE 1,6
    70 PRINT" Fenetre Rouge (0)";SPC(2)
    80 LOCATE #1,1,6
    90 PRINT #1," Fenetre Verte (1)"
    100 FOR t=1 TO 1000:NEXT
    110 WINDOW SWAP 0,1:GOTO 60
    run

COMMAND:
Inverts the first window and the second.

Both
<channel numbers> must obligatorily appear without being preceded, in this precise case, by the channel  indicator #.

This command makes it possible to direct the BASIC messages to another channel that this one used by defect #0.


Associated key words: WINDOW



WRITE

WRITE [
# <channel number>,][<data to write>]

    10 REM write data on the diskette
    20 INPUT "give me a number";a
    30 INPUT
"give me a string of characters";a$
    40 OPENOUT "FILENAME"
    50 WRITE #9,a,a$
    60 CLOSEOUT:PRINT "Data are saved on the diskette"
    run

COMMAND:
Post or WRITE data on the channel indicated. Two distinct articles must be separated by a comma and the character strings are placed between quotation marks.

In our example, the entered data will be written on channel #9, i.e. recorded on diskette.

To find the data, one will use the program below:


    10 REM recover the data from the diskette
    20 OPENIN "FILENAME":INPUT #9,a,a$
    30 CLOSEIN:PRINT"the 2 data are:"
    40 PRINT:PRINT a,a$
    run

Associated key words: INPUT, LINE INPUT



XOR

<argument> XOR <argument>

    IF "alan" < "bernard" XOR "dog" > "cat" THEN PRINT "true" ELSE PRINT "false"
       false
    IF "bernard" < "alan" XOR "cat" > "dog" THEN PRINT "true" ELSE PRINT "false"
       false
    IF "alan" < "bernard" XOR "cat" > "dog" THEN PRINT "true" ELSE PRINT "false"
       true
     ....
    PRINT 1 XOR 1
       0
    PRINT 0 XOR 0
       0
    PRINT 1 XOR 0
       1

OPERATOR: Carry out bit by bit the boolean operation XOR (OR exclusive) on entireties. When bits of two arguments are not identical, the resulting bit is 1.

Associated key words: AND, OR, NOT


XPOS

XPOS

    10 MODE 1:DRAW 320,200
    20 PRINT"POSition X of the graphic cursor=";
    30 PRINT XPOS
    run

FUNCTION:
Indicate, on the horizontal axis (X), the POSition of the graphic cursor.

Associated key words: MOVE, MOVER, ORIGIN, YPOS



YPOS

YPOS

    10 MODE 1:DRAW 320,200
    20 PRINT"POSition Y 
of the graphic cursor=";
    30 PRINT YPOS
    run

FUNCTION: Indicate, on the vertical axis (Y), the POSition of the graphic cursor.

Associated key words: MOVE, MOVER, ORIGIN, XPOS



ZONE

ZONE <whole number>

    10 CLS:FOR z=2 TO 20
    20 ZONE z
    30 PRINT "X","X ZONE ";z:NEXT
    run

COMMAND:
Modify the width of the tabulation indicated by the comma in the command PRINT. The width of the posting or impression zones, (about 13 characters per defect), can thus take an unspecified whole value between 1 and 255.

Associated key words: PRINT