Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_23.ADF » F/TUT2

F/TUT2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_23.ADF
Filename: F/TUT2
Read OK:
File size: 0DE6 bytes
Load address: 54204556
Exec address: D325455
File contents
10 PRINT"1.....ADDITION" 
20 PRINT"2.....SUBTRACTION" 
30 PRINT"3.....MULTIPLICATION"
40 PRINT"4.....DIVISION"
100 A=GET
110 IF A=49 GOTO 100
120 IF A=50 GOTO 200
130 IF A=51 GOTO 300
140 IF A=52 GOTO 400
150 IF A < 49 OR A > 52 GOTO 100
200 PRINT"ADDITION"
210 PRINT"Type in the first number and press RETURN"
220 INPUT B
230 PRINT"Type in the second number and press RETURN"
240 INPUT C
250 D=B+C
260 PRINT"The two numbers you typed in added together equal"D
270 END
300 PRINT"SUBTRACTION"
310 PRINT"Type in the first number and press RETURN"
320 INPUT B
330 PRINT"Type in the second number and press RETURN"
340 INPUT C
350 D=B-C
360 PRINT"Taking the second number from the first equals"D
370 END
400 PRINT"MULTIPLICATION"
410 PRINT"Type in the first number and press RETURN"
420 INPUT B
430 PRINT"Type in the second number and press RETURN"
440 INPUT C
450 D=B*C
460 PRINT"The two numbers you typed in multiplied together equal"D
470 END
500 PRINT"DIVISION"
510 PRINT"Type in the first number and press RETURN"
520 INPUT B
530 PRINT"Type in the second number and press RETURN"
540 INPUT C
550 D=B/C
560 PRINT"The first number divided by the second equals"D
570 END

You will find it quite easy to extend this program.

The program is in three main parts. The first asks you to choose which type
of arithmetic you want to do. A simple menu is printed onto the screen.

In the second section line 100 makes the variable A equal to GET. GET makes
the computer wait until a key is pressed and in this case the ASCII value
of that key is put into the variable A.

The program checks if this value corrisponds to any of the five values in
lines 110 to 150 which contain  the ASCII codes for the characters 1, 2,
3, and 4. If one of these values is equal to A then the instructions in
that line are executed. In this case the instructions cause the program to
jump to a particular line for the type of arithmetic you want to do
otherwise the next line is checked. 

If any other value is put in say 9 or M then line 150 puts the program back
to line 100 and starts the process again.

The second part of the program has been covered already. Notice in lines
260, 360, 460 and 560 that the print command first prints some text then
after the closing " the variable D which contains the total from the
problem is printed. This has combined the two methods of print which were
described above.

The advantage of using GET in the second, selection part was that with a
single key stroke the value is put into A and the program continues. You
could have used INPUT here but this would have meant two key strokes.

In the second part INPUT was used because otherwise long numbers couldn't
have been tried.

So the most important difference between INPUT and GET is that GET needs
only one key to be pressed but can only take one character. INPUT needs
to be completed by pressing RETURN but can have a number of characters.

Another word for getting a program to ask for information is INKEY

INKEY works in a different way to INPUT and GET. It has two forms. The
first is a timed form.

10 A=INKEY(1000)
20 IF TRUE PRINT CHR$ A
30 IF A=-1 PRINT"TOO SLOW"

The number in brackets after INKEY represents the length of time which
INKEY will hold up the program and wait for a key to be pressed. This
number is infact in 1/100 of a second so in this case INKEY(1000) means
wait for 10 seconds.

Line 10 makes the variable A equal to INKEY(1000)
If during that time you press any key the program will put that key's
ASCII value into the variable A and move to line 20 

00000000  0d 31 30 20 50 52 49 4e  54 22 31 2e 2e 2e 2e 2e  |.10 PRINT"1.....|
00000010  41 44 44 49 54 49 4f 4e  22 20 0d 32 30 20 50 52  |ADDITION" .20 PR|
00000020  49 4e 54 22 32 2e 2e 2e  2e 2e 53 55 42 54 52 41  |INT"2.....SUBTRA|
00000030  43 54 49 4f 4e 22 20 0d  33 30 20 50 52 49 4e 54  |CTION" .30 PRINT|
00000040  22 33 2e 2e 2e 2e 2e 4d  55 4c 54 49 50 4c 49 43  |"3.....MULTIPLIC|
00000050  41 54 49 4f 4e 22 0d 34  30 20 50 52 49 4e 54 22  |ATION".40 PRINT"|
00000060  34 2e 2e 2e 2e 2e 44 49  56 49 53 49 4f 4e 22 0d  |4.....DIVISION".|
00000070  31 30 30 20 41 3d 47 45  54 0d 31 31 30 20 49 46  |100 A=GET.110 IF|
00000080  20 41 3d 34 39 20 47 4f  54 4f 20 31 30 30 0d 31  | A=49 GOTO 100.1|
00000090  32 30 20 49 46 20 41 3d  35 30 20 47 4f 54 4f 20  |20 IF A=50 GOTO |
000000a0  32 30 30 0d 31 33 30 20  49 46 20 41 3d 35 31 20  |200.130 IF A=51 |
000000b0  47 4f 54 4f 20 33 30 30  0d 31 34 30 20 49 46 20  |GOTO 300.140 IF |
000000c0  41 3d 35 32 20 47 4f 54  4f 20 34 30 30 0d 31 35  |A=52 GOTO 400.15|
000000d0  30 20 49 46 20 41 20 3c  20 34 39 20 4f 52 20 41  |0 IF A < 49 OR A|
000000e0  20 3e 20 35 32 20 47 4f  54 4f 20 31 30 30 0d 32  | > 52 GOTO 100.2|
000000f0  30 30 20 50 52 49 4e 54  22 41 44 44 49 54 49 4f  |00 PRINT"ADDITIO|
00000100  4e 22 0d 32 31 30 20 50  52 49 4e 54 22 54 79 70  |N".210 PRINT"Typ|
00000110  65 20 69 6e 20 74 68 65  20 66 69 72 73 74 20 6e  |e in the first n|
00000120  75 6d 62 65 72 20 61 6e  64 20 70 72 65 73 73 20  |umber and press |
00000130  52 45 54 55 52 4e 22 0d  32 32 30 20 49 4e 50 55  |RETURN".220 INPU|
00000140  54 20 42 0d 32 33 30 20  50 52 49 4e 54 22 54 79  |T B.230 PRINT"Ty|
00000150  70 65 20 69 6e 20 74 68  65 20 73 65 63 6f 6e 64  |pe in the second|
00000160  20 6e 75 6d 62 65 72 20  61 6e 64 20 70 72 65 73  | number and pres|
00000170  73 20 52 45 54 55 52 4e  22 0d 32 34 30 20 49 4e  |s RETURN".240 IN|
00000180  50 55 54 20 43 0d 32 35  30 20 44 3d 42 2b 43 0d  |PUT C.250 D=B+C.|
00000190  32 36 30 20 50 52 49 4e  54 22 54 68 65 20 74 77  |260 PRINT"The tw|
000001a0  6f 20 6e 75 6d 62 65 72  73 20 79 6f 75 20 74 79  |o numbers you ty|
000001b0  70 65 64 20 69 6e 20 61  64 64 65 64 20 74 6f 67  |ped in added tog|
000001c0  65 74 68 65 72 20 65 71  75 61 6c 22 44 0d 32 37  |ether equal"D.27|
000001d0  30 20 45 4e 44 0d 33 30  30 20 50 52 49 4e 54 22  |0 END.300 PRINT"|
000001e0  53 55 42 54 52 41 43 54  49 4f 4e 22 0d 33 31 30  |SUBTRACTION".310|
000001f0  20 50 52 49 4e 54 22 54  79 70 65 20 69 6e 20 74  | PRINT"Type in t|
00000200  68 65 20 66 69 72 73 74  20 6e 75 6d 62 65 72 20  |he first number |
00000210  61 6e 64 20 70 72 65 73  73 20 52 45 54 55 52 4e  |and press RETURN|
00000220  22 0d 33 32 30 20 49 4e  50 55 54 20 42 0d 33 33  |".320 INPUT B.33|
00000230  30 20 50 52 49 4e 54 22  54 79 70 65 20 69 6e 20  |0 PRINT"Type in |
00000240  74 68 65 20 73 65 63 6f  6e 64 20 6e 75 6d 62 65  |the second numbe|
00000250  72 20 61 6e 64 20 70 72  65 73 73 20 52 45 54 55  |r and press RETU|
00000260  52 4e 22 0d 33 34 30 20  49 4e 50 55 54 20 43 0d  |RN".340 INPUT C.|
00000270  33 35 30 20 44 3d 42 2d  43 0d 33 36 30 20 50 52  |350 D=B-C.360 PR|
00000280  49 4e 54 22 54 61 6b 69  6e 67 20 74 68 65 20 73  |INT"Taking the s|
00000290  65 63 6f 6e 64 20 6e 75  6d 62 65 72 20 66 72 6f  |econd number fro|
000002a0  6d 20 74 68 65 20 66 69  72 73 74 20 65 71 75 61  |m the first equa|
000002b0  6c 73 22 44 0d 33 37 30  20 45 4e 44 0d 34 30 30  |ls"D.370 END.400|
000002c0  20 50 52 49 4e 54 22 4d  55 4c 54 49 50 4c 49 43  | PRINT"MULTIPLIC|
000002d0  41 54 49 4f 4e 22 0d 34  31 30 20 50 52 49 4e 54  |ATION".410 PRINT|
000002e0  22 54 79 70 65 20 69 6e  20 74 68 65 20 66 69 72  |"Type in the fir|
000002f0  73 74 20 6e 75 6d 62 65  72 20 61 6e 64 20 70 72  |st number and pr|
00000300  65 73 73 20 52 45 54 55  52 4e 22 0d 34 32 30 20  |ess RETURN".420 |
00000310  49 4e 50 55 54 20 42 0d  34 33 30 20 50 52 49 4e  |INPUT B.430 PRIN|
00000320  54 22 54 79 70 65 20 69  6e 20 74 68 65 20 73 65  |T"Type in the se|
00000330  63 6f 6e 64 20 6e 75 6d  62 65 72 20 61 6e 64 20  |cond number and |
00000340  70 72 65 73 73 20 52 45  54 55 52 4e 22 0d 34 34  |press RETURN".44|
00000350  30 20 49 4e 50 55 54 20  43 0d 34 35 30 20 44 3d  |0 INPUT C.450 D=|
00000360  42 2a 43 0d 34 36 30 20  50 52 49 4e 54 22 54 68  |B*C.460 PRINT"Th|
00000370  65 20 74 77 6f 20 6e 75  6d 62 65 72 73 20 79 6f  |e two numbers yo|
00000380  75 20 74 79 70 65 64 20  69 6e 20 6d 75 6c 74 69  |u typed in multi|
00000390  70 6c 69 65 64 20 74 6f  67 65 74 68 65 72 20 65  |plied together e|
000003a0  71 75 61 6c 22 44 0d 34  37 30 20 45 4e 44 0d 35  |qual"D.470 END.5|
000003b0  30 30 20 50 52 49 4e 54  22 44 49 56 49 53 49 4f  |00 PRINT"DIVISIO|
000003c0  4e 22 0d 35 31 30 20 50  52 49 4e 54 22 54 79 70  |N".510 PRINT"Typ|
000003d0  65 20 69 6e 20 74 68 65  20 66 69 72 73 74 20 6e  |e in the first n|
000003e0  75 6d 62 65 72 20 61 6e  64 20 70 72 65 73 73 20  |umber and press |
000003f0  52 45 54 55 52 4e 22 0d  35 32 30 20 49 4e 50 55  |RETURN".520 INPU|
00000400  54 20 42 0d 35 33 30 20  50 52 49 4e 54 22 54 79  |T B.530 PRINT"Ty|
00000410  70 65 20 69 6e 20 74 68  65 20 73 65 63 6f 6e 64  |pe in the second|
00000420  20 6e 75 6d 62 65 72 20  61 6e 64 20 70 72 65 73  | number and pres|
00000430  73 20 52 45 54 55 52 4e  22 0d 35 34 30 20 49 4e  |s RETURN".540 IN|
00000440  50 55 54 20 43 0d 35 35  30 20 44 3d 42 2f 43 0d  |PUT C.550 D=B/C.|
00000450  35 36 30 20 50 52 49 4e  54 22 54 68 65 20 66 69  |560 PRINT"The fi|
00000460  72 73 74 20 6e 75 6d 62  65 72 20 64 69 76 69 64  |rst number divid|
00000470  65 64 20 62 79 20 74 68  65 20 73 65 63 6f 6e 64  |ed by the second|
00000480  20 65 71 75 61 6c 73 22  44 0d 35 37 30 20 45 4e  | equals"D.570 EN|
00000490  44 0d 0d 59 6f 75 20 77  69 6c 6c 20 66 69 6e 64  |D..You will find|
000004a0  20 69 74 20 71 75 69 74  65 20 65 61 73 79 20 74  | it quite easy t|
000004b0  6f 20 65 78 74 65 6e 64  20 74 68 69 73 20 70 72  |o extend this pr|
000004c0  6f 67 72 61 6d 2e 0d 0d  54 68 65 20 70 72 6f 67  |ogram...The prog|
000004d0  72 61 6d 20 69 73 20 69  6e 20 74 68 72 65 65 20  |ram is in three |
000004e0  6d 61 69 6e 20 70 61 72  74 73 2e 20 54 68 65 20  |main parts. The |
000004f0  66 69 72 73 74 20 61 73  6b 73 20 79 6f 75 20 74  |first asks you t|
00000500  6f 20 63 68 6f 6f 73 65  20 77 68 69 63 68 20 74  |o choose which t|
00000510  79 70 65 0d 6f 66 20 61  72 69 74 68 6d 65 74 69  |ype.of arithmeti|
00000520  63 20 79 6f 75 20 77 61  6e 74 20 74 6f 20 64 6f  |c you want to do|
00000530  2e 20 41 20 73 69 6d 70  6c 65 20 6d 65 6e 75 20  |. A simple menu |
00000540  69 73 20 70 72 69 6e 74  65 64 20 6f 6e 74 6f 20  |is printed onto |
00000550  74 68 65 20 73 63 72 65  65 6e 2e 0d 0d 49 6e 20  |the screen...In |
00000560  74 68 65 20 73 65 63 6f  6e 64 20 73 65 63 74 69  |the second secti|
00000570  6f 6e 20 6c 69 6e 65 20  31 30 30 20 6d 61 6b 65  |on line 100 make|
00000580  73 20 74 68 65 20 76 61  72 69 61 62 6c 65 20 41  |s the variable A|
00000590  20 65 71 75 61 6c 20 74  6f 20 47 45 54 2e 20 47  | equal to GET. G|
000005a0  45 54 20 6d 61 6b 65 73  0d 74 68 65 20 63 6f 6d  |ET makes.the com|
000005b0  70 75 74 65 72 20 77 61  69 74 20 75 6e 74 69 6c  |puter wait until|
000005c0  20 61 20 6b 65 79 20 69  73 20 70 72 65 73 73 65  | a key is presse|
000005d0  64 20 61 6e 64 20 69 6e  20 74 68 69 73 20 63 61  |d and in this ca|
000005e0  73 65 20 74 68 65 20 41  53 43 49 49 20 76 61 6c  |se the ASCII val|
000005f0  75 65 0d 6f 66 20 74 68  61 74 20 6b 65 79 20 69  |ue.of that key i|
00000600  73 20 70 75 74 20 69 6e  74 6f 20 74 68 65 20 76  |s put into the v|
00000610  61 72 69 61 62 6c 65 20  41 2e 0d 0d 54 68 65 20  |ariable A...The |
00000620  70 72 6f 67 72 61 6d 20  63 68 65 63 6b 73 20 69  |program checks i|
00000630  66 20 74 68 69 73 20 76  61 6c 75 65 20 63 6f 72  |f this value cor|
00000640  72 69 73 70 6f 6e 64 73  20 74 6f 20 61 6e 79 20  |risponds to any |
00000650  6f 66 20 74 68 65 20 66  69 76 65 20 76 61 6c 75  |of the five valu|
00000660  65 73 20 69 6e 0d 6c 69  6e 65 73 20 31 31 30 20  |es in.lines 110 |
00000670  74 6f 20 31 35 30 20 77  68 69 63 68 20 63 6f 6e  |to 150 which con|
00000680  74 61 69 6e 20 20 74 68  65 20 41 53 43 49 49 20  |tain  the ASCII |
00000690  63 6f 64 65 73 20 66 6f  72 20 74 68 65 20 63 68  |codes for the ch|
000006a0  61 72 61 63 74 65 72 73  20 31 2c 20 32 2c 0d 33  |aracters 1, 2,.3|
000006b0  2c 20 61 6e 64 20 34 2e  20 49 66 20 6f 6e 65 20  |, and 4. If one |
000006c0  6f 66 20 74 68 65 73 65  20 76 61 6c 75 65 73 20  |of these values |
000006d0  69 73 20 65 71 75 61 6c  20 74 6f 20 41 20 74 68  |is equal to A th|
000006e0  65 6e 20 74 68 65 20 69  6e 73 74 72 75 63 74 69  |en the instructi|
000006f0  6f 6e 73 20 69 6e 0d 74  68 61 74 20 6c 69 6e 65  |ons in.that line|
00000700  20 61 72 65 20 65 78 65  63 75 74 65 64 2e 20 49  | are executed. I|
00000710  6e 20 74 68 69 73 20 63  61 73 65 20 74 68 65 20  |n this case the |
00000720  69 6e 73 74 72 75 63 74  69 6f 6e 73 20 63 61 75  |instructions cau|
00000730  73 65 20 74 68 65 20 70  72 6f 67 72 61 6d 20 74  |se the program t|
00000740  6f 0d 6a 75 6d 70 20 74  6f 20 61 20 70 61 72 74  |o.jump to a part|
00000750  69 63 75 6c 61 72 20 6c  69 6e 65 20 66 6f 72 20  |icular line for |
00000760  74 68 65 20 74 79 70 65  20 6f 66 20 61 72 69 74  |the type of arit|
00000770  68 6d 65 74 69 63 20 79  6f 75 20 77 61 6e 74 20  |hmetic you want |
00000780  74 6f 20 64 6f 0d 6f 74  68 65 72 77 69 73 65 20  |to do.otherwise |
00000790  74 68 65 20 6e 65 78 74  20 6c 69 6e 65 20 69 73  |the next line is|
000007a0  20 63 68 65 63 6b 65 64  2e 20 0d 0d 49 66 20 61  | checked. ..If a|
000007b0  6e 79 20 6f 74 68 65 72  20 76 61 6c 75 65 20 69  |ny other value i|
000007c0  73 20 70 75 74 20 69 6e  20 73 61 79 20 39 20 6f  |s put in say 9 o|
000007d0  72 20 4d 20 74 68 65 6e  20 6c 69 6e 65 20 31 35  |r M then line 15|
000007e0  30 20 70 75 74 73 20 74  68 65 20 70 72 6f 67 72  |0 puts the progr|
000007f0  61 6d 20 62 61 63 6b 0d  74 6f 20 6c 69 6e 65 20  |am back.to line |
00000800  31 30 30 20 61 6e 64 20  73 74 61 72 74 73 20 74  |100 and starts t|
00000810  68 65 20 70 72 6f 63 65  73 73 20 61 67 61 69 6e  |he process again|
00000820  2e 0d 0d 54 68 65 20 73  65 63 6f 6e 64 20 70 61  |...The second pa|
00000830  72 74 20 6f 66 20 74 68  65 20 70 72 6f 67 72 61  |rt of the progra|
00000840  6d 20 68 61 73 20 62 65  65 6e 20 63 6f 76 65 72  |m has been cover|
00000850  65 64 20 61 6c 72 65 61  64 79 2e 20 4e 6f 74 69  |ed already. Noti|
00000860  63 65 20 69 6e 20 6c 69  6e 65 73 0d 32 36 30 2c  |ce in lines.260,|
00000870  20 33 36 30 2c 20 34 36  30 20 61 6e 64 20 35 36  | 360, 460 and 56|
00000880  30 20 74 68 61 74 20 74  68 65 20 70 72 69 6e 74  |0 that the print|
00000890  20 63 6f 6d 6d 61 6e 64  20 66 69 72 73 74 20 70  | command first p|
000008a0  72 69 6e 74 73 20 73 6f  6d 65 20 74 65 78 74 20  |rints some text |
000008b0  74 68 65 6e 0d 61 66 74  65 72 20 74 68 65 20 63  |then.after the c|
000008c0  6c 6f 73 69 6e 67 20 22  20 74 68 65 20 76 61 72  |losing " the var|
000008d0  69 61 62 6c 65 20 44 20  77 68 69 63 68 20 63 6f  |iable D which co|
000008e0  6e 74 61 69 6e 73 20 74  68 65 20 74 6f 74 61 6c  |ntains the total|
000008f0  20 66 72 6f 6d 20 74 68  65 0d 70 72 6f 62 6c 65  | from the.proble|
00000900  6d 20 69 73 20 70 72 69  6e 74 65 64 2e 20 54 68  |m is printed. Th|
00000910  69 73 20 68 61 73 20 63  6f 6d 62 69 6e 65 64 20  |is has combined |
00000920  74 68 65 20 74 77 6f 20  6d 65 74 68 6f 64 73 20  |the two methods |
00000930  6f 66 20 70 72 69 6e 74  20 77 68 69 63 68 20 77  |of print which w|
00000940  65 72 65 0d 64 65 73 63  72 69 62 65 64 20 61 62  |ere.described ab|
00000950  6f 76 65 2e 0d 0d 54 68  65 20 61 64 76 61 6e 74  |ove...The advant|
00000960  61 67 65 20 6f 66 20 75  73 69 6e 67 20 47 45 54  |age of using GET|
00000970  20 69 6e 20 74 68 65 20  73 65 63 6f 6e 64 2c 20  | in the second, |
00000980  73 65 6c 65 63 74 69 6f  6e 20 70 61 72 74 20 77  |selection part w|
00000990  61 73 20 74 68 61 74 20  77 69 74 68 20 61 0d 73  |as that with a.s|
000009a0  69 6e 67 6c 65 20 6b 65  79 20 73 74 72 6f 6b 65  |ingle key stroke|
000009b0  20 74 68 65 20 76 61 6c  75 65 20 69 73 20 70 75  | the value is pu|
000009c0  74 20 69 6e 74 6f 20 41  20 61 6e 64 20 74 68 65  |t into A and the|
000009d0  20 70 72 6f 67 72 61 6d  20 63 6f 6e 74 69 6e 75  | program continu|
000009e0  65 73 2e 20 59 6f 75 0d  63 6f 75 6c 64 20 68 61  |es. You.could ha|
000009f0  76 65 20 75 73 65 64 20  49 4e 50 55 54 20 68 65  |ve used INPUT he|
00000a00  72 65 20 62 75 74 20 74  68 69 73 20 77 6f 75 6c  |re but this woul|
00000a10  64 20 68 61 76 65 20 6d  65 61 6e 74 20 74 77 6f  |d have meant two|
00000a20  20 6b 65 79 20 73 74 72  6f 6b 65 73 2e 0d 0d 49  | key strokes...I|
00000a30  6e 20 74 68 65 20 73 65  63 6f 6e 64 20 70 61 72  |n the second par|
00000a40  74 20 49 4e 50 55 54 20  77 61 73 20 75 73 65 64  |t INPUT was used|
00000a50  20 62 65 63 61 75 73 65  20 6f 74 68 65 72 77 69  | because otherwi|
00000a60  73 65 20 6c 6f 6e 67 20  6e 75 6d 62 65 72 73 20  |se long numbers |
00000a70  63 6f 75 6c 64 6e 27 74  0d 68 61 76 65 20 62 65  |couldn't.have be|
00000a80  65 6e 20 74 72 69 65 64  2e 0d 0d 53 6f 20 74 68  |en tried...So th|
00000a90  65 20 6d 6f 73 74 20 69  6d 70 6f 72 74 61 6e 74  |e most important|
00000aa0  20 64 69 66 66 65 72 65  6e 63 65 20 62 65 74 77  | difference betw|
00000ab0  65 65 6e 20 49 4e 50 55  54 20 61 6e 64 20 47 45  |een INPUT and GE|
00000ac0  54 20 69 73 20 74 68 61  74 20 47 45 54 20 6e 65  |T is that GET ne|
00000ad0  65 64 73 0d 6f 6e 6c 79  20 6f 6e 65 20 6b 65 79  |eds.only one key|
00000ae0  20 74 6f 20 62 65 20 70  72 65 73 73 65 64 20 62  | to be pressed b|
00000af0  75 74 20 63 61 6e 20 6f  6e 6c 79 20 74 61 6b 65  |ut can only take|
00000b00  20 6f 6e 65 20 63 68 61  72 61 63 74 65 72 2e 20  | one character. |
00000b10  49 4e 50 55 54 20 6e 65  65 64 73 0d 74 6f 20 62  |INPUT needs.to b|
00000b20  65 20 63 6f 6d 70 6c 65  74 65 64 20 62 79 20 70  |e completed by p|
00000b30  72 65 73 73 69 6e 67 20  52 45 54 55 52 4e 20 62  |ressing RETURN b|
00000b40  75 74 20 63 61 6e 20 68  61 76 65 20 61 20 6e 75  |ut can have a nu|
00000b50  6d 62 65 72 20 6f 66 20  63 68 61 72 61 63 74 65  |mber of characte|
00000b60  72 73 2e 0d 0d 41 6e 6f  74 68 65 72 20 77 6f 72  |rs...Another wor|
00000b70  64 20 66 6f 72 20 67 65  74 74 69 6e 67 20 61 20  |d for getting a |
00000b80  70 72 6f 67 72 61 6d 20  74 6f 20 61 73 6b 20 66  |program to ask f|
00000b90  6f 72 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 69  |or information i|
00000ba0  73 20 49 4e 4b 45 59 0d  0d 49 4e 4b 45 59 20 77  |s INKEY..INKEY w|
00000bb0  6f 72 6b 73 20 69 6e 20  61 20 64 69 66 66 65 72  |orks in a differ|
00000bc0  65 6e 74 20 77 61 79 20  74 6f 20 49 4e 50 55 54  |ent way to INPUT|
00000bd0  20 61 6e 64 20 47 45 54  2e 20 49 74 20 68 61 73  | and GET. It has|
00000be0  20 74 77 6f 20 66 6f 72  6d 73 2e 20 54 68 65 0d  | two forms. The.|
00000bf0  66 69 72 73 74 20 69 73  20 61 20 74 69 6d 65 64  |first is a timed|
00000c00  20 66 6f 72 6d 2e 0d 0d  31 30 20 41 3d 49 4e 4b  | form...10 A=INK|
00000c10  45 59 28 31 30 30 30 29  0d 32 30 20 49 46 20 54  |EY(1000).20 IF T|
00000c20  52 55 45 20 50 52 49 4e  54 20 43 48 52 24 20 41  |RUE PRINT CHR$ A|
00000c30  0d 33 30 20 49 46 20 41  3d 2d 31 20 50 52 49 4e  |.30 IF A=-1 PRIN|
00000c40  54 22 54 4f 4f 20 53 4c  4f 57 22 0d 0d 54 68 65  |T"TOO SLOW"..The|
00000c50  20 6e 75 6d 62 65 72 20  69 6e 20 62 72 61 63 6b  | number in brack|
00000c60  65 74 73 20 61 66 74 65  72 20 49 4e 4b 45 59 20  |ets after INKEY |
00000c70  72 65 70 72 65 73 65 6e  74 73 20 74 68 65 20 6c  |represents the l|
00000c80  65 6e 67 74 68 20 6f 66  20 74 69 6d 65 20 77 68  |ength of time wh|
00000c90  69 63 68 0d 49 4e 4b 45  59 20 77 69 6c 6c 20 68  |ich.INKEY will h|
00000ca0  6f 6c 64 20 75 70 20 74  68 65 20 70 72 6f 67 72  |old up the progr|
00000cb0  61 6d 20 61 6e 64 20 77  61 69 74 20 66 6f 72 20  |am and wait for |
00000cc0  61 20 6b 65 79 20 74 6f  20 62 65 20 70 72 65 73  |a key to be pres|
00000cd0  73 65 64 2e 20 54 68 69  73 0d 6e 75 6d 62 65 72  |sed. This.number|
00000ce0  20 69 73 20 69 6e 66 61  63 74 20 69 6e 20 31 2f  | is infact in 1/|
00000cf0  31 30 30 20 6f 66 20 61  20 73 65 63 6f 6e 64 20  |100 of a second |
00000d00  73 6f 20 69 6e 20 74 68  69 73 20 63 61 73 65 20  |so in this case |
00000d10  49 4e 4b 45 59 28 31 30  30 30 29 20 6d 65 61 6e  |INKEY(1000) mean|
00000d20  73 0d 77 61 69 74 20 66  6f 72 20 31 30 20 73 65  |s.wait for 10 se|
00000d30  63 6f 6e 64 73 2e 0d 0d  4c 69 6e 65 20 31 30 20  |conds...Line 10 |
00000d40  6d 61 6b 65 73 20 74 68  65 20 76 61 72 69 61 62  |makes the variab|
00000d50  6c 65 20 41 20 65 71 75  61 6c 20 74 6f 20 49 4e  |le A equal to IN|
00000d60  4b 45 59 28 31 30 30 30  29 0d 49 66 20 64 75 72  |KEY(1000).If dur|
00000d70  69 6e 67 20 74 68 61 74  20 74 69 6d 65 20 79 6f  |ing that time yo|
00000d80  75 20 70 72 65 73 73 20  61 6e 79 20 6b 65 79 20  |u press any key |
00000d90  74 68 65 20 70 72 6f 67  72 61 6d 20 77 69 6c 6c  |the program will|
00000da0  20 70 75 74 20 74 68 61  74 20 6b 65 79 27 73 0d  | put that key's.|
00000db0  41 53 43 49 49 20 76 61  6c 75 65 20 69 6e 74 6f  |ASCII value into|
00000dc0  20 74 68 65 20 76 61 72  69 61 62 6c 65 20 41 20  | the variable A |
00000dd0  61 6e 64 20 6d 6f 76 65  20 74 6f 20 6c 69 6e 65  |and move to line|
00000de0  20 32 30 20 0d 0d                                 | 20 ..|
00000de6
F/TUT2.m0
F/TUT2.m1
F/TUT2.m2
F/TUT2.m4
F/TUT2.m5