Line 70 introduces a delay loop as the computer counts ‘n’ from 1 to 900 before executing the next
statement - G 0 T 0 5. Thus the program re-cycles itself without ending. The only way out is to
[ESC]ape using the [ESC] key provided. Pressing this once will stop execution of the program.
Pressing it again will BREAK out into the direct command mode, without losing the contents of the
program memory.
In fact, unless you press [ESC] while the computer is still looping through the delay on line 70, the
program will break immediately, since the computer isn’t executing anything when it is waiting for
an input. The line it was waiting on will be listed after the Break. If you escape while the computer
is waiting for input, you will get the message:
Break in 10
If you can catch it in the delay loop, the message after the second depression of the
[ESC]
key is:
Break in 70
If you escape during the loop on line 70, you will suspend operation, and this can be resumed where
it left off simply by pressing ‘any key’. If you break out of the program, you can also resume where
you broke out by entering:
CONT
And the program will CONTinue from the line in which operation was suspended.
Whatever you do with the
[ESC]
key, you will not lose the program stored in current memory unless
you specifically instruct the computer to clear it out using a NEW command - or you issue a full reset
command by holding down the
[CTRL] [SHIFT]
and
[ESC]
keys simultaneously.
Thus there should be no need to provide a safety net for those who ‘inadvertently’ reset the machine.
The action of clearing out the current program memory is very deliberate, and very permanent. Save
anything on to the cassette if you are in any doubt whether you will want to use it again.
4.7 More variables, and strings
The essence of computing is the variable. If the computer is dealing strictly with fixed commodoties,
then it is merely an electronic typing aid. Remember that if any part of a mathematical expression is
variable, then the result must also be variable.
Variables have three attributes or characteristics: a name, a type and an ‘organisation’. Names have
been discussed earlier (4.1) - types are optional, so we could define a variable according to the rules
of (3.4) as:
The type markers are: <name>[<type marker>]
% for integer numbers where anything to the right of a decimal point is discarded. Integer variables
occupy less space in memory, and so programs that do not require decimal manipulations can be
made to run faster if the variables are DEFined as integers. The command DEFINT indicates that
variable names without an implicit type marker are to be taken as integer variables. Following the
command DEFINT A therefore, the same variable could be called A% or A, both being integer.
Integer values range from -32768....+32767.
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...