A?
User input B?
User input C?
Subroutine C
Subroutine B
Subroutine A
Fig. B-4: Structure of branched prog
a m s KODAK S-RA2500 Editing System 1.0 User Manual Page
0
B-2.2 Each to his
wn
As usual, our statement of the problem is very simple: we wish to show three blocks of text
(exceptionally, we shall ignore projectors on this occasion) and the user must be able to select
the text which he wishes to
e .
In the first version of our example we shall use the KEY instruction to achieve this; this instruc
ion should always be used if we require the user to press only one key. In our case the keys are key
1, 2 an
3 .
The format of the KEY instruction KEY <key> TO <destination> merely causes the keyb
ard buffer of the computer to be polled to establish whether a key has been pressed. If a key has
een pressed and the key is the same as the key specified in <key>, the program branches to the p
int which was marked by means of the LABEL instruction according to the destination specified i
TO <destination>. In all other cases, the program executes the next program s
p .
If we wish to give users several possible options, we can string appropriate KEY instructions toge
her in a block with various specified keys and destinations. Our example makes use of this possibil
y :
LABEL START; Example program starts
e r e SHOW TITLE; Show title page (supplied on demo diske
te)