Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_19.ADF » F/Scren2
F/Scren2
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_19.ADF |
Filename: | F/Scren2 |
Read OK: | ✔ |
File size: | 0B6A bytes |
Load address: | 53204556 |
Exec address: | 6E657263 |
File contents
200CLS The FOR NEXT loop of A has ended, the screen needs to be cleared for the punch line. 220FORT%= 1 TO B% STEP 2:NEXT This is another delay loop. This time the screen is blank and the delay is a buildup to the punch line. A long delay isn't necessary so the period is halved with the STEP statement. Normally a FOR NEXT loop will count 1, 2, 3, and so on. With STEP 2 the counting is 1, 3, 5, and so the number of B% is reached more quickly 230PRINT 240PRINT When the screen in cleared the cursor returns to the top left hand corner of the screen. On some monitors and TV's anything printed at this point can sometimes be a bit tricky to see so these two PRINT statements simply lower the cursor down the screen by two lines. 250PRINT"Well press SPACE then" The punch line statement. No need to use a TAB(ii,dd) because the position is not critical. 255*FX15,0 Incase some impatient people have been tapping the keys while the program was running this statement will flush the keyboard buffer. If the computer is doing something and any keys are pressed they are stored in a buffer so that as soon as the computer is free those keys will be looked at. If the buffer was not flushed then these impatient people would lose the opportunity to have a chuckle at the punch line. 260A=GET:CHAIN"Menu" The statement A=GET basically tells the computer to wait untill a key is pressed, any key infact and then when a key has been pressed to move onto the next instruction. The purpose of the : is to separate two separate instructions. I could have put the CHAIN"Menu" on a separate line but since it shares a line with A=GET it needs the : Without the : the computer would assume that A=GETCHAIN"Menu" was all one instruction, would not understand what was meant and the program would stop. 270DATA"Well, not much of a screen this time" The first DATA statement. Remember that the FOR NEXT loop went round eight times? and that there were two READ statements A$ and B$. Well there are 16 DATA statements, eight for A$ and eight for B$. If you deleted say one then the program would stop with the message 'out of data at line ...' If there are too many the remainder will be ignored. In the second part of the program after line 200 I could have made the punch line statement come from another DATA statement. See if you can figure out how this would be done. It will seem hard at first but when you figure it out.... Some other things you could try. Change B% in line 70 to equal say 10. Try deleting line 110. Try deleting line 225 and press a few keys while the first part of the program is running. Try deleting a line with a DATA statement. Also try rewriting the DATA statements with your own text, perhaps you could introduce a third character C$. You will need more DATA statements. Exerimenting like this is by far the best way to learn about programming.
00000000 32 30 30 43 4c 53 20 54 68 65 20 46 4f 52 20 4e |200CLS The FOR N| 00000010 45 58 54 20 6c 6f 6f 70 20 6f 66 20 41 20 68 61 |EXT loop of A ha| 00000020 73 20 65 6e 64 65 64 2c 20 74 68 65 20 73 63 72 |s ended, the scr| 00000030 65 65 6e 20 6e 65 65 64 73 20 74 6f 20 0d 62 65 |een needs to .be| 00000040 20 63 6c 65 61 72 65 64 20 66 6f 72 20 74 68 65 | cleared for the| 00000050 20 70 75 6e 63 68 20 6c 69 6e 65 2e 0d 0d 32 32 | punch line...22| 00000060 30 46 4f 52 10 54 25 3d 20 31 20 54 4f 20 42 25 |0FOR.T%= 1 TO B%| 00000070 20 53 54 45 50 20 32 3a 4e 45 58 54 20 54 68 69 | STEP 2:NEXT Thi| 00000080 73 20 69 73 20 61 6e 6f 74 68 65 72 20 64 65 6c |s is another del| 00000090 61 79 20 6c 6f 6f 70 2e 20 0d 54 68 69 73 20 10 |ay loop. .This .| 000000a0 74 69 6d 65 20 74 68 65 20 73 63 72 65 65 6e 20 |time the screen | 000000b0 69 73 20 62 6c 61 6e 6b 20 61 6e 64 20 74 68 65 |is blank and the| 000000c0 20 64 65 6c 61 79 20 69 73 20 61 20 62 75 69 6c | delay is a buil| 000000d0 64 75 70 20 74 6f 20 0d 74 68 65 20 10 70 75 6e |dup to .the .pun| 000000e0 63 68 20 10 6c 69 6e 65 2e 20 41 20 6c 6f 6e 67 |ch .line. A long| 000000f0 20 64 65 6c 61 79 20 69 73 6e 27 74 20 6e 65 63 | delay isn't nec| 00000100 65 73 73 61 72 79 20 73 6f 20 74 68 65 20 70 65 |essary so the pe| 00000110 72 69 6f 64 20 0d 69 73 20 10 68 61 6c 76 65 64 |riod .is .halved| 00000120 20 77 69 74 68 20 74 68 65 20 53 54 45 50 20 73 | with the STEP s| 00000130 74 61 74 65 6d 65 6e 74 2e 20 4e 6f 72 6d 61 6c |tatement. Normal| 00000140 6c 79 20 61 20 46 4f 52 20 4e 45 58 54 20 6c 6f |ly a FOR NEXT lo| 00000150 6f 70 20 0d 77 69 6c 6c 20 63 6f 75 6e 74 20 31 |op .will count 1| 00000160 2c 20 32 2c 20 33 2c 20 61 6e 64 20 73 6f 20 6f |, 2, 3, and so o| 00000170 6e 2e 20 57 69 74 68 20 53 54 45 50 20 32 20 74 |n. With STEP 2 t| 00000180 68 65 20 63 6f 75 6e 74 69 6e 67 20 69 73 20 0d |he counting is .| 00000190 31 2c 20 33 2c 20 35 2c 20 61 6e 64 20 73 6f 20 |1, 3, 5, and so | 000001a0 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 42 25 |the number of B%| 000001b0 20 69 73 20 72 65 61 63 68 65 64 20 6d 6f 72 65 | is reached more| 000001c0 20 71 75 69 63 6b 6c 79 0d 0d 32 33 30 50 52 49 | quickly..230PRI| 000001d0 4e 54 0d 32 34 30 50 52 49 4e 54 20 57 68 65 6e |NT.240PRINT When| 000001e0 20 74 68 65 20 73 63 72 65 65 6e 20 69 6e 20 63 | the screen in c| 000001f0 6c 65 61 72 65 64 20 74 68 65 20 63 75 72 73 6f |leared the curso| 00000200 72 20 72 65 74 75 72 6e 73 20 74 6f 20 0d 74 68 |r returns to .th| 00000210 65 20 74 6f 70 20 6c 65 66 74 20 68 61 6e 64 20 |e top left hand | 00000220 63 6f 72 6e 65 72 20 6f 66 20 74 68 65 20 73 63 |corner of the sc| 00000230 72 65 65 6e 2e 20 4f 6e 20 73 6f 6d 65 20 6d 6f |reen. On some mo| 00000240 6e 69 74 6f 72 73 20 61 6e 64 20 0d 54 56 27 73 |nitors and .TV's| 00000250 20 61 6e 79 74 68 69 6e 67 20 70 72 69 6e 74 65 | anything printe| 00000260 64 20 61 74 20 74 68 69 73 20 70 6f 69 6e 74 20 |d at this point | 00000270 63 61 6e 20 73 6f 6d 65 74 69 6d 65 73 20 62 65 |can sometimes be| 00000280 20 61 20 62 69 74 20 0d 74 72 69 63 6b 79 20 74 | a bit .tricky t| 00000290 6f 20 73 65 65 20 73 6f 20 74 68 65 73 65 20 74 |o see so these t| 000002a0 77 6f 20 50 52 49 4e 54 20 73 74 61 74 65 6d 65 |wo PRINT stateme| 000002b0 6e 74 73 20 73 69 6d 70 6c 79 20 6c 6f 77 65 72 |nts simply lower| 000002c0 20 74 68 65 20 0d 63 75 72 73 6f 72 20 64 6f 77 | the .cursor dow| 000002d0 6e 20 74 68 65 20 73 63 72 65 65 6e 20 62 79 20 |n the screen by | 000002e0 74 77 6f 20 6c 69 6e 65 73 2e 0d 0d 32 35 30 50 |two lines...250P| 000002f0 52 49 4e 54 22 57 65 6c 6c 20 70 72 65 73 73 20 |RINT"Well press | 00000300 53 50 41 43 45 20 74 68 65 6e 22 20 20 54 68 65 |SPACE then" The| 00000310 20 70 75 6e 63 68 20 6c 69 6e 65 20 73 74 61 74 | punch line stat| 00000320 65 6d 65 6e 74 2e 20 0d 4e 6f 20 6e 65 65 64 20 |ement. .No need | 00000330 74 6f 20 75 73 65 20 61 20 54 41 42 28 69 69 2c |to use a TAB(ii,| 00000340 64 64 29 20 62 65 63 61 75 73 65 20 74 68 65 20 |dd) because the | 00000350 70 6f 73 69 74 69 6f 6e 20 69 73 20 6e 6f 74 20 |position is not | 00000360 0d 63 72 69 74 69 63 61 6c 2e 0d 0d 32 35 35 2a |.critical...255*| 00000370 46 58 31 35 2c 30 20 49 6e 63 61 73 65 20 73 6f |FX15,0 Incase so| 00000380 6d 65 20 69 6d 70 61 74 69 65 6e 74 20 70 65 6f |me impatient peo| 00000390 70 6c 65 20 68 61 76 65 20 62 65 65 6e 20 74 61 |ple have been ta| 000003a0 70 70 69 6e 67 20 0d 74 68 65 20 6b 65 79 73 20 |pping .the keys | 000003b0 77 68 69 6c 65 20 74 68 65 20 70 72 6f 67 72 61 |while the progra| 000003c0 6d 20 77 61 73 20 72 75 6e 6e 69 6e 67 20 74 68 |m was running th| 000003d0 69 73 20 73 74 61 74 65 6d 65 6e 74 20 77 69 6c |is statement wil| 000003e0 6c 20 0d 66 6c 75 73 68 20 74 68 65 20 6b 65 79 |l .flush the key| 000003f0 62 6f 61 72 64 20 62 75 66 66 65 72 2e 20 49 66 |board buffer. If| 00000400 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 69 73 | the computer is| 00000410 20 64 6f 69 6e 67 20 0d 73 6f 6d 65 74 68 69 6e | doing .somethin| 00000420 67 20 61 6e 64 20 61 6e 79 20 6b 65 79 73 20 61 |g and any keys a| 00000430 72 65 20 70 72 65 73 73 65 64 20 74 68 65 79 20 |re pressed they | 00000440 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 61 20 |are stored in a | 00000450 0d 62 75 66 66 65 72 20 73 6f 20 74 68 61 74 20 |.buffer so that | 00000460 61 73 20 73 6f 6f 6e 20 61 73 20 74 68 65 20 63 |as soon as the c| 00000470 6f 6d 70 75 74 65 72 20 69 73 20 66 72 65 65 20 |omputer is free | 00000480 74 68 6f 73 65 20 6b 65 79 73 20 0d 77 69 6c 6c |those keys .will| 00000490 20 62 65 20 6c 6f 6f 6b 65 64 20 61 74 2e 20 49 | be looked at. I| 000004a0 66 20 74 68 65 20 62 75 66 66 65 72 20 77 61 73 |f the buffer was| 000004b0 20 6e 6f 74 20 66 6c 75 73 68 65 64 20 74 68 65 | not flushed the| 000004c0 6e 20 74 68 65 73 65 20 0d 69 6d 70 61 74 69 65 |n these .impatie| 000004d0 6e 74 20 70 65 6f 70 6c 65 20 77 6f 75 6c 64 20 |nt people would | 000004e0 6c 6f 73 65 20 74 68 65 20 6f 70 70 6f 72 74 75 |lose the opportu| 000004f0 6e 69 74 79 20 74 6f 20 68 61 76 65 20 61 20 0d |nity to have a .| 00000500 63 68 75 63 6b 6c 65 20 61 74 20 74 68 65 20 70 |chuckle at the p| 00000510 75 6e 63 68 20 6c 69 6e 65 2e 0d 0d 32 36 30 41 |unch line...260A| 00000520 3d 47 45 54 3a 43 48 41 49 4e 22 4d 65 6e 75 22 |=GET:CHAIN"Menu"| 00000530 20 54 68 65 20 73 74 61 74 65 6d 65 6e 74 20 41 | The statement A| 00000540 3d 47 45 54 20 62 61 73 69 63 61 6c 6c 79 20 74 |=GET basically t| 00000550 65 6c 6c 73 20 74 68 65 20 0d 63 6f 6d 70 75 74 |ells the .comput| 00000560 65 72 20 74 6f 20 77 61 69 74 20 75 6e 74 69 6c |er to wait until| 00000570 6c 20 61 20 6b 65 79 20 69 73 20 70 72 65 73 73 |l a key is press| 00000580 65 64 2c 20 61 6e 79 20 6b 65 79 20 69 6e 66 61 |ed, any key infa| 00000590 63 74 20 61 6e 64 20 0d 74 68 65 6e 20 77 68 65 |ct and .then whe| 000005a0 6e 20 61 20 6b 65 79 20 68 61 73 20 62 65 65 6e |n a key has been| 000005b0 20 70 72 65 73 73 65 64 20 74 6f 20 6d 6f 76 65 | pressed to move| 000005c0 20 6f 6e 74 6f 20 74 68 65 20 6e 65 78 74 20 0d | onto the next .| 000005d0 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 54 68 65 |instruction. The| 000005e0 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 65 20 | purpose of the | 000005f0 3a 20 69 73 20 74 6f 20 73 65 70 61 72 61 74 65 |: is to separate| 00000600 20 74 77 6f 20 0d 73 65 70 61 72 61 74 65 20 69 | two .separate i| 00000610 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 49 20 63 |nstructions. I c| 00000620 6f 75 6c 64 20 68 61 76 65 20 70 75 74 20 74 68 |ould have put th| 00000630 65 20 43 48 41 49 4e 22 4d 65 6e 75 22 20 6f 6e |e CHAIN"Menu" on| 00000640 20 61 20 0d 73 65 70 61 72 61 74 65 20 6c 69 6e | a .separate lin| 00000650 65 20 62 75 74 20 73 69 6e 63 65 20 69 74 20 73 |e but since it s| 00000660 68 61 72 65 73 20 61 20 6c 69 6e 65 20 77 69 74 |hares a line wit| 00000670 68 20 41 3d 47 45 54 20 69 74 20 6e 65 65 64 73 |h A=GET it needs| 00000680 20 0d 74 68 65 20 3a 20 57 69 74 68 6f 75 74 20 | .the : Without | 00000690 74 68 65 20 3a 20 74 68 65 20 63 6f 6d 70 75 74 |the : the comput| 000006a0 65 72 20 77 6f 75 6c 64 20 61 73 73 75 6d 65 20 |er would assume | 000006b0 74 68 61 74 20 0d 41 3d 47 45 54 43 48 41 49 4e |that .A=GETCHAIN| 000006c0 22 4d 65 6e 75 22 20 77 61 73 20 61 6c 6c 20 6f |"Menu" was all o| 000006d0 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 2c 20 |ne instruction, | 000006e0 77 6f 75 6c 64 20 6e 6f 74 20 0d 75 6e 64 65 72 |would not .under| 000006f0 73 74 61 6e 64 20 77 68 61 74 20 77 61 73 20 6d |stand what was m| 00000700 65 61 6e 74 20 61 6e 64 20 74 68 65 20 70 72 6f |eant and the pro| 00000710 67 72 61 6d 20 77 6f 75 6c 64 20 73 74 6f 70 2e |gram would stop.| 00000720 0d 0d 32 37 30 44 41 54 41 22 57 65 6c 6c 2c 20 |..270DATA"Well, | 00000730 6e 6f 74 20 6d 75 63 68 20 6f 66 20 61 20 73 63 |not much of a sc| 00000740 72 65 65 6e 20 74 68 69 73 20 74 69 6d 65 22 20 |reen this time" | 00000750 20 54 68 65 20 66 69 72 73 74 20 0d 44 41 54 41 | The first .DATA| 00000760 20 73 74 61 74 65 6d 65 6e 74 2e 20 52 65 6d 65 | statement. Reme| 00000770 6d 62 65 72 20 74 68 61 74 20 74 68 65 20 46 4f |mber that the FO| 00000780 52 20 4e 45 58 54 20 6c 6f 6f 70 20 77 65 6e 74 |R NEXT loop went| 00000790 20 72 6f 75 6e 64 20 0d 65 69 67 68 74 20 74 69 | round .eight ti| 000007a0 6d 65 73 3f 20 61 6e 64 20 74 68 61 74 20 74 68 |mes? and that th| 000007b0 65 72 65 20 77 65 72 65 20 74 77 6f 20 52 45 41 |ere were two REA| 000007c0 44 20 73 74 61 74 65 6d 65 6e 74 73 20 41 24 20 |D statements A$ | 000007d0 61 6e 64 20 0d 42 24 2e 20 57 65 6c 6c 20 74 68 |and .B$. Well th| 000007e0 65 72 65 20 61 72 65 20 31 36 20 44 41 54 41 20 |ere are 16 DATA | 000007f0 73 74 61 74 65 6d 65 6e 74 73 2c 20 65 69 67 68 |statements, eigh| 00000800 74 20 66 6f 72 20 41 24 20 61 6e 64 20 0d 65 69 |t for A$ and .ei| 00000810 67 68 74 20 66 6f 72 20 42 24 2e 20 49 66 20 79 |ght for B$. If y| 00000820 6f 75 20 64 65 6c 65 74 65 64 20 73 61 79 20 6f |ou deleted say o| 00000830 6e 65 20 74 68 65 6e 20 74 68 65 20 70 72 6f 67 |ne then the prog| 00000840 72 61 6d 20 77 6f 75 6c 64 20 0d 73 74 6f 70 20 |ram would .stop | 00000850 77 69 74 68 20 74 68 65 20 6d 65 73 73 61 67 65 |with the message| 00000860 20 27 6f 75 74 20 6f 66 20 64 61 74 61 20 61 74 | 'out of data at| 00000870 20 6c 69 6e 65 20 2e 2e 2e 27 20 49 66 20 74 68 | line ...' If th| 00000880 65 72 65 20 61 72 65 20 0d 74 6f 6f 20 6d 61 6e |ere are .too man| 00000890 79 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 |y the remainder | 000008a0 77 69 6c 6c 20 62 65 20 69 67 6e 6f 72 65 64 2e |will be ignored.| 000008b0 20 49 6e 20 74 68 65 20 73 65 63 6f 6e 64 20 70 | In the second p| 000008c0 61 72 74 20 0d 6f 66 20 74 68 65 20 70 72 6f 67 |art .of the prog| 000008d0 72 61 6d 20 61 66 74 65 72 20 6c 69 6e 65 20 32 |ram after line 2| 000008e0 30 30 20 49 20 63 6f 75 6c 64 20 68 61 76 65 20 |00 I could have | 000008f0 6d 61 64 65 20 74 68 65 20 70 75 6e 63 68 20 0d |made the punch .| 00000900 6c 69 6e 65 20 73 74 61 74 65 6d 65 6e 74 20 63 |line statement c| 00000910 6f 6d 65 20 66 72 6f 6d 20 61 6e 6f 74 68 65 72 |ome from another| 00000920 20 44 41 54 41 20 73 74 61 74 65 6d 65 6e 74 2e | DATA statement.| 00000930 20 53 65 65 20 69 66 20 79 6f 75 20 0d 63 61 6e | See if you .can| 00000940 20 66 69 67 75 72 65 20 6f 75 74 20 68 6f 77 20 | figure out how | 00000950 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 64 6f |this would be do| 00000960 6e 65 2e 20 49 74 20 77 69 6c 6c 20 73 65 65 6d |ne. It will seem| 00000970 20 68 61 72 64 20 61 74 20 0d 66 69 72 73 74 20 | hard at .first | 00000980 62 75 74 20 77 68 65 6e 20 79 6f 75 20 66 69 67 |but when you fig| 00000990 75 72 65 20 69 74 20 6f 75 74 2e 2e 2e 2e 0d 0d |ure it out......| 000009a0 53 6f 6d 65 20 6f 74 68 65 72 20 74 68 69 6e 67 |Some other thing| 000009b0 73 20 79 6f 75 20 63 6f 75 6c 64 20 74 72 79 2e |s you could try.| 000009c0 20 0d 43 68 61 6e 67 65 20 42 25 20 69 6e 20 6c | .Change B% in l| 000009d0 69 6e 65 20 37 30 20 74 6f 20 10 65 71 75 61 6c |ine 70 to .equal| 000009e0 20 73 61 79 20 31 30 2e 20 0d 54 72 79 20 64 65 | say 10. .Try de| 000009f0 6c 65 74 69 6e 67 20 6c 69 6e 65 20 10 31 31 30 |leting line .110| 00000a00 2e 20 0d 54 72 79 20 64 65 6c 65 74 69 6e 67 20 |. .Try deleting | 00000a10 6c 69 6e 65 20 32 32 35 20 61 6e 64 20 70 72 65 |line 225 and pre| 00000a20 73 73 20 61 20 66 65 77 20 6b 65 79 73 20 77 68 |ss a few keys wh| 00000a30 69 6c 65 20 74 68 65 20 66 69 72 73 74 20 0d 70 |ile the first .p| 00000a40 61 72 74 20 6f 66 20 74 68 65 20 70 72 6f 67 72 |art of the progr| 00000a50 61 6d 20 69 73 20 72 75 6e 6e 69 6e 67 2e 0d 54 |am is running..T| 00000a60 72 79 20 64 65 6c 65 74 69 6e 67 20 61 20 6c 69 |ry deleting a li| 00000a70 6e 65 20 77 69 74 68 20 61 20 44 41 54 41 20 73 |ne with a DATA s| 00000a80 74 61 74 65 6d 65 6e 74 2e 20 41 6c 73 6f 20 74 |tatement. Also t| 00000a90 72 79 20 0d 72 65 77 72 69 74 69 6e 67 20 74 68 |ry .rewriting th| 00000aa0 65 20 44 41 54 41 20 73 74 61 74 65 6d 65 6e 74 |e DATA statement| 00000ab0 73 20 77 69 74 68 20 79 6f 75 72 20 6f 77 6e 20 |s with your own | 00000ac0 74 65 78 74 2c 20 70 65 72 68 61 70 73 20 0d 79 |text, perhaps .y| 00000ad0 6f 75 20 63 6f 75 6c 64 20 69 6e 74 72 6f 64 75 |ou could introdu| 00000ae0 63 65 20 61 20 74 68 69 72 64 20 63 68 61 72 61 |ce a third chara| 00000af0 63 74 65 72 20 43 24 2e 20 59 6f 75 20 77 69 6c |cter C$. You wil| 00000b00 6c 20 6e 65 65 64 20 6d 6f 72 65 20 0d 44 41 54 |l need more .DAT| 00000b10 41 20 73 74 61 74 65 6d 65 6e 74 73 2e 0d 0d 45 |A statements...E| 00000b20 78 65 72 69 6d 65 6e 74 69 6e 67 20 6c 69 6b 65 |xerimenting like| 00000b30 20 74 68 69 73 20 69 73 20 62 79 20 66 61 72 20 | this is by far | 00000b40 74 68 65 20 62 65 73 74 20 77 61 79 20 74 6f 20 |the best way to | 00000b50 6c 65 61 72 6e 20 61 62 6f 75 74 20 0d 70 72 6f |learn about .pro| 00000b60 67 72 61 6d 6d 69 6e 67 2e 0d |gramming..| 00000b6a