Home » Archimedes archive » Acorn User » AU 1998-03 A.adf » Features » RTR/PotTest2
RTR/PotTest2
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 1998-03 A.adf » Features |
Filename: | RTR/PotTest2 |
Read OK: | ✔ |
File size: | 03C2 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM> Virtual Screw pot test 20CLS 30PRINT"Virtual screw pot test" 40PRINT"IIC Bus Digital Input Device &70" 50PRINT"By Mike Cook" 60DIM PBK% 3,cw%(3),acw%(3) 70PROC_init 80REM SET ALL BITS HIGH 90?PBK%=&FF 100SYS "IIC_Control",&70,PBK%,1 110REM Read current value 120SYS "IIC_Control",&71,PBK%,1 130CV%=?PBK% AND 3 140pos%=0:ppos%=15 150 160REPEAT 170REM Hold until a change 180REPEAT 190SYS "IIC_Control",&71,PBK%,1 200NV%=?PBK% AND 3 210UNTIL CV%<>NV% 220dir%=0 230IF cw%(CV%)=NV% THEN dir%=-1 240IF acw%(CV%)=NV% THEN dir%=1 250pos%+=dir% 260IF pos%>15 THEN pos%=0 270IF pos%<0 THEN pos%=15 280REM PRINTpos% 290PROCdraw(ppos%,pos%) 300ppos%=pos% 310CV%=NV% 320UNTIL FALSE 330 340DEF PROC_init 350cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1 360acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2 370tp=2*PI 380r%=200 390s%=r%*2 400MODE 20 410ENDPROC 420 430DEF PROCdraw(o%,n%) 440GCOL 0,0 450PROCrd(o%) 460GCOL 0,7 470PROCrd(n%) 480ENDPROC 490 500DEF PROCrd(p%) 510th=(p%/16)*tp 520x%=s%+r%*COS(th) 530y%=s%+r%*SIN(th) 540MOVE x%,y% 550th+=PI 560x%=s%+r%*COS(th) 570y%=s%+r%*SIN(th) 580DRAW x%,y% 590ENDPROC
�> Virtual Screw pot test � �"Virtual screw pot test" ('�"IIC Bus Digital Input Device &70" 2�"By Mike Cook" <� PBK% 3,cw%(3),acw%(3) F �_init P� SET ALL BITS HIGH Z ?PBK%=&FF dș "IIC_Control",&70,PBK%,1 n� Read current value xș "IIC_Control",&71,PBK%,1 �CV%=?PBK% � 3 �pos%=0:ppos%=15 � �� �� Hold until a change �� �ș "IIC_Control",&71,PBK%,1 �NV%=?PBK% � 3 �� CV%<>NV% � dir%=0 �� cw%(CV%)=NV% � dir%=-1 �� acw%(CV%)=NV% � dir%=1 �pos%+=dir% � pos%>15 � pos%=0 � pos%<0 � pos%=15 � PRINTpos% "�draw(ppos%,pos%) ,ppos%=pos% 6CV%=NV% @� � J T� �_init ^'cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1 h+acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2 r tp=2*� | r%=200 �s%=r%*2 �� 20 �� � �� �draw(o%,n%) � � 0,0 ��rd(o%) � � 0,7 ��rd(n%) �� � � � �rd(p%) �th=(p%/16)*tp x%=s%+r%*�(th) y%=s%+r%*�(th) � x%,y% & th+=� 0x%=s%+r%*�(th) :y%=s%+r%*�(th) D� x%,y% N� �
00000000 0d 00 0a 1d f4 3e 20 56 69 72 74 75 61 6c 20 53 |.....> Virtual S| 00000010 63 72 65 77 20 70 6f 74 20 74 65 73 74 0d 00 14 |crew pot test...| 00000020 05 db 0d 00 1e 1d f1 22 56 69 72 74 75 61 6c 20 |......."Virtual | 00000030 73 63 72 65 77 20 70 6f 74 20 74 65 73 74 22 0d |screw pot test".| 00000040 00 28 27 f1 22 49 49 43 20 42 75 73 20 44 69 67 |.('."IIC Bus Dig| 00000050 69 74 61 6c 20 49 6e 70 75 74 20 44 65 76 69 63 |ital Input Devic| 00000060 65 20 26 37 30 22 0d 00 32 13 f1 22 42 79 20 4d |e &70"..2.."By M| 00000070 69 6b 65 20 43 6f 6f 6b 22 0d 00 3c 1b de 20 50 |ike Cook"..<.. P| 00000080 42 4b 25 20 33 2c 63 77 25 28 33 29 2c 61 63 77 |BK% 3,cw%(3),acw| 00000090 25 28 33 29 0d 00 46 0a f2 5f 69 6e 69 74 0d 00 |%(3)..F.._init..| 000000a0 50 17 f4 20 53 45 54 20 41 4c 4c 20 42 49 54 53 |P.. SET ALL BITS| 000000b0 20 48 49 47 48 0d 00 5a 0d 3f 50 42 4b 25 3d 26 | HIGH..Z.?PBK%=&| 000000c0 46 46 0d 00 64 1f c8 99 20 22 49 49 43 5f 43 6f |FF..d... "IIC_Co| 000000d0 6e 74 72 6f 6c 22 2c 26 37 30 2c 50 42 4b 25 2c |ntrol",&70,PBK%,| 000000e0 31 0d 00 6e 18 f4 20 52 65 61 64 20 63 75 72 72 |1..n.. Read curr| 000000f0 65 6e 74 20 76 61 6c 75 65 0d 00 78 1f c8 99 20 |ent value..x... | 00000100 22 49 49 43 5f 43 6f 6e 74 72 6f 6c 22 2c 26 37 |"IIC_Control",&7| 00000110 31 2c 50 42 4b 25 2c 31 0d 00 82 11 43 56 25 3d |1,PBK%,1....CV%=| 00000120 3f 50 42 4b 25 20 80 20 33 0d 00 8c 13 70 6f 73 |?PBK% . 3....pos| 00000130 25 3d 30 3a 70 70 6f 73 25 3d 31 35 0d 00 96 04 |%=0:ppos%=15....| 00000140 0d 00 a0 05 f5 0d 00 aa 19 f4 20 48 6f 6c 64 20 |.......... Hold | 00000150 75 6e 74 69 6c 20 61 20 63 68 61 6e 67 65 0d 00 |until a change..| 00000160 b4 05 f5 0d 00 be 1f c8 99 20 22 49 49 43 5f 43 |......... "IIC_C| 00000170 6f 6e 74 72 6f 6c 22 2c 26 37 31 2c 50 42 4b 25 |ontrol",&71,PBK%| 00000180 2c 31 0d 00 c8 11 4e 56 25 3d 3f 50 42 4b 25 20 |,1....NV%=?PBK% | 00000190 80 20 33 0d 00 d2 0e fd 20 43 56 25 3c 3e 4e 56 |. 3..... CV%<>NV| 000001a0 25 0d 00 dc 0a 64 69 72 25 3d 30 0d 00 e6 1c e7 |%....dir%=0.....| 000001b0 20 63 77 25 28 43 56 25 29 3d 4e 56 25 20 8c 20 | cw%(CV%)=NV% . | 000001c0 64 69 72 25 3d 2d 31 0d 00 f0 1c e7 20 61 63 77 |dir%=-1..... acw| 000001d0 25 28 43 56 25 29 3d 4e 56 25 20 8c 20 64 69 72 |%(CV%)=NV% . dir| 000001e0 25 3d 31 0d 00 fa 0e 70 6f 73 25 2b 3d 64 69 72 |%=1....pos%+=dir| 000001f0 25 0d 01 04 16 e7 20 70 6f 73 25 3e 31 35 20 8c |%..... pos%>15 .| 00000200 20 70 6f 73 25 3d 30 0d 01 0e 16 e7 20 70 6f 73 | pos%=0..... pos| 00000210 25 3c 30 20 8c 20 70 6f 73 25 3d 31 35 0d 01 18 |%<0 . pos%=15...| 00000220 0f f4 20 50 52 49 4e 54 70 6f 73 25 0d 01 22 15 |.. PRINTpos%..".| 00000230 f2 64 72 61 77 28 70 70 6f 73 25 2c 70 6f 73 25 |.draw(ppos%,pos%| 00000240 29 0d 01 2c 0e 70 70 6f 73 25 3d 70 6f 73 25 0d |)..,.ppos%=pos%.| 00000250 01 36 0b 43 56 25 3d 4e 56 25 0d 01 40 07 fd 20 |.6.CV%=NV%..@.. | 00000260 a3 0d 01 4a 04 0d 01 54 0c dd 20 f2 5f 69 6e 69 |...J...T.. ._ini| 00000270 74 0d 01 5e 27 63 77 25 28 30 29 3d 32 3a 63 77 |t..^'cw%(0)=2:cw| 00000280 25 28 31 29 3d 30 3a 63 77 25 28 32 29 3d 33 3a |%(1)=0:cw%(2)=3:| 00000290 63 77 25 28 33 29 3d 31 0d 01 68 2b 61 63 77 25 |cw%(3)=1..h+acw%| 000002a0 28 30 29 3d 31 3a 61 63 77 25 28 31 29 3d 33 3a |(0)=1:acw%(1)=3:| 000002b0 61 63 77 25 28 32 29 3d 30 3a 61 63 77 25 28 33 |acw%(2)=0:acw%(3| 000002c0 29 3d 32 0d 01 72 0a 74 70 3d 32 2a af 0d 01 7c |)=2..r.tp=2*...|| 000002d0 0a 72 25 3d 32 30 30 0d 01 86 0b 73 25 3d 72 25 |.r%=200....s%=r%| 000002e0 2a 32 0d 01 90 08 eb 20 32 30 0d 01 9a 05 e1 0d |*2..... 20......| 000002f0 01 a4 04 0d 01 ae 12 dd 20 f2 64 72 61 77 28 6f |........ .draw(o| 00000300 25 2c 6e 25 29 0d 01 b8 09 e6 20 30 2c 30 0d 01 |%,n%)..... 0,0..| 00000310 c2 0b f2 72 64 28 6f 25 29 0d 01 cc 09 e6 20 30 |...rd(o%)..... 0| 00000320 2c 37 0d 01 d6 0b f2 72 64 28 6e 25 29 0d 01 e0 |,7.....rd(n%)...| 00000330 05 e1 0d 01 ea 04 0d 01 f4 0d dd 20 f2 72 64 28 |........... .rd(| 00000340 70 25 29 0d 01 fe 11 74 68 3d 28 70 25 2f 31 36 |p%)....th=(p%/16| 00000350 29 2a 74 70 0d 02 08 12 78 25 3d 73 25 2b 72 25 |)*tp....x%=s%+r%| 00000360 2a 9b 28 74 68 29 0d 02 12 12 79 25 3d 73 25 2b |*.(th)....y%=s%+| 00000370 72 25 2a b5 28 74 68 29 0d 02 1c 0b ec 20 78 25 |r%*.(th)..... x%| 00000380 2c 79 25 0d 02 26 09 74 68 2b 3d af 0d 02 30 12 |,y%..&.th+=...0.| 00000390 78 25 3d 73 25 2b 72 25 2a 9b 28 74 68 29 0d 02 |x%=s%+r%*.(th)..| 000003a0 3a 12 79 25 3d 73 25 2b 72 25 2a b5 28 74 68 29 |:.y%=s%+r%*.(th)| 000003b0 0d 02 44 0b df 20 78 25 2c 79 25 0d 02 4e 05 e1 |..D.. x%,y%..N..| 000003c0 0d ff |..| 000003c2