Home » Archimedes archive » Acorn User » AU 1998-03 A.adf » Features » RTR/FeedTest1

RTR/FeedTest1

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/FeedTest1
Read OK:
File size: 05E9 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM> Virtual Screw pot test 2
   20CLS
   30PRINT"Virtual screw pot test"
   40PRINT"IIC Bus Digital Input Device &70"
   50PRINT"By Mike Cook"
   60DIM PBK% 3,cw%(3),acw%(3)
   70DIM PBC% 3
   80
   90PROC_init
  100REM SET ALL BITS HIGH
  110?PBK%=&FF
  120SYS "IIC_Control",&70,PBK%,1
  130REM Read current value
  140SYS "IIC_Control",&71,PBK%,1
  150CV%=?PBK% AND 3
  160pos%=0:ppos%=15:apos%=0
  170PROCdraw(ppos%,pos%)
  180BR%=0
  190
  200REPEAT
  210REM Hold until a change
  220REPEAT
  230SYS "IIC_Control",&71,PBK%,1
  240NV%=?PBK% AND 3
  250UNTIL CV%<>NV%
  260dir%=0
  270IF cw%(CV%)=NV% THEN dir%=-1
  280IF acw%(CV%)=NV% THEN dir%=1
  290pos%-=dir%
  300apos%+=dir%
  310BR%+=dir%*8
  320IF apos%>300 OR apos%<-30 THEN pos%+=dir%:apos%-=dir%:BR%-=dir%*8
  330AB%=BR%
  340IF BR%>255 THEN AB%=255
  350IF BR%<0 THEN AB%=0
  360PROCbreak(AB%)
  370
  380IF pos%>15 THEN pos%=0
  390IF pos%<0 THEN pos%=15
  400PROCdraw(ppos%,pos%)
  410PRINTBR%
  420ppos%=pos%
  430CV%=NV%
  440UNTIL FALSE
  450
  460DEF PROC_init
  470cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1
  480acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2
  490tp=2*PI
  500r%=50
  510s%=400
  520PROCbreak(0)
  530MODE 20
  540ENDPROC
  550
  560DEF PROCdraw(o%,n%)
  570REM GCOL 0,0
  580REM PROCrd(o%)
  590CLS
  600GCOL 0,7
  610PROCrd(n%)
  620ENDPROC
  630
  640DEF PROCrd(p%)
  650LOCAL th,r,l%,q
  660q=(p%/16)*tp
  670th=q
  680x%=s%+r%*COS(th)
  690y%=s%+r%*SIN(th)
  700MOVE x%,y%
  710th+=PI
  720x%=s%+r%*COS(th)
  730y%=s%+r%*SIN(th)
  740DRAW x%,y%
  750CIRCLE s%,s%,r%
  760
  770r=30:th=0:l%=300:w%=100
  780r=30+(apos%/16)*12.566
  790REPEAT
  800sx%=w%+r*SIN(th)
  810IF th=0 THEN MOVE l%,sx% ELSE DRAW l%,sx%
  820l%+=2
  830th-=0.1
  840r+=.2
  850UNTIL r>60
  860RECTANGLE l%,30,20,140
  870ENDPROC
  880
  890DEF PROCbreak(b%)
  900b%=&FF-(b% AND &FF)
  910?PBC%=&40
  920PBC%?1=b%
  930SYS "IIC_Control",&90,PBC%,2
  940ENDPROC

�> Virtual Screw pot test 2
�
�"Virtual screw pot test"
('�"IIC Bus Digital Input Device &70"
2�"By Mike Cook"
<� PBK% 3,cw%(3),acw%(3)
F� PBC% 3
P
Z
�_init
d� SET ALL BITS HIGH
n
?PBK%=&FF
xș "IIC_Control",&70,PBK%,1
�� Read current value
�ș "IIC_Control",&71,PBK%,1
�CV%=?PBK% � 3
�pos%=0:ppos%=15:apos%=0
��draw(ppos%,pos%)
�	BR%=0
�
��
�� 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%
,apos%+=dir%
6BR%+=dir%*8
@@� apos%>300 � apos%<-30 � pos%+=dir%:apos%-=dir%:BR%-=dir%*8
JAB%=BR%
T� BR%>255 � AB%=255
^� BR%<0 � AB%=0
h�break(AB%)
r
|� pos%>15 � pos%=0
�� pos%<0 � pos%=15
��draw(ppos%,pos%)
��BR%
�ppos%=pos%
�CV%=NV%
�� �
�
�� �_init
�'cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1
�+acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2
�
tp=2*�
�	r%=50
�
s%=400

�break(0)
� 20
�
&
0� �draw(o%,n%)
:� GCOL 0,0
D� PROCrd(o%)
N�
X	� 0,7
b�rd(n%)
l�
v
�
� �rd(p%)
�� th,r,l%,q
�q=(p%/16)*tp
�th=q
�x%=s%+r%*�(th)
�y%=s%+r%*�(th)
�� x%,y%
�	th+=�
�x%=s%+r%*�(th)
�y%=s%+r%*�(th)
�� x%,y%
�ȏ s%,s%,r%
�
r=30:th=0:l%=300:w%=100
r=30+(apos%/16)*12.566
�
 sx%=w%+r*�(th)
* � th=0 � � l%,sx% � � l%,sx%
4	l%+=2
>th-=0.1
H	r+=.2
R
� r>60
\ȓ l%,30,20,140
f�
p
z� �break(b%)
�b%=&FF-(b% � &FF)
�
?PBC%=&40
�
PBC%?1=b%
�ș "IIC_Control",&90,PBC%,2
��
�
00000000  0d 00 0a 1f 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 20 32 0d  |crew pot test 2.|
00000020  00 14 05 db 0d 00 1e 1d  f1 22 56 69 72 74 75 61  |........."Virtua|
00000030  6c 20 73 63 72 65 77 20  70 6f 74 20 74 65 73 74  |l screw pot test|
00000040  22 0d 00 28 27 f1 22 49  49 43 20 42 75 73 20 44  |"..('."IIC Bus D|
00000050  69 67 69 74 61 6c 20 49  6e 70 75 74 20 44 65 76  |igital Input Dev|
00000060  69 63 65 20 26 37 30 22  0d 00 32 13 f1 22 42 79  |ice &70"..2.."By|
00000070  20 4d 69 6b 65 20 43 6f  6f 6b 22 0d 00 3c 1b de  | Mike Cook"..<..|
00000080  20 50 42 4b 25 20 33 2c  63 77 25 28 33 29 2c 61  | PBK% 3,cw%(3),a|
00000090  63 77 25 28 33 29 0d 00  46 0c de 20 50 42 43 25  |cw%(3)..F.. PBC%|
000000a0  20 33 0d 00 50 04 0d 00  5a 0a f2 5f 69 6e 69 74  | 3..P...Z.._init|
000000b0  0d 00 64 17 f4 20 53 45  54 20 41 4c 4c 20 42 49  |..d.. SET ALL BI|
000000c0  54 53 20 48 49 47 48 0d  00 6e 0d 3f 50 42 4b 25  |TS HIGH..n.?PBK%|
000000d0  3d 26 46 46 0d 00 78 1f  c8 99 20 22 49 49 43 5f  |=&FF..x... "IIC_|
000000e0  43 6f 6e 74 72 6f 6c 22  2c 26 37 30 2c 50 42 4b  |Control",&70,PBK|
000000f0  25 2c 31 0d 00 82 18 f4  20 52 65 61 64 20 63 75  |%,1..... Read cu|
00000100  72 72 65 6e 74 20 76 61  6c 75 65 0d 00 8c 1f c8  |rrent value.....|
00000110  99 20 22 49 49 43 5f 43  6f 6e 74 72 6f 6c 22 2c  |. "IIC_Control",|
00000120  26 37 31 2c 50 42 4b 25  2c 31 0d 00 96 11 43 56  |&71,PBK%,1....CV|
00000130  25 3d 3f 50 42 4b 25 20  80 20 33 0d 00 a0 1b 70  |%=?PBK% . 3....p|
00000140  6f 73 25 3d 30 3a 70 70  6f 73 25 3d 31 35 3a 61  |os%=0:ppos%=15:a|
00000150  70 6f 73 25 3d 30 0d 00  aa 15 f2 64 72 61 77 28  |pos%=0.....draw(|
00000160  70 70 6f 73 25 2c 70 6f  73 25 29 0d 00 b4 09 42  |ppos%,pos%)....B|
00000170  52 25 3d 30 0d 00 be 04  0d 00 c8 05 f5 0d 00 d2  |R%=0............|
00000180  19 f4 20 48 6f 6c 64 20  75 6e 74 69 6c 20 61 20  |.. Hold until a |
00000190  63 68 61 6e 67 65 0d 00  dc 05 f5 0d 00 e6 1f c8  |change..........|
000001a0  99 20 22 49 49 43 5f 43  6f 6e 74 72 6f 6c 22 2c  |. "IIC_Control",|
000001b0  26 37 31 2c 50 42 4b 25  2c 31 0d 00 f0 11 4e 56  |&71,PBK%,1....NV|
000001c0  25 3d 3f 50 42 4b 25 20  80 20 33 0d 00 fa 0e fd  |%=?PBK% . 3.....|
000001d0  20 43 56 25 3c 3e 4e 56  25 0d 01 04 0a 64 69 72  | CV%<>NV%....dir|
000001e0  25 3d 30 0d 01 0e 1c e7  20 63 77 25 28 43 56 25  |%=0..... cw%(CV%|
000001f0  29 3d 4e 56 25 20 8c 20  64 69 72 25 3d 2d 31 0d  |)=NV% . dir%=-1.|
00000200  01 18 1c e7 20 61 63 77  25 28 43 56 25 29 3d 4e  |.... acw%(CV%)=N|
00000210  56 25 20 8c 20 64 69 72  25 3d 31 0d 01 22 0e 70  |V% . dir%=1..".p|
00000220  6f 73 25 2d 3d 64 69 72  25 0d 01 2c 0f 61 70 6f  |os%-=dir%..,.apo|
00000230  73 25 2b 3d 64 69 72 25  0d 01 36 0f 42 52 25 2b  |s%+=dir%..6.BR%+|
00000240  3d 64 69 72 25 2a 38 0d  01 40 40 e7 20 61 70 6f  |=dir%*8..@@. apo|
00000250  73 25 3e 33 30 30 20 84  20 61 70 6f 73 25 3c 2d  |s%>300 . apos%<-|
00000260  33 30 20 8c 20 70 6f 73  25 2b 3d 64 69 72 25 3a  |30 . pos%+=dir%:|
00000270  61 70 6f 73 25 2d 3d 64  69 72 25 3a 42 52 25 2d  |apos%-=dir%:BR%-|
00000280  3d 64 69 72 25 2a 38 0d  01 4a 0b 41 42 25 3d 42  |=dir%*8..J.AB%=B|
00000290  52 25 0d 01 54 17 e7 20  42 52 25 3e 32 35 35 20  |R%..T.. BR%>255 |
000002a0  8c 20 41 42 25 3d 32 35  35 0d 01 5e 13 e7 20 42  |. AB%=255..^.. B|
000002b0  52 25 3c 30 20 8c 20 41  42 25 3d 30 0d 01 68 0f  |R%<0 . AB%=0..h.|
000002c0  f2 62 72 65 61 6b 28 41  42 25 29 0d 01 72 04 0d  |.break(AB%)..r..|
000002d0  01 7c 16 e7 20 70 6f 73  25 3e 31 35 20 8c 20 70  |.|.. pos%>15 . p|
000002e0  6f 73 25 3d 30 0d 01 86  16 e7 20 70 6f 73 25 3c  |os%=0..... pos%<|
000002f0  30 20 8c 20 70 6f 73 25  3d 31 35 0d 01 90 15 f2  |0 . pos%=15.....|
00000300  64 72 61 77 28 70 70 6f  73 25 2c 70 6f 73 25 29  |draw(ppos%,pos%)|
00000310  0d 01 9a 08 f1 42 52 25  0d 01 a4 0e 70 70 6f 73  |.....BR%....ppos|
00000320  25 3d 70 6f 73 25 0d 01  ae 0b 43 56 25 3d 4e 56  |%=pos%....CV%=NV|
00000330  25 0d 01 b8 07 fd 20 a3  0d 01 c2 04 0d 01 cc 0c  |%..... .........|
00000340  dd 20 f2 5f 69 6e 69 74  0d 01 d6 27 63 77 25 28  |. ._init...'cw%(|
00000350  30 29 3d 32 3a 63 77 25  28 31 29 3d 30 3a 63 77  |0)=2:cw%(1)=0:cw|
00000360  25 28 32 29 3d 33 3a 63  77 25 28 33 29 3d 31 0d  |%(2)=3:cw%(3)=1.|
00000370  01 e0 2b 61 63 77 25 28  30 29 3d 31 3a 61 63 77  |..+acw%(0)=1:acw|
00000380  25 28 31 29 3d 33 3a 61  63 77 25 28 32 29 3d 30  |%(1)=3:acw%(2)=0|
00000390  3a 61 63 77 25 28 33 29  3d 32 0d 01 ea 0a 74 70  |:acw%(3)=2....tp|
000003a0  3d 32 2a af 0d 01 f4 09  72 25 3d 35 30 0d 01 fe  |=2*.....r%=50...|
000003b0  0a 73 25 3d 34 30 30 0d  02 08 0d f2 62 72 65 61  |.s%=400.....brea|
000003c0  6b 28 30 29 0d 02 12 08  eb 20 32 30 0d 02 1c 05  |k(0)..... 20....|
000003d0  e1 0d 02 26 04 0d 02 30  12 dd 20 f2 64 72 61 77  |...&...0.. .draw|
000003e0  28 6f 25 2c 6e 25 29 0d  02 3a 0e f4 20 47 43 4f  |(o%,n%)..:.. GCO|
000003f0  4c 20 30 2c 30 0d 02 44  10 f4 20 50 52 4f 43 72  |L 0,0..D.. PROCr|
00000400  64 28 6f 25 29 0d 02 4e  05 db 0d 02 58 09 e6 20  |d(o%)..N....X.. |
00000410  30 2c 37 0d 02 62 0b f2  72 64 28 6e 25 29 0d 02  |0,7..b..rd(n%)..|
00000420  6c 05 e1 0d 02 76 04 0d  02 80 0d dd 20 f2 72 64  |l....v...... .rd|
00000430  28 70 25 29 0d 02 8a 0f  ea 20 74 68 2c 72 2c 6c  |(p%)..... th,r,l|
00000440  25 2c 71 0d 02 94 10 71  3d 28 70 25 2f 31 36 29  |%,q....q=(p%/16)|
00000450  2a 74 70 0d 02 9e 08 74  68 3d 71 0d 02 a8 12 78  |*tp....th=q....x|
00000460  25 3d 73 25 2b 72 25 2a  9b 28 74 68 29 0d 02 b2  |%=s%+r%*.(th)...|
00000470  12 79 25 3d 73 25 2b 72  25 2a b5 28 74 68 29 0d  |.y%=s%+r%*.(th).|
00000480  02 bc 0b ec 20 78 25 2c  79 25 0d 02 c6 09 74 68  |.... x%,y%....th|
00000490  2b 3d af 0d 02 d0 12 78  25 3d 73 25 2b 72 25 2a  |+=.....x%=s%+r%*|
000004a0  9b 28 74 68 29 0d 02 da  12 79 25 3d 73 25 2b 72  |.(th)....y%=s%+r|
000004b0  25 2a b5 28 74 68 29 0d  02 e4 0b df 20 78 25 2c  |%*.(th)..... x%,|
000004c0  79 25 0d 02 ee 0f c8 8f  20 73 25 2c 73 25 2c 72  |y%...... s%,s%,r|
000004d0  25 0d 02 f8 04 0d 03 02  1b 72 3d 33 30 3a 74 68  |%........r=30:th|
000004e0  3d 30 3a 6c 25 3d 33 30  30 3a 77 25 3d 31 30 30  |=0:l%=300:w%=100|
000004f0  0d 03 0c 1a 72 3d 33 30  2b 28 61 70 6f 73 25 2f  |....r=30+(apos%/|
00000500  31 36 29 2a 31 32 2e 35  36 36 0d 03 16 05 f5 0d  |16)*12.566......|
00000510  03 20 12 73 78 25 3d 77  25 2b 72 2a b5 28 74 68  |. .sx%=w%+r*.(th|
00000520  29 0d 03 2a 20 e7 20 74  68 3d 30 20 8c 20 ec 20  |)..* . th=0 . . |
00000530  6c 25 2c 73 78 25 20 8b  20 df 20 6c 25 2c 73 78  |l%,sx% . . l%,sx|
00000540  25 0d 03 34 09 6c 25 2b  3d 32 0d 03 3e 0b 74 68  |%..4.l%+=2..>.th|
00000550  2d 3d 30 2e 31 0d 03 48  09 72 2b 3d 2e 32 0d 03  |-=0.1..H.r+=.2..|
00000560  52 0a fd 20 72 3e 36 30  0d 03 5c 13 c8 93 20 6c  |R.. r>60..\... l|
00000570  25 2c 33 30 2c 32 30 2c  31 34 30 0d 03 66 05 e1  |%,30,20,140..f..|
00000580  0d 03 70 04 0d 03 7a 10  dd 20 f2 62 72 65 61 6b  |..p...z.. .break|
00000590  28 62 25 29 0d 03 84 15  62 25 3d 26 46 46 2d 28  |(b%)....b%=&FF-(|
000005a0  62 25 20 80 20 26 46 46  29 0d 03 8e 0d 3f 50 42  |b% . &FF)....?PB|
000005b0  43 25 3d 26 34 30 0d 03  98 0d 50 42 43 25 3f 31  |C%=&40....PBC%?1|
000005c0  3d 62 25 0d 03 a2 1f c8  99 20 22 49 49 43 5f 43  |=b%...... "IIC_C|
000005d0  6f 6e 74 72 6f 6c 22 2c  26 39 30 2c 50 42 43 25  |ontrol",&90,PBC%|
000005e0  2c 32 0d 03 ac 05 e1 0d  ff                       |,2.......|
000005e9