Home » Personal collection » Acorn DFS disks » dfs_box03_disk12_bcpl.scp » EXMP3B
EXMP3B
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: | EXMP3B |
Read OK: | ✔ |
File size: | 1034 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
section "EXMP3" get "exmphdr" // This section of EXAMPLE contains the procedure to // display the voltages of the four analogue inputs. manifest $( col.red = 0 // logical colours used col.white = 1 col.blue = 2 col.cyan = 3 $) // VOLTMETER displays the voltages read from the four analogue input channels // as vertical bars. let voltmeter() be $( let prevpos = vec 4 // previous position of top of bar // Select screen mode 5. unless mode(5) then $( let endt = time() + 500 // show message for 5 seconds if endt < 0 then endt := endt + #X8000 // allow for wrap-round wrbin(12) // clear screen writes("Cannot select mode 5.*N") writes("When '!' appears type:*n") writes("*x88SHUFFLE*x89*nand press*x88RETURN*n") writes("then re-run this program.*n") until time() = endt loop stop(0) // exit $) // Define logical colours. vdu("19,%,1;0;", col.red) vdu("19,%,7;0;", col.white) vdu("19,%,4;0;", col.blue) vdu("19,%,6;0;", col.cyan) // Display fixed text etc. dofixed() for i=1 to 4 do prevpos!i := 224 // initialise to 0v. // Loop round each channel in turn, reading the value and // updating the display. $( for i = 1 to 4 do // Value is read as number between 0 (=0v) and 65520 (=1.8v). // Convert it to y co-ord of top of bar (224=0v; 685=1.8v). // When converting shift value right to avoid values > 32767 // being treated as negative. $( let endpos = 224 + muldiv(adval(i) >> 1, 462, 32760) let xpos = 256*i + 132 // 'x' for left of bar // If new bar is same length as before do nothing. If new bar is // shorter then erase top of existing bar by drawing it in the // background colour. If new bar is longer draw the extra bit only. unless endpos = prevpos!i do drawbar(xpos, endpos, prevpos!i, (endpos < prevpos!i -> col.blue, col.cyan) ) prevpos!i := endpos // remember new position // See if DELETE was pressed and return if so. (*FX129 with // -ve parameter checks if specied key is pressed.) if opsys(129, -90, #xFF) ~= 0 return $) $) repeat $) // DOFIXED sets up the fixed part of the display. and dofixed() be $( hidecursor() // Set up a red background then define a graphics window and // initialise it to blue. colour(128+col.red) wrbin(12) // clear text screen vdu("24,256;224;1279;1023;") gcol(0, 128+col.blue) wrbin(16) // clear graphics area colour(col.white) // write text in white txtcursor(6, 0); writes("VOLTMETER") txtcursor(1, 2); wrch('V') for i = 0 to 5 do $( txtcursor(0, 24-4*i) // write scale in format x.x writef("%i1.%i1", (5*i)/10, (5*i) rem 10) $) txtcursor(0, 27); writes("CHN: 1 2 3 4") txtcursor(1, 31); writes("Hit DELETE to exit") plotgrid() $) // DRAWBAR draws or deletes a bar. Comments assume XPOS is // the x co-ord of the left of the bar ,YLOW is the y co-ord // of the bottom, YHI is the y co-ord of the top and COL is // the colour. In fact YLOW and YHI may be reversed. and drawbar(xpos, ylow, yhi, col) be $( gcol(0, col) // select colour plot(4, xpos, ylow) // move to bottom left plot(5, xpos+64, ylow) // draw to bottom right plot(85, xpos+64, yhi) // fill triangle to top right plot(5, xpos, yhi) // draw to top left plot(85, xpos, ylow) // fill triangle to bottom left plotgrid() // redraw grid in case lines were overwritten $) // PLOTGRID plots the horizontal lines every 0.5 volots. and plotgrid() be $( gcol(0, col.white) // write graphics in white for i = 0 to 5 do $( plot(4, 256, 224+i*128) // move to left endpoint plot(17, 1024, 0) // draw dotted to right endpoint $) $) .
00000000 73 65 63 74 69 6f 6e 20 22 45 58 4d 50 33 22 0d |section "EXMP3".| 00000010 0a 0d 0a 67 65 74 20 22 65 78 6d 70 68 64 72 22 |...get "exmphdr"| 00000020 0d 0a 0d 0a 2f 2f 20 54 68 69 73 20 73 65 63 74 |....// This sect| 00000030 69 6f 6e 20 6f 66 20 45 58 41 4d 50 4c 45 20 63 |ion of EXAMPLE c| 00000040 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 72 6f 63 |ontains the proc| 00000050 65 64 75 72 65 20 74 6f 0d 0a 2f 2f 20 64 69 73 |edure to..// dis| 00000060 70 6c 61 79 20 74 68 65 20 76 6f 6c 74 61 67 65 |play the voltage| 00000070 73 20 6f 66 20 74 68 65 20 66 6f 75 72 20 61 6e |s of the four an| 00000080 61 6c 6f 67 75 65 20 69 6e 70 75 74 73 2e 0d 0a |alogue inputs...| 00000090 0d 0a 6d 61 6e 69 66 65 73 74 20 24 28 20 63 6f |..manifest $( co| 000000a0 6c 2e 72 65 64 20 20 20 3d 20 30 20 20 2f 2f 20 |l.red = 0 // | 000000b0 6c 6f 67 69 63 61 6c 20 63 6f 6c 6f 75 72 73 20 |logical colours | 000000c0 75 73 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 |used.. | 000000d0 20 20 63 6f 6c 2e 77 68 69 74 65 20 3d 20 31 0d | col.white = 1.| 000000e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6c |. col| 000000f0 2e 62 6c 75 65 20 20 3d 20 32 0d 0a 20 20 20 20 |.blue = 2.. | 00000100 20 20 20 20 20 20 20 20 63 6f 6c 2e 63 79 61 6e | col.cyan| 00000110 20 20 3d 20 33 0d 0a 20 20 20 20 20 20 20 20 20 | = 3.. | 00000120 24 29 0d 0a 0d 0a 2f 2f 20 56 4f 4c 54 4d 45 54 |$)....// VOLTMET| 00000130 45 52 20 64 69 73 70 6c 61 79 73 20 74 68 65 20 |ER displays the | 00000140 76 6f 6c 74 61 67 65 73 20 72 65 61 64 20 66 72 |voltages read fr| 00000150 6f 6d 20 74 68 65 20 66 6f 75 72 20 61 6e 61 6c |om the four anal| 00000160 6f 67 75 65 20 69 6e 70 75 74 20 63 68 61 6e 6e |ogue input chann| 00000170 65 6c 73 0d 0a 2f 2f 20 61 73 20 76 65 72 74 69 |els..// as verti| 00000180 63 61 6c 20 62 61 72 73 2e 0d 0a 0d 0a 6c 65 74 |cal bars.....let| 00000190 20 76 6f 6c 74 6d 65 74 65 72 28 29 20 62 65 0d | voltmeter() be.| 000001a0 0a 24 28 20 6c 65 74 20 70 72 65 76 70 6f 73 20 |.$( let prevpos | 000001b0 3d 20 76 65 63 20 34 20 20 20 20 20 20 20 20 2f |= vec 4 /| 000001c0 2f 20 70 72 65 76 69 6f 75 73 20 70 6f 73 69 74 |/ previous posit| 000001d0 69 6f 6e 20 6f 66 20 74 6f 70 20 6f 66 20 62 61 |ion of top of ba| 000001e0 72 0d 0a 0d 0a 2f 2f 20 53 65 6c 65 63 74 20 73 |r....// Select s| 000001f0 63 72 65 65 6e 20 6d 6f 64 65 20 35 2e 0d 0a 0d |creen mode 5....| 00000200 0a 20 20 20 75 6e 6c 65 73 73 20 6d 6f 64 65 28 |. unless mode(| 00000210 35 29 20 74 68 65 6e 0d 0a 20 20 20 24 28 20 6c |5) then.. $( l| 00000220 65 74 20 65 6e 64 74 20 3d 20 74 69 6d 65 28 29 |et endt = time()| 00000230 20 2b 20 35 30 30 20 20 20 2f 2f 20 73 68 6f 77 | + 500 // show| 00000240 20 6d 65 73 73 61 67 65 20 66 6f 72 20 35 20 73 | message for 5 s| 00000250 65 63 6f 6e 64 73 0d 0a 20 20 20 20 20 20 69 66 |econds.. if| 00000260 20 65 6e 64 74 20 3c 20 30 20 74 68 65 6e 20 65 | endt < 0 then e| 00000270 6e 64 74 20 3a 3d 20 65 6e 64 74 20 2b 20 23 58 |ndt := endt + #X| 00000280 38 30 30 30 0d 0a 20 20 20 20 20 20 20 20 20 20 |8000.. | 00000290 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000002a0 20 20 20 20 20 20 2f 2f 20 61 6c 6c 6f 77 20 66 | // allow f| 000002b0 6f 72 20 77 72 61 70 2d 72 6f 75 6e 64 0d 0a 20 |or wrap-round.. | 000002c0 20 20 20 20 20 77 72 62 69 6e 28 31 32 29 20 20 | wrbin(12) | 000002d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f | /| 000002e0 2f 20 63 6c 65 61 72 20 73 63 72 65 65 6e 0d 0a |/ clear screen..| 000002f0 20 20 20 20 20 20 77 72 69 74 65 73 28 22 43 61 | writes("Ca| 00000300 6e 6e 6f 74 20 73 65 6c 65 63 74 20 6d 6f 64 65 |nnot select mode| 00000310 20 35 2e 2a 4e 22 29 0d 0a 20 20 20 20 20 20 77 | 5.*N").. w| 00000320 72 69 74 65 73 28 22 57 68 65 6e 20 27 21 27 20 |rites("When '!' | 00000330 61 70 70 65 61 72 73 20 74 79 70 65 3a 2a 6e 22 |appears type:*n"| 00000340 29 0d 0a 20 20 20 20 20 20 77 72 69 74 65 73 28 |).. writes(| 00000350 22 2a 78 38 38 53 48 55 46 46 4c 45 2a 78 38 39 |"*x88SHUFFLE*x89| 00000360 2a 6e 61 6e 64 20 70 72 65 73 73 2a 78 38 38 52 |*nand press*x88R| 00000370 45 54 55 52 4e 2a 6e 22 29 0d 0a 20 20 20 20 20 |ETURN*n").. | 00000380 20 77 72 69 74 65 73 28 22 74 68 65 6e 20 72 65 | writes("then re| 00000390 2d 72 75 6e 20 74 68 69 73 20 70 72 6f 67 72 61 |-run this progra| 000003a0 6d 2e 2a 6e 22 29 0d 0a 20 20 20 20 20 20 75 6e |m.*n").. un| 000003b0 74 69 6c 20 74 69 6d 65 28 29 20 3d 20 65 6e 64 |til time() = end| 000003c0 74 20 6c 6f 6f 70 0d 0a 20 20 20 20 20 20 73 74 |t loop.. st| 000003d0 6f 70 28 30 29 20 20 20 20 20 20 20 20 20 20 20 |op(0) | 000003e0 20 20 20 20 20 20 20 20 20 2f 2f 20 65 78 69 74 | // exit| 000003f0 0d 0a 20 20 20 24 29 0d 0a 0d 0a 20 20 20 2f 2f |.. $).... //| 00000400 20 44 65 66 69 6e 65 20 6c 6f 67 69 63 61 6c 20 | Define logical | 00000410 63 6f 6c 6f 75 72 73 2e 0d 0a 0d 0a 20 20 20 76 |colours..... v| 00000420 64 75 28 22 31 39 2c 25 2c 31 3b 30 3b 22 2c 20 |du("19,%,1;0;", | 00000430 63 6f 6c 2e 72 65 64 29 0d 0a 20 20 20 76 64 75 |col.red).. vdu| 00000440 28 22 31 39 2c 25 2c 37 3b 30 3b 22 2c 20 63 6f |("19,%,7;0;", co| 00000450 6c 2e 77 68 69 74 65 29 0d 0a 20 20 20 76 64 75 |l.white).. vdu| 00000460 28 22 31 39 2c 25 2c 34 3b 30 3b 22 2c 20 63 6f |("19,%,4;0;", co| 00000470 6c 2e 62 6c 75 65 29 0d 0a 20 20 20 76 64 75 28 |l.blue).. vdu(| 00000480 22 31 39 2c 25 2c 36 3b 30 3b 22 2c 20 63 6f 6c |"19,%,6;0;", col| 00000490 2e 63 79 61 6e 29 0d 0a 0d 0a 20 20 20 2f 2f 20 |.cyan).... // | 000004a0 44 69 73 70 6c 61 79 20 66 69 78 65 64 20 74 65 |Display fixed te| 000004b0 78 74 20 65 74 63 2e 0d 0a 0d 0a 20 20 20 64 6f |xt etc..... do| 000004c0 66 69 78 65 64 28 29 0d 0a 20 20 20 66 6f 72 20 |fixed().. for | 000004d0 69 3d 31 20 74 6f 20 34 20 64 6f 20 70 72 65 76 |i=1 to 4 do prev| 000004e0 70 6f 73 21 69 20 3a 3d 20 32 32 34 20 20 2f 2f |pos!i := 224 //| 000004f0 20 69 6e 69 74 69 61 6c 69 73 65 20 74 6f 20 30 | initialise to 0| 00000500 76 2e 0d 0a 0d 0a 20 20 20 2f 2f 20 4c 6f 6f 70 |v..... // Loop| 00000510 20 72 6f 75 6e 64 20 65 61 63 68 20 63 68 61 6e | round each chan| 00000520 6e 65 6c 20 69 6e 20 74 75 72 6e 2c 20 72 65 61 |nel in turn, rea| 00000530 64 69 6e 67 20 74 68 65 20 76 61 6c 75 65 20 61 |ding the value a| 00000540 6e 64 0d 0a 20 20 20 2f 2f 20 75 70 64 61 74 69 |nd.. // updati| 00000550 6e 67 20 74 68 65 20 64 69 73 70 6c 61 79 2e 0d |ng the display..| 00000560 0a 0d 0a 20 20 20 24 28 20 66 6f 72 20 69 20 3d |... $( for i =| 00000570 20 31 20 74 6f 20 34 20 64 6f 0d 0a 0d 0a 20 20 | 1 to 4 do.... | 00000580 20 20 20 20 2f 2f 20 56 61 6c 75 65 20 69 73 20 | // Value is | 00000590 72 65 61 64 20 61 73 20 6e 75 6d 62 65 72 20 62 |read as number b| 000005a0 65 74 77 65 65 6e 20 30 20 28 3d 30 76 29 20 61 |etween 0 (=0v) a| 000005b0 6e 64 20 36 35 35 32 30 20 28 3d 31 2e 38 76 29 |nd 65520 (=1.8v)| 000005c0 2e 0d 0a 20 20 20 20 20 20 2f 2f 20 43 6f 6e 76 |... // Conv| 000005d0 65 72 74 20 69 74 20 74 6f 20 79 20 63 6f 2d 6f |ert it to y co-o| 000005e0 72 64 20 6f 66 20 74 6f 70 20 6f 66 20 62 61 72 |rd of top of bar| 000005f0 20 28 32 32 34 3d 30 76 3b 20 36 38 35 3d 31 2e | (224=0v; 685=1.| 00000600 38 76 29 2e 0d 0a 20 20 20 20 20 20 2f 2f 20 57 |8v)... // W| 00000610 68 65 6e 20 63 6f 6e 76 65 72 74 69 6e 67 20 73 |hen converting s| 00000620 68 69 66 74 20 76 61 6c 75 65 20 72 69 67 68 74 |hift value right| 00000630 20 74 6f 20 61 76 6f 69 64 20 76 61 6c 75 65 73 | to avoid values| 00000640 20 3e 20 33 32 37 36 37 0d 0a 20 20 20 20 20 20 | > 32767.. | 00000650 2f 2f 20 62 65 69 6e 67 20 74 72 65 61 74 65 64 |// being treated| 00000660 20 61 73 20 6e 65 67 61 74 69 76 65 2e 0d 0a 0d | as negative....| 00000670 0a 20 20 20 20 20 20 24 28 20 6c 65 74 20 65 6e |. $( let en| 00000680 64 70 6f 73 20 3d 20 32 32 34 20 2b 20 6d 75 6c |dpos = 224 + mul| 00000690 64 69 76 28 61 64 76 61 6c 28 69 29 20 3e 3e 20 |div(adval(i) >> | 000006a0 31 2c 20 34 36 32 2c 20 33 32 37 36 30 29 0d 0a |1, 462, 32760)..| 000006b0 20 20 20 20 20 20 20 20 20 6c 65 74 20 78 70 6f | let xpo| 000006c0 73 20 3d 20 32 35 36 2a 69 20 2b 20 31 33 32 20 |s = 256*i + 132 | 000006d0 20 20 20 20 20 2f 2f 20 27 78 27 20 66 6f 72 20 | // 'x' for | 000006e0 6c 65 66 74 20 6f 66 20 62 61 72 0d 0a 0d 0a 20 |left of bar.... | 000006f0 20 20 20 20 20 20 20 20 2f 2f 20 49 66 20 6e 65 | // If ne| 00000700 77 20 62 61 72 20 69 73 20 73 61 6d 65 20 6c 65 |w bar is same le| 00000710 6e 67 74 68 20 61 73 20 62 65 66 6f 72 65 20 64 |ngth as before d| 00000720 6f 20 6e 6f 74 68 69 6e 67 2e 20 49 66 20 6e 65 |o nothing. If ne| 00000730 77 20 62 61 72 20 69 73 0d 0a 20 20 20 20 20 20 |w bar is.. | 00000740 20 20 20 2f 2f 20 73 68 6f 72 74 65 72 20 74 68 | // shorter th| 00000750 65 6e 20 65 72 61 73 65 20 74 6f 70 20 6f 66 20 |en erase top of | 00000760 65 78 69 73 74 69 6e 67 20 62 61 72 20 62 79 20 |existing bar by | 00000770 64 72 61 77 69 6e 67 20 69 74 20 69 6e 20 74 68 |drawing it in th| 00000780 65 0d 0a 20 20 20 20 20 20 20 20 20 2f 2f 20 62 |e.. // b| 00000790 61 63 6b 67 72 6f 75 6e 64 20 63 6f 6c 6f 75 72 |ackground colour| 000007a0 2e 20 49 66 20 6e 65 77 20 62 61 72 20 69 73 20 |. If new bar is | 000007b0 6c 6f 6e 67 65 72 20 64 72 61 77 20 74 68 65 20 |longer draw the | 000007c0 65 78 74 72 61 20 62 69 74 20 6f 6e 6c 79 2e 0d |extra bit only..| 000007d0 0a 0d 0a 20 20 20 20 20 20 20 20 20 75 6e 6c 65 |... unle| 000007e0 73 73 20 65 6e 64 70 6f 73 20 3d 20 70 72 65 76 |ss endpos = prev| 000007f0 70 6f 73 21 69 20 64 6f 0d 0a 20 20 20 20 20 20 |pos!i do.. | 00000800 20 20 20 20 20 20 64 72 61 77 62 61 72 28 78 70 | drawbar(xp| 00000810 6f 73 2c 20 65 6e 64 70 6f 73 2c 20 70 72 65 76 |os, endpos, prev| 00000820 70 6f 73 21 69 2c 0d 0a 20 20 20 20 20 20 20 20 |pos!i,.. | 00000830 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 64 | (end| 00000840 70 6f 73 20 3c 20 70 72 65 76 70 6f 73 21 69 20 |pos < prevpos!i | 00000850 2d 3e 20 63 6f 6c 2e 62 6c 75 65 2c 20 63 6f 6c |-> col.blue, col| 00000860 2e 63 79 61 6e 29 0d 0a 20 20 20 20 20 20 20 20 |.cyan).. | 00000870 20 20 20 20 20 20 20 20 20 20 20 29 0d 0a 0d 0a | )....| 00000880 20 20 20 20 20 20 20 20 20 70 72 65 76 70 6f 73 | prevpos| 00000890 21 69 20 3a 3d 20 65 6e 64 70 6f 73 20 20 20 20 |!i := endpos | 000008a0 20 20 20 20 2f 2f 20 72 65 6d 65 6d 62 65 72 20 | // remember | 000008b0 6e 65 77 20 70 6f 73 69 74 69 6f 6e 0d 0a 0d 0a |new position....| 000008c0 20 20 20 20 20 20 20 20 20 2f 2f 20 53 65 65 20 | // See | 000008d0 69 66 20 44 45 4c 45 54 45 20 77 61 73 20 70 72 |if DELETE was pr| 000008e0 65 73 73 65 64 20 61 6e 64 20 72 65 74 75 72 6e |essed and return| 000008f0 20 69 66 20 73 6f 2e 20 28 2a 46 58 31 32 39 20 | if so. (*FX129 | 00000900 77 69 74 68 0d 0a 20 20 20 20 20 20 20 20 20 2f |with.. /| 00000910 2f 20 2d 76 65 20 70 61 72 61 6d 65 74 65 72 20 |/ -ve parameter | 00000920 63 68 65 63 6b 73 20 69 66 20 73 70 65 63 69 65 |checks if specie| 00000930 64 20 6b 65 79 20 69 73 20 70 72 65 73 73 65 64 |d key is pressed| 00000940 2e 29 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 69 |.).... i| 00000950 66 20 6f 70 73 79 73 28 31 32 39 2c 20 2d 39 30 |f opsys(129, -90| 00000960 2c 20 23 78 46 46 29 20 7e 3d 20 30 20 72 65 74 |, #xFF) ~= 0 ret| 00000970 75 72 6e 0d 0a 20 20 20 20 20 20 24 29 0d 0a 20 |urn.. $).. | 00000980 20 20 24 29 20 72 65 70 65 61 74 0d 0a 24 29 0d | $) repeat..$).| 00000990 0a 0d 0a 0d 0a 2f 2f 20 44 4f 46 49 58 45 44 20 |.....// DOFIXED | 000009a0 73 65 74 73 20 75 70 20 74 68 65 20 66 69 78 65 |sets up the fixe| 000009b0 64 20 70 61 72 74 20 6f 66 20 74 68 65 20 64 69 |d part of the di| 000009c0 73 70 6c 61 79 2e 0d 0a 0d 0a 61 6e 64 20 64 6f |splay.....and do| 000009d0 66 69 78 65 64 28 29 20 62 65 0d 0a 24 28 20 68 |fixed() be..$( h| 000009e0 69 64 65 63 75 72 73 6f 72 28 29 0d 0a 0d 0a 20 |idecursor().... | 000009f0 20 20 2f 2f 20 53 65 74 20 75 70 20 61 20 72 65 | // Set up a re| 00000a00 64 20 62 61 63 6b 67 72 6f 75 6e 64 20 74 68 65 |d background the| 00000a10 6e 20 64 65 66 69 6e 65 20 61 20 67 72 61 70 68 |n define a graph| 00000a20 69 63 73 20 77 69 6e 64 6f 77 20 61 6e 64 0d 0a |ics window and..| 00000a30 20 20 20 2f 2f 20 69 6e 69 74 69 61 6c 69 73 65 | // initialise| 00000a40 20 69 74 20 74 6f 20 62 6c 75 65 2e 0d 0a 0d 0a | it to blue.....| 00000a50 20 20 20 63 6f 6c 6f 75 72 28 31 32 38 2b 63 6f | colour(128+co| 00000a60 6c 2e 72 65 64 29 0d 0a 20 20 20 77 72 62 69 6e |l.red).. wrbin| 00000a70 28 31 32 29 20 20 20 20 20 20 20 20 20 2f 2f 20 |(12) // | 00000a80 63 6c 65 61 72 20 74 65 78 74 20 73 63 72 65 65 |clear text scree| 00000a90 6e 0d 0a 20 20 20 76 64 75 28 22 32 34 2c 32 35 |n.. vdu("24,25| 00000aa0 36 3b 32 32 34 3b 31 32 37 39 3b 31 30 32 33 3b |6;224;1279;1023;| 00000ab0 22 29 0d 0a 20 20 20 67 63 6f 6c 28 30 2c 20 31 |").. gcol(0, 1| 00000ac0 32 38 2b 63 6f 6c 2e 62 6c 75 65 29 0d 0a 20 20 |28+col.blue).. | 00000ad0 20 77 72 62 69 6e 28 31 36 29 20 20 20 20 20 20 | wrbin(16) | 00000ae0 20 20 20 2f 2f 20 63 6c 65 61 72 20 67 72 61 70 | // clear grap| 00000af0 68 69 63 73 20 61 72 65 61 0d 0a 0d 0a 20 20 20 |hics area.... | 00000b00 63 6f 6c 6f 75 72 28 63 6f 6c 2e 77 68 69 74 65 |colour(col.white| 00000b10 29 20 2f 2f 20 77 72 69 74 65 20 74 65 78 74 20 |) // write text | 00000b20 69 6e 20 77 68 69 74 65 0d 0a 20 20 20 74 78 74 |in white.. txt| 00000b30 63 75 72 73 6f 72 28 36 2c 20 30 29 3b 20 77 72 |cursor(6, 0); wr| 00000b40 69 74 65 73 28 22 56 4f 4c 54 4d 45 54 45 52 22 |ites("VOLTMETER"| 00000b50 29 0d 0a 20 20 20 74 78 74 63 75 72 73 6f 72 28 |).. txtcursor(| 00000b60 31 2c 20 32 29 3b 20 77 72 63 68 28 27 56 27 29 |1, 2); wrch('V')| 00000b70 0d 0a 20 20 20 66 6f 72 20 69 20 3d 20 30 20 74 |.. for i = 0 t| 00000b80 6f 20 35 20 64 6f 0d 0a 20 20 20 24 28 20 74 78 |o 5 do.. $( tx| 00000b90 74 63 75 72 73 6f 72 28 30 2c 20 32 34 2d 34 2a |tcursor(0, 24-4*| 00000ba0 69 29 20 20 20 20 2f 2f 20 77 72 69 74 65 20 73 |i) // write s| 00000bb0 63 61 6c 65 20 69 6e 20 66 6f 72 6d 61 74 20 78 |cale in format x| 00000bc0 2e 78 0d 0a 20 20 20 20 20 20 77 72 69 74 65 66 |.x.. writef| 00000bd0 28 22 25 69 31 2e 25 69 31 22 2c 20 28 35 2a 69 |("%i1.%i1", (5*i| 00000be0 29 2f 31 30 2c 20 28 35 2a 69 29 20 72 65 6d 20 |)/10, (5*i) rem | 00000bf0 31 30 29 0d 0a 20 20 20 24 29 0d 0a 20 20 20 74 |10).. $).. t| 00000c00 78 74 63 75 72 73 6f 72 28 30 2c 20 32 37 29 3b |xtcursor(0, 27);| 00000c10 20 77 72 69 74 65 73 28 22 43 48 4e 3a 20 20 31 | writes("CHN: 1| 00000c20 20 20 20 32 20 20 20 33 20 20 20 34 22 29 0d 0a | 2 3 4")..| 00000c30 20 20 20 74 78 74 63 75 72 73 6f 72 28 31 2c 20 | txtcursor(1, | 00000c40 33 31 29 3b 20 77 72 69 74 65 73 28 22 48 69 74 |31); writes("Hit| 00000c50 20 44 45 4c 45 54 45 20 74 6f 20 65 78 69 74 22 | DELETE to exit"| 00000c60 29 0d 0a 0d 0a 20 20 20 70 6c 6f 74 67 72 69 64 |).... plotgrid| 00000c70 28 29 0d 0a 24 29 0d 0a 0d 0a 0d 0a 2f 2f 20 44 |()..$)......// D| 00000c80 52 41 57 42 41 52 20 64 72 61 77 73 20 6f 72 20 |RAWBAR draws or | 00000c90 64 65 6c 65 74 65 73 20 61 20 62 61 72 2e 20 43 |deletes a bar. C| 00000ca0 6f 6d 6d 65 6e 74 73 20 61 73 73 75 6d 65 20 58 |omments assume X| 00000cb0 50 4f 53 20 69 73 0d 0a 2f 2f 20 74 68 65 20 78 |POS is..// the x| 00000cc0 20 63 6f 2d 6f 72 64 20 6f 66 20 74 68 65 20 6c | co-ord of the l| 00000cd0 65 66 74 20 6f 66 20 74 68 65 20 62 61 72 20 2c |eft of the bar ,| 00000ce0 59 4c 4f 57 20 69 73 20 74 68 65 20 79 20 63 6f |YLOW is the y co| 00000cf0 2d 6f 72 64 0d 0a 2f 2f 20 6f 66 20 74 68 65 20 |-ord..// of the | 00000d00 62 6f 74 74 6f 6d 2c 20 59 48 49 20 69 73 20 74 |bottom, YHI is t| 00000d10 68 65 20 79 20 63 6f 2d 6f 72 64 20 6f 66 20 74 |he y co-ord of t| 00000d20 68 65 20 74 6f 70 20 61 6e 64 20 43 4f 4c 20 69 |he top and COL i| 00000d30 73 0d 0a 2f 2f 20 74 68 65 20 63 6f 6c 6f 75 72 |s..// the colour| 00000d40 2e 20 49 6e 20 66 61 63 74 20 59 4c 4f 57 20 61 |. In fact YLOW a| 00000d50 6e 64 20 59 48 49 20 6d 61 79 20 62 65 20 72 65 |nd YHI may be re| 00000d60 76 65 72 73 65 64 2e 0d 0a 0d 0a 61 6e 64 20 64 |versed.....and d| 00000d70 72 61 77 62 61 72 28 78 70 6f 73 2c 20 79 6c 6f |rawbar(xpos, ylo| 00000d80 77 2c 20 79 68 69 2c 20 63 6f 6c 29 20 62 65 0d |w, yhi, col) be.| 00000d90 0a 24 28 20 67 63 6f 6c 28 30 2c 20 63 6f 6c 29 |.$( gcol(0, col)| 00000da0 20 20 20 20 20 20 2f 2f 20 73 65 6c 65 63 74 20 | // select | 00000db0 63 6f 6c 6f 75 72 0d 0a 20 20 20 70 6c 6f 74 28 |colour.. plot(| 00000dc0 34 2c 20 78 70 6f 73 2c 20 79 6c 6f 77 29 20 20 |4, xpos, ylow) | 00000dd0 20 20 20 2f 2f 20 6d 6f 76 65 20 74 6f 20 62 6f | // move to bo| 00000de0 74 74 6f 6d 20 6c 65 66 74 0d 0a 20 20 20 70 6c |ttom left.. pl| 00000df0 6f 74 28 35 2c 20 78 70 6f 73 2b 36 34 2c 20 79 |ot(5, xpos+64, y| 00000e00 6c 6f 77 29 20 20 2f 2f 20 64 72 61 77 20 74 6f |low) // draw to| 00000e10 20 62 6f 74 74 6f 6d 20 72 69 67 68 74 0d 0a 20 | bottom right.. | 00000e20 20 20 70 6c 6f 74 28 38 35 2c 20 78 70 6f 73 2b | plot(85, xpos+| 00000e30 36 34 2c 20 79 68 69 29 20 20 2f 2f 20 66 69 6c |64, yhi) // fil| 00000e40 6c 20 74 72 69 61 6e 67 6c 65 20 74 6f 20 74 6f |l triangle to to| 00000e50 70 20 72 69 67 68 74 0d 0a 0d 0a 20 20 20 70 6c |p right.... pl| 00000e60 6f 74 28 35 2c 20 78 70 6f 73 2c 20 79 68 69 29 |ot(5, xpos, yhi)| 00000e70 20 20 20 20 20 20 2f 2f 20 64 72 61 77 20 74 6f | // draw to| 00000e80 20 74 6f 70 20 6c 65 66 74 0d 0a 20 20 20 70 6c | top left.. pl| 00000e90 6f 74 28 38 35 2c 20 78 70 6f 73 2c 20 79 6c 6f |ot(85, xpos, ylo| 00000ea0 77 29 20 20 20 20 2f 2f 20 66 69 6c 6c 20 74 72 |w) // fill tr| 00000eb0 69 61 6e 67 6c 65 20 74 6f 20 62 6f 74 74 6f 6d |iangle to bottom| 00000ec0 20 6c 65 66 74 0d 0a 0d 0a 20 20 20 70 6c 6f 74 | left.... plot| 00000ed0 67 72 69 64 28 29 20 20 20 20 20 20 20 20 2f 2f |grid() //| 00000ee0 20 72 65 64 72 61 77 20 67 72 69 64 20 69 6e 20 | redraw grid in | 00000ef0 63 61 73 65 20 6c 69 6e 65 73 20 77 65 72 65 20 |case lines were | 00000f00 6f 76 65 72 77 72 69 74 74 65 6e 0d 0a 24 29 0d |overwritten..$).| 00000f10 0a 0d 0a 0d 0a 2f 2f 20 50 4c 4f 54 47 52 49 44 |.....// PLOTGRID| 00000f20 20 70 6c 6f 74 73 20 74 68 65 20 68 6f 72 69 7a | plots the horiz| 00000f30 6f 6e 74 61 6c 20 6c 69 6e 65 73 20 65 76 65 72 |ontal lines ever| 00000f40 79 20 30 2e 35 20 76 6f 6c 6f 74 73 2e 0d 0a 0d |y 0.5 volots....| 00000f50 0a 61 6e 64 20 70 6c 6f 74 67 72 69 64 28 29 20 |.and plotgrid() | 00000f60 62 65 0d 0a 24 28 20 67 63 6f 6c 28 30 2c 20 63 |be..$( gcol(0, c| 00000f70 6f 6c 2e 77 68 69 74 65 29 20 2f 2f 20 77 72 69 |ol.white) // wri| 00000f80 74 65 20 67 72 61 70 68 69 63 73 20 69 6e 20 77 |te graphics in w| 00000f90 68 69 74 65 0d 0a 20 20 20 66 6f 72 20 69 20 3d |hite.. for i =| 00000fa0 20 30 20 74 6f 20 35 20 64 6f 0d 0a 20 20 20 24 | 0 to 5 do.. $| 00000fb0 28 20 70 6c 6f 74 28 34 2c 20 32 35 36 2c 20 32 |( plot(4, 256, 2| 00000fc0 32 34 2b 69 2a 31 32 38 29 20 2f 2f 20 6d 6f 76 |24+i*128) // mov| 00000fd0 65 20 74 6f 20 6c 65 66 74 20 65 6e 64 70 6f 69 |e to left endpoi| 00000fe0 6e 74 0d 0a 20 20 20 20 20 20 70 6c 6f 74 28 31 |nt.. plot(1| 00000ff0 37 2c 20 31 30 32 34 2c 20 30 29 20 20 20 20 20 |7, 1024, 0) | 00001000 20 20 2f 2f 20 64 72 61 77 20 64 6f 74 74 65 64 | // draw dotted| 00001010 20 74 6f 20 72 69 67 68 74 20 65 6e 64 70 6f 69 | to right endpoi| 00001020 6e 74 0d 0a 20 20 20 24 29 0d 0a 24 29 0d 0a 2e |nt.. $)..$)...| 00001030 0d 0a 0d 0a |....| 00001034