Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras » Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/vdu
Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/vdu
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 » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras |
Filename: | Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/vdu |
Read OK: | ✔ |
File size: | 02D3 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
/* Little library of output functions. GCW 02/03/94 */ vdu(s) { local out,i; out = fopen("rawvdu:","w"); for(i=0;i<sizeof(s);putc(s[i++],out)); fclose(out); } mode(n) { vdu(""+22+n); } tab_to(x,y) { vdu(""+31+x+y); } colour(n) { vdu(""+17+n); } gcol(k,n) { vdu(""+18+k+n); } clg() { vdu(""+16); } cls() { vdu(""+12); } plot(k,x,y) { vdu(""+25+k+(x%256)+(x/256)+(y%256)+(y/256)); } move(x,y) { plot(4,x,y); } line(x1,y1,x2,y2) { move(x1,y1); plot(5,x2,y2); } point(x,y) { plot(69,x,y); } circle(x,y,r) { move(x,y); plot(145,r,0); } circlefill(x,y,r) { move(x,y); plot(153,r,0); } rectangle(x,y,w,h) { move(x,y); plot(97,w,h); } cursor(n) { vdu(""+23+1+(n%256)+(n/256)); } // Now add your own.
00000000 2f 2a 20 4c 69 74 74 6c 65 20 6c 69 62 72 61 72 |/* Little librar| 00000010 79 20 6f 66 20 6f 75 74 70 75 74 20 66 75 6e 63 |y of output func| 00000020 74 69 6f 6e 73 2e 20 47 43 57 20 30 32 2f 30 33 |tions. GCW 02/03| 00000030 2f 39 34 20 2a 2f 0a 0a 76 64 75 28 73 29 0a 7b |/94 */..vdu(s).{| 00000040 0a 20 6c 6f 63 61 6c 20 6f 75 74 2c 69 3b 0a 20 |. local out,i;. | 00000050 6f 75 74 20 3d 20 66 6f 70 65 6e 28 22 72 61 77 |out = fopen("raw| 00000060 76 64 75 3a 22 2c 22 77 22 29 3b 0a 20 66 6f 72 |vdu:","w");. for| 00000070 28 69 3d 30 3b 69 3c 73 69 7a 65 6f 66 28 73 29 |(i=0;i<sizeof(s)| 00000080 3b 70 75 74 63 28 73 5b 69 2b 2b 5d 2c 6f 75 74 |;putc(s[i++],out| 00000090 29 29 3b 0a 20 66 63 6c 6f 73 65 28 6f 75 74 29 |));. fclose(out)| 000000a0 3b 0a 7d 0a 0a 6d 6f 64 65 28 6e 29 0a 7b 20 76 |;.}..mode(n).{ v| 000000b0 64 75 28 22 22 2b 32 32 2b 6e 29 3b 20 7d 0a 0a |du(""+22+n); }..| 000000c0 74 61 62 5f 74 6f 28 78 2c 79 29 0a 7b 20 76 64 |tab_to(x,y).{ vd| 000000d0 75 28 22 22 2b 33 31 2b 78 2b 79 29 3b 20 7d 0a |u(""+31+x+y); }.| 000000e0 0a 63 6f 6c 6f 75 72 28 6e 29 0a 7b 20 76 64 75 |.colour(n).{ vdu| 000000f0 28 22 22 2b 31 37 2b 6e 29 3b 20 7d 0a 0a 67 63 |(""+17+n); }..gc| 00000100 6f 6c 28 6b 2c 6e 29 0a 7b 20 76 64 75 28 22 22 |ol(k,n).{ vdu(""| 00000110 2b 31 38 2b 6b 2b 6e 29 3b 20 7d 0a 0a 63 6c 67 |+18+k+n); }..clg| 00000120 28 29 0a 7b 20 76 64 75 28 22 22 2b 31 36 29 3b |().{ vdu(""+16);| 00000130 20 7d 0a 0a 63 6c 73 28 29 0a 7b 20 76 64 75 28 | }..cls().{ vdu(| 00000140 22 22 2b 31 32 29 3b 20 7d 0a 0a 70 6c 6f 74 28 |""+12); }..plot(| 00000150 6b 2c 78 2c 79 29 0a 7b 20 76 64 75 28 22 22 2b |k,x,y).{ vdu(""+| 00000160 32 35 2b 6b 2b 28 78 25 32 35 36 29 2b 28 78 2f |25+k+(x%256)+(x/| 00000170 32 35 36 29 2b 28 79 25 32 35 36 29 2b 28 79 2f |256)+(y%256)+(y/| 00000180 32 35 36 29 29 3b 20 7d 0a 0a 6d 6f 76 65 28 78 |256)); }..move(x| 00000190 2c 79 29 0a 7b 20 70 6c 6f 74 28 34 2c 78 2c 79 |,y).{ plot(4,x,y| 000001a0 29 3b 20 7d 0a 0a 6c 69 6e 65 28 78 31 2c 79 31 |); }..line(x1,y1| 000001b0 2c 78 32 2c 79 32 29 0a 7b 0a 20 6d 6f 76 65 28 |,x2,y2).{. move(| 000001c0 78 31 2c 79 31 29 3b 0a 20 70 6c 6f 74 28 35 2c |x1,y1);. plot(5,| 000001d0 78 32 2c 79 32 29 3b 0a 7d 0a 0a 70 6f 69 6e 74 |x2,y2);.}..point| 000001e0 28 78 2c 79 29 0a 7b 20 70 6c 6f 74 28 36 39 2c |(x,y).{ plot(69,| 000001f0 78 2c 79 29 3b 20 7d 0a 0a 63 69 72 63 6c 65 28 |x,y); }..circle(| 00000200 78 2c 79 2c 72 29 0a 7b 0a 20 6d 6f 76 65 28 78 |x,y,r).{. move(x| 00000210 2c 79 29 3b 0a 20 70 6c 6f 74 28 31 34 35 2c 72 |,y);. plot(145,r| 00000220 2c 30 29 3b 0a 7d 0a 0a 63 69 72 63 6c 65 66 69 |,0);.}..circlefi| 00000230 6c 6c 28 78 2c 79 2c 72 29 0a 7b 0a 20 6d 6f 76 |ll(x,y,r).{. mov| 00000240 65 28 78 2c 79 29 3b 0a 20 70 6c 6f 74 28 31 35 |e(x,y);. plot(15| 00000250 33 2c 72 2c 30 29 3b 0a 7d 0a 0a 72 65 63 74 61 |3,r,0);.}..recta| 00000260 6e 67 6c 65 28 78 2c 79 2c 77 2c 68 29 0a 7b 0a |ngle(x,y,w,h).{.| 00000270 20 6d 6f 76 65 28 78 2c 79 29 3b 0a 20 70 6c 6f | move(x,y);. plo| 00000280 74 28 39 37 2c 77 2c 68 29 3b 0a 7d 0a 0a 63 75 |t(97,w,h);.}..cu| 00000290 72 73 6f 72 28 6e 29 0a 7b 0a 20 76 64 75 28 22 |rsor(n).{. vdu("| 000002a0 22 2b 32 33 2b 31 2b 28 6e 25 32 35 36 29 2b 28 |"+23+1+(n%256)+(| 000002b0 6e 2f 32 35 36 29 29 3b 0a 7d 0a 0a 0a 2f 2f 20 |n/256));.}...// | 000002c0 4e 6f 77 20 61 64 64 20 79 6f 75 72 20 6f 77 6e |Now add your own| 000002d0 2e 0a 20 |.. | 000002d3