Home » Personal collection » Acorn DFS disks » dfs_box03_disk12_bcpl.scp » EXMP1B
EXMP1B
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 DFS disks » dfs_box03_disk12_bcpl.scp |
Filename: | EXMP1B |
Read OK: | ✔ |
File size: | 08CC bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
section "EXMP1" needs "sound" // sections from LIB needs "envelope" needs "adval" needs "vdu" needs "time" get "exmphdr" // header file // This section of EXAMPLE contains START plus various // utility routines. let start() be $( // Select teletext mode and write double-height cyan heading. mode(7) for i = 0 to 1 do // write 2 identical lines (double height) writes("*x86*x8D E X A M P L E*n") // '*x86' gives character 86 (hex) // Write list of options in white. writes("*nEnter*X88T*X89(Tune)*n") writes( " *X88V*X89(Voltmeter)*n") writes( " *X88X*X89(Exit)*n*n") writes( "then press*x88RETURN") $( // Enter loop to get valid input. Discard any characters left // over from previous input, blank out previous input then prompt. while testflags(more.input) do rdch() txtcursor(0, 12) for i = 1 to 40 do wrch('*S') txtcursor(0, 12) writes("? ") // Process the input, taking notice of the first character only. switchon capch(rdch()) into $( case 'T': playtune() break // jumps out of inner repeat loop case 'V': voltmeter() break case 'X': wrbin(12) // clear screen stop(0) // and exit $) // If input invalid issue a flashing magenta error message and // loop back to re-issue prompt. txtcursor(0, 15) writes("*x85*x88Please enter T, V or X*n") $) repeat // Come here on return from PLAYTUNE or VOLTMETER. Repeat the whole // procedure. $) repeat // COLOUR sets the text colour (not in mode 7). and colour(col) be vdu("17,%", col) // GCOL sets the graphics colour (not in mode 7). and gcol(gmode, col) be vdu("18,%,%", gmode, col) // HIDECURSOR conceals the cursor. and hidecursor() be vdu("23,1,0;0;0;0;") // PLOT has the same effect as the BASIC command PLOT. and plot(k, x, y) be vdu("25,%,%;%;", k, x, y) // TXTCURSOR positions the text cursor. and txtcursor(x, y) be vdu("31,%,%", x, y) . // '.' marks end of section
00000000 73 65 63 74 69 6f 6e 20 22 45 58 4d 50 31 22 0d |section "EXMP1".| 00000010 0a 0d 0a 6e 65 65 64 73 20 22 73 6f 75 6e 64 22 |...needs "sound"| 00000020 20 20 20 20 20 2f 2f 20 73 65 63 74 69 6f 6e 73 | // sections| 00000030 20 66 72 6f 6d 20 4c 49 42 0d 0a 6e 65 65 64 73 | from LIB..needs| 00000040 20 22 65 6e 76 65 6c 6f 70 65 22 0d 0a 6e 65 65 | "envelope"..nee| 00000050 64 73 20 22 61 64 76 61 6c 22 0d 0a 6e 65 65 64 |ds "adval"..need| 00000060 73 20 22 76 64 75 22 0d 0a 6e 65 65 64 73 20 22 |s "vdu"..needs "| 00000070 74 69 6d 65 22 0d 0a 0d 0a 67 65 74 20 22 65 78 |time"....get "ex| 00000080 6d 70 68 64 72 22 20 20 20 20 20 2f 2f 20 68 65 |mphdr" // he| 00000090 61 64 65 72 20 66 69 6c 65 0d 0a 0d 0a 2f 2f 20 |ader file....// | 000000a0 54 68 69 73 20 73 65 63 74 69 6f 6e 20 6f 66 20 |This section of | 000000b0 45 58 41 4d 50 4c 45 20 63 6f 6e 74 61 69 6e 73 |EXAMPLE contains| 000000c0 20 53 54 41 52 54 20 70 6c 75 73 20 76 61 72 69 | START plus vari| 000000d0 6f 75 73 0d 0a 2f 2f 20 75 74 69 6c 69 74 79 20 |ous..// utility | 000000e0 72 6f 75 74 69 6e 65 73 2e 0d 0a 0d 0a 6c 65 74 |routines.....let| 000000f0 20 73 74 61 72 74 28 29 20 62 65 0d 0a 24 28 20 | start() be..$( | 00000100 2f 2f 20 53 65 6c 65 63 74 20 74 65 6c 65 74 65 |// Select telete| 00000110 78 74 20 6d 6f 64 65 20 61 6e 64 20 77 72 69 74 |xt mode and writ| 00000120 65 20 64 6f 75 62 6c 65 2d 68 65 69 67 68 74 20 |e double-height | 00000130 63 79 61 6e 20 68 65 61 64 69 6e 67 2e 0d 0a 0d |cyan heading....| 00000140 0a 20 20 20 6d 6f 64 65 28 37 29 0d 0a 20 20 20 |. mode(7).. | 00000150 66 6f 72 20 69 20 3d 20 30 20 74 6f 20 31 20 64 |for i = 0 to 1 d| 00000160 6f 20 20 20 20 2f 2f 20 77 72 69 74 65 20 32 20 |o // write 2 | 00000170 69 64 65 6e 74 69 63 61 6c 20 6c 69 6e 65 73 20 |identical lines | 00000180 28 64 6f 75 62 6c 65 20 68 65 69 67 68 74 29 0d |(double height).| 00000190 0a 20 20 20 20 20 20 77 72 69 74 65 73 28 22 2a |. writes("*| 000001a0 78 38 36 2a 78 38 44 20 20 20 20 20 20 20 20 20 |x86*x8D | 000001b0 20 20 45 20 58 20 41 20 4d 20 50 20 4c 20 45 2a | E X A M P L E*| 000001c0 6e 22 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 |n").. | 000001d0 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 | // | 000001e0 27 2a 78 38 36 27 20 67 69 76 65 73 20 63 68 61 |'*x86' gives cha| 000001f0 72 61 63 74 65 72 20 38 36 20 28 68 65 78 29 0d |racter 86 (hex).| 00000200 0a 0d 0a 20 20 20 2f 2f 20 57 72 69 74 65 20 6c |... // Write l| 00000210 69 73 74 20 6f 66 20 6f 70 74 69 6f 6e 73 20 69 |ist of options i| 00000220 6e 20 77 68 69 74 65 2e 0d 0a 0d 0a 20 20 20 77 |n white..... w| 00000230 72 69 74 65 73 28 22 2a 6e 45 6e 74 65 72 2a 58 |rites("*nEnter*X| 00000240 38 38 54 2a 58 38 39 28 54 75 6e 65 29 2a 6e 22 |88T*X89(Tune)*n"| 00000250 29 0d 0a 20 20 20 77 72 69 74 65 73 28 20 20 22 |).. writes( "| 00000260 20 20 20 20 20 2a 58 38 38 56 2a 58 38 39 28 56 | *X88V*X89(V| 00000270 6f 6c 74 6d 65 74 65 72 29 2a 6e 22 29 0d 0a 20 |oltmeter)*n").. | 00000280 20 20 77 72 69 74 65 73 28 20 20 22 20 20 20 20 | writes( " | 00000290 20 2a 58 38 38 58 2a 58 38 39 28 45 78 69 74 29 | *X88X*X89(Exit)| 000002a0 2a 6e 2a 6e 22 29 0d 0a 20 20 20 77 72 69 74 65 |*n*n").. write| 000002b0 73 28 20 20 22 74 68 65 6e 20 70 72 65 73 73 2a |s( "then press*| 000002c0 78 38 38 52 45 54 55 52 4e 22 29 0d 0a 0d 0a 20 |x88RETURN").... | 000002d0 20 20 24 28 20 2f 2f 20 45 6e 74 65 72 20 6c 6f | $( // Enter lo| 000002e0 6f 70 20 74 6f 20 67 65 74 20 76 61 6c 69 64 20 |op to get valid | 000002f0 69 6e 70 75 74 2e 20 44 69 73 63 61 72 64 20 61 |input. Discard a| 00000300 6e 79 20 63 68 61 72 61 63 74 65 72 73 20 6c 65 |ny characters le| 00000310 66 74 0d 0a 20 20 20 20 20 20 2f 2f 20 6f 76 65 |ft.. // ove| 00000320 72 20 66 72 6f 6d 20 70 72 65 76 69 6f 75 73 20 |r from previous | 00000330 69 6e 70 75 74 2c 20 62 6c 61 6e 6b 20 6f 75 74 |input, blank out| 00000340 20 70 72 65 76 69 6f 75 73 20 69 6e 70 75 74 20 | previous input | 00000350 74 68 65 6e 20 70 72 6f 6d 70 74 2e 0d 0a 0d 0a |then prompt.....| 00000360 20 20 20 20 20 20 77 68 69 6c 65 20 74 65 73 74 | while test| 00000370 66 6c 61 67 73 28 6d 6f 72 65 2e 69 6e 70 75 74 |flags(more.input| 00000380 29 20 64 6f 20 72 64 63 68 28 29 0d 0a 20 20 20 |) do rdch().. | 00000390 20 20 20 74 78 74 63 75 72 73 6f 72 28 30 2c 20 | txtcursor(0, | 000003a0 31 32 29 0d 0a 20 20 20 20 20 20 66 6f 72 20 69 |12).. for i| 000003b0 20 3d 20 31 20 74 6f 20 34 30 20 64 6f 20 77 72 | = 1 to 40 do wr| 000003c0 63 68 28 27 2a 53 27 29 0d 0a 20 20 20 20 20 20 |ch('*S').. | 000003d0 74 78 74 63 75 72 73 6f 72 28 30 2c 20 31 32 29 |txtcursor(0, 12)| 000003e0 0d 0a 20 20 20 20 20 20 77 72 69 74 65 73 28 22 |.. writes("| 000003f0 3f 20 22 29 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f |? ").... //| 00000400 20 50 72 6f 63 65 73 73 20 74 68 65 20 69 6e 70 | Process the inp| 00000410 75 74 2c 20 74 61 6b 69 6e 67 20 6e 6f 74 69 63 |ut, taking notic| 00000420 65 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 63 |e of the first c| 00000430 68 61 72 61 63 74 65 72 20 6f 6e 6c 79 2e 0d 0a |haracter only...| 00000440 0d 0a 20 20 20 20 20 20 73 77 69 74 63 68 6f 6e |.. switchon| 00000450 20 63 61 70 63 68 28 72 64 63 68 28 29 29 20 69 | capch(rdch()) i| 00000460 6e 74 6f 0d 0a 20 20 20 20 20 20 24 28 20 63 61 |nto.. $( ca| 00000470 73 65 20 27 54 27 3a 0d 0a 20 20 20 20 20 20 20 |se 'T':.. | 00000480 20 20 20 20 20 70 6c 61 79 74 75 6e 65 28 29 0d | playtune().| 00000490 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 |. bre| 000004a0 61 6b 20 2f 2f 20 6a 75 6d 70 73 20 6f 75 74 20 |ak // jumps out | 000004b0 6f 66 20 69 6e 6e 65 72 20 72 65 70 65 61 74 20 |of inner repeat | 000004c0 6c 6f 6f 70 0d 0a 0d 0a 20 20 20 20 20 20 20 20 |loop.... | 000004d0 20 63 61 73 65 20 27 56 27 3a 0d 0a 20 20 20 20 | case 'V':.. | 000004e0 20 20 20 20 20 20 20 20 76 6f 6c 74 6d 65 74 65 | voltmete| 000004f0 72 28 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 |r().. | 00000500 20 62 72 65 61 6b 0d 0a 0d 0a 20 20 20 20 20 20 | break.... | 00000510 20 20 20 63 61 73 65 20 27 58 27 3a 0d 0a 20 20 | case 'X':.. | 00000520 20 20 20 20 20 20 20 20 20 20 77 72 62 69 6e 28 | wrbin(| 00000530 31 32 29 20 20 20 2f 2f 20 63 6c 65 61 72 20 73 |12) // clear s| 00000540 63 72 65 65 6e 0d 0a 20 20 20 20 20 20 20 20 20 |creen.. | 00000550 20 20 20 73 74 6f 70 28 30 29 20 20 20 20 20 2f | stop(0) /| 00000560 2f 20 61 6e 64 20 65 78 69 74 0d 0a 20 20 20 20 |/ and exit.. | 00000570 20 20 24 29 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f | $).... //| 00000580 20 49 66 20 69 6e 70 75 74 20 69 6e 76 61 6c 69 | If input invali| 00000590 64 20 69 73 73 75 65 20 61 20 66 6c 61 73 68 69 |d issue a flashi| 000005a0 6e 67 20 6d 61 67 65 6e 74 61 20 65 72 72 6f 72 |ng magenta error| 000005b0 20 6d 65 73 73 61 67 65 20 61 6e 64 0d 0a 20 20 | message and.. | 000005c0 20 20 20 20 2f 2f 20 6c 6f 6f 70 20 62 61 63 6b | // loop back| 000005d0 20 74 6f 20 72 65 2d 69 73 73 75 65 20 70 72 6f | to re-issue pro| 000005e0 6d 70 74 2e 0d 0a 0d 0a 20 20 20 20 20 20 74 78 |mpt..... tx| 000005f0 74 63 75 72 73 6f 72 28 30 2c 20 31 35 29 0d 0a |tcursor(0, 15)..| 00000600 20 20 20 20 20 20 77 72 69 74 65 73 28 22 2a 78 | writes("*x| 00000610 38 35 2a 78 38 38 50 6c 65 61 73 65 20 65 6e 74 |85*x88Please ent| 00000620 65 72 20 54 2c 20 56 20 6f 72 20 58 2a 6e 22 29 |er T, V or X*n")| 00000630 0d 0a 20 20 20 24 29 20 72 65 70 65 61 74 0d 0a |.. $) repeat..| 00000640 0d 0a 20 20 20 2f 2f 20 43 6f 6d 65 20 68 65 72 |.. // Come her| 00000650 65 20 6f 6e 20 72 65 74 75 72 6e 20 66 72 6f 6d |e on return from| 00000660 20 50 4c 41 59 54 55 4e 45 20 6f 72 20 56 4f 4c | PLAYTUNE or VOL| 00000670 54 4d 45 54 45 52 2e 20 52 65 70 65 61 74 20 74 |TMETER. Repeat t| 00000680 68 65 20 77 68 6f 6c 65 0d 0a 20 20 20 2f 2f 20 |he whole.. // | 00000690 70 72 6f 63 65 64 75 72 65 2e 0d 0a 0d 0a 24 29 |procedure.....$)| 000006a0 20 72 65 70 65 61 74 0d 0a 0d 0a 0d 0a 2f 2f 20 | repeat......// | 000006b0 43 4f 4c 4f 55 52 20 73 65 74 73 20 74 68 65 20 |COLOUR sets the | 000006c0 74 65 78 74 20 63 6f 6c 6f 75 72 20 28 6e 6f 74 |text colour (not| 000006d0 20 69 6e 20 6d 6f 64 65 20 37 29 2e 0d 0a 0d 0a | in mode 7).....| 000006e0 61 6e 64 20 63 6f 6c 6f 75 72 28 63 6f 6c 29 20 |and colour(col) | 000006f0 62 65 0d 0a 20 20 20 76 64 75 28 22 31 37 2c 25 |be.. vdu("17,%| 00000700 22 2c 20 63 6f 6c 29 0d 0a 0d 0a 0d 0a 2f 2f 20 |", col)......// | 00000710 47 43 4f 4c 20 73 65 74 73 20 74 68 65 20 67 72 |GCOL sets the gr| 00000720 61 70 68 69 63 73 20 63 6f 6c 6f 75 72 20 28 6e |aphics colour (n| 00000730 6f 74 20 69 6e 20 6d 6f 64 65 20 37 29 2e 0d 0a |ot in mode 7)...| 00000740 0d 0a 61 6e 64 20 67 63 6f 6c 28 67 6d 6f 64 65 |..and gcol(gmode| 00000750 2c 20 63 6f 6c 29 20 62 65 0d 0a 20 20 20 76 64 |, col) be.. vd| 00000760 75 28 22 31 38 2c 25 2c 25 22 2c 20 67 6d 6f 64 |u("18,%,%", gmod| 00000770 65 2c 20 63 6f 6c 29 0d 0a 0d 0a 0d 0a 2f 2f 20 |e, col)......// | 00000780 48 49 44 45 43 55 52 53 4f 52 20 63 6f 6e 63 65 |HIDECURSOR conce| 00000790 61 6c 73 20 74 68 65 20 63 75 72 73 6f 72 2e 0d |als the cursor..| 000007a0 0a 0d 0a 61 6e 64 20 68 69 64 65 63 75 72 73 6f |...and hidecurso| 000007b0 72 28 29 20 62 65 0d 0a 20 20 20 76 64 75 28 22 |r() be.. vdu("| 000007c0 32 33 2c 31 2c 30 3b 30 3b 30 3b 30 3b 22 29 0d |23,1,0;0;0;0;").| 000007d0 0a 0d 0a 0d 0a 2f 2f 20 50 4c 4f 54 20 68 61 73 |.....// PLOT has| 000007e0 20 74 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 | the same effect| 000007f0 20 61 73 20 74 68 65 20 42 41 53 49 43 20 63 6f | as the BASIC co| 00000800 6d 6d 61 6e 64 20 50 4c 4f 54 2e 0d 0a 0d 0a 61 |mmand PLOT.....a| 00000810 6e 64 20 70 6c 6f 74 28 6b 2c 20 78 2c 20 79 29 |nd plot(k, x, y)| 00000820 20 62 65 0d 0a 20 20 20 76 64 75 28 22 32 35 2c | be.. vdu("25,| 00000830 25 2c 25 3b 25 3b 22 2c 20 6b 2c 20 78 2c 20 79 |%,%;%;", k, x, y| 00000840 29 0d 0a 0d 0a 0d 0a 2f 2f 20 54 58 54 43 55 52 |)......// TXTCUR| 00000850 53 4f 52 20 70 6f 73 69 74 69 6f 6e 73 20 74 68 |SOR positions th| 00000860 65 20 74 65 78 74 20 63 75 72 73 6f 72 2e 0d 0a |e text cursor...| 00000870 0d 0a 61 6e 64 20 74 78 74 63 75 72 73 6f 72 28 |..and txtcursor(| 00000880 78 2c 20 79 29 20 62 65 0d 0a 20 20 20 76 64 75 |x, y) be.. vdu| 00000890 28 22 33 31 2c 25 2c 25 22 2c 20 78 2c 20 79 29 |("31,%,%", x, y)| 000008a0 0d 0a 0d 0a 2e 20 20 20 20 20 20 20 20 2f 2f 20 |..... // | 000008b0 27 2e 27 20 6d 61 72 6b 73 20 65 6e 64 20 6f 66 |'.' marks end of| 000008c0 20 73 65 63 74 69 6f 6e 0d 0a 0d 0a | section....| 000008cc